Created
December 21, 2018 10:21
-
-
Save guillemcordoba/7e32c06979141f3c13f2e01c023e84e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APP_NAME=$1 | |
MODULE_NAME=$2 | |
ENTITY_NAME=$3 | |
ng new $APP_NAME | |
cd $APP_NAME | |
# Angular Material | |
ng add @angular/material | |
# Dependencies | |
npm install @ngrx/store @ngrx/effects @ngrx/entity @ngrx/store-devtools | |
npm install @ngrx/schematics | |
npm install @ngrx/router-store | |
npm install @angular/flex-layout | |
ng config cli.defaultCollection @ngrx/schematics | |
# Skeleton | |
mkdir src/app/containers | |
mkdir src/app/state | |
ng generate @angular/material:nav containers/home | |
# Generate container | |
#ng generate container Home --state reducers/index.ts --stateInterface MyState | |
# NGRX root | |
ng generate @ngrx/schematics:store State --statePath state --root | |
#--stateInterface <InterfaceName> (--module <module-name>) | |
# ng generate @ngrx/schematics:effect state/App --root | |
# Generate module | |
ng generate module $MODULE_NAME --flat false | |
mkdir src/app/$MODULE_NAME/components | |
mkdir src/app/$MODULE_NAME/containers | |
mkdir src/app/$MODULE_NAME/services | |
mkdir src/app/$MODULE_NAME/state | |
#ng generate feature $MODULE_NAME/state/$MODULE_NAME -m $MODULE_NAME/$MODULE_NAME.module.ts --reducers ../../state/index.ts | |
ng generate entity $MODULE_NAME/state/$ENTITY_NAME -m ../../$MODULE_NAME/$MODULE_NAME.module.ts -f | |
ng generate effect $MODULE_NAME/state/$ENTITY_NAME -m $MODULE_NAME/$MODULE_NAME.module.ts | |
ROOT_CONFIG="StoreModule.forRoot(reducers), | |
EffectsModule.forRoot([]), | |
StoreDevtoolsModule.instrument({ | |
maxAge: 25, | |
logOnly: environment.production, | |
}), | |
StoreRouterConnectingModule.forRoot()," | |
echo $ROOT_CONFIG >> src/app/app.module.ts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment