Comparing version 1.0.18 to 1.0.19
# @gilamran/tsc-watch CHANGELOG | ||
## v1.0.18 - 8/04/2018 | ||
## v1.0.19 - 8/04/2018 | ||
* Fixed passing compilation when using --pretty param (Thanks to @tomaba) | ||
@@ -5,0 +5,0 @@ |
@@ -7,2 +7,3 @@ #!/usr/bin/env node | ||
const killer = require('./killer'); | ||
const stripAnsi = require('strip-ansi'); | ||
@@ -13,3 +14,4 @@ const compilationStartedRegex = /Starting incremental compilation/; | ||
const typescriptWatchCommandRegex = /Watch input files\./; | ||
const typescriptErrorRegex = /\(\d+,\d+\): .*error.*TS\d+:/; | ||
const typescriptPrettyErrorRegex = /:\d+:\d+ \- error TS\d+: /; | ||
const typescriptErrorRegex = /\(\d+,\d+\): error TS\d+: /; | ||
const onSuccessCommandSyntax = ' --onSuccess COMMAND Run the COMMAND on each successful compilation'; | ||
@@ -45,2 +47,6 @@ const onFirstSuccessCommandSyntax = ' --onFirstSuccess COMMAND Run the COMMAND on the first successful compilation (Will not run the onSuccess)'; | ||
function removeColors(lines) { | ||
return lines.map(line => stripAnsi(line)); | ||
} | ||
function cleanArgs(inputArgs) { | ||
@@ -135,6 +141,6 @@ return inputArgs | ||
.map(a => a.replace(typescriptWatchCommandRegex, newAdditionToSyntax)); | ||
print(lines); | ||
const newCompilation = lines.some(line => compilationStartedRegex.test(line)); | ||
const cleanLines = removeColors(lines); | ||
const newCompilation = cleanLines.some(line => compilationStartedRegex.test(line)); | ||
if (newCompilation) { | ||
@@ -144,3 +150,3 @@ hadErrors = false; | ||
const error = lines.some(line => typescriptErrorRegex.test(line)); | ||
const error = cleanLines.some(line => typescriptErrorRegex.test(line) || typescriptPrettyErrorRegex.test(line)); | ||
if (error) { | ||
@@ -150,3 +156,3 @@ hadErrors = true; | ||
const compilationComplete = lines.some(line => compilationCompleteRegex.test(line)); | ||
const compilationComplete = cleanLines.some(line => compilationCompleteRegex.test(line)); | ||
if (compilationComplete) { | ||
@@ -153,0 +159,0 @@ if (hadErrors) { |
{ | ||
"name": "tsc-watch", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "The TypeScript compiler with onSuccess command", | ||
@@ -28,2 +28,3 @@ "scripts": { | ||
"ps-tree": "^1.1.0", | ||
"strip-ansi": "^4.0.0", | ||
"typescript": "*" | ||
@@ -30,0 +31,0 @@ }, |
@@ -11,3 +11,2 @@ const { fork } = require('child_process'); | ||
this.subscriptions = new Map(); | ||
this.wait = Promise.resolve(); | ||
} | ||
@@ -35,9 +34,9 @@ | ||
modifyAndSucceedAfter(wait = 0, isFailingPath) { | ||
this._extendWait(wait).then(() => fs.appendFileSync(SUCCESS_FILE_PATH, ' ')); | ||
modifyAndSucceedAfter(timeToWait = 0, isFailingPath) { | ||
this._wait(timeToWait).then(() => fs.appendFileSync(SUCCESS_FILE_PATH, ' ')); | ||
return this; | ||
} | ||
modifyAndFailAfter(wait = 0) { | ||
this._extendWait(wait).then(() => fs.appendFileSync(FAIL_FILE_PATH, '{{{')); | ||
modifyAndFailAfter(timeToWait = 0) { | ||
this._wait(timeToWait).then(() => fs.appendFileSync(FAIL_FILE_PATH, '{{{')); | ||
return this; | ||
@@ -53,8 +52,7 @@ } | ||
this.subscriptions.clear(); | ||
this.wait = Promise.resolve(); | ||
return this; | ||
} | ||
_extendWait(ms) { | ||
return this.wait = this.wait.then(() => new Promise(resolve => setTimeout(resolve, ms))); | ||
_wait(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
@@ -61,0 +59,0 @@ } |
@@ -6,3 +6,3 @@ const { expect } = require('chai'); | ||
const eventually = fn => mochaEventually(fn, 4000, 10); | ||
const eventually = fn => mochaEventually(fn, 8000, 10); | ||
@@ -26,4 +26,4 @@ describe('TSC-Watch child process messages', () => { | ||
.startWatch() | ||
.modifyAndSucceedAfter(2000) | ||
.modifyAndSucceedAfter(1000) | ||
.modifyAndSucceedAfter(3000) | ||
@@ -30,0 +30,0 @@ return eventually(() => |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16546
362
5
+ Addedstrip-ansi@^4.0.0
+ Addedansi-regex@3.0.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)