refactor!: remove next.js (#3267)

This commit is contained in:
Alex Yang
2023-07-19 00:53:10 +08:00
committed by GitHub
parent 79227a1e7c
commit 47f12f77f2
296 changed files with 4115 additions and 3617 deletions

View File

@@ -9,8 +9,8 @@ const require = createRequire(import.meta.url);
const repoRootDir = path.join(__dirname, '..', '..', '..');
const electronRootDir = path.join(__dirname, '..');
const publicDistDir = path.join(electronRootDir, 'resources');
const affineWebDir = path.join(repoRootDir, 'apps', 'web');
const affineWebOutDir = path.join(affineWebDir, 'out');
const affineCoreDir = path.join(repoRootDir, 'apps', 'core');
const affineCoreOutDir = path.join(affineCoreDir, 'dist');
const publicAffineOutDir = path.join(publicDistDir, `web-static`);
const releaseVersionEnv = process.env.RELEASE_VERSION || '';
@@ -18,8 +18,8 @@ console.log('build with following dir', {
repoRootDir,
electronRootDir,
publicDistDir,
affineSrcDir: affineWebDir,
affineSrcOutDir: affineWebOutDir,
affineSrcDir: affineCoreDir,
affineSrcOutDir: affineCoreOutDir,
publicAffineOutDir,
});
@@ -42,13 +42,13 @@ cd(repoRootDir);
// step 1: build web (nextjs) dist
if (!process.env.SKIP_WEB_BUILD) {
process.env.ENABLE_LEGACY_PROVIDER = 'false';
await $`yarn nx build @affine/web`;
await $`yarn nx build @affine/core`;
// step 1.5: amend sourceMappingURL to allow debugging in devtools
await glob('**/*.{js,css}', { cwd: affineWebOutDir }).then(files => {
await glob('**/*.{js,css}', { cwd: affineCoreOutDir }).then(files => {
return files.map(async file => {
const dir = path.dirname(file);
const fullpath = path.join(affineWebOutDir, file);
const fullpath = path.join(affineCoreOutDir, file);
let content = await fs.readFile(fullpath, 'utf-8');
// replace # sourceMappingURL=76-6370cd185962bc89.js.map
// to # sourceMappingURL=assets://./{dir}/76-6370cd185962bc89.js.map
@@ -59,7 +59,7 @@ if (!process.env.SKIP_WEB_BUILD) {
});
});
await fs.move(affineWebOutDir, publicAffineOutDir, { overwrite: true });
await fs.move(affineCoreOutDir, publicAffineOutDir, { overwrite: true });
}
// step 2: update app-updater.yml content with build type in resources folder