From afb0e96b666ce964b6daf6d6e7a475c696240753 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Sun, 25 Oct 2020 22:35:23 +0100 Subject: [PATCH] build: improve ignores in node_modules --- build/.moduleignore | 38 ++++++++++++++++++++++++++++++++++++++ build/.nativeignore | 2 ++ build/.webignore | 4 ++++ build/gulpfile.vscode.js | 5 +++-- build/lib/asar.ts | 6 ++---- 5 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 build/.moduleignore diff --git a/build/.moduleignore b/build/.moduleignore new file mode 100644 index 00000000000..489d4709f0a --- /dev/null +++ b/build/.moduleignore @@ -0,0 +1,38 @@ + +# additional cleanup rules for node modules, .gitignore style + +**/docs/** +**/example/** +**/examples/** +**/test/** +**/tests/** + +**/History.md +**/CHANGELOG.md +**/README.md +**/readme.md +**/readme.markdown + +**/*.ts +!typescript/**/*.d.ts + +jschardet/dist/** + +es6-promise/lib/** + +vscode-textmate/webpack.config.js + +zone.js/dist/** +!zone.js/dist/zone-node.js + +# https://github.com/xtermjs/xterm.js/issues/3137 +xterm/src/** +xterm/tsconfig.all.json + +# https://github.com/xtermjs/xterm.js/issues/3138 +xterm-addon-*/src/** +xterm-addon-*/fixtures/** +xterm-addon-*/out/** +xterm-addon-*/out-test/** + + diff --git a/build/.nativeignore b/build/.nativeignore index 0e0eb08b283..a27530745f3 100644 --- a/build/.nativeignore +++ b/build/.nativeignore @@ -46,6 +46,7 @@ spdlog/build/** spdlog/deps/** spdlog/src/** spdlog/test/** +spdlog/*.yml !spdlog/build/Release/*.node jschardet/dist/** @@ -72,6 +73,7 @@ node-pty/build/** node-pty/src/** node-pty/tools/** node-pty/deps/** +node-pty/scripts/** !node-pty/build/Release/*.exe !node-pty/build/Release/*.dll !node-pty/build/Release/*.node diff --git a/build/.webignore b/build/.webignore index 1035cb291cc..553d445f3f6 100644 --- a/build/.webignore +++ b/build/.webignore @@ -8,6 +8,10 @@ **/LICENSE **/CONTRIBUTORS +**/docs/** +**/example/** +**/examples/** + jschardet/index.js jschardet/src/** jschardet/dist/jschardet.js diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index d046aa71ed2..00e6940a941 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -205,9 +205,10 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op const dependenciesSrc = _.flatten(productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`])); const deps = gulp.src(dependenciesSrc, { base: '.', dot: true }) - .pipe(filter(['**', '!**/package-lock.json'])) + .pipe(filter(['**', '!**/package-lock.json', '!**/yarn.lock'])) .pipe(util.cleanNodeModules(path.join(__dirname, '.nativeignore'))) - .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*', '**/*.wasm'], 'app/node_modules.asar')); + .pipe(util.cleanNodeModules(path.join(__dirname, '.moduleignore'))) + .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*', '**/*.wasm'], 'node_modules.asar')); let all = es.merge( packageJsonStream, diff --git a/build/lib/asar.ts b/build/lib/asar.ts index 38fbc634e99..07b321fd41d 100644 --- a/build/lib/asar.ts +++ b/build/lib/asar.ts @@ -87,8 +87,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena // The file goes outside of xx.asar, in a folder xx.asar.unpacked const relative = path.relative(folderPath, file.path); this.queue(new VinylFile({ - cwd: folderPath, - base: folderPath, + base: '.', path: path.join(destFilename + '.unpacked', relative), stat: file.stat, contents: file.contents @@ -117,8 +116,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena out.length = 0; this.queue(new VinylFile({ - cwd: folderPath, - base: folderPath, + base: '.', path: destFilename, contents: contents }));