![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
tsc-watch
Advanced tools
Changelog
v4.2.9 - 23/6/2020
Readme
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.
Argument | Description |
---|---|
--onSuccess COMMAND | Executes COMMAND on every successful compilation. |
--onFirstSuccess COMMAND | Executes COMMAND on the first successful compilation. |
--onFailure COMMAND | Executes COMMAND on every failed compilation. |
--onCompilationComplete COMMAND | Executes COMMAND on every successful or failed compilation. |
--noColors | By default tsc-watch adds colors the output with green on success, and in red on failiure. Add this argument to prevent that. |
--noClear | In watch mode the tsc compiler clears the screen before reportingAdd this argument to prevent that. |
--compiler PATH | The PATH will be used instead of typescript compiler.Default is typescript/bin/tsc |
Notes:
That all the above COMMAND
s will be killed on process exit. (Using SIGTERM
)
A COMMAND
is a single command and not multi command like script1.sh && script2.sh
Any child process (COMMAND
) will be terminated before creating a new one.
npm install tsc-watch --save-dev
## Watching a project (with tsconfig.json)
tsc-watch --onSuccess "node ./dist/server.js"
## Beep on failure
tsc-watch --onFailure "echo Beep! Compilation Failed"
## Wathcing a single file
tsc-watch server.ts --outDir ./dist --onSuccess "node ./dist/server.js"
## Custom compiler
tsc-watch --onSuccess "node ./dist/server.js" --compiler my-typescript/bin/tsc
The client is implemented as an instance of Node.JS
's EventEmitter
, with the following events:
first_success
- Emitted upon first successful compilation.subsequent_success
- Emitted upon every subsequent successful compilation.compile_errors
- Emitted upon every failing compilation.Once subscribed to the relevant events, start the client by running watch.start()
To kill the client, run watch.kill()
Example usage:
const TscWatchClient = require('tsc-watch/client');
const watch = new TscWatchClient();
watch.on('first_success', () => {
console.log('First success!');
});
watch.on('success', () => {
// Your code goes here...
});
watch.on('compile_errors', () => {
// Your code goes here...
});
watch.start('--project', '.');
try {
// do something...
} catch (e) {
watch.kill(); // Fatal error, kill the compiler instance.
}
Notes:
onSuccess
) COMMAND
will not run if the compilation failed.tsc-watch
is using the currently installed TypeScript compiler.tsc-watch
is not changing the compiler, just adds the new arguments, compilation is the same, and all other arguments are the same.FAQs
The TypeScript compiler with onSuccess command
The npm package tsc-watch receives a total of 428,863 weekly downloads. As such, tsc-watch popularity was classified as popular.
We found that tsc-watch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.