feat: add env init command that copies from template placeholders#516
feat: add env init command that copies from template placeholders#516zimeg wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #516 +/- ##
==========================================
+ Coverage 71.56% 71.69% +0.12%
==========================================
Files 224 225 +1
Lines 18976 19083 +107
==========================================
+ Hits 13581 13681 +100
- Misses 4192 4199 +7
Partials 1203 1203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mwbrooks
left a comment
There was a problem hiding this comment.
🙇🏻 Thanks a bunch for opening this PR! 🎉 I'm excited to see this one landing.
🧠 Could we swap "template placeholders" for "template file" or ".env template file"? "Placeholder" tends to imply a variable or token that gets substituted, which is a bit ambiguous here. Since we're copying the file verbatim, ".env template file" is more precise and the common convention in the wild from a little Claude research.
|
@mwbrooks Apologies for the pause after review 🎁 ✨ The polish to how these concepts landed above and I think it puts this in a better place for ongoing iteration! Let's not think about that right now though. I requested another review for sureness of how this appears 🔮 |
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Thanks for the refactors @zimeg! This PR looks great and works like a charm! 👌🏻
🧪 Manual tests are looking good and unit tests have good test coverage.
📝 A few follow-ups that come to mind:
- suggestion: We should include
env initas part ofproject initso that the new projects come with a.envprovisioned out-of-the-box. - question: When no
.envexists and we runenv set, the CLI creates.env. Should it create a blank.envor use.env.example/samplewhen it exists? My first impression is that we'd remain consistent if we tempalted from the.env.example/sample.
| // Init copies an .env template file (.env.sample or .env.example) to .env. It | ||
| // returns an error if .env already exists, or if no template file is found. | ||
| func Init(fs afero.Fs) (string, error) { | ||
| sampleFiles := []string{".env.sample", ".env.example"} |
There was a problem hiding this comment.
note: I had Claude do some research on github.com and these are the top 2 placeholder names for .env files and make up the largest percentage. So, I think this is a great start!
| ErrDenoNotFound = "deno_not_found" | ||
| ErrDeployedAppNotSupported = "deployed_app_not_supported" | ||
| ErrDocumentationGenerationFailed = "documentation_generation_failed" | ||
| ErrDotEnvFileAlreadyExists = "dotenv_file_already_exists" |
There was a problem hiding this comment.
praise: error code prefixes for clean organization! 🎉
Changelog
Summary
This PR adds the
env initcommand that copies from template placeholders 🌲Preview
Included are expected cases and common edges to encounter! 🔬 ✨
⚡ Bolt Frameworks
🥀 ROSI Features
Testing
Checkout the changes of this branch and experiment with either a Bolt or Deno app:
Notes
Some follow up remains proposed to improve this but is left out of scope for this PR 🏁
project initought make setup a breeze it's been said 😉Requirements