This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Ensure proper usage of yargs + npm create
script without using --
#704
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 is part of #700
There was a reason for me adding the
--
requirement and your changes (reflected in #703) just steamrolled over those necessary changes without discussion. I am providing you 2 different options that I strongly encourage you picking and merging one. I also would appreciate PR reviews rather than just coding over what you want/don't want; that way we can have a discussion when you have a disagreement so I can explain why I made the decisions I did.This PR is option 1 (without using
--
, but using positional args)--
If you don't want to use the
--
that NPM requires you to use to pass--flag
arguments (what yargs calls "options"), then you need to change thecreate
script to use strictly positional arguments.This is because without the
--
, NPM parses your--location
and--folder
as NPM flags instead ofcreate.ts
flags. It tries to parse, determines they do nothing, ignores them, and proceeds to pass in the other arguments.See the top red circle where
--folder
and--location
are actually dropped. Then further you can see howlocation
actually parsediamfolder
due to guessing it's position from the command string