feat: init doc monitor (#3320)

This commit is contained in:
Alex Yang
2023-07-20 10:44:50 +08:00
committed by GitHub
parent 27edd7cd93
commit 604b53d9a4
20 changed files with 145 additions and 76 deletions

View File

@@ -41,25 +41,7 @@ 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/core`;
// step 1.5: amend sourceMappingURL to allow debugging in devtools
await glob('**/*.{js,css}', { cwd: affineCoreOutDir }).then(files => {
return files.map(async file => {
const dir = path.dirname(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
content = content.replace(/# sourceMappingURL=(.*)\.map/g, (_, p1) => {
return `# sourceMappingURL=assets://./${dir}/${p1}.map`;
});
await fs.writeFile(fullpath, content);
});
});
await fs.move(affineCoreOutDir, publicAffineOutDir, { overwrite: true });
await $`DISTRIBUTION=desktop yarn nx build @affine/core`;
}
// step 2: update app-updater.yml content with build type in resources folder