Skip to content

Commit

Permalink
feat: build command (tsc prod build) now uses ts5.6's --noCheck
Browse files Browse the repository at this point in the history
for performance gain.
  • Loading branch information
kirillgroshkov committed Sep 20, 2024
1 parent 85eeb0a commit a195235
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
21 changes: 9 additions & 12 deletions src/bin/dev-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,28 @@ interface Command {

const commands: (Command | Separator)[] = [
new Separator(), // build
{
name: 'tsc',
fn: tscAll,
desc: 'Run tsc in folders (src, scripts, e2e, playwright) if there is tsconfig.json present',
},
{ name: 'bt', fn: bt, desc: 'Build & Test: run "tsc" and then "test".' },
{ name: 'lbt', fn: lbt, desc: 'Lint/Build/Test: run "lint", then "tsc", then "test".' },
{
name: 'build',
fn: buildProd,
desc: 'Clean ./dist, run "build-copy" then tsc with emit, using tsconfig.prod.json',
cliOnly: true,
desc: 'Clean ./dist, run "build-copy" then tsc with --emit and --noCheck, using tsconfig.prod.json',
},
{
name: 'build-copy',
fn: buildCopy,
desc: 'Copy the non-ts files from ./src to ./dist',
cliOnly: true,
},
{
name: 'build-esm-cjs',
fn: buildEsmCjs,
desc: 'Clean ./dist and ./dist-esm, then run "tsc" in CJS and ESM modes.',
cliOnly: true,
},
{
name: 'tsc',
fn: tscAll,
desc: 'Run tsc in folders (src, scripts, e2e, playwright) if there is tsconfig.json present',
desc: 'Clean ./dist and ./dist-esm, then run "tsc" in CJS and ESM modes, with --emit and --noCheck',
},
{ name: 'bt', fn: bt, desc: 'Build & Test: run "build" and then "test".' },
{ name: 'lbt', fn: lbt, desc: 'Lint/Build/Test: run "lint", then "build", then "test".' },
new Separator(), // test
{ name: 'test', fn: runJest, desc: 'Run jest for *.test.ts files.' },
{
Expand Down
10 changes: 8 additions & 2 deletions src/build.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export async function buildEsmCjs(): Promise<void> {
'nodenext',
'--moduleResolution',
'nodenext',
'--noEmit',
'false',
'--noCheck',
],
shell: false,
}),
Expand All @@ -45,6 +48,9 @@ export async function buildEsmCjs(): Promise<void> {
'bundler',
'--declaration',
'false',
'--noEmit',
'false',
'--noCheck',
],
shell: false,
}),
Expand Down Expand Up @@ -89,11 +95,11 @@ export async function runTSCInFolder(tsconfigPath: string, args: string[] = []):
})
}

export async function runTSCProd(): Promise<void> {
export async function runTSCProd(args: string[] = []): Promise<void> {
const tsconfigPath = [`./tsconfig.prod.json`].find(p => fs.existsSync(p)) || 'tsconfig.json'

await exec2.spawnAsync(`tsc`, {
args: ['-P', tsconfigPath],
args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', ...args],
shell: false,
})
}
Expand Down

0 comments on commit a195235

Please sign in to comment.