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

Include .gitattributes when building the gem #193

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

pokonski
Copy link
Contributor

@pokonski pokonski commented May 9, 2024

lib/install/bun/.gitattributes was missing from the final build of the gem. This was causing an error during installation when jsbundling-rails tried to copy its own .gitattributes into host project's root.

Dir["lib/**/*"] does not include files starting with a dot, so I replaced it with a method that does include them. Also stripped directories from the list because according to the specification, they are ignored anyway:

Only add files you can require to this list, not directories, etc.
Directories are automatically stripped from this list when building a gem, other non-files cause an error.

Fixes #175

Proof:

Dir.glob("lib/**/*", File::FNM_DOTMATCH).any? { |path| path.include?(".gitattributes") }
=> true

vs

Dir["lib/**/*"].any? { |path| path.include?(".gitattributes") }
=> false

@dhh dhh merged commit 69bfc1c into rails:main Jul 29, 2024
@pokonski pokonski deleted the fix-bundling-gitattributes branch August 1, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bun install fails without .gitattributes file in project root
2 participants