Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

chore: define pkg config in separate config file

towfiqi76267c99e7c3
diff --git a/backend/package.json b/backend/package.json
index 0c9d0ec..25877f7 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -103,18 +103,6 @@
]
}
},
- "pkg": {
- "scripts": [
- "dist/pkg-index.cjs"
- ],
- "assets": [
- "public/**/*",
- "node_modules/**/*",
- "!node_modules/better-sqlite3/**/*",
- "drizzle/**/*",
- "src/notifications/templates/**/*"
- ]
- },
"scripts": {
"checkUpdates": "npx npm-check -u",
"db:studio": "npx drizzle-kit studio --port 4983",
diff --git a/backend/pkg.config.json b/backend/pkg.config.json
new file mode 100644
index 0000000..3785b07
--- /dev/null
+++ b/backend/pkg.config.json
@@ -0,0 +1,16 @@
+{
+ "name": "@plutonhq/core-backend",
+ "bin": "dist/pkg-index.cjs",
+ "pkg": {
+ "scripts": [
+ "dist/pkg-index.cjs"
+ ],
+ "assets": [
+ "public/**/*",
+ "node_modules/**/*",
+ "!node_modules/better-sqlite3/**/*",
+ "drizzle/**/*",
+ "src/notifications/templates/**/*"
+ ]
+ }
+}
diff --git a/scripts/build-executables.js b/scripts/build-executables.js
index 280ffe7..2a8f820 100644
--- a/scripts/build-executables.js
+++ b/scripts/build-executables.js
@@ -788,15 +788,16 @@ async function generateExecutables() {
const pkgTargets = Object.values(targets)
.map((t) => t.pkgTarget)
.join(",");
- // Use package.json as entry point so pkg reads the configuration (bin, pkg.scripts, etc.)
- const entryPoint = join(backendDir, "package.json");
+ // Load pkg configuration from backend/pkg.config.json
+ const entryPoint = join(backendDir, "dist", "pkg-index.cjs");
+ const pkgConfig = join(backendDir, "pkg.config.json");
console.log(`\n🔨 Building executables for all platforms...`);
console.log(` Targets: ${pkgTargets}`);
console.log(` Output name: ${OUTPUT_NAME}`);
// Output to pkg-builds directory to avoid naming conflicts with distribution folders
- const pkgCommand = `npx pkg ${entryPoint} --targets ${pkgTargets} --output ${join(pkgBuildsDir, OUTPUT_NAME)} --compress GZip --public --public-packages "*" --options expose-gc`;
+ const pkgCommand = `npx pkg --config ${pkgConfig} ${entryPoint} --targets ${pkgTargets} --output ${join(pkgBuildsDir, OUTPUT_NAME)} --compress GZip --public --public-packages "*" --options expose-gc`;
try {
exec(pkgCommand, { cwd: rootDir });