feat: provide macos arm m1 package and sign it

This commit is contained in:
lin onetwo 2022-11-25 16:03:12 +08:00
parent dbce1debf5
commit b67d531ce0
3 changed files with 17 additions and 11 deletions

View file

@ -23,8 +23,10 @@ const keepingLprojRegEx = /(en|zh_CN)\.lproj/g;
* @returns
*/
exports.default = async (buildPath, electronVersion, platform, arch, callback) => {
const cwd = path.join(buildPath, '..');
const projectRoot = path.join(__dirname, '..');
const cwd = path.resolve(buildPath, '..');
const projectRoot = path.resolve(__dirname, '..');
const appParentPath = path.resolve(buildPath, '..', '..', '..', '..');
const appPath = path.join(appParentPath, 'Electron.app');
/** delete useless lproj files to make it clean */
const lproj = glob.sync('*.lproj', { cwd });
@ -48,6 +50,10 @@ exports.default = async (buildPath, electronVersion, platform, arch, callback) =
await exec(`npm i --legacy-building`, { cwd: path.join(cwd, 'node_modules', 'zx', 'node_modules', 'globby') });
await exec(`npm i --legacy-building --ignore-scripts`, { cwd: path.join(cwd, 'node_modules', 'zx', 'node_modules', 'node-fetch') });
}
/** sign it for mac m1 https://www.zhihu.com/question/431722091/answer/1592339574 */
if (platform === 'darwin') {
await exec(`xattr -rd com.apple.quarantine ${appPath}`, { cwd: appParentPath });
}
/** complete this hook */
callback();
};