|
1 | 1 | #!/usr/bin/env node |
2 | 2 |
|
3 | 3 | const esbuild = require('esbuild'); |
4 | | -const { nodeExternalsPlugin } = require('esbuild-node-externals'); |
5 | 4 | const fs = require('fs'); |
6 | | -const path = require('path') |
| 5 | +const path = require('path'); |
7 | 6 |
|
8 | | -const distPath = path.resolve(__dirname, './dynamic-test-app/dist') |
| 7 | +const distPath = path.resolve(__dirname, './dynamic-test-app/dist'); |
9 | 8 |
|
10 | 9 | if (!fs.existsSync(distPath)) { |
11 | | - fs.mkdirSync(distPath); |
| 10 | + fs.mkdirSync(distPath); |
12 | 11 | } |
13 | 12 |
|
14 | | -const indexHtmlSource = path.resolve(__dirname, './dynamic-test-app/static/index.html') |
15 | | -const indexHtmlTarget = path.resolve(distPath, './index.html') |
16 | | -fs.copyFileSync(indexHtmlSource, indexHtmlTarget) |
| 13 | +const indexHtmlSource = path.resolve(__dirname, './dynamic-test-app/static/index.html'); |
| 14 | +const indexHtmlTarget = path.resolve(distPath, './index.html'); |
| 15 | +fs.copyFileSync(indexHtmlSource, indexHtmlTarget); |
17 | 16 |
|
18 | 17 | /* Build testApp frontend */ |
19 | | -esbuild.build( |
20 | | - { |
21 | | - logLevel: "info", |
22 | | - entryPoints: ['./node/dynamic-test-app/src/index.tsx'], |
23 | | - bundle: true, |
24 | | - platform: "browser", |
25 | | - outfile: "./node/dynamic-test-app/dist/index.js", |
26 | | - } |
27 | | -).catch(() => process.exit(1)); |
| 18 | +esbuild |
| 19 | + .build({ |
| 20 | + logLevel: 'info', |
| 21 | + entryPoints: ['./node/dynamic-test-app/src/index.tsx'], |
| 22 | + bundle: true, |
| 23 | + platform: 'browser', |
| 24 | + outfile: './node/dynamic-test-app/dist/index.js', |
| 25 | + }) |
| 26 | + .catch(() => process.exit(1)); |
28 | 27 | /* Build testApp backend */ |
29 | | -esbuild.build( |
30 | | - { |
31 | | - logLevel: "info", |
32 | | - entryPoints: ["./node/dynamic-test-app/src/server.ts"], |
33 | | - bundle: true, |
34 | | - platform: "node", |
35 | | - outfile: "./node/dynamic-test-app/dist/server.js", |
36 | | - /* plugins: [nodeExternalsPlugin()], */ |
37 | | - } |
38 | | -).catch(() => process.exit(1)); |
| 28 | +esbuild |
| 29 | + .build({ |
| 30 | + logLevel: 'info', |
| 31 | + entryPoints: ['./node/dynamic-test-app/src/server.ts'], |
| 32 | + bundle: true, |
| 33 | + platform: 'node', |
| 34 | + outfile: './node/dynamic-test-app/dist/server.js', |
| 35 | + /* plugins: [nodeExternalsPlugin()], */ |
| 36 | + }) |
| 37 | + .catch(() => process.exit(1)); |
0 commit comments