From 2b38d8d3ca98d17e4f27b5232b6690d283b9ce32 Mon Sep 17 00:00:00 2001 From: kirillgroshkov Date: Sat, 17 Sep 2022 21:37:41 +0200 Subject: [PATCH] feat: run tsc with `--noEmit`, unless for `-prod` commands --- src/bin/bt.ts | 2 +- src/bin/btl.ts | 2 +- src/bin/build.ts | 2 +- src/util/tsc.util.ts | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin/bt.ts b/src/bin/bt.ts index 921d891..2ee9781 100755 --- a/src/bin/bt.ts +++ b/src/bin/bt.ts @@ -9,7 +9,7 @@ import { tsc } from '../util/tsc.util' runScript(async () => { fs.emptyDirSync('./dist') // it doesn't delete the dir itself, to prevent IDE jumping // fs.rmSync('./dist', { recursive: true, force: true }) - await tsc() + await tsc(true) await tscScriptsCommand() await runJest() }) diff --git a/src/bin/btl.ts b/src/bin/btl.ts index cfe2286..b91d625 100755 --- a/src/bin/btl.ts +++ b/src/bin/btl.ts @@ -11,7 +11,7 @@ runScript(async () => { await lintAllCommand() fs.emptyDirSync('./dist') // it doesn't delete the dir itself, to prevent IDE jumping // fs.rmSync('./dist', { recursive: true, force: true }) - await tsc() + await tsc(true) await tscScriptsCommand() await runJest() }) diff --git a/src/bin/build.ts b/src/bin/build.ts index 1e41b70..9c97270 100755 --- a/src/bin/build.ts +++ b/src/bin/build.ts @@ -8,6 +8,6 @@ import { tsc } from '../util/tsc.util' runScript(async () => { fs.emptyDirSync('./dist') // it doesn't delete the dir itself, to prevent IDE jumping // fs.rmSync('./dist', { recursive: true, force: true }) - await tsc() + await tsc(true) await tscScriptsCommand() }) diff --git a/src/util/tsc.util.ts b/src/util/tsc.util.ts index 3ac2780..775302c 100644 --- a/src/util/tsc.util.ts +++ b/src/util/tsc.util.ts @@ -5,9 +5,10 @@ import { execCommand } from '@naturalcycles/nodejs-lib/dist/exec' import { kpySync } from '@naturalcycles/nodejs-lib/dist/fs' import { cfgDir } from '../cnst/paths.cnst' -export async function tsc(): Promise { +export async function tsc(noEmit = false): Promise { const started = Date.now() - await execCommand('tsc') + const cmd = ['tsc', noEmit && '--noEmit'].filter(Boolean).join(' ') + await execCommand(cmd) console.log(`${boldGrey('tsc')} ${dimGrey(`took ` + _since(started))}`) }