mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
chore(nx/forge): try a method to avoid missing prebuilds
This commit is contained in:
parent
fec9ca60db
commit
dbad4fce36
@ -43,23 +43,7 @@ module.exports = {
|
||||
// All resources should stay in Resources directory for macOS
|
||||
...(process.platform === "darwin" ? [] : extraResourcesForPlatform)
|
||||
],
|
||||
afterPrune: [
|
||||
(buildPath, _electronVersion, _platform, _arch, callback) => {
|
||||
// buildPath is a temporary directory that electron-packager creates - it's in the form of
|
||||
// /tmp/electron-packager/tmp-SjJl0s/resources/app
|
||||
try {
|
||||
const cleanupNodeModulesScript = path.join(buildPath, "build", "node_modules", "@triliumnext/server", "scripts", "cleanupNodeModules.ts");
|
||||
// we don't have access to any devDeps like 'tsx' here, so use the built-in '--experimental-strip-types' flag instead
|
||||
const command = `node --experimental-strip-types ${cleanupNodeModulesScript} "${buildPath}" --skip-prune-dev-deps`;
|
||||
// execSync throws, if above returns any non-zero exit code
|
||||
// TODO: Not working.
|
||||
// execSync(command);
|
||||
callback()
|
||||
} catch(err) {
|
||||
callback(err)
|
||||
}
|
||||
}
|
||||
],
|
||||
prune: false,
|
||||
afterComplete: [
|
||||
(buildPath, _electronVersion, platform, _arch, callback) => {
|
||||
// Only move resources on non-macOS platforms
|
||||
@ -190,7 +174,7 @@ function getExtraResourcesForPlatform() {
|
||||
const getScriptResources = () => {
|
||||
const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
|
||||
const scriptExt = (process.platform === "win32") ? "bat" : "sh";
|
||||
return scripts.map(script => `apps/desktop/electron-forge/${script}.${scriptExt}`);
|
||||
return scripts.map(script => `electron-forge/${script}.${scriptExt}`);
|
||||
}
|
||||
|
||||
switch (process.platform) {
|
||||
|
@ -67,11 +67,11 @@
|
||||
},
|
||||
"electron-forge:make": {
|
||||
"dependsOn": [ "build" ],
|
||||
"command": "pnpm exec electron-forge make apps/desktop/dist"
|
||||
"command": "pnpm -C apps/desktop exec cross-env DEBUG=* NODE_INSTALLER=npm electron-forge make dist"
|
||||
},
|
||||
"electron-forge:package": {
|
||||
"dependsOn": [ "build" ],
|
||||
"command": "pnpm exec cross-env DEBUG=* electron-forge package apps/desktop/dist"
|
||||
"command": "pnpm -C apps/desktop exec cross-env DEBUG=* NODE_INSTALLER=npm electron-forge package dist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ module.exports = {
|
||||
to: join(outputDir, "assets")
|
||||
},
|
||||
{
|
||||
from: "../../node_modules/@electron/remote",
|
||||
from: "node_modules/@electron/remote",
|
||||
to: join(outputDir, "node_modules/@electron/remote")
|
||||
},
|
||||
{
|
||||
from: "../../node_modules/prebuild-install",
|
||||
from: "node_modules/prebuild-install",
|
||||
to: join(outputDir, "node_modules/better-sqlite3/node_modules/prebuild-install")
|
||||
},
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ function buildFilesToCopy() {
|
||||
|
||||
for (const nodePath of nodePaths) {
|
||||
files.push({
|
||||
from: join("..", "..", "node_modules", nodePath),
|
||||
from: join("node_modules", nodePath),
|
||||
to: join(outputDir, "node_modules", nodePath)
|
||||
})
|
||||
}
|
||||
|
@ -19,4 +19,4 @@ onlyBuiltDependencies:
|
||||
- fs-xattr
|
||||
- macos-alias
|
||||
|
||||
nodeLinker: hoisted
|
||||
nodeLinker: isolated
|
||||
|
Loading…
x
Reference in New Issue
Block a user