Skip to content

Commit 264413a

Browse files
committedAug 29, 2020
If ignoreScripts is set, then don't even read the package.json file
1 parent 6102666 commit 264413a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎src/run-npm-script.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import { NpmScript, ProgressEvent } from "./types/version-bump-progress";
88
* Runs the specified NPM script in the package.json file.
99
*/
1010
export async function runNpmScript(script: NpmScript, operation: Operation): Promise<Operation> {
11-
let { cwd } = operation.options;
11+
let { cwd, ignoreScripts } = operation.options;
1212

13-
let { data: manifest } = await readJsonFile("package.json", cwd);
13+
if (!ignoreScripts) {
14+
let { data: manifest } = await readJsonFile("package.json", cwd);
1415

15-
if (!operation.options.ignoreScripts && (isManifest(manifest) && hasScript(manifest, script))) {
16-
await ezSpawn.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
17-
operation.update({ event: ProgressEvent.NpmScript, script });
16+
if (isManifest(manifest) && hasScript(manifest, script)) {
17+
await ezSpawn.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
18+
operation.update({ event: ProgressEvent.NpmScript, script });
19+
}
1820
}
1921

2022
return operation;

0 commit comments

Comments
 (0)
Failed to load comments.