@@ -34,16 +34,13 @@ const LibModuleCommand: any = Command.extend({
3434 anonymousOptions : [ '<glob-pattern>' ] ,
3535
3636 run : function ( commandOptions : any , rawArgs : string [ ] ) {
37- const packageName = rawArgs . shift ( ) ;
38-
39- if ( ! packageName ) {
37+ if ( ! commandOptions . name ) {
4038 return Promise . reject ( new SilentError (
4139 `The "ng ${ this . name } " command requires a name argument to be specified. ` +
4240 `For more details, use "ng help".` ) ) ;
4341 }
4442
45- commandOptions . name = packageName ;
46- commandOptions . directory = packageName ;
43+ commandOptions . directory = commandOptions . name ;
4744
4845 if ( commandOptions . dryRun ) {
4946 commandOptions . skipGit = true ;
@@ -99,7 +96,7 @@ const LibModuleCommand: any = Command.extend({
9996
10097 const project = this . project ;
10198
102- if ( ! packageName ) {
99+ if ( ! commandOptions . name ) {
103100 const message = 'The `ng ' + this . name + '` command requires a ' +
104101 'package.json in current folder with name attribute or a specified name via arguments. ' +
105102 'For more details, use `ng help`.' ;
@@ -110,7 +107,7 @@ const LibModuleCommand: any = Command.extend({
110107 const blueprintOpts = {
111108 dryRun : commandOptions . dryRun ,
112109 blueprint : 'libmodule' ,
113- rawName : packageName ,
110+ rawName : commandOptions . name ,
114111 targetFiles : rawArgs || '' ,
115112 rawArgs : rawArgs . toString ( ) ,
116113 sourceDir : commandOptions . sourceDir ,
@@ -123,9 +120,9 @@ const LibModuleCommand: any = Command.extend({
123120 ignoredUpdateFiles : [ 'favicon.ico' ]
124121 } ;
125122
126- if ( ! validProjectName ( packageName ) ) {
123+ if ( ! validProjectName ( commandOptions . name ) ) {
127124 return Promise . reject (
128- new SilentError ( 'We currently do not support a name of `' + packageName + '`.' ) ) ;
125+ new SilentError ( 'We currently do not support a name of `' + commandOptions . name + '`.' ) ) ;
129126 }
130127
131128 if ( commandOptions . mobile ) {
0 commit comments