clean-scripts
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -44,4 +44,16 @@ "use strict"; | ||
const context = {}; | ||
async function execAsync(script, processKey) { | ||
async function spawnAsync(command, args, options, processKey) { | ||
return new Promise((resolve, reject) => { | ||
const subProcess = childProcess.spawn(command, args, options); | ||
subProcess.stdout.pipe(process.stdout); | ||
subProcess.stderr.pipe(process.stderr); | ||
if (processKey) { | ||
context[processKey] = subProcess; | ||
serviceProcesses.push(subProcess); | ||
} | ||
resolve(); | ||
}); | ||
} | ||
async function execAsync(script) { | ||
return new Promise((resolve, reject) => { | ||
const now = Date.now(); | ||
@@ -58,6 +70,2 @@ const subProcess = childProcess.exec(script, { encoding: "utf8" }, (error, stdout, stderr) => { | ||
subProcess.stderr.pipe(process.stderr); | ||
if (processKey) { | ||
context[processKey] = subProcess; | ||
serviceProcesses.push(subProcess); | ||
} | ||
}); | ||
@@ -98,4 +106,5 @@ } | ||
printInConsole(script.script); | ||
const scriptParts = script.script.split(" "); | ||
const now = Date.now(); | ||
execAsync(script.script, script.processKey); | ||
spawnAsync(scriptParts[0], scriptParts.slice(1), undefined, script.processKey); | ||
return [{ time: Date.now() - now, script: script.script }]; | ||
@@ -102,0 +111,0 @@ } |
{ | ||
"name": "clean-scripts", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "A CLI tool to make scripts in package.json clean.", | ||
@@ -5,0 +5,0 @@ "main": "dist/core.js", |
@@ -151,3 +151,3 @@ [![Dependency Status](https://david-dm.org/plantain-00/clean-scripts.svg)](https://david-dm.org/plantain-00/clean-scripts) | ||
All services will be killed after all scripts end, or any script errors. | ||
All services will be killed(send `SIGINT` actually) after all scripts end, or any script errors. | ||
@@ -154,0 +154,0 @@ ##### short-hand methods |
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
12378
196