Skip to content

Commit 088737f

Browse files
Add ignoreScripts option
Add ignoreScripts option, which should be used when during installation of modules you want to skip all scripts declared in package.json's of these modules. When you specify --ignoreScripts, we just add `--ignore-scripts` to npm install command.
1 parent 5fd2615 commit 088737f

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

lib/declarations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ interface IOptions extends ICommonOptions {
6565
keyStoreAlias: string;
6666
keyStoreAliasPassword: string;
6767
sdk: string;
68+
ignoreScripts: boolean;
6869
}
6970

7071
interface IProjectFilesManager {

lib/node-package-manager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export class NodePackageManager implements INodePackageManager {
2828
}
2929

3030
public install(packageName: string, pathToSave: string, config?: any): IFuture<any> {
31+
if(this.$options.ignoreScripts) {
32+
config = config || {};
33+
config["ignore-scripts"] = true;
34+
}
35+
3136
return this.loadAndExecute("install", [pathToSave, packageName], { config: config });
3237
}
3338

lib/options.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export class Options extends commonOptionsLibPath.OptionsBase {
2727
keyStorePassword: { type: OptionType.String,},
2828
keyStoreAlias: { type: OptionType.String },
2929
keyStoreAliasPassword: { type: OptionType.String },
30-
sdk: { type: OptionType.String }
30+
sdk: { type: OptionType.String },
31+
ignoreScripts: {type: OptionType.Boolean }
3132
},
3233
path.join($hostInfo.isWindows ? process.env.LocalAppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
3334
$errors, $staticConfig);

lib/services/plugins-service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ export class PluginsService implements IPluginsService {
116116
}
117117

118118
public ensureAllDependenciesAreInstalled(): IFuture<void> {
119-
return this.$childProcess.exec("npm install ", { cwd: this.$projectData.projectDir });
119+
let command = "npm install ";
120+
if(this.$options.ignoreScripts) {
121+
command += "--ignore-scripts";
122+
}
123+
return this.$childProcess.exec(command, { cwd: this.$projectData.projectDir });
120124
}
121125

122126
public getAllInstalledPlugins(): IFuture<IPluginData[]> {

0 commit comments

Comments
 (0)