Skip to content

Commit

Permalink
Update afterPack.js
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Jun 29, 2024
1 parent 262d5f7 commit 7e4bd2b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/afterPack.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
const path = require('path');
const fs = require('fs');
const fsExtra = require('fs-extra');
const packageJSON = require('../package.json');

/**
Expand All @@ -27,7 +28,7 @@ const keepingLprojRegEx = /(en|zh_CN)\.lproj/g;
* @param {*} arch x64
* @returns
*/
exports.default = (
exports.default = async (
buildPath,
electronVersion,
platform,
Expand All @@ -38,7 +39,7 @@ exports.default = (
const projectRoot = path.resolve(__dirname, '..');
// const appParentPath = path.resolve(buildPath, '..', '..', '..', '..');
// const appPath = path.join(appParentPath, 'Electron.app');
// const shell = platform === 'darwin' ? '/bin/zsh' : undefined;
const shell = platform === 'darwin' ? '/bin/zsh' : undefined;
// const winMacLinuxPlatformName = platform === 'darwin' ? 'mac' : (platform === 'win32' ? 'win' : 'linux');
/** delete useless lproj files to make it clean */
// const lproj = glob.sync('*.lproj', { cwd });
Expand All @@ -47,9 +48,9 @@ exports.default = (
.filter((dir) => !keepingLprojRegEx.test(dir))
.map((dir) => path.join(cwd, dir));
if (platform === 'darwin') {
pathsToRemove.forEach((dir) => {
fs.unlinkSync(dir);
});
await Promise.all(pathsToRemove.map(async (dir) => {
await fsExtra.remove(dir);
}));
}
console.log(`copy npm packages with node-worker dependencies with binary (dugite) or __filename usages (tiddlywiki), which can't be prepare properly by webpack`);
if (['production', 'test'].includes(process.env.NODE_ENV)) {
Expand Down

0 comments on commit 7e4bd2b

Please sign in to comment.