fix(nx/forge): rebuild not working due to ignore logic

This commit is contained in:
Elian Doran 2025-04-27 18:14:55 +03:00
parent ceb4f2084f
commit fec9ca60db
No known key found for this signature in database
2 changed files with 3 additions and 20 deletions

View File

@ -43,24 +43,6 @@ module.exports = {
// All resources should stay in Resources directory for macOS // All resources should stay in Resources directory for macOS
...(process.platform === "darwin" ? [] : extraResourcesForPlatform) ...(process.platform === "darwin" ? [] : extraResourcesForPlatform)
], ],
ignore(copyPath) {
// Known files that will not be ignored and not logged.
if (copyPath.startsWith("/assets") || copyPath.startsWith("/public")) {
return false;
}
// Keep only the prebuild, source code and package index.
if (copyPath.startsWith("/node_modules/better-sqlite3")) {
if (!copyPath.startsWith("/node_modules/better-sqlite3/build")
&& copyPath !== "/node_modules/better-sqlite3/package.json"
&& !copyPath.startsWith("/node_modules/better-sqlite3/lib")) {
return true;
}
}
// console.log("[FORGE] ASAR: ", copyPath);
return false;
},
afterPrune: [ afterPrune: [
(buildPath, _electronVersion, _platform, _arch, callback) => { (buildPath, _electronVersion, _platform, _arch, callback) => {
// buildPath is a temporary directory that electron-packager creates - it's in the form of // buildPath is a temporary directory that electron-packager creates - it's in the form of
@ -102,7 +84,8 @@ module.exports = {
] ]
}, },
rebuildConfig: { rebuildConfig: {
force: true force: true,
extraModules: [ "better-sqlite3" ]
}, },
makers: [ makers: [
{ {

View File

@ -71,7 +71,7 @@
}, },
"electron-forge:package": { "electron-forge:package": {
"dependsOn": [ "build" ], "dependsOn": [ "build" ],
"command": "pnpm exec cross-env DEBUG=electron-rebuild:* electron-forge package apps/desktop/dist" "command": "pnpm exec cross-env DEBUG=* electron-forge package apps/desktop/dist"
} }
} }
} }