fix: scoped packages with . produces incorrect package name
#1033
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.
Summary:
This fixes #1031 (a regression introduced with #910). It also makes sure that the package name contains only an allowed chars.
Theoretically NPM scope name can contain only a lowercase url-safe chars (


a-z 0-9 - _ . ! ~ * ' ( )). But I did not tried to use those chars as the scope name. I mean the validator does not throw an error but I'm not sure if you can save it actually. I've attached some screenshots from npmjs.org:On the other hand package name cannot contain these chars:
/ \ : < > " ? * |. So we definitely need to replace*to be 100% sure that the package name is correct. Also I replaced~ ! ' ( )too (or I shouldn't do that?).Test Plan:
I've tried to add
yarn add @bam.tech/react-native-snap-carouseland build the app.The app builds successfully.
Also I've create a small groovy test script as an example:
https://groovyconsole.appspot.com/script/5174010459455488