npm-script-selector
Advanced tools
Comparing version 1.0.3 to 1.0.5
@@ -19,3 +19,3 @@ #!/usr/bin/env node | ||
ProgramName: 'NPM Script Selector', | ||
Version: '1.0.3', | ||
Version: '1.0.5', | ||
Description: 'A CLI for finding npm scripts within a package and allowing a user to run them from the command line.', | ||
@@ -35,3 +35,2 @@ Options: { | ||
}; | ||
console.log(figlet.textSync(DEFAULTS.ProgramName, { font: 'Pagga' })); | ||
export function selectAndRunScript(filePath) { | ||
@@ -69,7 +68,24 @@ return __awaiter(this, void 0, void 0, function* () { | ||
export function runProgram(filePath) { | ||
if (!fs.existsSync(filePath)) { | ||
console.error(`${DEFAULTS.ErrorMessages.FileNotFound} ${filePath}`); | ||
process.exit(1); | ||
} | ||
selectAndRunScript(filePath); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
console.log(figlet.textSync(DEFAULTS.ProgramName, { font: 'Pagga' })); | ||
console.log(); // Put some spacing between the title and output | ||
if (!fs.existsSync(filePath)) { | ||
console.error(`${DEFAULTS.ErrorMessages.FileNotFound} ${filePath}`); | ||
process.exit(1); | ||
} | ||
let continueRunning = true; | ||
while (continueRunning) { | ||
yield selectAndRunScript(filePath); | ||
const answer = yield inquirer.prompt([ | ||
{ | ||
type: 'confirm', | ||
name: 'continue', | ||
message: 'Do you want to run another script?', | ||
default: true, | ||
}, | ||
]); | ||
continueRunning = answer.continue; | ||
} | ||
console.log('Goodbye!'); | ||
}); | ||
} | ||
@@ -76,0 +92,0 @@ const program = new Command(); |
{ | ||
"name": "npm-script-selector", | ||
"version": "1.0.3", | ||
"version": "1.0.5", | ||
"description": "A command line app for finding and running npm scripts within a project.", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "jasmine", | ||
"run": "node ./dist/app.js", | ||
"start": "npm run build && npm run run" | ||
"author": { | ||
"name": "Justin L. Sunday", | ||
"email": "admin@jlsunday.com", | ||
"url": "https://jlsunday.com" | ||
}, | ||
"bin": { | ||
"npmss": "dist/app.js" | ||
}, | ||
"homepage": "https://github.com/sundayj/npm-script-selector", | ||
"repository": "github:sundayj/npm-script-selector", | ||
"bugs": "https://github.com/sundayj/npm-script-selector/issues", | ||
"license": "MIT", | ||
"keywords": [ | ||
@@ -26,4 +24,13 @@ "typescript", | ||
], | ||
"author": "Justin L. Sunday", | ||
"license": "ISC", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "jasmine", | ||
"start": "node ./dist/app.js", | ||
"devstart": "npm run build && node ./dist/app.js -f package.json" | ||
}, | ||
"bin": { | ||
"npmss": "dist/app.js" | ||
}, | ||
"dependencies": { | ||
@@ -30,0 +37,0 @@ "commander": "^11.1.0", |
@@ -12,3 +12,3 @@ #!/usr/bin/env node | ||
ProgramName: 'NPM Script Selector', | ||
Version: '1.0.3', | ||
Version: '1.0.5', | ||
Description: 'A CLI for finding npm scripts within a package and allowing a user to run them from the command line.', | ||
@@ -29,4 +29,2 @@ Options: { | ||
console.log(figlet.textSync(DEFAULTS.ProgramName, { font: 'Pagga' })); | ||
export async function selectAndRunScript(filePath: string): Promise<void> { | ||
@@ -68,3 +66,5 @@ const packageData = JSON.parse(fs.readFileSync(filePath, 'utf8')); | ||
export function runProgram(filePath: string): void { | ||
export async function runProgram(filePath: string): Promise<void> { | ||
console.log(figlet.textSync(DEFAULTS.ProgramName, { font: 'Pagga' })); | ||
console.log(); // Put some spacing between the title and output | ||
@@ -76,5 +76,24 @@ if (!fs.existsSync(filePath)) { | ||
selectAndRunScript(filePath); | ||
let continueRunning = true; | ||
while (continueRunning) { | ||
await selectAndRunScript(filePath); | ||
const answer = await inquirer.prompt([ | ||
{ | ||
type: 'confirm', | ||
name: 'continue', | ||
message: 'Do you want to run another script?', | ||
default: true, | ||
}, | ||
]); | ||
continueRunning = answer.continue; | ||
} | ||
console.log('Goodbye!'); | ||
} | ||
const program = new Command(); | ||
@@ -81,0 +100,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
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
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
1
47
3
53247
9
321