2023-05-09 10:30:01 +03:00
|
|
|
import * as esbuild from 'esbuild';
|
|
|
|
|
2023-10-18 09:13:47 +03:00
|
|
|
import { config, mode } from './common';
|
2023-05-17 07:36:51 +03:00
|
|
|
|
2023-05-09 10:30:01 +03:00
|
|
|
async function buildLayers() {
|
|
|
|
const common = config();
|
2023-10-17 04:15:19 +03:00
|
|
|
|
2023-10-18 09:13:47 +03:00
|
|
|
const define: Record<string, string> = {
|
|
|
|
'process.env.NODE_ENV': `"${mode}"`,
|
2023-10-17 04:15:19 +03:00
|
|
|
'process.env.BUILD_TYPE': `"${process.env.BUILD_TYPE || 'stable'}"`,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (process.env.BUILD_TYPE_OVERRIDE) {
|
2023-11-23 08:18:05 +03:00
|
|
|
define['process.env.BUILD_TYPE_OVERRIDE'] =
|
|
|
|
`"${process.env.BUILD_TYPE_OVERRIDE}"`;
|
2023-10-17 04:15:19 +03:00
|
|
|
}
|
|
|
|
|
2023-05-09 10:30:01 +03:00
|
|
|
await esbuild.build({
|
2023-10-18 09:13:47 +03:00
|
|
|
...common,
|
2023-10-17 04:15:19 +03:00
|
|
|
define: define,
|
2023-05-09 10:30:01 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
await buildLayers();
|
2023-10-18 09:13:47 +03:00
|
|
|
console.log('Build layers done');
|