diff options
Diffstat (limited to 'apps/peertube-runner/scripts/build.js')
-rw-r--r-- | apps/peertube-runner/scripts/build.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/peertube-runner/scripts/build.js b/apps/peertube-runner/scripts/build.js new file mode 100644 index 000000000..f54ca35f3 --- /dev/null +++ b/apps/peertube-runner/scripts/build.js | |||
@@ -0,0 +1,26 @@ | |||
1 | import * as esbuild from 'esbuild' | ||
2 | |||
3 | const packageJSON = JSON.parse(readFileSync(new URL('../package.json', import.meta.url))) | ||
4 | |||
5 | export const esbuildOptions = { | ||
6 | entryPoints: [ './src/peertube-runner.ts' ], | ||
7 | bundle: true, | ||
8 | platform: 'node', | ||
9 | format: 'esm', | ||
10 | target: 'node16', | ||
11 | external: [ | ||
12 | './lib-cov/fluent-ffmpeg', | ||
13 | 'pg-hstore' | ||
14 | ], | ||
15 | outfile: './dist/peertube-runner.js', | ||
16 | banner: { | ||
17 | js: `const require = (await import("node:module")).createRequire(import.meta.url);` + | ||
18 | `const __filename = (await import("node:url")).fileURLToPath(import.meta.url);` + | ||
19 | `const __dirname = (await import("node:path")).dirname(__filename);` | ||
20 | }, | ||
21 | define: { | ||
22 | 'process.env.PACKAGE_VERSION': `'${packageJSON.version}'` | ||
23 | } | ||
24 | } | ||
25 | |||
26 | await esbuild.build(esbuildOptions) | ||