build: improve ignores in node_modules

This commit is contained in:
Martin Aeschlimann 2020-10-25 22:35:23 +01:00 committed by Sandeep Somavarapu
parent c0289ea182
commit afb0e96b66
5 changed files with 49 additions and 6 deletions

38
build/.moduleignore Normal file
View file

@ -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/**

View file

@ -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

View file

@ -8,6 +8,10 @@
**/LICENSE
**/CONTRIBUTORS
**/docs/**
**/example/**
**/examples/**
jschardet/index.js
jschardet/src/**
jschardet/dist/jschardet.js

View file

@ -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,

View file

@ -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
}));