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

Update .gitignore files in create-svelte package to ignore all dotfiles with a prefix of .env #2905

Merged
merged 4 commits into from
Nov 24, 2021

Conversation

kellenmace
Copy link
Contributor

@kellenmace kellenmace commented Nov 24, 2021

Fixes #2904.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2021

🦋 Changeset detected

Latest commit: 2d1d6a8

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

This PR includes changesets to release 1 package
Name Type
create-svelte 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

@Conduitry
Copy link
Member

IMO this should only add .env.*, if anything, and not .env*.

@bjon
Copy link
Contributor

bjon commented Nov 24, 2021

Shouldn't only env files ending with .local be ignored by default?
We're using vite's support for modes, e.g. .env.[stage|prod]

@Rich-Harris
Copy link
Member

Thank you! Aside from the feedback above, can you reinstate the deleted checklist and add a changeset?

…mplate rather than all files beginning with .env
@kellenmace
Copy link
Contributor Author

Thanks for the feedback, all! 🙌

@Conduitry - Sounds good. I updated the PR so that .env and .env.* files are git ignored. This way, on the off chance that the dev has some other file that begins with ".env" in their project, like ".envision", it won't be affected.

@bjon - Files like .env.local, .env.stage and .env.prod should generally not be added to version control. They often contain sensitive data like API keys. Devs should set their environment variables in their hosting provider's UI for their staging and prod sites. If a developer has a reason to want those included in git (which I wouldn't recommend), they can just tweak the .gitignore file to accomplish that. Next.js, for example, excludes those files in their .gitignore file for new projects, as well: https://github.com/vercel/next.js/blob/canary/examples/active-class-name/.gitignore#L27-L31

@Rich-Harris - Yes, checklist reinstated and changeset added. Please let me know if anything else is needed. 👍🏼

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.

Ignore all dotfiles with a .env prefix by default for new projects
5 participants