mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: build layer (#2769)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
|
|
||||||
const { z } = require('zod');
|
const { z } = require('zod');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -104,6 +105,27 @@ module.exports = {
|
|||||||
// so stable and canary will not share the same app data
|
// so stable and canary will not share the same app data
|
||||||
packageJson.productName = productName;
|
packageJson.productName = productName;
|
||||||
},
|
},
|
||||||
|
prePackage: async () => {
|
||||||
|
const { rm, cp } = require('node:fs/promises');
|
||||||
|
const { resolve } = require('node:path');
|
||||||
|
|
||||||
|
await rm(
|
||||||
|
resolve(__dirname, './node_modules/@toeverything/plugin-infra'),
|
||||||
|
{
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
await cp(
|
||||||
|
resolve(__dirname, '../../packages/plugin-infra'),
|
||||||
|
resolve(__dirname, './node_modules/@toeverything/plugin-infra'),
|
||||||
|
{
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
generateAssets: async (_, platform, arch) => {
|
generateAssets: async (_, platform, arch) => {
|
||||||
if (process.env.SKIP_GENERATE_ASSETS) {
|
if (process.env.SKIP_GENERATE_ASSETS) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ if (releaseVersionEnv && electronPackageJson.version !== releaseVersionEnv) {
|
|||||||
}
|
}
|
||||||
// copy web dist files to electron dist
|
// copy web dist files to electron dist
|
||||||
|
|
||||||
// step 1: clean up
|
|
||||||
await cleanup();
|
|
||||||
echo('Clean up done');
|
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
$.shell = 'powershell.exe';
|
$.shell = 'powershell.exe';
|
||||||
$.prefix = '';
|
$.prefix = '';
|
||||||
@@ -43,7 +39,7 @@ if (process.platform === 'win32') {
|
|||||||
|
|
||||||
cd(repoRootDir);
|
cd(repoRootDir);
|
||||||
|
|
||||||
// step 2: build web (nextjs) dist
|
// step 1: build web (nextjs) dist
|
||||||
if (!process.env.SKIP_WEB_BUILD) {
|
if (!process.env.SKIP_WEB_BUILD) {
|
||||||
process.env.ENABLE_LEGACY_PROVIDER = 'false';
|
process.env.ENABLE_LEGACY_PROVIDER = 'false';
|
||||||
await $`yarn nx build @affine/web`;
|
await $`yarn nx build @affine/web`;
|
||||||
@@ -67,7 +63,7 @@ if (!process.env.SKIP_WEB_BUILD) {
|
|||||||
await fs.move(affineWebOutDir, publicAffineOutDir, { overwrite: true });
|
await fs.move(affineWebOutDir, publicAffineOutDir, { overwrite: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 3: update app-updater.yml content with build type in resources folder
|
// step 2: update app-updater.yml content with build type in resources folder
|
||||||
if (process.env.BUILD_TYPE === 'internal') {
|
if (process.env.BUILD_TYPE === 'internal') {
|
||||||
const appUpdaterYml = path.join(publicDistDir, 'app-update.yml');
|
const appUpdaterYml = path.join(publicDistDir, 'app-update.yml');
|
||||||
const appUpdaterYmlContent = await fs.readFile(appUpdaterYml, 'utf-8');
|
const appUpdaterYmlContent = await fs.readFile(appUpdaterYml, 'utf-8');
|
||||||
@@ -77,14 +73,3 @@ if (process.env.BUILD_TYPE === 'internal') {
|
|||||||
);
|
);
|
||||||
await fs.writeFile(appUpdaterYml, newAppUpdaterYmlContent);
|
await fs.writeFile(appUpdaterYml, newAppUpdaterYmlContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// --------
|
|
||||||
/// --------
|
|
||||||
/// --------
|
|
||||||
async function cleanup() {
|
|
||||||
if (!process.env.SKIP_WEB_BUILD) {
|
|
||||||
await fs.emptyDir(publicAffineOutDir);
|
|
||||||
}
|
|
||||||
await fs.remove(path.join(electronRootDir, 'dist'));
|
|
||||||
await fs.remove(path.join(electronRootDir, 'out'));
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user