File tree 5 files changed +28
-3
lines changed
docs/generated/packages/js/generators
5 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 127
127
"type" : " boolean" ,
128
128
"description" : " Generate a library with a minimal setup. No README.md generated." ,
129
129
"default" : false
130
+ },
131
+ "simpleName" : {
132
+ "description" : " Don't include the directory in the generated file name." ,
133
+ "type" : " boolean" ,
134
+ "default" : false
130
135
}
131
136
},
132
137
"required" : [" name" ],
Original file line number Diff line number Diff line change @@ -183,7 +183,6 @@ describe('lib', () => {
183
183
name : 'myLib2' ,
184
184
directory : 'myDir' ,
185
185
tags : 'one,two' ,
186
- simpleModuleName : true ,
187
186
} ) ;
188
187
projects = Object . fromEntries ( getProjects ( tree ) ) ;
189
188
expect ( projects ) . toMatchObject ( {
@@ -1147,4 +1146,20 @@ describe('lib', () => {
1147
1146
expect ( project . targets . build . options . assets ) . toEqual ( [ ] ) ;
1148
1147
} ) ;
1149
1148
} ) ;
1149
+
1150
+ describe ( '--simpleName' , ( ) => {
1151
+ it ( 'should generate a simple name' , async ( ) => {
1152
+ await libraryGenerator ( tree , {
1153
+ ...defaultOptions ,
1154
+ name : 'myLib' ,
1155
+ simpleName : true ,
1156
+ directory : 'web' ,
1157
+ } ) ;
1158
+
1159
+ expect ( tree . read ( 'libs/web/my-lib/src/index.ts' , 'utf-8' ) ) . toContain (
1160
+ `export * from './lib/my-lib';`
1161
+ ) ;
1162
+ expect ( tree . exists ( 'libs/web/my-lib/src/lib/my-lib.ts' ) ) . toBeTruthy ( ) ;
1163
+ } ) ;
1164
+ } ) ;
1150
1165
} ) ;
Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ function normalizeOptions(
487
487
? name
488
488
: projectDirectory . replace ( new RegExp ( '/' , 'g' ) , '-' ) ;
489
489
const fileName = getCaseAwareFileName ( {
490
- fileName : options . simpleModuleName ? name : projectName ,
490
+ fileName : options . simpleName ? name : projectName ,
491
491
pascalCaseFiles : options . pascalCaseFiles ,
492
492
} ) ;
493
493
Original file line number Diff line number Diff line change 127
127
"type" : " boolean" ,
128
128
"description" : " Generate a library with a minimal setup. No README.md generated." ,
129
129
"default" : false
130
+ },
131
+ "simpleName" : {
132
+ "description" : " Don't include the directory in the generated file name." ,
133
+ "type" : " boolean" ,
134
+ "default" : false
130
135
}
131
136
},
132
137
"required" : [" name" ],
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ export interface LibraryGeneratorSchema {
11
11
directory ?: string ;
12
12
skipFormat ?: boolean ;
13
13
tags ?: string ;
14
- simpleModuleName ?: boolean ;
15
14
skipTsConfig ?: boolean ;
16
15
includeBabelRc ?: boolean ;
17
16
unitTestRunner ?: 'jest' | 'vitest' | 'none' ;
@@ -30,6 +29,7 @@ export interface LibraryGeneratorSchema {
30
29
skipTypeCheck ?: boolean ;
31
30
minimal ?: boolean ;
32
31
rootProject ?: boolean ;
32
+ simpleName ?: boolean ;
33
33
}
34
34
35
35
export interface ExecutorOptions {
You can’t perform that action at this time.
1 commit comments
vercel[bot] commentedon Apr 27, 2023
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev