This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
chore: throw if name arg in create script includes scope #3108
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.
Description
Very minor change to the
create.ts
script that checks for a scope in thename
arg. This is implicitly documented in theREADME
but thevalidate-npm-package-name
will allow for@scope/name
to get through the validation check. When this happens, the creation script will bomb out with a partially created package.Steps to Validate
develop
branchnpm run create roflcopter --location chains
Expected: New 'roflcopter' chain is created in
chains
folder.npm run create @ganache/roflcopter-options --location chains/roflcopter --folder options
Expected: Error: Name
@ganache/roflcopter-options
includes scope and is an invalid name.Actual:
options
folder will be created in theroflcopter
folder, test will not be created,package.json
name will be@ganache/@ganache/roflcopter-options
Error Message:
Steps to Test
npm run create roflcopter --location chains
Expected: New 'roflcopter' chain is created in
chains
folder.npm run create @ganache/roflcopter-options --location chains/roflcopter --folder options
Actual:
Notes
The validation package will catch names similar to
@<name>
because the@
is not url-friendly. However, it will validate the@<scope>/<name>
names because it is a valid npm package. This is a very narrow bug.Existing validation will catch:
@<name>
<name>/<name>
<name>@<name>
This change catches:
@<name>/<name>
See: Examples