Skip to content

Commit b765037

Browse files
Don't use npx for webpack build and update npm version (microsoft#9387)
1 parent de0deba commit b765037

File tree

6 files changed

+928
-312
lines changed

6 files changed

+928
-312
lines changed

build/ci/templates/globals.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variables:
22
PythonVersion: '3.7' # Always use latest version.
33
NodeVersion: '10.11.0' # Check version of node used in VS Code.
4-
NpmVersion: '6.10.3'
4+
NpmVersion: '6.13.4'
55
MOCHA_FILE: '$(Build.ArtifactStagingDirectory)/test-junit.xml' # All test files will write their JUnit xml output to this file, clobbering the last time it was written.
66
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter).
77
VSC_PYTHON_FORCE_LOGGING: true # Enable this to turn on console output for the logger

build/ci/templates/steps/initialization.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ steps:
101101
displayName: "Setup NODE_PATH for extension (Debugger Tests)"
102102
condition: and(succeeded(), eq(variables['agent.os'], 'Darwin'))
103103
104-
# We need these almost always.
104+
# Install vsce
105105
- bash: |
106106
npm install -g vsce
107-
npm install -g npx
108-
displayName: "Install vsce & npx"
107+
displayName: "Install vsce"
109108
condition: and(succeeded(), eq('${{ parameters.installVSCEorNPX }}', 'true'))
110109
111110
- bash: npx tsc -p ./

gulpfile.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,30 +111,30 @@ gulp.task('checkNativeDependencies', done => {
111111
gulp.task('check-datascience-dependencies', () => checkDatascienceDependencies());
112112

113113
gulp.task('compile-webviews', async () => {
114-
await spawnAsync('npx', ['-n', '--max_old_space_size=9096', 'webpack', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], {'BUNDLE_INDEX': '0'});
115-
await spawnAsync('npx', ['-n', '--max_old_space_size=9096', 'webpack', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], {'BUNDLE_INDEX': '1'});
116-
await spawnAsync('npx', ['-n', '--max_old_space_size=9096', 'webpack', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], {'BUNDLE_INDEX': '2'});
117-
await spawnAsync('npx', ['-n', '--max_old_space_size=9096', 'webpack', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], {'BUNDLE_INDEX': '3'});
114+
await spawnAsync('npm', ['run', 'webpack', '--', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '0' });
115+
await spawnAsync('npm', ['run', 'webpack', '--', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '1' });
116+
await spawnAsync('npm', ['run', 'webpack', '--', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '2' });
117+
await spawnAsync('npm', ['run', 'webpack', '--', '--config', './build/webpack/webpack.config.js', '--mode', 'production'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '3' });
118118
});
119119

120120
gulp.task('webpack', async () => {
121121
// Build node_modules and DS stuff.
122122
// Unwrap the array used to build each webpack.
123-
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], {'BUNDLE_INDEX': '0'});
124-
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], {'BUNDLE_INDEX': '1'});
125-
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], {'BUNDLE_INDEX': '2'});
126-
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], {'BUNDLE_INDEX': '3'});
127-
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], {'BUNDLE_INDEX': '4'});
123+
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '0' });
124+
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '1' });
125+
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '2' });
126+
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '3' });
127+
await buildWebPack('production', ['--config', './build/webpack/webpack.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096', 'BUNDLE_INDEX': '4' });
128128
// Run both in parallel, for faster process on CI.
129129
// Yes, console would print output from both, that's ok, we have a faster CI.
130130
// If things fail, we can run locally separately.
131131
if (isCI) {
132-
const buildExtension = buildWebPack('extension', ['--config', './build/webpack/webpack.extension.config.js']);
133-
const buildDebugAdapter = buildWebPack('debugAdapter', ['--config', './build/webpack/webpack.debugadapter.config.js']);
132+
const buildExtension = buildWebPack('extension', ['--config', './build/webpack/webpack.extension.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096' });
133+
const buildDebugAdapter = buildWebPack('debugAdapter', ['--config', './build/webpack/webpack.debugadapter.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096' });
134134
await Promise.all([buildExtension, buildDebugAdapter]);
135135
} else {
136-
await buildWebPack('extension', ['--config', './build/webpack/webpack.extension.config.js']);
137-
await buildWebPack('debugAdapter', ['--config', './build/webpack/webpack.debugadapter.config.js']);
136+
await buildWebPack('extension', ['--config', './build/webpack/webpack.extension.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096' });
137+
await buildWebPack('debugAdapter', ['--config', './build/webpack/webpack.debugadapter.config.js'], { 'NODE_OPTIONS': '--max_old_space_size=9096' });
138138
}
139139
});
140140

@@ -173,7 +173,7 @@ async function updateBuildNumber(args) {
173173
async function buildWebPack(webpackConfigName, args, env) {
174174
// Remember to perform a case insensitive search.
175175
const allowedWarnings = getAllowedWarningsForWebPack(webpackConfigName).map(item => item.toLowerCase());
176-
const stdOut = await spawnAsync('npx', ['-n', '--max_old_space_size=9096', 'webpack', ...args, ...['--mode', 'production']], env);
176+
const stdOut = await spawnAsync('npm', ['run', 'webpack', '--', ...args, ...['--mode', 'production']], env);
177177
const stdOutLines = stdOut
178178
.split(os.EOL)
179179
.map(item => item.trim())
@@ -335,7 +335,7 @@ gulp.task('uploadReleaseExtension', () => uploadExtension(`ms-python-${process.e
335335

336336
function spawnAsync(command, args, env) {
337337
env = env || {};
338-
env = {...process.env, ...env};
338+
env = { ...process.env, ...env };
339339
return new Promise((resolve, reject) => {
340340
let stdOut = '';
341341
const proc = spawn(command, args, { cwd: __dirname, env });

news/3 Code Health/7197.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove npx from webpack build as it [breaks on windows](https://github.com/npm/npx/issues/5) on npm 6.11+ and doesn't seem to be getting fixes. Update npm to current version.

0 commit comments

Comments
 (0)