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

Remove user-specific entries added to .gitignore #178

Merged
merged 2 commits into from
Jan 15, 2022

Conversation

mdesantis
Copy link
Contributor

@mdesantis mdesantis commented Jan 15, 2022

It removes the .DS_Store entry inserted by vite_ruby into .gitignore, as it is user-specific and should be added to user's global gitignore.

@ElMassimo
Copy link
Owner

ElMassimo commented Jan 15, 2022

Hi Maurizio!

The idea is to provide reasonable defaults. Users can remove these entries if they need to track the files under version control, which is very unlikely.

  • node_modules: Vite Ruby will install npm packages during the installation process
  • *.local: Vite will automatically read environment variables from .env.local and similar .env files that should not be added to version control

Wouldn't mind removing .DS_Store, it's already included in most starter .gitignore files. Would you update the PR?

@mdesantis
Copy link
Contributor Author

Hi Maximo <3

I disagree about node_modules: I can't see why you should set up vite_ruby before setting up any JavaScript package manager. Are you sure about that?

Is the *.local behaviour documented somewhere? it surprises me. I wonder why vite_ruby takes responsibility for handling env vars, why don't use something like dotenv instead? 🤔 also, is it documented anywhere?

I'll update the PR if you're still sure about it

@ElMassimo
Copy link
Owner

ElMassimo commented Jan 15, 2022

why you should set up vite_ruby before setting up any JavaScript package manager?

Rails 7 and other Ruby frameworks do not depend on node, so it's possible that the Vite Ruby installation is the first time you install npm packages in a project.

Vite Ruby supports npm, yarn, and pnpm, all of which install packages in node_modules by default. It's bad practice to add that to source control, that's what lockfiles are for.

I wonder why vite_ruby takes responsibility for handling env vars, why don't use something like dotenv instead? 🤔

It doesn't. Vite does, it's well documented, and it is powered by dotenv.

@mdesantis
Copy link
Contributor Author

Thank you for addressing my concerns, I see your thinking now.

What do think about putting a comment referencing https://vitejs.dev/guide/env-and-mode.html#env-files above the *.local line? I would have never realized that without your explanation

@ElMassimo
Copy link
Owner

I like the suggestion, adding a commented link above the *.local line 👍

@mdesantis mdesantis changed the title Remove questionable entries added to .gitignore Remove user-specific entries added to .gitignore Jan 15, 2022
It removes the `.DS_Store` entry inserted by vite_ruby into
`.gitignore`, as it is user-specific and should be added to user's
global gitignore.
The `*.local` entry may surprise `vite_ruby` users, as it is related to
Vite's integration with `dotenv`, which may be unknown by vite_ruby
users.
@mdesantis
Copy link
Contributor Author

I updated the PR; feel free to update my changes as you like, if needed!

@ElMassimo ElMassimo merged commit 5a0931d into ElMassimo:main Jan 15, 2022
@vfonic
Copy link

vfonic commented Mar 22, 2022

Awesome! 🤘 Thanks @mdesantis for this PR! I came here to search why would vite_rails add .DS_Store to my .gitignore.

Thanks for removing this! I'll upgrade the gem version in my Gemfile now.

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.

3 participants