mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Add script to prefetch headers for native module compile
This commit is contained in:
parent
bfad20be9d
commit
e346d0f1f9
37
build/prefetchHeaders.js
Normal file
37
build/prefetchHeaders.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const cp = require('child_process');
|
||||
|
||||
function installHeaders(rcFile) {
|
||||
const lines = fs.readFileSync(rcFile, 'utf8').split(/\r\n?/g);
|
||||
let disturl, target;
|
||||
for (const line of lines) {
|
||||
let match = line.match(/\s*disturl\s*(.*)$/);
|
||||
if (match !== null && match.length >= 1) {
|
||||
disturl = match[1];
|
||||
}
|
||||
match = line.match(/\s*target\s*(.*)$/);
|
||||
if (match !== null && match.length >= 1) {
|
||||
target = match[1];
|
||||
}
|
||||
}
|
||||
if (disturl !== undefined && target !== undefined) {
|
||||
console.log(`Pre-fetch headers for ${target} from ${disturl}`);
|
||||
cp.execSync(`node-gyp install --dist-url ${disturl} ${target}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function main() {
|
||||
installHeaders(path.join(__dirname, '..', '.yarnrc'));
|
||||
installHeaders(path.join(__dirname, '..', 'remote', '.yarnrc'));
|
||||
}
|
||||
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
|
@ -55,7 +55,8 @@
|
|||
"minify-vscode-reh-web": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js minify-vscode-reh-web",
|
||||
"hygiene": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js hygiene",
|
||||
"core-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js core-ci",
|
||||
"extensions-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js extensions-ci"
|
||||
"extensions-ci": "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js extensions-ci",
|
||||
"refetch-headers": "node build/prefetchHeaders.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/applicationinsights-web": "^2.6.4",
|
||||
|
|
Loading…
Reference in a new issue