Skip to content

Commit 2c25a53

Browse files
FatmeFatme
authored andcommitted
Merge pull request #830 from NativeScript/fatme/npm-install
Execute npm install only when node_modules folder does not exist
2 parents 25738e0 + be8298e commit 2c25a53

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/services/plugins-service.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,15 @@ export class PluginsService implements IPluginsService {
130130
}
131131

132132
public ensureAllDependenciesAreInstalled(): IFuture<void> {
133-
let command = "npm install ";
134-
if(this.$options.ignoreScripts) {
135-
command += "--ignore-scripts";
136-
}
137-
return this.$childProcess.exec(command, { cwd: this.$projectData.projectDir });
133+
return (() => {
134+
if(!this.$fs.exists(path.join(this.$projectData.projectDir, constants.NODE_MODULES_FOLDER_NAME)).wait()) {
135+
let command = "npm install ";
136+
if(this.$options.ignoreScripts) {
137+
command += "--ignore-scripts";
138+
}
139+
this.$childProcess.exec(command, { cwd: this.$projectData.projectDir }).wait();
140+
}
141+
}).future<void>()();
138142
}
139143

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

0 commit comments

Comments
 (0)