AFFiNE/apps/electron/scripts/build-layers.mjs
Peng Xiao 7c2574b1ca
feat: create workspace from loading existing exported file (#2122)
Co-authored-by: Himself65 <himself65@outlook.com>
2023-05-09 02:30:01 -05:00

29 lines
651 B
JavaScript

#!/usr/bin/env zx
import 'zx/globals';
import * as esbuild from 'esbuild';
import { config } from './common.mjs';
const NODE_ENV =
process.env.NODE_ENV === 'development' ? 'development' : 'production';
async function buildLayers() {
const common = config();
await esbuild.build(common.preload);
await esbuild.build({
...common.main,
define: {
...common.main.define,
'process.env.NODE_ENV': `"${NODE_ENV}"`,
'process.env.BUILD_TYPE': `"${process.env.BUILD_TYPE || 'stable'}"`,
},
});
await $`yarn workspace @affine/electron generate-main-exposed-meta`;
}
await buildLayers();
echo('Build layers done');