3 /* eslint-disable no-console */
4 import browserslistToEsbuild from 'browserslist-to-esbuild';
5 import esbuild from 'esbuild';
7 import path from 'path';
9 const isProd = process.env.NODE_ENV === 'production';
10 const distDir = './dist';
11 const srcDir = './src';
13 const fileName = 'sandbox.js';
14 const outFile = path.join(distDir, fileName);
16 // Step 1 - generate JS bundle
21 target: browserslistToEsbuild('> 0.5%, not IE 11, Firefox ESR, Safari 14, iOS 14'),
23 entryPoints: [path.join(srcDir, 'index.ts')],
31 console.log(`✅ Built - ./dist/${fileName}`);
33 // Step 2 - copy to apps
35 const apps = ['drive', 'mail'];
36 const publicPath = 'public/assets';
38 apps.forEach((app) => {
39 fs.copyFileSync(outFile, path.join(`../${app}`, publicPath, fileName));
40 console.log(`✅ Copied - applications/${app}/${publicPath}`);