{"name":"tsc-watch","version":"4.5.0","description":"The TypeScript compiler with onSuccess command","scripts":{"test":"mocha test/**/*.js"},"bin":{"tsc-watch":"index.js"},"repository":{"type":"git","url":"git+ssh://git@github.com/gilamran/tsc-watch.git"},"keywords":["TypeScript"],"engines":{"node":">=8.17.0"},"author":{"name":"Gil Amran"},"license":"MIT","bugs":{"url":"https://github.com/gilamran/tsc-watch/issues"},"homepage":"https://github.com/gilamran/tsc-watch#readme","prettier":{"trailingComma":"all","tabWidth":2,"semi":true,"singleQuote":true,"printWidth":100},"dependencies":{"cross-spawn":"^7.0.3","node-cleanup":"^2.1.2","ps-tree":"^1.2.0","string-argv":"^0.1.1","strip-ansi":"^6.0.0"},"peerDependencies":{"typescript":"*"},"devDependencies":{"chai":"^4.2.0","fs-extra":"^8.1.0","mocha":"^7.1.2","mocha-eventually":"^1.1.0","sinon":"^9.0.2","typescript":"^3.3.3"},"gitHead":"ccbc36a1184d22c6fd9e9656155a16421164aae7","_id":"tsc-watch@4.5.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"shasum":"d6884b932822b2c2ccd37f1c1f3748304566a474","size":10901,"noattachment":false,"tarball":"https://registry.npmmirror.com/tsc-watch/-/tsc-watch-4.5.0.tgz","integrity":"sha512-aXhN4jY+1YEcn/NwCQ/+fHqU43EqOpW+pS+933EPsVEsrKhvyrodPDIjQsk1a1niFrabAK3RIBrRbAslVefEbQ=="},"_npmUser":{"name":"gilamran","email":"gilamran@gmail.com"},"directories":{},"maintainers":[{"name":"gilamran","email":"gilamran@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tsc-watch_4.5.0_1629398910703_0.5848442011421682"},"_hasShrinkwrap":false,"publish_time":1629398910832,"_cnpm_publish_time":1629398910832,"_cnpmcore_publish_time":"2021-12-16T18:01:27.429Z","readme":"[![Build Status](https://travis-ci.com/gilamran/tsc-watch.svg?branch=master)](https://travis-ci.com/gilamran/tsc-watch)\r\n\r\n# The nodemon for TypeScript\r\n\r\n`tsc-watch` starts a TypeScript compiler with `--watch` parameter, with the ability to react to compilation status.\r\n`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.\r\n\r\n| Argument | Description |\r\n|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|\r\n| `--onSuccess COMMAND` | Executes `COMMAND` on **every successful** compilation. |\r\n| `--onFirstSuccess COMMAND` | Executes `COMMAND` on the **first successful** compilation. |\r\n| `--onFailure COMMAND` | Executes `COMMAND` on **every failed** compilation. |\r\n| `--onCompilationStarted COMMAND` | Executes `COMMAND` on **every compilation start** event (initial and incremental). |\r\n| `--onCompilationComplete COMMAND` | Executes `COMMAND` on **every successful or failed** compilation. |\r\n| `--noColors` | By default tsc-watch adds colors the output with green
on success, and in red on failure.
Add this argument to prevent that. |\r\n| `--noClear` | In watch mode the `tsc` compiler clears the screen before reporting
Add this argument to prevent that. |\r\n| `--compiler PATH` | The `PATH` will be used instead of typescript compiler.
Default is `typescript/bin/tsc` |\r\n\r\nNotes:\r\n\r\n* That all the above `COMMAND`s will be killed on process exit. (Using `SIGTERM`)\r\n \r\n* A `COMMAND` is a single command and not multi command like `script1.sh && script2.sh`\r\n \r\n* Any child process (`COMMAND`) will be terminated before creating a new one.\r\n\r\n## Install\r\n\r\n```sh\r\nnpm install tsc-watch --save-dev\r\n```\r\n\r\n## Usage\r\n\r\n### From Command-Line\r\n\r\n```sh\r\n## Watching a project (with tsconfig.json)\r\ntsc-watch --onSuccess \"node ./dist/server.js\"\r\n\r\n## Beep on failure\r\ntsc-watch --onFailure \"echo Beep! Compilation Failed\"\r\n\r\n## Watching a single file\r\ntsc-watch server.ts --outDir ./dist --onSuccess \"node ./dist/server.js\"\r\n\r\n## Custom compiler\r\ntsc-watch --onSuccess \"node ./dist/server.js\" --compiler my-typescript/bin/tsc\r\n```\r\n\r\n### From npm script\r\n```\r\n\"dev-server\": \"tsc-watch --noClear -p ./src/tsconfig.json --onSuccess \\\"node ./dist/server.js\\\"\",\r\n```\r\n\r\n### From javascript\r\n\r\nYou can see a detailed example [here](https://github.com/gilamran/tsc-watch/blob/master/tsc-watch-client-example.js)\r\n\r\nThe client is implemented as an instance of `Node.JS`'s `EventEmitter`, with the following events:\r\n\r\n- `started` - Emitted upon the compilation start (initial or incremental).\r\n- `first_success` - Emitted upon first successful compilation.\r\n- `subsequent_success` - Emitted upon every subsequent successful compilation.\r\n- `compile_errors` - Emitted upon every failing compilation.\r\n\r\nOnce subscribed to the relevant events, start the client by running `watch.start()`\r\n\r\nTo kill the client, run `watch.kill()`\r\n\r\nExample usage:\r\n\r\n```javascript\r\nconst TscWatchClient = require('tsc-watch/client');\r\nconst watch = new TscWatchClient();\r\n\r\nwatch.on('started', () => {\r\n console.log('Compilation started');\r\n});\r\n\r\nwatch.on('first_success', () => {\r\n console.log('First success!');\r\n});\r\n\r\nwatch.on('success', () => {\r\n // Your code goes here...\r\n});\r\n\r\nwatch.on('compile_errors', () => {\r\n // Your code goes here...\r\n});\r\n\r\nwatch.start('--project', '.');\r\n\r\ntry {\r\n // do something...\r\n} catch (e) {\r\n watch.kill(); // Fatal error, kill the compiler instance.\r\n}\r\n```\r\n\r\nNotes:\r\n\r\n- The (`onSuccess`) `COMMAND` will not run if the compilation failed.\r\n- `tsc-watch` is using the currently installed TypeScript compiler.\r\n- `tsc-watch` is not changing the compiler, just adds the new arguments, compilation is the same, and all other arguments are the same.\r\n"}