From 0af60ab3aa33561726ad90a090d650b12c0f1bf3 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson <85414302+CalvinWilkinson@users.noreply.github.com> Date: Mon, 6 Nov 2023 23:31:16 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8BAdd=20deno=20check=20and=20lint=20s?= =?UTF-8?q?cripts=20(#132)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Start work for issue #128 * ci: add cicd script linting status check workflow * chore: add new utils function to replace the doesNotExist function * ci: improve the Directory class * ci: create class to run cli commands * refactor: replace isNullOrEmpty func uses with isNothing func * chore: add further type restriction to type guard * refactor: improve containsPathSeparator func * docs: add code docs to Path class * ci: create deno check script * ide: create deno check task and launch config * config: update deno lock * ci: create cicd script build status check workflow --- .github/cicd/core/CLI.ts | 36 +++++++ .github/cicd/core/CloneRepoService.ts | 2 +- .github/cicd/core/DefaultDocTool.ts | 6 +- .github/cicd/core/Directory.ts | 53 +++++----- .github/cicd/core/DocProcessor.ts | 8 +- .github/cicd/core/DotNetToolService.ts | 2 +- .github/cicd/core/File.ts | 6 +- .github/cicd/core/HTMLService.ts | 2 +- .../cicd/core/MarkdownFileContentService.ts | 2 +- .github/cicd/core/MarkdownService.ts | 8 +- .github/cicd/core/Path.ts | 100 ++++++++++++++---- .github/cicd/core/Utils.ts | 35 ++++-- .github/cicd/core/ValidateReleaseService.ts | 4 +- .github/cicd/scripts/deno-check.ts | 63 +++++++++++ .github/workflows/cicd-build-status-check.yml | 32 ++++++ .github/workflows/cicd-lint-status-check.yml | 31 ++++++ .vscode/launch.json | 16 +++ .vscode/tasks.json | 16 +++ deno.lock | 9 ++ 19 files changed, 361 insertions(+), 70 deletions(-) create mode 100644 .github/cicd/core/CLI.ts create mode 100644 .github/cicd/scripts/deno-check.ts create mode 100644 .github/workflows/cicd-build-status-check.yml create mode 100644 .github/workflows/cicd-lint-status-check.yml diff --git a/.github/cicd/core/CLI.ts b/.github/cicd/core/CLI.ts new file mode 100644 index 00000000..fec8264f --- /dev/null +++ b/.github/cicd/core/CLI.ts @@ -0,0 +1,36 @@ +/** + * A simple CLI command wrapper. + */ +export class CLI { + /** + * Runs the following CLI {@link command}. + * @param command The command to run. + * @returns The output of the command if successful, otherwise an error. + */ + public async runAsync(command: string): Promise { + if (command === undefined || command === null || command === "") { + const errorMsg = "The command parameter cannot be null or empty."; + Deno.exit(1); + } + + if (!command.includes(" ")) { + const errorMsg = "The command parameter must include a space."; + Deno.exit(1); + } + + const sections: string[] = command.split(" "); + + const app = sections[0]; + const args = sections.slice(1); + + const cmd = new Deno.Command(app, { args: args }); + + const { code, stdout, stderr } = await cmd.output(); + + if (code === 0) { + return new TextDecoder().decode(stdout); + } else { + return new Error(new TextDecoder().decode(stderr)); + } + } +} diff --git a/.github/cicd/core/CloneRepoService.ts b/.github/cicd/core/CloneRepoService.ts index e34c3e32..ba54ea6e 100644 --- a/.github/cicd/core/CloneRepoService.ts +++ b/.github/cicd/core/CloneRepoService.ts @@ -13,7 +13,7 @@ export class CloneRepoService { * @param tagOrBranch The tag or branch name of the repository to clone. */ public cloneRepo(tagOrBranch: string): void { - if (Utils.isNullOrEmpty(tagOrBranch)) { + if (Utils.isNothing(tagOrBranch)) { throw Error("The tag or branch name must not be null, undefined, or empty."); } diff --git a/.github/cicd/core/DefaultDocTool.ts b/.github/cicd/core/DefaultDocTool.ts index 55898fc6..32e564ad 100644 --- a/.github/cicd/core/DefaultDocTool.ts +++ b/.github/cicd/core/DefaultDocTool.ts @@ -28,9 +28,9 @@ export class DefaultDocTool { outputDirPath: string, configFilePath: string, ): Promise { - Utils.isNullOrEmpty(assemblyPath); - Utils.isNullOrEmpty(outputDirPath); - Utils.isNullOrEmpty(configFilePath); + Utils.isNothing(assemblyPath); + Utils.isNothing(outputDirPath); + Utils.isNothing(configFilePath); await this.dotNetToolService.setupDotNetTools(this.defaultDocToolName, this.defaultDocToolVersion); diff --git a/.github/cicd/core/Directory.ts b/.github/cicd/core/Directory.ts index 5624ef7e..18d153a4 100644 --- a/.github/cicd/core/Directory.ts +++ b/.github/cicd/core/Directory.ts @@ -33,42 +33,43 @@ export class Directory { } /** - * Returns a list of all of the files in the given directory. - * @param {string} dirPath The path to the directory to the files of. - * @param {string} extension The extension filter of all of the files to get. If undefined or empty, all files will be returned. If not undefined or empty, the extension must start with a period. If the extension does not start with a period, it will be added automatically. - * @returns {string[]} The files in the given directory, + * Gets a list of files in the given {@link dirPath}. This will search recursively + * if {@link recursive} is true. + * @param dirPath The path of the directory start searching. + * @param extension The file extension to search for. + * @param recursive True to search recursively, otherwise false. + * @returns {string[]} A list of files in the given {@link dirPath}. */ - public static getFiles(dirPath: string, extension = "*.*"): string[] { - Guard.isNotUndefinedOrEmpty(dirPath); + public static getFiles(dirPath: string, extension:string, recursive = false): string[] { + let files: string[] = []; - if (Path.isNotDirPath(dirPath)) { - throw new Error(`The path '${dirPath}' is not a directory path.`); - } + extension = Utils.isNothing(extension) ? "*.*" : extension; + extension = extension.startsWith(".") ? extension : `.${extension}`; - if (this.doesNotExist(dirPath)) { - throw new Error(`The path '${dirPath}' does not exist.`); + if (dirPath === undefined || dirPath === null || dirPath === "") { + const errorMsg = "The dirPath parameter cannot be null or empty."; + Deno.exit(1); } - // Default value if undefined or empty - extension = Utils.isNullOrEmpty(extension) ? "*.*" : extension; - - extension = extension != "*.*" && extension.startsWith("*") ? extension.replace("*", "") : extension; - - dirPath = Path.normalizeSeparators(dirPath); - - const filePaths: string[] = []; + dirPath = dirPath === "." || dirPath === "/" ? "." : dirPath; for (const dirEntry of Deno.readDirSync(dirPath)) { - if (dirEntry.isFile) { - const fileExtension: string = Path.getExtension(dirEntry.name); - - if (extension === "*.*" || extension === fileExtension) { - filePaths.push(`${dirPath}${dirEntry.name}`); + const entry = dirPath + "/" + dirEntry.name; + + if (recursive && dirEntry.isDirectory) { + files = [...files, ...(Directory.getFiles(entry, extension, recursive))]; + } else if (dirEntry.isFile) { + if (extension === "*.*") { + files.push(entry); + } else { + if (entry.endsWith(extension)) { + files.push(entry); + } } } } - return filePaths; + return files; } /** @@ -130,7 +131,7 @@ export class Directory { * @param {string} dirPath The path to the directory to delete. */ public static delete(dirPath: string): void { - if (Utils.isNullOrEmpty(dirPath)) { + if (Utils.isNothing(dirPath)) { return; } diff --git a/.github/cicd/core/DocProcessor.ts b/.github/cicd/core/DocProcessor.ts index 29b2955a..d9b966fb 100644 --- a/.github/cicd/core/DocProcessor.ts +++ b/.github/cicd/core/DocProcessor.ts @@ -35,12 +35,12 @@ export class DocProcessor { * @param releaseTag The Velaptor release tag. */ public async generateFromTag(apiDocDirPath: string, releaseTag: string): Promise { - if (Utils.isNullOrEmpty(apiDocDirPath)) { + if (Utils.isNothing(apiDocDirPath)) { console.log(chalk.red("The API doc dir path is required.")); Deno.exit(); } - if (Utils.isNullOrEmpty(releaseTag)) { + if (Utils.isNothing(releaseTag)) { console.log(chalk.red("The release tag is required.")); Deno.exit(); } @@ -64,12 +64,12 @@ export class DocProcessor { * @param branchName The name of the branch to generate the API documentation from. */ public async generateFromBranch(apiDocDirPath: string, branchName: string): Promise { - if (Utils.isNullOrEmpty(apiDocDirPath)) { + if (Utils.isNothing(apiDocDirPath)) { console.log(chalk.red("The API doc dir path is required.")); Deno.exit(); } - if (Utils.isNullOrEmpty(branchName)) { + if (Utils.isNothing(branchName)) { console.log(chalk.red("The branch name is required.")); Deno.exit(); } diff --git a/.github/cicd/core/DotNetToolService.ts b/.github/cicd/core/DotNetToolService.ts index 58c02621..2ee48352 100644 --- a/.github/cicd/core/DotNetToolService.ts +++ b/.github/cicd/core/DotNetToolService.ts @@ -96,7 +96,7 @@ export class DotNetToolService { * @returns The lines with empty lines removed. */ private toLines(value: string): string[] { - if (Utils.isNullOrEmpty(value)) { + if (Utils.isNothing(value)) { return []; } diff --git a/.github/cicd/core/File.ts b/.github/cicd/core/File.ts index 437bf801..a4962852 100644 --- a/.github/cicd/core/File.ts +++ b/.github/cicd/core/File.ts @@ -35,11 +35,11 @@ export class File { public static writeTextFileSync(filePath: string, fileContent: string): void { Guard.isNotUndefinedOrEmpty(filePath, "filePath"); - if (Utils.isNullOrEmpty(fileContent)) { + if (Utils.isNothing(fileContent)) { return; } - if (Utils.isNullOrEmpty(filePath)) { + if (Utils.isNothing(filePath)) { throw new Error(`The parameter '${filePath}' must not be null or empty.`); } @@ -87,7 +87,7 @@ export class File { * @param {string} filePath The file to delete. */ public static deleteFile(filePath: string): void { - if (Utils.isNullOrEmpty(filePath)) { + if (Utils.isNothing(filePath)) { throw new Error(`The 'filePath' parameter must not be null or empty.`); } diff --git a/.github/cicd/core/HTMLService.ts b/.github/cicd/core/HTMLService.ts index cd2bdd25..5554e80b 100644 --- a/.github/cicd/core/HTMLService.ts +++ b/.github/cicd/core/HTMLService.ts @@ -8,7 +8,7 @@ export class HTMLService { } public isHTMLLink(value: string): boolean { - if (Utils.isNullOrEmpty(value)) { + if (Utils.isNothing(value)) { return false; } diff --git a/.github/cicd/core/MarkdownFileContentService.ts b/.github/cicd/core/MarkdownFileContentService.ts index 4276fe28..8e29e0d0 100644 --- a/.github/cicd/core/MarkdownFileContentService.ts +++ b/.github/cicd/core/MarkdownFileContentService.ts @@ -84,7 +84,7 @@ export class MarkdownFileContentService { } private processHeaderAngleBrackets(fileContent: string): string { - if (Utils.isNullOrEmpty(fileContent)) { + if (Utils.isNothing(fileContent)) { return ""; } diff --git a/.github/cicd/core/MarkdownService.ts b/.github/cicd/core/MarkdownService.ts index a858577c..abc0f8c8 100644 --- a/.github/cicd/core/MarkdownService.ts +++ b/.github/cicd/core/MarkdownService.ts @@ -133,7 +133,7 @@ export class MarkdownService { public headerExists(name: string, lines: string[]): boolean; public headerExists(name: string, content: string): boolean; public headerExists(name: string, linesOrContent: string[] | string): boolean { - if (Utils.isNullOrEmpty(name)) { + if (Utils.isNothing(name)) { return false; } @@ -191,7 +191,7 @@ export class MarkdownService { } public isHeaderLine(line: string): boolean { - if (Utils.isNullOrEmpty(line)) { + if (Utils.isNothing(line)) { return false; } @@ -200,7 +200,7 @@ export class MarkdownService { } public containsMarkdownLink(markDownLink: string): boolean { - if (Utils.isNullOrEmpty(markDownLink)) { + if (Utils.isNothing(markDownLink)) { return false; } @@ -220,7 +220,7 @@ export class MarkdownService { } public createFrontMatter(title: string): string { - if (Utils.isNullOrEmpty(title)) { + if (Utils.isNothing(title)) { throw new Error("The 'title' parameter must not be null or empty when creating front matter."); } diff --git a/.github/cicd/core/Path.ts b/.github/cicd/core/Path.ts index a792b0ba..3bdb9938 100644 --- a/.github/cicd/core/Path.ts +++ b/.github/cicd/core/Path.ts @@ -1,9 +1,17 @@ import { Utils } from "./Utils.ts"; import { dirname, extname } from "std/path/mod.ts"; +/** + * Provides path related operations. + */ export class Path { + /** + * Gets the file name from the given file path. + * @param filePath The file path to get the file name from. + * @returns The file name. + */ public static getFileName(filePath: string): string { - if (Utils.isNullOrEmpty(filePath)) { + if (Utils.isNothing(filePath)) { return ""; } @@ -24,6 +32,11 @@ export class Path { } } + /** + * Gets the file name without the extension from the given file path. + * @param filePath The file path to get the file name from. + * @returns The file name without the extension. + */ public static getFileNameWithoutExtension(filePath: string): string { let fileName: string = this.getFileName(filePath); @@ -51,8 +64,13 @@ export class Path { } } + /** + * Gets the directory path from the given file path. + * @param filePath The file path to get the directory from. + * @returns The directory path. + */ public static getDirectory(filePath: string): string { - if (Utils.isNullOrEmpty(filePath)) { + if (Utils.isNothing(filePath)) { return ""; } @@ -65,14 +83,26 @@ export class Path { return this.normalizeSeparators(filePath); } + /** + * Returns a value indicating whether or not the given {@link path} is a file path. + * @param path The path to check. + * @returns True if the path is a file path, otherwise false. + */ public static isFilePath(path: string): boolean { - if (Utils.isNullOrEmpty(path)) { + if (Utils.isNothing(path)) { return false; } return this.containsPathSeparator(path) && this.hasExtension(path); } + /** + * Returns a value indicating whether or not the given {@link path} has the given {@link extension}. + * @param path The path to check. + * @param extension The extension to check for. + * @returns True if the path has the given extension, otherwise false. + * @remarks If no extension is provided, then this will return true if the path any extension. + */ public static hasExtension(path: string, extension = ""): boolean { extension = extension === undefined ? "" : extension; @@ -87,8 +117,13 @@ export class Path { } } + /** + * Gets the extension of the given file path. + * @param filePath The file path to get the extension from. + * @returns The extension of the file path. + */ public static getExtension(filePath: string): string { - if (Utils.isNullOrEmpty(filePath)) { + if (Utils.isNothing(filePath)) { return ""; } @@ -99,18 +134,29 @@ export class Path { return `.${filePath.split(".").pop()}`; } - public static containsPathSeparator(value: string): boolean { - if (Utils.isNullOrEmpty(value)) { + /** + * Returns a value indicating whether or not the given {@link path} contains a path separator. + * @param path The path to check. + * @returns True if the path contains a path separator, otherwise false. + */ + public static containsPathSeparator(path: string): boolean { + if (Utils.isNothing(path)) { return false; } - const containsBackslashes: boolean = value.indexOf("\\") != -1; - const containsForwardSlashes: boolean = value.indexOf("/") != -1; - return containsBackslashes || containsForwardSlashes; + path = this.normalizeSeparators(path); + const containsForwardSlashes: boolean = path.indexOf("/") != -1; + + return containsForwardSlashes; } + /** + * Returns a value indicating whether or not the given {@link dirPath} is a directory path. + * @param dirPath The directory path to check. + * @returns True if the directory path is a directory path, otherwise false. + */ public static isDirPath(dirPath: string): boolean { - if (Utils.isNullOrEmpty(dirPath)) { + if (Utils.isNothing(dirPath)) { return false; } @@ -122,12 +168,22 @@ export class Path { return containsPathSeparator && doesNotContainExtension; } + /** + * Returns a value indicating whether or not the given {@link dirPath} is not a directory path. + * @param dirPath The directory path to check. + * @returns True if the directory path is not a directory path, otherwise false. + */ public static isNotDirPath(dirPath: string): boolean { return !this.isDirPath(dirPath); } + /** + * Normalizes the path separators to forward slashes. + * @param path The path to normalize. + * @returns The normalized path. + */ public static normalizeSeparators(path: string): string { - if (Utils.isNullOrEmpty(path)) { + if (Utils.isNothing(path)) { return ""; } @@ -140,8 +196,13 @@ export class Path { return path.endsWith("/") ? path : `${path}/`; } + /** + * Gets the the last directory name from the given directory path. + * @param dirPath The directory path to get the last directory name from. + * @returns The last directory name. + */ public static getLastDirName(dirPath: string): string { - if (Utils.isNullOrEmpty(dirPath)) { + if (Utils.isNothing(dirPath)) { return ""; } @@ -158,21 +219,24 @@ export class Path { * @returns The list of directory names from the directory paths. */ public static getLastDirNames(dirPaths: string[]): string[] { - if (Utils.isNullOrEmpty(dirPaths)) { - return []; - } + dirPaths = Utils.isNothing(dirPaths) ? [] : dirPaths; const result: string[] = []; - for (const path of dirPaths) { + dirPaths.forEach(path => { result.push(this.getLastDirName(path)); - } + }); return result; } + /** + * Removes the last directory from the given path. + * @param path The path to remove the last directory from. + * @returns The path with the last directory removed. + */ public static removeLastDir(path: string): string { - if (Utils.isNullOrEmpty(path)) { + if (Utils.isNothing(path)) { return ""; } diff --git a/.github/cicd/core/Utils.ts b/.github/cicd/core/Utils.ts index 65893bd7..aa761a36 100644 --- a/.github/cicd/core/Utils.ts +++ b/.github/cicd/core/Utils.ts @@ -12,6 +12,29 @@ export class Utils { return isUndefined || isNull || isEmpty; } + /** + * Checks if the value is null, undefined, or empty. + * @param value The value to check. + * @returns True if the value is null, undefined, or empty, otherwise false. + */ + public static isNothing( + value: undefined | null | string | number | boolean | T[] | (() => T) | object, + ): value is undefined | null | "" | number | T[] | (() => T) | object { + if (value === undefined || value === null) { + return true; + } + + if (typeof value === "string") { + return value === ""; + } + + if (Array.isArray(value)) { + return value.length === 0; + } + + return false; + } + public static cwd(): string { return Deno.cwd(); } @@ -35,13 +58,13 @@ export class Utils { * @param versions The list of versions to look through. */ public static getOldestVersion(versions: string[]): string { - if (Utils.isNullOrEmpty(versions)) { + if (Utils.isNothing(versions)) { throw new Error("The 'versions' parameter must not be null or empty."); } const sortedVersions = Utils.sortVersions(versions); let oldestVersion = sortedVersions[sortedVersions.length - 1]; - oldestVersion = Utils.isNullOrEmpty(oldestVersion) ? "" : oldestVersion; + oldestVersion = Utils.isNothing(oldestVersion) ? "" : oldestVersion; oldestVersion = oldestVersion.startsWith("v") ? oldestVersion : `v${oldestVersion}`; return oldestVersion; @@ -53,7 +76,7 @@ export class Utils { * @returns True if the version is a preview or production version; Otherwise, false. */ public static isProdVersion(version: string): boolean { - if (Utils.isNullOrEmpty(version)) { + if (Utils.isNothing(version)) { return false; } @@ -66,7 +89,7 @@ export class Utils { * @returns True if the version is a preview or production version; Otherwise, false. */ public static isPrevVersion(version: string): boolean { - if (Utils.isNullOrEmpty(version)) { + if (Utils.isNothing(version)) { return false; } @@ -79,7 +102,7 @@ export class Utils { * @returns True if the version is a preview or production version; Otherwise, false. */ public static isPrevOrProdVersion(version: string): boolean { - if (Utils.isNullOrEmpty(version)) { + if (Utils.isNothing(version)) { return false; } @@ -103,7 +126,7 @@ export class Utils { } public static underscoresToAngles(value: string): string { - if (Utils.isNullOrEmpty(value)) { + if (Utils.isNothing(value)) { return ""; } diff --git a/.github/cicd/core/ValidateReleaseService.ts b/.github/cicd/core/ValidateReleaseService.ts index a6c20635..96ab8d28 100644 --- a/.github/cicd/core/ValidateReleaseService.ts +++ b/.github/cicd/core/ValidateReleaseService.ts @@ -28,7 +28,7 @@ export class ValidateReleaseService { * @returns True if the tag exists; Otherwise, false. */ private async releaseTagExists(tagToCheck: string): Promise { - if (Utils.isNullOrEmpty(tagToCheck)) { + if (Utils.isNothing(tagToCheck)) { throw Error("The tag to check is required."); } @@ -43,7 +43,7 @@ export class ValidateReleaseService { * @returns True if the NuGet package exists; Otherwise, false. */ private async nugetPackageExists(versionToCheck: string): Promise { - if (Utils.isNullOrEmpty(versionToCheck)) { + if (Utils.isNothing(versionToCheck)) { throw Error("The version to check is required."); } diff --git a/.github/cicd/scripts/deno-check.ts b/.github/cicd/scripts/deno-check.ts new file mode 100644 index 00000000..eccaabbf --- /dev/null +++ b/.github/cicd/scripts/deno-check.ts @@ -0,0 +1,63 @@ +import { CLI } from "../core/CLI.ts"; +import { Directory } from "../core/Directory.ts"; + +const ignoreDirectories = [ + "./vendor/", + "./node_modules/" +]; + +const files: string[] = Directory + .getFiles("/", ".ts", true) + .filter(f => { + const isTypeScriptFile = f.endsWith(".ts"); + + const shouldNotIgnore = ignoreDirectories.every(ignoreDir => !f.startsWith(ignoreDir)) + + return isTypeScriptFile && shouldNotIgnore; + }); + +const cli: CLI = new CLI(); +let failed = false; + +console.clear(); +console.log(`Checking ${files.length} files . . .`); + +let totalPassed = 0; +let totalFailed = 0; + +// Perform a deno check on all of the files +for await (let file of files) { + const logStart = new TextEncoder().encode(`Checking ${file}`); + Deno.stdout.writeSync(logStart); + + const result = await cli.runAsync(`deno check ${file}`); + + let logEndValue = ""; + + // If the result is an error type + if (result instanceof Error) + { + failed = true; + logEndValue = "❌\n"; + + const lines = result.message.split("\n"); + lines.forEach(line => { + logEndValue += ` ${line}\n`; + }); + + totalFailed++; + } else { + logEndValue = "✅\n"; + totalPassed++; + } + + const logEnd = new TextEncoder().encode(logEndValue); + Deno.stdout.writeSync(logEnd); +}; + +const resultsMsg = new TextEncoder().encode(`\nTotal Checks Passed✅: ${totalPassed}\nTotal Checks Failed❌: ${totalFailed}\n`); +Deno.stdout.writeSync(resultsMsg); + +if (failed) { + Deno.exit(1); +} diff --git a/.github/workflows/cicd-build-status-check.yml b/.github/workflows/cicd-build-status-check.yml new file mode 100644 index 00000000..4460d689 --- /dev/null +++ b/.github/workflows/cicd-build-status-check.yml @@ -0,0 +1,32 @@ +name: ✅CICD Build Status Check +run-name: ✅CICD Build Status Check (${{ github.base_ref }} branch) + + +defaults: + run: + shell: pwsh + + +on: + pull_request_target: + branches: main + + +jobs: + cicd_build_status_check: + name: CICD Build Status Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + repository: ${{ github.repository }} + + - name: Setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: ${{ vars.DENO_VERSION }} + + - name: Run Build + run: | + deno run --allow-read --allow-run "./.github/cicd/scripts/deno-check.ts"; diff --git a/.github/workflows/cicd-lint-status-check.yml b/.github/workflows/cicd-lint-status-check.yml new file mode 100644 index 00000000..ef09c870 --- /dev/null +++ b/.github/workflows/cicd-lint-status-check.yml @@ -0,0 +1,31 @@ +name: ✅CICD Lint Status Check +run-name: ✅CICD Lint Status Check (${{ github.base_ref }} branch) + + +defaults: + run: + shell: pwsh + + +on: + pull_request_target: + branches: main + + +jobs: + cicd_lint_status_check: + name: CICD Lint Status Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + repository: ${{ github.repository }} + + - name: Setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: ${{ vars.DENO_VERSION }} + + - name: Run Lint + run: deno lint diff --git a/.vscode/launch.json b/.vscode/launch.json index fcec1fa8..8263ce1a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -153,5 +153,21 @@ "attachSimplePort": 9229, "console": "integratedTerminal" }, + { // DENO CHECK ALL FILES + "request": "launch", + "name": "Deno Check All Files", + "type": "node", + "program": "${workspaceFolder}/.github/cicd/scripts/deno-check.ts", + "cwd": "${workspaceFolder}", + "runtimeExecutable": "${userHome}/.deno/bin/deno.EXE", + "runtimeArgs": [ + "run", + "--inspect-wait", + "--allow-read", + "--allow-run", + ], + "attachSimplePort": 9229, + "console": "integratedTerminal" + } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b8b227f8..82091803 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -126,6 +126,22 @@ "${workspaceFolder}/.github/cicd/scripts/delete-api-docs.ts", ] } + }, + { // DENO CHECK ALL FILES + "label": "Deno Check All Files", + "dependsOn": [ "Disable Testing Environment" ], + "detail": "Runs deno check on all files in the project.", + "type": "shell", + "options": { + "cwd": "${workspaceFolder}" + }, + "command": "deno", + "args": [ + "run", + "--allow-read", + "--allow-run", + "${workspaceFolder}/.github/cicd/scripts/deno-check.ts", + ] } ] } diff --git a/deno.lock b/deno.lock index d6e821ae..d30399ee 100644 --- a/deno.lock +++ b/deno.lock @@ -110,6 +110,10 @@ "https://deno.land/std@0.196.0/streams/write_all.ts": "aec90152978581ea62d56bb53a5cbf487e6a89c902f87c5969681ffbdf32b998", "https://deno.land/std@0.203.0/assert/assert.ts": "9a97dad6d98c238938e7540736b826440ad8c1c1e54430ca4c4e623e585607ee", "https://deno.land/std@0.203.0/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56", + "https://deno.land/std@0.203.0/fs/_util.ts": "fbf57dcdc9f7bc8128d60301eece608246971a7836a3bb1e78da75314f08b978", + "https://deno.land/std@0.203.0/fs/copy.ts": "23cc1c465babe5ca4d69778821e2f8addc44593e30a5ca0b902b3784eed75bb6", + "https://deno.land/std@0.203.0/fs/empty_dir.ts": "2e52cd4674d18e2e007175c80449fc3d263786a1361e858d9dfa9360a6581b47", + "https://deno.land/std@0.203.0/fs/ensure_dir.ts": "dc64c4c75c64721d4e3fb681f1382f803ff3d2868f08563ff923fdd20d071c40", "https://deno.land/std@0.203.0/path/_basename.ts": "057d420c9049821f983f784fd87fa73ac471901fb628920b67972b0f44319343", "https://deno.land/std@0.203.0/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0", "https://deno.land/std@0.203.0/path/_dirname.ts": "355e297236b2218600aee7a5301b937204c62e12da9db4b0b044993d9e658395", @@ -146,6 +150,7 @@ "https://deno.land/std@0.203.0/path/to_file_url.ts": "00e6322373dd51ad109956b775e4e72e5f9fa68ce2c6b04e4af2a6eed3825d31", "https://deno.land/std@0.203.0/path/to_namespaced_path.ts": "1b1db3055c343ab389901adfbda34e82b7386bcd1c744d54f9c1496ee0fd0c3d", "https://deno.land/std@0.203.0/path/win32.ts": "8b3f80ef7a462511d5e8020ff490edcaa0a0d118f1b1e9da50e2916bdd73f9dd", + "https://deno.land/std@0.203.0/streams/write_all.ts": "4cdd36256f892fe7aead46338054f6ea813a63765e87bda4c60e8c5a57d1c5c1", "https://deno.land/x/cliffy@v0.25.7/_utils/distance.ts": "02af166952c7c358ac83beae397aa2fbca4ad630aecfcd38d92edb1ea429f004", "https://deno.land/x/cliffy@v0.25.7/ansi/ansi_escapes.ts": "885f61f343223f27b8ec69cc138a54bea30542924eacd0f290cd84edcf691387", "https://deno.land/x/cliffy@v0.25.7/ansi/chain.ts": "31fb9fcbf72fed9f3eb9b9487270d2042ccd46a612d07dd5271b1a80ae2140a0", @@ -210,8 +215,10 @@ "https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/secret.ts": "cece271c7ce01e12b249c31c2f9cea9e53b6e6be7621a478dac902bd8f288b61", "https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/select.ts": "c10902aeaca02a55d9b846934958dd166ee39c741faebdaa9800689e402186cf", "https://deno.land/x/cliffy@v1.0.0-rc.3/prompt/toggle.ts": "028f80de31750e7b5479727a64b4878f090ecd783fe3bb0d286e2e1c29f0eee3", + "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/clients/GithubResponse.ts": "6a5ede27ce6b35dc679b4df7436d82a409acd8a09766e3a50d96f29420d0c05b", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/clients/NuGetClient.ts": "a8ba94c85eead46934f3e8af094a07f2456278ca5b3761e7ca97eecf9ac982af", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/clients/TagClient.ts": "bddb82dfadbd7995a9af1a701b8dbebe7843e1af174b83691b702462e292cfc6", + "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/clients/WorkflowClient.ts": "dcc0a94a2191c12cb0e33b09d8e91e156692560044ee96b43d284bea8d1c626e", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Enums.ts": "df445643e675f63ef0ff6562c2da3cd618b2a8aba0068b9ca473220f8cd17fe0", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/GitHubClient.ts": "ca93be71bc88c0626e23508202bec2178191d94a92430a2c9af2bc308ae7fc0a", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Guard.ts": "bd7615864af78bc4a32e9db6501ef5e08bac70f01642fc67e2125fdc4c6d3ea6", @@ -229,6 +236,8 @@ "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Models/RepoModel.ts": "97c0ae69d84851c170ed7a514f0e69c4fe4919c901c58cd5fc81dd4183f51a9d", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Models/TagModel.ts": "7201dc41e148716ec27adec8f5e76734712a93ee7156a143589acd01bff08334", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Models/UserModel.ts": "634dfac13ce03ef55004a5247e87b6d6c7fd30785f7731d49f4d4f03c689187b", + "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Models/WorkflowRunModel.ts": "9465c759c074dddf0b5fea1af107a79fbbbca83200e88012c0ca9f4408efe50b", + "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Models/WorkflowRunsModel.ts": "6d7f849f1a5c053126fc2abfad60fc21ea22e85181e2733d3d973178aba0c1ee", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Types.ts": "dcde3629b900ca279cf999d61e3ab4e58e1aec8a63d8e0cf1201c9cee0c0be2a", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/Utils.ts": "035a2db7884092817c4cabc721bd9c72417b697dede39910edaa783b093f22a8", "https://raw.githubusercontent.com/kinsondigital/Infrastructure/v12.1.0/cicd/core/WebAPIClient.ts": "274cf7d19e2d10eb3a36fb5f06dd6cbc8357352ab636781fd3399077b27264ed"