Skip to content
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

Conversation

mikeseese
Copy link
Contributor

@mikeseese mikeseese commented Jan 11, 2021

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 the create script to use strictly positional arguments.

This is because without the --, NPM parses your --location and --folder as NPM flags instead of create.ts flags. It tries to parse, determines they do nothing, ignores them, and proceeds to pass in the other arguments.

image

See the top red circle where --folder and --location are actually dropped. Then further you can see how location actually parsed iamfolder due to guessing it's position from the command string

@davidmurdoch
Copy link
Member

Ah, I see. I only ever tested --location followed by --folder.

@mikeseese
Copy link
Contributor Author

Closing in favor of #707

@mikeseese mikeseese closed this Jan 11, 2021
@mikeseese mikeseese deleted the fix/create-script-option-1 branch January 11, 2021 19:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants