clean-scripts
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -44,16 +44,4 @@ "use strict"; | ||
const context = {}; | ||
async function spawnAsync(command, args, options, processKey) { | ||
async function execAsync(script, isService, 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(); | ||
@@ -70,2 +58,8 @@ const subProcess = childProcess.exec(script, { encoding: "utf8" }, (error, stdout, stderr) => { | ||
subProcess.stderr.pipe(process.stderr); | ||
if (processKey) { | ||
context[processKey] = subProcess; | ||
} | ||
if (isService) { | ||
serviceProcesses.push(subProcess); | ||
} | ||
}); | ||
@@ -76,3 +70,3 @@ } | ||
printInConsole(script); | ||
const time = await execAsync(script); | ||
const time = await execAsync(script, false); | ||
return [{ time, script }]; | ||
@@ -107,5 +101,4 @@ } | ||
printInConsole(script.script); | ||
const scriptParts = script.script.split(" "); | ||
const now = Date.now(); | ||
spawnAsync(scriptParts[0], scriptParts.slice(1), undefined, script.processKey); | ||
execAsync(script.script, true, script.processKey); | ||
return [{ time: Date.now() - now, script: script.script }]; | ||
@@ -143,2 +136,3 @@ } | ||
printInConsole("script success."); | ||
process.exit(); | ||
}, error => { | ||
@@ -145,0 +139,0 @@ printInConsole(error); |
{ | ||
"name": "clean-scripts", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "A CLI tool to make scripts in package.json clean.", | ||
@@ -5,0 +5,0 @@ "main": "dist/core.js", |
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
12074
190