-
Notifications
You must be signed in to change notification settings - Fork 155
fix(@schematics/angular): Allow for scoped library names #646
Conversation
const name = options.name; | ||
// If scoped project (i.e. "@foo/bar"), convert projectDir to "foo-bar". | ||
const packageName = options.name; | ||
options.name = /@[\S]*\/[\S]*/.test(options.name) |
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.
What if the name passed on the command line is a/b/c
? Is it going to create c
in /projects/a/b
?
The removal of |
I think it would be good to keep the |
@about-code in my experience having |
let scopeName = ''; | ||
if (/@[\S]*\/[\S]*/.test(options.name)) { | ||
const [scope, name] = options.name.split('/'); | ||
scopeName = scope.replace('@', ''); |
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.
replace(/^@/, '')
Question; do we check that I cannot enter any strings somewhere? Do we have a pattern in the schema? |
@hansl I updated the logic to validate the project name... but not via a schema pattern in order to provide more verbose error messages. |
2f16d7a
to
6996de1
Compare
I am not yet sure whether it's preferable to strip the Assume an Angular app wants to lazy load an NgModule from a library in the
then it might (not tested in CLI context) become possible to compile angular apps which load an NgModule from a library with an absolute path beginning with the package name maybe like so:
Webpack were able to resolve |
@about-code we add TS path configuration pointing the to built library artifacts. Our webpack plugin adds the TS paths to the module resolution logic of webpack. This way the folder name proper does not matter. |
@filipesilva Thank you very much for your response and for taking away my concerns. Now I am gonna be quiet on this. 😃 |
d218225
to
693ec98
Compare
} else if (unsupportedProjectNames.indexOf(projectName) !== -1) { | ||
throw new SchematicsException(`Project name "${projectName}" is not a supported name.`); | ||
} else if (!packageNameRegex.test(projectName)) { | ||
throw new SchematicsException(`Project name (${projectName}) is invalid.`); |
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.
${JSON.stringify(projectName)}
Hi All |
@rodchenkov I have a fix incoming in #895 |
fixes angular/angular-cli#10172