mirror of
https://github.com/unraid/api.git
synced 2026-01-16 13:39:51 -06:00
feat: more changes
This commit is contained in:
@@ -82,6 +82,9 @@ async function main() {
|
||||
const outfile = `${outputDir}/index.js`;
|
||||
|
||||
const externals = [
|
||||
'@fastify/static',
|
||||
'@fastify/view',
|
||||
'@apollo/gateway',
|
||||
'@nestjs/websockets/socket-module',
|
||||
'@nestjs/microservices/microservices-module',
|
||||
'@nestjs/microservices',
|
||||
@@ -98,36 +101,29 @@ async function main() {
|
||||
|
||||
/** @type { import('esbuild').BuildOptions } */
|
||||
const config = {
|
||||
entryPoints: ['dist/cli.js'],
|
||||
entryPoints: ['dist/cli.js', 'dist/main.js'],
|
||||
|
||||
logLevel: 'error',
|
||||
plugins: [nativeNodeModulesPlugin],
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
target: 'node20',
|
||||
sourcemap: true,
|
||||
outfile,
|
||||
outdir: outputDir,
|
||||
// suppress direct-eval warning
|
||||
logOverride: {
|
||||
'direct-eval': 'silent',
|
||||
},
|
||||
format: 'esm',
|
||||
treeShaking: false,
|
||||
|
||||
external: externals,
|
||||
|
||||
// Prevent esbuild from adding a "2" to the names of CC classes for some reason.
|
||||
keepNames: true,
|
||||
|
||||
// Fix import.meta.url in CJS output
|
||||
define: {
|
||||
'import.meta.url': '__import_meta_url',
|
||||
},
|
||||
inject: ['configs/esbuild-shims.js'],
|
||||
};
|
||||
|
||||
await esbuild.build(config);
|
||||
|
||||
console.log(`Build took ${Date.now() - start}ms`);
|
||||
await printSize(outfile);
|
||||
|
||||
/* const content = (await readFile(outfile, 'utf-8'))
|
||||
.replace(/__dirname, "\.\.\/"/g, '__dirname, "./node_modules/@serialport/bindings-cpp"')
|
||||
@@ -135,20 +131,6 @@ async function main() {
|
||||
|
||||
// await writeFile(outfile, content);
|
||||
|
||||
if (process.argv.includes('--minify')) {
|
||||
// minify the file
|
||||
await esbuild.build({
|
||||
...config,
|
||||
entryPoints: [outfile],
|
||||
minify: true,
|
||||
keepNames: true, // needed for zwave-js as it relies on class names
|
||||
allowOverwrite: true,
|
||||
outfile,
|
||||
});
|
||||
|
||||
console.log(`Minify took ${Date.now() - start}ms`);
|
||||
await printSize(outfile);
|
||||
}
|
||||
|
||||
// copy assets to build folder
|
||||
for (const ext of externals) {
|
||||
|
||||
12889
api/package-lock.json
generated
12889
api/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@
|
||||
"postbuild": "chmod +x dist/main.js && chmod +x dist/cli.js",
|
||||
"build-and-pack": "./scripts/build.mjs",
|
||||
"bundle": "node ./configs/esbuild.js",
|
||||
"build:binary": "pkg --config configs/pkg.config.json deploy/esbuild/index.js",
|
||||
"build:binary": "pkg --sea --config configs/pkg.config.json deploy/esbuild/index.js",
|
||||
"codegen": "MOTHERSHIP_GRAPHQL_LINK='https://staging.mothership.unraid.net/ws' graphql-codegen --config configs/codegen.yml -r dotenv/config './.env.staging'",
|
||||
"codegen:watch": "DOTENV_CONFIG_PATH='./.env.staging' graphql-codegen --config configs/codegen.yml --watch -r dotenv/config",
|
||||
"codegen:local": "NODE_TLS_REJECT_UNAUTHORIZED=0 MOTHERSHIP_GRAPHQL_LINK='https://mothership.localhost/ws' graphql-codegen-esm --config configs/codegen.yml --watch",
|
||||
@@ -111,7 +111,7 @@
|
||||
"pino": "^9.5.0",
|
||||
"pino-http": "^10.3.0",
|
||||
"pino-pretty": "^11.3.0",
|
||||
"pm2": "^5.4.2",
|
||||
"pm2": "^5.4.3",
|
||||
"reflect-metadata": "^0.1.14",
|
||||
"request": "^2.88.2",
|
||||
"semver": "^7.6.3",
|
||||
|
||||
Reference in New Issue
Block a user