-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📋Add deno check and lint scripts (#132)
* 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
- Loading branch information
1 parent
4925a97
commit 0af60ab
Showing
19 changed files
with
361 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string | Error> { | ||
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)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.