@@ -36,7 +36,7 @@ import {Schema} from './schema';
3636import { TsComponentGenerator } from './generators/ts-component.generator' ;
3737import { addModuleImportToModule } from '@angular/cdk/schematics' ;
3838import ora from 'ora' ;
39- import { WIZARD_CONFIG_FILE } from " ../table-prompter/index" ;
39+ import { WIZARD_CONFIG_FILE } from ' ../table-prompter/index' ;
4040
4141export default function ( options : Schema ) : Rule {
4242 return ( tree : Tree , context : SchematicContext ) : void => {
@@ -64,10 +64,19 @@ export default function (options: Schema): Rule {
6464export function generateTable ( options : Schema ) : Rule {
6565 options . spinner = ora ( ) . start ( ) ;
6666
67- if ( ! options . skipImport ) {
68- options . skipImport = false ;
67+ const defaultOptions = {
68+ skipImport : false ,
69+ } ;
70+
71+ if ( options . configFile !== WIZARD_CONFIG_FILE ) {
72+ options . configFile = WIZARD_CONFIG_FILE ;
6973 }
7074
75+ options = {
76+ ...defaultOptions ,
77+ ...options ,
78+ } ;
79+
7180 loadAndApplyConfigFile ( options . configFile , options ) ;
7281
7382 if ( options . aspectModelTFilesString ) {
@@ -105,25 +114,25 @@ export function generateTable(options: Schema): Rule {
105114 options . spinner ,
106115 options . enableRemoteDataHandling
107116 ? [
108- ...DEFAULT_DEPENDENCIES ,
109- {
110- type : NodeDependencyType . Default ,
111- version : '~0.9.4' ,
112- name : 'rollun-ts-rql' ,
113- overwrite : false ,
114- } ,
115- {
116- type : NodeDependencyType . Default ,
117- version : '~4.1.1' ,
118- name : 'crypto-js' ,
119- overwrite : false ,
120- } ,
121- ]
117+ ...DEFAULT_DEPENDENCIES ,
118+ {
119+ type : NodeDependencyType . Default ,
120+ version : '~0.9.4' ,
121+ name : 'rollun-ts-rql' ,
122+ overwrite : false ,
123+ } ,
124+ {
125+ type : NodeDependencyType . Default ,
126+ version : '~4.1.1' ,
127+ name : 'crypto-js' ,
128+ overwrite : false ,
129+ } ,
130+ ]
122131 : DEFAULT_DEPENDENCIES
123132 ) ,
124133 addPackageJsonDependencies (
125134 ! options . enabledCommandBarFunctions ?. includes ( 'addDateQuickFilters' ) ||
126- ( options . skipImport !== undefined && options . skipImport ) ,
135+ ( options . skipImport !== undefined && options . skipImport ) ,
127136 options . spinner ,
128137 [
129138 {
@@ -141,9 +150,7 @@ export function generateTable(options: Schema): Rule {
141150 ]
142151 ) ,
143152 updateConfigFiles ( options ) ,
144- addToAppModule ( options . skipImport , [
145- { name : 'BrowserAnimationsModule' , fromLib : '@angular/platform-browser/animations' }
146- ] ) ,
153+ addToAppModule ( options . skipImport , [ { name : 'BrowserAnimationsModule' , fromLib : '@angular/platform-browser/animations' } ] ) ,
147154 addToComponentModule ( options . skipImport , options , [
148155 { name : 'MatTableModule' , fromLib : '@angular/material/table' } ,
149156 { name : 'MatPaginatorModule' , fromLib : '@angular/material/paginator' } ,
@@ -169,7 +176,7 @@ export function generateTable(options: Schema): Rule {
169176 addToComponentModule (
170177 {
171178 skip ( ) {
172- return ! options . addCommandBar || options . skipImport as boolean ;
179+ return ! options . addCommandBar || ( options . skipImport as boolean ) ;
173180 } ,
174181 } ,
175182 options ,
@@ -188,7 +195,7 @@ export function generateTable(options: Schema): Rule {
188195 addToComponentModule (
189196 {
190197 skip ( ) {
191- return options . templateHelper . getDateProperties ( options ) . length < 1 || options . skipImport as boolean ;
198+ return options . templateHelper . getDateProperties ( options ) . length < 1 || ( options . skipImport as boolean ) ;
192199 } ,
193200 } ,
194201 options ,
@@ -197,7 +204,7 @@ export function generateTable(options: Schema): Rule {
197204 addToComponentModule (
198205 {
199206 skip ( ) {
200- return ! options . enabledCommandBarFunctions ?. includes ( 'addDateQuickFilters' ) || options . skipImport as boolean ;
207+ return ! options . enabledCommandBarFunctions ?. includes ( 'addDateQuickFilters' ) || ( options . skipImport as boolean ) ;
201208 } ,
202209 } ,
203210 options ,
@@ -209,7 +216,7 @@ export function generateTable(options: Schema): Rule {
209216 addToComponentModule (
210217 {
211218 skip ( ) {
212- return ! options . enabledCommandBarFunctions ?. includes ( 'addEnumQuickFilters' ) || options . skipImport as boolean ;
219+ return ! options . enabledCommandBarFunctions ?. includes ( 'addEnumQuickFilters' ) || ( options . skipImport as boolean ) ;
213220 } ,
214221 } ,
215222 options ,
@@ -218,17 +225,14 @@ export function generateTable(options: Schema): Rule {
218225 { name : 'MatOptionModule' , fromLib : '@angular/material/core' } ,
219226 ]
220227 ) ,
221- addToAppSharedModule (
222- false ,
223- [
224- { name : 'MatButtonModule' , fromLib : '@angular/material/button' } ,
225- { name : 'MatDialogModule' , fromLib : '@angular/material/dialog' } ,
226- { name : 'MatCheckboxModule' , fromLib : '@angular/material/checkbox' } ,
227- { name : 'MatIconModule' , fromLib : '@angular/material/icon' } ,
228- { name : 'FormsModule' , fromLib : '@angular/forms' } ,
229- { name : 'NgIf' , fromLib : '@angular/common' } ,
230- ]
231- ) ,
228+ addToAppSharedModule ( false , [
229+ { name : 'MatButtonModule' , fromLib : '@angular/material/button' } ,
230+ { name : 'MatDialogModule' , fromLib : '@angular/material/dialog' } ,
231+ { name : 'MatCheckboxModule' , fromLib : '@angular/material/checkbox' } ,
232+ { name : 'MatIconModule' , fromLib : '@angular/material/icon' } ,
233+ { name : 'FormsModule' , fromLib : '@angular/forms' } ,
234+ { name : 'NgIf' , fromLib : '@angular/common' } ,
235+ ] ) ,
232236 generateComponentFiles ( options ) ,
233237 generateStyles ( options ) ,
234238 generateTranslationFiles ( options ) ,
@@ -445,7 +449,12 @@ function generateConfigMenu(options: Schema): Rule {
445449 const componentContent = options . tsGenerator . generateConfigMenu ( ) ;
446450 const componentPath = `${ options . path } /${ dasherize ( options . name ) } -config-menu.component.ts` ;
447451 createOrOverwrite ( tree , `${ componentPath } ` , options . overwrite , componentContent ) ;
448- addToDeclarationsArray ( options , tree , `${ classify ( options . name ) } ConfigMenuComponent` , `${ componentPath . replace ( '.ts' , '' ) } ` ) . then ( ) ;
452+ addToDeclarationsArray (
453+ options ,
454+ tree ,
455+ `${ classify ( options . name ) } ConfigMenuComponent` ,
456+ `${ componentPath . replace ( '.ts' , '' ) } `
457+ ) . then ( ) ;
449458 return tree ;
450459 }
451460 } ;
0 commit comments