Skip to content

Commit 34e9510

Browse files
committed
chore(nx/forge): try a method to avoid missing prebuilds
1 parent fec9ca6 commit 34e9510

File tree

5 files changed

+7
-23
lines changed

5 files changed

+7
-23
lines changed

apps/desktop/electron-forge/forge.config.cjs

+1-17
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,7 @@ module.exports = {
4343
// All resources should stay in Resources directory for macOS
4444
...(process.platform === "darwin" ? [] : extraResourcesForPlatform)
4545
],
46-
afterPrune: [
47-
(buildPath, _electronVersion, _platform, _arch, callback) => {
48-
// buildPath is a temporary directory that electron-packager creates - it's in the form of
49-
// /tmp/electron-packager/tmp-SjJl0s/resources/app
50-
try {
51-
const cleanupNodeModulesScript = path.join(buildPath, "build", "node_modules", "@triliumnext/server", "scripts", "cleanupNodeModules.ts");
52-
// we don't have access to any devDeps like 'tsx' here, so use the built-in '--experimental-strip-types' flag instead
53-
const command = `node --experimental-strip-types ${cleanupNodeModulesScript} "${buildPath}" --skip-prune-dev-deps`;
54-
// execSync throws, if above returns any non-zero exit code
55-
// TODO: Not working.
56-
// execSync(command);
57-
callback()
58-
} catch(err) {
59-
callback(err)
60-
}
61-
}
62-
],
46+
prune: false,
6347
afterComplete: [
6448
(buildPath, _electronVersion, platform, _arch, callback) => {
6549
// Only move resources on non-macOS platforms

apps/desktop/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@
6767
},
6868
"electron-forge:make": {
6969
"dependsOn": [ "build" ],
70-
"command": "pnpm exec electron-forge make apps/desktop/dist"
70+
"command": "pnpm exec cross-env DEBUG=* NODE_INSTALLER=npm electron-forge make apps/desktop/dist"
7171
},
7272
"electron-forge:package": {
7373
"dependsOn": [ "build" ],
74-
"command": "pnpm exec cross-env DEBUG=* electron-forge package apps/desktop/dist"
74+
"command": "pnpm exec cross-env DEBUG=* NODE_INSTALLER=npm electron-forge package apps/desktop/dist"
7575
}
7676
}
7777
}

apps/desktop/webpack.config.cjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ module.exports = {
4242
to: join(outputDir, "assets")
4343
},
4444
{
45-
from: "../../node_modules/@electron/remote",
45+
from: "node_modules/@electron/remote",
4646
to: join(outputDir, "node_modules/@electron/remote")
4747
},
4848
{
49-
from: "../../node_modules/prebuild-install",
49+
from: "node_modules/prebuild-install",
5050
to: join(outputDir, "node_modules/better-sqlite3/node_modules/prebuild-install")
5151
},
5252
{

apps/server/webpack.config.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function buildFilesToCopy() {
3636

3737
for (const nodePath of nodePaths) {
3838
files.push({
39-
from: join("..", "..", "node_modules", nodePath),
39+
from: join("node_modules", nodePath),
4040
to: join(outputDir, "node_modules", nodePath)
4141
})
4242
}

pnpm-workspace.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ onlyBuiltDependencies:
1919
- fs-xattr
2020
- macos-alias
2121

22-
nodeLinker: hoisted
22+
nodeLinker: isolated

0 commit comments

Comments
 (0)