tsc-watch
Advanced tools
Comparing version 2.4.0 to 3.0.0
# @gilamran/tsc-watch CHANGELOG | ||
## v3.0.0 - 19/9/2019 | ||
onSuccess will run on EVERY successful compilation, also on the first success. - (Thanks to @mchl-hub for the idea) | ||
## v2.2.1 - 19/5/2019 | ||
@@ -4,0 +8,0 @@ |
setInterval(() => console.log(Math.random()), 1000); |
setInterval(() => console.log(Math.random()), 1000); |
@@ -0,0 +0,0 @@ function removeRunnerArgs(args) { |
@@ -0,0 +0,0 @@ const { fork } = require('child_process'); |
@@ -0,0 +0,0 @@ const psTree = require('ps-tree'); |
@@ -0,0 +0,0 @@ const spawn = require('cross-spawn'); |
@@ -0,0 +0,0 @@ const stripAnsi = require('strip-ansi'); |
@@ -68,7 +68,12 @@ #!/usr/bin/env node | ||
} else { | ||
if (firstTime) { | ||
firstTime = false; | ||
Signal.emitFirstSuccess(); | ||
if (onFirstSuccessCommand) { | ||
firstSuccessKiller = run(onFirstSuccessCommand); | ||
} | ||
} | ||
Signal.emitSuccess(); | ||
if (firstTime && onFirstSuccessCommand) { | ||
firstTime = false; | ||
firstSuccessKiller = run(onFirstSuccessCommand); | ||
} else if (onSuccessCommand) { | ||
if (onSuccessCommand) { | ||
successKiller = run(onSuccessCommand); | ||
@@ -83,8 +88,4 @@ } | ||
send: typeof process.send === 'function' ? (...e) => process.send(...e) : () => {}, | ||
_successStr: 'first_success', | ||
emitSuccess: () => { | ||
Signal.send(Signal._successStr); | ||
Signal._successStr = 'subsequent_success'; | ||
}, | ||
emitFirstSuccess: () => Signal.send('first_success'), | ||
emitSuccess: () => Signal.send('success'), | ||
emitFail: () => Signal.send('compile_errors'), | ||
@@ -91,0 +92,0 @@ }; |
{ | ||
"name": "tsc-watch", | ||
"version": "2.4.0", | ||
"version": "3.0.0", | ||
"description": "The TypeScript compiler with onSuccess command", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -7,4 +7,4 @@ [![Build Status](https://travis-ci.com/gilamran/tsc-watch.svg?branch=master)](https://travis-ci.com/gilamran/tsc-watch) | ||
- `--onSuccess COMMAND` - The `COMMAND` will be executed on every successful TypeScript compilation. | ||
- `--onFirstSuccess COMMAND` - The `COMMAND` will be executed only one time, on the first successful TypeScript compilation. | ||
- `--onSuccess COMMAND` - The `COMMAND` will be executed on every successful TypeScript compilation. The process will be killed and restarted on every successful compilation. | ||
- `--onFirstSuccess COMMAND` - The `COMMAND` will be executed only one time, on the first successful TypeScript compilation, it will not get killed on every success. | ||
- `--onFailure COMMAND` - The `COMMAND` will be executed on failed TypeScript compilation. | ||
@@ -11,0 +11,0 @@ - `--noColors` - `tsc-watch` colors the output with green on success, and in red on failiure. Add this argument to prevent that. |
@@ -0,0 +0,0 @@ const fs = require('fs'); |
@@ -0,0 +0,0 @@ const { expect } = require('chai'); |
@@ -26,6 +26,5 @@ const { expect } = require('chai'); | ||
it('Should fire "subsequent_success" on subsequent successes', () => { | ||
watchClient.on('subsequent_success', callback); | ||
it('Should emit "success" on first success', () => { | ||
watchClient.on('success', callback); | ||
watchClient.start('--noClear', '--out', './tmp/output.js', './tmp/fixtures/passing.ts'); | ||
tscWatchDriver.modifyAndSucceedAfter(1500); | ||
@@ -32,0 +31,0 @@ return eventually(() => expect(callback.calledOnce).to.be.true); |
@@ -0,0 +0,0 @@ const { fork } = require('child_process'); |
@@ -13,3 +13,6 @@ const { expect } = require('chai'); | ||
it('Should send "first_success" on first success', () => { | ||
driver.subscribe('first_success', this.listener).startWatch(); | ||
driver | ||
.subscribe('first_success', this.listener) | ||
.startWatch() | ||
.modifyAndSucceedAfter(1000); | ||
@@ -19,8 +22,7 @@ return eventually(() => expect(this.listener.callCount).to.be.equal(1)); | ||
it('Should send "subsequent_success" on subsequent successes', () => { | ||
it('Should send "success" on subsequent successes', () => { | ||
driver | ||
.subscribe('subsequent_success', this.listener) | ||
.subscribe('success', this.listener) | ||
.startWatch() | ||
.modifyAndSucceedAfter(1000) | ||
.modifyAndSucceedAfter(3000); | ||
.modifyAndSucceedAfter(1000); | ||
@@ -27,0 +29,0 @@ return eventually(() => expect(this.listener.callCount).to.be.equal(2)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28921
526