@dlr-eoc/core-ui (Schematics for UKIS core-ui)
This is are some schematics to add the base UKIS-Layout to an angular application.
It is based on Clarity so add this first!
For further information how to build custom schematics see angular schematics and @angular-devkit.
This is what the ng-add command is doing
Ng Add options
ng add @dlr-eoc/core-ui
--project=string // the project in the angular workspace
--routing=boolean // default false
--addClr=boolean // run's @clr/angular:ng-add default false
// Not implemented right now!
--addMap=boolean // adds a map component default false
--auth=boolean // default false, adjusts the app for authentication and user login
Test locally on a new angular project
https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2
-
build the schematics ng build core-ui
-
set Versions in build node scripts/library/index.js --set
-
create a new project ng new my-project
-
link to the Schematics in the new project npm link $PATH_TO_SCHEMATIC_PROJECT
e.g. (npm link ../frontend-libraries/dist/core-ui
)
-
run the schematics in the new project schematics @dlr-eoc/core-ui:ng-add
or ng generate @dlr-eoc/core-ui:ng-add
to unlink use
npm unlink $PATH_TO_SCHEMATIC_PROJECT
(npm unlink ../frontend-libraries/dist/core-ui
) // this unfortunately does not remove the full link so you have to run
npm uninstall @dlr-eoc/core-ui -g
// this leaves an empty folder @dlr-eoc in the global directory (npm config get prefix
/node_modules) so remove it later if not needed
Unit Testing
npm run schematics:test
will run the unit tests, using Jasmine as a runner and test framework.
ng test core-ui
will run the unit tests of the lib via Karma.
Build Schematics
- build core-ui
- compile schematics to core-ui build
tsc -p projects/core-ui/tsconfig.schematics.json
- copy files (this is done by a custom builder)
cpx projects/core-ui/schematics/collection.json dist/core-ui/schematics/
cpx projects/core-ui/schematics/**/schema.json dist/core-ui/schematics/
cpx projects/core-ui/schematics/*/files/** dist/core-ui/schematics/
cpx projects/core-ui/src/lib/global-alert/** dist/core-ui/schematics/ng-add/files/src/app/components/global-alert/
cpx projects/core-ui/src/lib/global-progress/** dist/core-ui/schematics/ng-add/files/src/app/components/global-progress/
- ...
Publishing
for local publish use
- in dist/
npm pack
this creates a ukis-schematics-.tgz file which we can copy.