-
Notifications
You must be signed in to change notification settings - Fork 280
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
fix(create-neon): Explicit project type #1041
Merged
Merged
Conversation
This file contains 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
- either by passing --app or --lib - or by interactive dialog via stdin
dherman
force-pushed
the
create-neon-requires-project-type
branch
from
May 12, 2024 18:00
4a71dee
to
7661e45
Compare
kjvalencik
approved these changes
May 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The templated JSON is a difficult to tell if it always results in valid JSON. In a future PR, it may be cleaner to generate it in JS and call JSON.stringify
.
- small cleanups to `inferOrg` regexp logic - revert the `"prepare"` hook for --app (see #1042 (comment) )
kjvalencik
approved these changes
May 20, 2024
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.
This PR changes the syntax of create-neon to require the user to explicitly specify the Neon project type, either by passing
--lib
or--app
at the command-line, or otherwise by interactively asking them via stdin.The reason for this is a limitation of
npm init
: the only way it will forward an argument like--lib
to create-neon is if the user remembers to prefix it with--
:Without the extra
--
, npm silently ignores the--lib
, which is a subtle and surprising hazard. This pitfall is easy to stumble into and difficult to debug.(I built a demonstration package called create-dherman that you can use to test this behavior. Test it out with
npm init dherman --lib foobar
vsnpm init dherman -- --lib foobar
, for example.)With this PR, users still need the
--
, but if they forget it, they'll be asked the project type interactively.