- Node.js 8.12.0 (run
node -v
to verify) - npm 6.4.1 (run
npm -v
to verify) - Angular CLI 6.2.1 (run
npm ls -g @angular/cli --depth=0
to verify) - Yarn 1.10.1 or greater (run
yarn -v
to verify) - TSLint 5.11.0 or greater (run
tslint -v
to verify) - TypeScript 2.3.4 (for webpack) (run
npm ls -g typescript --depth=0
to verify)
- Uninstall all global packages:
npm uninstall -g <package>
- Uninstall Node.js
- Delete
C:\Users\{user}\AppData\Roaming\npm
- Delete
C:\Users\{user}\AppData\Roaming\npm-cache
- Delete
C:\Users\{user}\AppData\Local\Temp\npm-*
- Reboot
Install Node.js
Includes npm... Just use default settings.
- Install Angular CLI:
npm i -g @angular/[email protected]
- Install Yarn:
npm i -g yarn
- Install TSLint:
npm i -g tslint
- Install TypeScript (needed for Webpack):
npm i -g typescript@'>=2.1.0 <2.4.0'
npm ls -g --depth=0
-
After installing Node and Yarn, you can fork or straight download a copy of this application to start your own app.
-
First download all the dependencies with
yarn install
. -
Run
npm start
to start the webpack server to run the application on port 4200.Go to http://localhost:4200 to verify that the application is running.
💡 To change the default port, open
.angular-cli.json
, change the value ondefaults.serve.port
. -
Run
npm run build
to just build the project. The build artifacts will be stored in thedist/
directory. Use the-prod
flag for a production build, like so:ng serve --prod
to run in production mode. -
Run
npm run lint
to just lint your app code using TSLint.
- Before starting the local API project, in your shell, enable Keycloak and set Tantalis variables:
export KEYCLOAK_ENABLED=true
export TTLS_API_ENDPOINT="<see below>"
export WEBADE_AUTH_ENDPOINT="<see below>"
export WEBADE_USERNAME="<see below>"
export WEBADE_PASSWORD="<see below>"
💡 Get the values for TTLS_API_ENDPOINT, WEBADE_AUTH_ENDPOINT, WEBADE_USERNAME and WEBADE_PASSWORD, at Openshift → Natural Resource Public Review and Comment (dev) project → Applications → Pods → prc-api pod → Environment.
- Before starting the local Admin project, in file
src/app/services/keycloak.service.ts
, around line 17, change code to:
case 'http://localhost:4200':
// Local
this.keycloakEnabled = true;
break;
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|module
.
ng g c customer
ng g d search-box
ng g s general-data
Angular will give out a warning line after this command:
WARNING Service is generated but not provided, it must be provided to be used
After generating a service, we must go to its owning module and add the service to the providers
array.
ng g s general-data2 -m app.module
# class
ng g cl models/customer
# interface
ng g i models/person
# enum
ng g enum models/gender
ng g pipe shared/init-caps
Create a login directory and generate a login module in that directory.
ng g module login/login.module
Generate a module called admin and add routing feature to it.
ng g module admin --routing
Set up via Karma, Jasmine:
- Run
ng test
to execute the unit tests via Karma.
Set up with Protractor:
- Run
ng e2e
to execute the end-to-end tests via Protractor. - Before running the tests make sure you are serving the app via
ng serve
.
ng set default.styleExt css
ng new my-app --routing --style scss
- To get more help on the Angular CLI use
ng help
or go check out the Angular CLI README. ng doc component
to look up documentation for features.ng serve --help
to look up doc forng serve
command.
For dev, test, and production builds on OpenShift/Jenkins see openshift/README.md for detailed instructions on how to setup in an OpenShift environment using nginx.
Feel free to create pull requests from the default "master" branch, click here to create one automatically: https://github.com/bcgov/nrts-prc-admin/pull/new/master