Skip to content
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

fix: support including node_modules in other subdirectories #8562

Merged
merged 18 commits into from
Oct 7, 2024

Conversation

beyondkmp
Copy link
Collaborator

@beyondkmp beyondkmp commented Oct 6, 2024

fix #6080 and support including node_modules in other subdirectories

How to fix

  1. No file patterns

    • The final File patterns are ["**/*", "!**/node_modules/**", "!dist{,/**/*}", ...]
  2. File patterns with other sub node_modules ["/*", "**/sub/node_modules/**"]

    • File patterns are ["**/*", "!**/node_modules/**", "**/sub/node_modules/**", "!dist{,/**/*}", ...]
  3. File patterns without sub node_modules

    • The final File patterns are ["**/*", "!**/node_modules/**", "!dist{,/**/*}", ...]

The final patterns above all filter out the node_modules in the app root directory. In filter.ts, we handle this by returning false by default if relative === 'node_modules', so it won't be filtered out.

if (relative === "node_modules") {
return false
}

However, if you really want to filter out the node_modules in the app directory, you can use ["!node_modules/**/*"] to filter it.

Two points to note

  1. Now ["**/*", "**/sub/node_modules"] cannot match. Only ["**/*", "**/sub/node_modules/**"] will match.

    For a relative path of sub/node_modules, if don't add a / at the end, we can only use **/sub/node_module to match. If add a / at the end, we can only use **/sub/node_module/** to match.

    I currently prefer that **/sub/node_modules/** matches, as this aligns more with conventional usage.

  2. */sub/node_modules/** cannot match because the relative path is sub/node_modules, and there's no extra directory at the beginning.

Copy link

changeset-bot bot commented Oct 6, 2024

🦋 Changeset detected

Latest commit: e433da5

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

This PR includes changesets to release 10 packages
Name Type
app-builder-lib Major
builder-util Major
dmg-builder Major
electron-builder-squirrel-windows Major
electron-builder Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major
electron-publish Major

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

Copy link

netlify bot commented Oct 6, 2024

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit e433da5
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/670325527fba5b000846d7c7
😎 Deploy Preview https://deploy-preview-8562--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@beyondkmp beyondkmp marked this pull request as ready for review October 6, 2024 14:33
@beyondkmp beyondkmp requested a review from mmaietta October 6, 2024 14:33
@beyondkmp beyondkmp changed the title fix: exclude sub node_modules of the other dir instead of root dir fix:support include sub node_modules of the other dir instead of root dir Oct 6, 2024
@beyondkmp beyondkmp changed the title fix:support include sub node_modules of the other dir instead of root dir fix:Support including node_modules in other subdirectories Oct 6, 2024
@beyondkmp beyondkmp changed the title fix:Support including node_modules in other subdirectories fix: support including node_modules in other subdirectories Oct 6, 2024
@beyondkmp beyondkmp merged commit b8185d4 into electron-userland:master Oct 7, 2024
13 checks passed
@beyondkmp beyondkmp deleted the excludeNodemoudles branch October 11, 2024 07: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.

2 participants