Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "tsc-watch", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "The TypeScirpt compiler with onSuccess command", | ||
@@ -28,4 +28,5 @@ "main": "tsc-watch.js", | ||
"cross-spawn": "^5.1.0", | ||
"ps-tree": "^1.1.0", | ||
"typescript": "*" | ||
} | ||
} |
@@ -6,2 +6,3 @@ #!/usr/bin/env node | ||
const spawn = require('cross-spawn'); | ||
const killer = require('./killer'); | ||
@@ -57,17 +58,21 @@ const compilationStartedRegex = /Starting incremental compilation/; | ||
function runCommand(fullCommand) { | ||
const parts = fullCommand.split(' ').filter(a => a.length > 0); | ||
return spawn(parts[0], parts.slice(1), {stdio: 'inherit'}) | ||
if (fullCommand) { | ||
const parts = fullCommand.split(' ').filter(a => a.length > 0); | ||
return spawn(parts[0], parts.slice(1), {stdio: 'inherit'}) | ||
} | ||
} | ||
function killAllProcesses() { | ||
const promises = []; | ||
if (firstSuccessProcess) { | ||
firstSuccessProcess.kill(); | ||
firstSuccessProcess = null; | ||
promises.push(killer(firstSuccessProcess).then(() => firstSuccessProcess = null)); | ||
} | ||
if (successProcess) { | ||
successProcess.kill(); | ||
successProcess = null; | ||
promises.push(killer(successProcess).then(() => successProcess = null)); | ||
} | ||
return Promise.all(promises); | ||
} | ||
let allArgs = process.argv; | ||
@@ -120,9 +125,10 @@ // onSuccess | ||
} else { | ||
killAllProcesses(); | ||
if (firstTime && onFirstSuccessCommand) { | ||
firstTime = false; | ||
firstSuccessProcess = runCommand(onFirstSuccessCommand); | ||
} else { | ||
successProcess = runCommand(onSuccessCommand); | ||
} | ||
killAllProcesses().then(() => { | ||
if (firstTime && onFirstSuccessCommand) { | ||
firstTime = false; | ||
firstSuccessProcess = runCommand(onFirstSuccessCommand); | ||
} else { | ||
successProcess = runCommand(onSuccessCommand); | ||
} | ||
}); | ||
} | ||
@@ -129,0 +135,0 @@ } |
Sorry, the diff of this file is not supported yet
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
12446
9
158
4
1
+ Addedps-tree@^1.1.0
+ Addedps-tree@1.2.0(transitive)