mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Exclude unimportant files from Electron build
Summary: TSIA Changelog: [Internal] bypass-github-export-checks Reviewed By: huntie Differential Revision: D78351935 fbshipit-source-id: 7f71f3df3ecf8ce92891109b8d9f8e0a74361f21
This commit is contained in:
committed by
Facebook GitHub Bot
parent
20baf2a992
commit
4a1884e5e5
@@ -44,6 +44,21 @@ async function main() {
|
||||
if (!pkg.main.startsWith('./dist/')) {
|
||||
throw new Error('Package not built yet. Run scripts/build/build.js first.');
|
||||
}
|
||||
|
||||
const IGNORE_PREFIXES = [
|
||||
'src',
|
||||
'dist/node',
|
||||
'metainternal/build-mac',
|
||||
'__tests__',
|
||||
'README.md',
|
||||
].map(
|
||||
dirRelativeToPackageRoot =>
|
||||
path.join(PACKAGE_ROOT, dirRelativeToPackageRoot) + path.sep,
|
||||
);
|
||||
const IGNORE_FILES = ['BUCK'].map(fileRelativeToPackageRoot =>
|
||||
path.join(PACKAGE_ROOT, fileRelativeToPackageRoot),
|
||||
);
|
||||
|
||||
await packager({
|
||||
dir: PACKAGE_ROOT,
|
||||
icon: path.join(PACKAGE_ROOT, 'src/electron/resources/icon'),
|
||||
@@ -64,6 +79,10 @@ async function main() {
|
||||
OriginalFilename: `${APP_NAME}.exe`,
|
||||
},
|
||||
overwrite: true,
|
||||
ignore: [
|
||||
...IGNORE_PREFIXES.map(prefix => new RegExp('^' + escapeRegex(prefix))),
|
||||
...IGNORE_FILES.map(file => new RegExp('^' + escapeRegex(file) + '$')),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,3 +92,7 @@ if (require.main === module) {
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
|
||||
function escapeRegex(str /*: string */) /*: string */ {
|
||||
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, '\\$&');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user