mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-04 02:49:57 +08:00
fix: cleanup electron build script (#1813)
This commit is contained in:
@@ -31,4 +31,18 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
],
|
||||
hooks: {
|
||||
generateAssets: async (_, platform, arch) => {
|
||||
const { $ } = await import('zx');
|
||||
|
||||
if (platform === 'darwin' && arch === 'arm64') {
|
||||
// In GitHub Actions runner, MacOS is always x64
|
||||
// we need to manually set TARGET to aarch64-apple-darwin
|
||||
process.env.TARGET = 'aarch64-apple-darwin';
|
||||
}
|
||||
|
||||
// run yarn generate-assets
|
||||
await $`yarn generate-assets`;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development node scripts/dev.mjs",
|
||||
"prod": "cross-env NODE_ENV=production node scripts/dev.mjs",
|
||||
"before-make": "zx scripts/before-make.mjs",
|
||||
"generate-assets": "zx scripts/generate-assets.mjs",
|
||||
"make": "electron-forge make",
|
||||
"make-macos-arm64": "electron-forge make --platform=darwin --arch=arm64",
|
||||
"make-macos-x64": "electron-forge make --platform=darwin --arch=x64",
|
||||
|
||||
@@ -40,6 +40,17 @@ await fs.move(affineWebOutDir, publicAffineOutDir, { overwrite: true });
|
||||
await buildLayers();
|
||||
echo('Build layers done');
|
||||
|
||||
// step 3: build octobase-node
|
||||
let buildOctobaseNode = 'yarn workspace @affine/octobase-node build';
|
||||
if (process.env.TARGET) {
|
||||
buildOctobaseNode += ` --target=${process.env.TARGET}`;
|
||||
}
|
||||
await $([buildOctobaseNode]);
|
||||
|
||||
// step 4: copy octobase-node to electron dist
|
||||
await fs.ensureDir('./apps/electron/dist/layers/main/');
|
||||
await $`cp ./packages/octobase-node/octobase.*.node ./apps/electron/dist/layers/main/`;
|
||||
|
||||
/// --------
|
||||
/// --------
|
||||
/// --------
|
||||
Reference in New Issue
Block a user