Skip to content

fix(asar): refactoring symlink check logic #9130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mmaietta
Copy link
Collaborator

@mmaietta mmaietta commented May 29, 2025

Since pnpm install operates from the current subpackage's dir and considered as root (process.cwd()), additional logic is needed that walks up the directory tree to find a pnpm-workspace.yaml or package.json with monorepo configuration set. The "walk" functionality auto-stops when it detects a .git folder to prevent unnecessary walking further up the directory tree.

const rootDir = (await findWorkspaceRoot(fileSet.src)) ?? fileSet.src

This finds the root of the monorepo to resolve dependencies from avoiding/instead of the ../ relative path trap from occurring.
The interesting part is that the better_sqlite3 file is not considered a symlink, even though the parent directory further up the tree is a symlink. The new asarUtil logic is that it copies the .node as a direct file since it itself is not a symlink, which allows the electron-builder packaging process to continue

Fixes #9025

Copy link

changeset-bot bot commented May 29, 2025

🦋 Changeset detected

Latest commit: 275d72d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-builder Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

… is within the project directory due to monorepo workspaces having `process.cwd()` returning the subpackage instead of monorepo root
@mmaietta mmaietta force-pushed the fix/asar-symlink-check branch from 9950a77 to 47712e6 Compare June 8, 2025 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to copy, file is symlinked outside the package
1 participant