In the Typescript compiler cli, is there any way to specify no watch on the command line, i.e. to override the config from tsconfig.json
?
tsc-watch starts a TypeScript compiler with --watch parameter, with the ability to react to compilation status. tsc-watch was created to allow an easy dev process with TypeScript. Commonly used to restart a node server, similar to nodemon but for TypeScript. Executes COMMAND on every successful compilation.
What is tsc? A deprecated release of the TypeScript compiler. Visit Snyk Advisor to see a full health score report for tsc, including popularity, security, maintenance & community analysis.
The tsc command envokes the TypeScript compiler. When no command-line options are present, this command looks for the tsconfig. json file. If no tsconfig.
i.e. to override the config from tsconfig.json
No. you really should not have watch
in tsconfig.json and specify it only when you need it on the command line.
There is no CLI way that I know of. In order to achieve that write a nodejs script which overrides watch to be false. Run the tsc with execSync and change the file back. Here is the nutshell untested.
var path = require('path')
var fs = require('fs')
var execSync = require('child_process').execSync
var pathTofile = path.resolve(process.cwd(), 'tsconfig.json');
var config = JSON.parse(fs.readFileSync(pathTofile, 'utf8'));
config.watch = false;
fs.writeFileSync(pathTofile, JSON.stringify(config),{encoding:'utf8'});
execSync('tsc');
config.watch = true;
fs.writeFileSync(pathTofile, JSON.stringify(config),{encoding:'utf8'});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With