@@ -54,13 +54,13 @@ function convertToStandaloneApp(
54
54
export default async function ( tree : Tree , options : DomainOptions ) {
55
55
const appName = strings . dasherize ( options . name ) ;
56
56
const appNameAndDirectory = options . appDirectory
57
- ? `${ options . appDirectory } /${ appName } `
58
- : appName ;
59
- const appNameAndDirectoryDasherized = strings
60
- . dasherize ( appNameAndDirectory )
57
+ ? `apps/ ${ options . appDirectory } /${ appName } `
58
+ : `apps/ ${ appName } ` ;
59
+ const appNameSlug = strings
60
+ . dasherize ( appName )
61
61
. split ( '/' )
62
62
. join ( '-' ) ;
63
- const appFolderPath = `apps/ ${ appNameAndDirectory } ` ;
63
+ const appFolderPath = `${ appNameAndDirectory } ` ;
64
64
const appSrcFolder = `${ appFolderPath } /src` ;
65
65
const appModuleFolder = `${ appFolderPath } /src/app` ;
66
66
const appModuleFilepath = `${ appModuleFolder } /app.module.ts` ;
@@ -69,23 +69,21 @@ export default async function (tree: Tree, options: DomainOptions) {
69
69
const libNameAndDirectory = options . directory
70
70
? `${ options . directory } /${ libName } `
71
71
: libName ;
72
- const libNameAndDirectoryDasherized = strings
73
- . dasherize ( libNameAndDirectory )
74
- . split ( '/' )
75
- . join ( '-' ) ;
76
- const libFolderPath = `libs/${ libNameAndDirectory } ` ;
77
- const libLibFolder = `${ libFolderPath } /domain/src/lib` ;
78
- const libSrcFolder = `${ libFolderPath } /domain/src` ;
79
72
80
- // if (options.ngrx && !options.addApp) {
81
- // throw new Error(
82
- // `The 'ngrx' option may only be used when the 'addApp' option is used.`
83
- // );
84
- // }
73
+ const libFolderPath = `libs/${ libNameAndDirectory } /domain` ;
74
+ const libSrcFolder = `${ libFolderPath } /src` ;
75
+ const libLibFolder = `${ libSrcFolder } /lib` ;
76
+
77
+ /*if (options.ngrx && !options.addApp) {
78
+ throw new Error(
79
+ `The 'ngrx' option may only be used when the 'addApp' option is used.`
80
+ );
81
+ }*/
85
82
86
83
await libraryGenerator ( tree , {
87
- name : `libs/${ libNameAndDirectory } /domain` ,
88
- // directory: libNameAndDirectory,
84
+ // name: `libs/${libNameAndDirectory}/domain`,
85
+ name : 'domain' ,
86
+ directory : libFolderPath ,
89
87
tags : `domain:${ libName } ,type:domain-logic` ,
90
88
prefix : libName ,
91
89
publishable : options . type === 'publishable' ,
@@ -114,8 +112,8 @@ export default async function (tree: Tree, options: DomainOptions) {
114
112
115
113
if ( options . addApp ) {
116
114
await applicationGenerator ( tree , {
117
- name : options . appDirectory ? `apps/ ${ options . appDirectory } / ${ appName } ` : `apps/ ${ appName } ` ,
118
- // directory: options.appDirectory ,
115
+ name : appNameAndDirectory ,
116
+ directory : appNameAndDirectory ,
119
117
tags : `domain:${ appName } ,type:app` ,
120
118
style : 'scss' ,
121
119
standalone : options . standalone
@@ -125,7 +123,7 @@ export default async function (tree: Tree, options: DomainOptions) {
125
123
const wsConfig = readNxJson ( tree ) ;
126
124
const npmScope = getNpmScope ( tree ) ;
127
125
// const wsConfig = readWorkspaceConfiguration(tree);
128
-
126
+
129
127
if ( options . addApp && options . standalone ) {
130
128
convertToStandaloneApp ( tree , {
131
129
name : options . name ,
@@ -146,7 +144,7 @@ export default async function (tree: Tree, options: DomainOptions) {
146
144
) ;
147
145
148
146
await generateStore ( tree , {
149
- project : appNameAndDirectoryDasherized ,
147
+ project : appNameSlug ,
150
148
root : true ,
151
149
minimal : true ,
152
150
module : 'app.module.ts' ,
@@ -177,7 +175,7 @@ export default async function (tree: Tree, options: DomainOptions) {
177
175
libName ,
178
176
! options . ngrx
179
177
) ;
180
-
178
+
181
179
await formatFiles ( tree ) ;
182
180
return ( ) => {
183
181
installPackagesTask ( tree ) ;
0 commit comments