feat(init): ignore generated files and make the example visible - #38
Merged
Conversation
Three things a fresh `sputnik init` got wrong. The scaffold never mentioned .gitignore, so the compiled container Nette writes into .sputnik/cache on the first run was staged for the user's first commit, along with .sputnik.neon - the local override of the committed dist file. init now writes those two entries, creating .gitignore if the project has none and otherwise appending only what is missing. An existing file is never rewritten. The example task called $ctx->info() twice, which goes to the log and is only shown with -v: of the three lines it appeared to print, a user saw one. Those are writeln() now, and one info() stays with a comment saying what it does, because the distinction is worth learning at that point rather than looking broken. The scaffolded config had no pointer to either 0.2 feature. It now carries commented examples for variables.secrets and environment.executor, so the two things a project most often needs next are named in the file the user is told to edit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three things a fresh
sputnik initgot wrong. I found them by running the built PHAR as a user would while checking the release path for #36.The scaffold staged generated code for the user's first commit
initnever wrote a.gitignore. Nette compiles the container into.sputnik/cacheon the very first run, sogit add .in a fresh project picks up generated PHP with absolute paths in it..sputnik.neon- the local, uncommitted override of the committed.sputnik.dist.neon- had the same problem.initnow ensures both entries:.gitignore→ creates one with the two paths.gitignore→ appends only what is missing, under a# Sputnikcomment, never rewriting what is thereAll three paths are tested, including the "leaves it alone" case, which is the one that would quietly clobber someone's file if it broke.
The example task printed one of the three lines it appeared to print
info()is a logger call, visible only with-v. A user runningsputnik examplefor the first time sawHello, World!and nothing else, from code that plainly looks like it prints three lines. That reads as broken, and it is the first thing anyone runs.The two are
writeln()now. Oneinfo()stays, with a comment saying what it is for - the distinction between output and logging is worth learning at that moment rather than discovering by confusion.The scaffolded config never mentioned either 0.2 feature
The file the user is told to edit now carries commented examples for
variables.secretsandenvironment.executor, so the two things a project most often needs next are named where they will be seen. Both are comments, so the config still validates as-is.Verified
The 8 skipped tests are
tests/E2E/PharReleaseTest, which needs a built PHAR - #36 makes CI build one, so they run there.🤖 Generated with Claude Code
https://claude.ai/code/session_018CTvnzcNYmFgm2HQcm821A