npm-script-selector
Advanced tools
Comparing version 1.1.0 to 1.2.0
26
app.ts
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
import { confirm } from '@inquirer/prompts'; | ||
import { exec } from 'child_process'; | ||
import { spawn } from 'child_process'; | ||
@@ -108,10 +108,20 @@ | ||
private async runScript(scriptName: string): Promise<void> { | ||
return new Promise<void>((resolve, reject) => { | ||
exec(`npm run ${scriptName}`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`Error running script: ${error.message}`); | ||
reject(error); | ||
return new Promise((resolve, reject) => { | ||
const child = spawn('npm', [`run ${scriptName}`], { | ||
stdio: 'inherit', // This line makes the child process use the same stdio as the parent. | ||
shell: true | ||
}); | ||
child.on('error', (error) => { | ||
console.error(`Error starting script: ${error.message}`); | ||
reject(error); | ||
}); | ||
child.on('exit', (code, signal) => { | ||
if (code === 0) { | ||
console.log(`Script exited successfully.`); | ||
resolve(); | ||
} else { | ||
console.log(`Script output:\n${stdout}`); | ||
resolve(); | ||
console.error(`Script exited with code ${code} and signal ${signal}`); | ||
reject(new Error(`Script exited with code ${code} and signal ${signal}`)); | ||
} | ||
@@ -118,0 +128,0 @@ }); |
@@ -119,10 +119,18 @@ #!/usr/bin/env node | ||
return new Promise((resolve, reject) => { | ||
(0, child_process_1.exec)(`npm run ${scriptName}`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`Error running script: ${error.message}`); | ||
reject(error); | ||
const child = (0, child_process_1.spawn)('npm', [`run ${scriptName}`], { | ||
stdio: 'inherit', | ||
shell: true | ||
}); | ||
child.on('error', (error) => { | ||
console.error(`Error starting script: ${error.message}`); | ||
reject(error); | ||
}); | ||
child.on('exit', (code, signal) => { | ||
if (code === 0) { | ||
console.log(`Script exited successfully.`); | ||
resolve(); | ||
} | ||
else { | ||
console.log(`Script output:\n${stdout}`); | ||
resolve(); | ||
console.error(`Script exited with code ${code} and signal ${signal}`); | ||
reject(new Error(`Script exited with code ${code} and signal ${signal}`)); | ||
} | ||
@@ -129,0 +137,0 @@ }); |
{ | ||
"name": "npm-script-selector", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "A CLI for finding npm scripts within a `package.json` and allowing a user to run them from the command line.", | ||
@@ -11,3 +11,6 @@ "author": { | ||
"homepage": "https://github.com/sundayj/npm-script-selector", | ||
"repository": "github:sundayj/npm-script-selector", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sundayj/npm-script-selector.git" | ||
}, | ||
"bugs": "https://github.com/sundayj/npm-script-selector/issues", | ||
@@ -33,3 +36,3 @@ "license": "MIT", | ||
"bin": { | ||
"npmss": "./dist/app.js" | ||
"npmss": "dist/app.js" | ||
}, | ||
@@ -36,0 +39,0 @@ "config": { |
{ | ||
"name": "npm-script-selector", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A CLI for finding npm scripts within a `package.json` and allowing a user to run them from the command line.", | ||
@@ -11,3 +11,6 @@ "author": { | ||
"homepage": "https://github.com/sundayj/npm-script-selector", | ||
"repository": "github:sundayj/npm-script-selector", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sundayj/npm-script-selector.git" | ||
}, | ||
"bugs": "https://github.com/sundayj/npm-script-selector/issues", | ||
@@ -33,3 +36,3 @@ "license": "MIT", | ||
"bin": { | ||
"npmss": "./dist/app.js" | ||
"npmss": "dist/app.js" | ||
}, | ||
@@ -36,0 +39,0 @@ "config": { |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
60690
393
2
2