-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Validate Project Names #468
Conversation
|
||
if (npmPackageNameErrors) { | ||
const npmPackageNameMsg = npmPackageNameErrors.join(', '); | ||
return error(`${argv.name} is not a valid package name. ${npmPackageNameMsg}`, 1); |
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.
can you add a chalk
message before this?
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.
Not sure what the chalk message would have in it. Doesn't the error
method from the utils already display the message given?
i.e ✖ ERROR ./asdasd is not a valid package name. name cannot start with a period, name can only contain URL-friendly characters
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.
You are right. Internally error
method in utils
uses chalk itself.
@prateekbh that is totally valid. 😄
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.
gosh I need to do my revision for this codebase
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.
This looks good! My only suggestion is formatting on that error message:
if (npmPackageNameErrors) {
const msgs = [`Invalid package name: ${argv.name}`].concat(npmPackageNameErrors);
return error(msgs.map(capitalize).join('\n >'), 1);
}
✖ ERROR Invalid package name: ./asdasd
> Name cannot start with a period
> Name can only contain URL-friendly characters
We can totally get this in a separate PR tho. 👍
Thank you @milesthedisch ~! |
What kind of change does this PR introduce?
Add test and validation to
dest
and/orname
options.Did you add tests for your changes?
Yes
Summary
#466
Does this PR introduce a breaking change?
No
Other information