diff --git a/script/lib/install-apm.js b/script/lib/install-apm.js index a233f611951..e2d9c61befb 100644 --- a/script/lib/install-apm.js +++ b/script/lib/install-apm.js @@ -9,7 +9,7 @@ module.exports = function(ci) { // npm ci leaves apm with a bunch of unmet dependencies childProcess.execFileSync( CONFIG.getNpmBinPath(), - ['--global-style', '--loglevel=error', 'install'], + ['--global-style', '--loglevel=error', 'install', ci ? '--no-save' : ''], { env: process.env, cwd: CONFIG.apmRootPath } ); }; diff --git a/script/lib/install-script-dependencies.js b/script/lib/install-script-dependencies.js index 6c69c360fe4..fe7bf6eab04 100644 --- a/script/lib/install-script-dependencies.js +++ b/script/lib/install-script-dependencies.js @@ -9,8 +9,8 @@ process.env.ELECTRON_CUSTOM_VERSION = CONFIG.appMetadata.electronVersion; module.exports = function(ci) { console.log('Installing script dependencies'); childProcess.execFileSync( - CONFIG.getNpmBinPath(ci), - ['--loglevel=error', ci ? 'ci' : 'install'], + CONFIG.getNpmBinPath(), + ['--loglevel=error', 'install'], { env: process.env, cwd: CONFIG.scriptRootPath } ); }; diff --git a/script/lib/run-apm-install.js b/script/lib/run-apm-install.js index b5ce0869163..14b1c5d9905 100644 --- a/script/lib/run-apm-install.js +++ b/script/lib/run-apm-install.js @@ -11,9 +11,13 @@ module.exports = function(packagePath, ci, stdioOptions) { // Set our target (Electron) version so that node-pre-gyp can download the // proper binaries. installEnv.npm_config_target = CONFIG.appMetadata.electronVersion; - childProcess.execFileSync(CONFIG.getApmBinPath(), [ci ? 'ci' : 'install'], { - env: installEnv, - cwd: packagePath, - stdio: stdioOptions || 'inherit' - }); + childProcess.execFileSync( + CONFIG.getApmBinPath(), + ['install', ci ? '--no-save' : ''], + { + env: installEnv, + cwd: packagePath, + stdio: stdioOptions || 'inherit' + } + ); }; diff --git a/script/vsts/platforms/templates/cache.yml b/script/vsts/platforms/templates/cache.yml index 37683f403a4..a3953289b18 100644 --- a/script/vsts/platforms/templates/cache.yml +++ b/script/vsts/platforms/templates/cache.yml @@ -11,20 +11,29 @@ steps: - task: Cache@2 displayName: Cache node_modules inputs: - key: 'npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml' + key: 'npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, package-lock.json, script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml' + restoreKeys: | + npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml + npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml path: 'node_modules' cacheHitVar: MainNodeModulesRestored - task: Cache@2 displayName: Cache script/node_modules inputs: - key: 'npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml' + key: 'npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | script/package.json, script/package-lock.json, script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml' + restoreKeys: | + npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | script/package.json, script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml + npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml path: 'script/node_modules' cacheHitVar: ScriptNodeModulesRestored - task: Cache@2 displayName: Cache apm/node_modules inputs: - key: 'npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml' + key: 'npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml' + restoreKeys: | + npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | apm/package.json, script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml + npm | "$(Agent.OS)" | "$(BUILD_ARCH)" | script/vsts/platforms/templates/preparation.yml, script/vsts/platforms/${{ parameters.OS }}.yml path: 'apm/node_modules' cacheHitVar: ApmNodeModulesRestored