diff --git a/.changeset/three-books-cross.md b/.changeset/three-books-cross.md new file mode 100644 index 0000000..30ced90 --- /dev/null +++ b/.changeset/three-books-cross.md @@ -0,0 +1,5 @@ +--- +"@rnm/tscx": patch +--- + +feat: support built-in `--noCheck` options diff --git a/packages/tscx/README.md b/packages/tscx/README.md index ad08430..3986130 100644 --- a/packages/tscx/README.md +++ b/packages/tscx/README.md @@ -24,6 +24,7 @@ A `tsc` wrapper with many convenient features. Bring the [nodemon](https://www.n - 🚨 As for `tsc` built-in options, we only support these options below. - `--project` - `--watch` + - `--noCheck` ## Install diff --git a/packages/tscx/src/bin/tscx.cli.mts b/packages/tscx/src/bin/tscx.cli.mts index ef85648..1bf9162 100755 --- a/packages/tscx/src/bin/tscx.cli.mts +++ b/packages/tscx/src/bin/tscx.cli.mts @@ -27,6 +27,11 @@ new Command() "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.", "tsconfig.json", ) + .option( + "--noCheck", + "Disable full type checking (only critical parse and emit errors will be reported).", + false, + ) .option("-w, --watch", "Watch input files.", false) .option( "-r, --remove", diff --git a/packages/tscx/src/cmd/index.ts b/packages/tscx/src/cmd/index.ts index 2b82895..0b3c81d 100644 --- a/packages/tscx/src/cmd/index.ts +++ b/packages/tscx/src/cmd/index.ts @@ -23,9 +23,15 @@ export function remove(filepath: string) { return spawn("node", REMOVE_PATH, filepath); } -export function tsc(options: { project: string }) { +export function tsc(options: { project: string; noCheck: boolean }) { console.log("Tsc", options); - return spawn("node", TSC_PATH, "--project", options.project); + const args = [ + TSC_PATH, + "--project", + options.project, + ...(options.noCheck ? ["--noCheck"] : []), + ]; + return spawn("node", ...args); } export function copyfiles(rootDir: string, outDir: string) { diff --git a/packages/tscx/src/compiler.ts b/packages/tscx/src/compiler.ts index 62fa0c3..a3e88ab 100644 --- a/packages/tscx/src/compiler.ts +++ b/packages/tscx/src/compiler.ts @@ -7,6 +7,7 @@ import { copyfiles, exec, remove, script, tsc } from "./cmd/index.js"; export interface CompilerOptions { project: string; + noCheck: boolean; remove: boolean; copyfiles: boolean; script?: string; @@ -63,6 +64,7 @@ export class Compiler { private getTasks(): Array<() => childProcess.ChildProcess> { const { project, + noCheck, remove: rm, copyfiles: cp, script: scr, @@ -70,7 +72,7 @@ export class Compiler { } = this.options; return [ ...(rm ? [() => remove(this.outDir)] : []), - () => tsc({ project }), + () => tsc({ project, noCheck }), ...(cp ? [() => copyfiles(this.rootDir, this.outDir)] : []), ...(scr ? [() => script(scr)] : []), ...(ex ? [() => exec(ex)] : []),