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