From 156f9d1875a0fc354d3cbcedce04d8b3c2adc9e9 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Thu, 18 Mar 2021 20:31:50 +0300 Subject: [PATCH] Refactor readme and npm scripts. --- README.md | 9 +++++---- package.json | 15 ++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0416b41..ac0668e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Run `npm install -g @angular/cli` to install the angular CLI. ## Development server -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. +Run `npm run start:dev` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. ## Code scaffolding @@ -22,11 +22,11 @@ Run `ng generate module module-name --route module-name --module app.module` to ## Build -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. +Run `npm run build:dev` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `build:prod` script for a production build. ## Running unit tests -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). +Run `npm run test:dev` to execute the unit tests via [Karma](https://karma-runner.github.io). ## Running end-to-end tests @@ -34,8 +34,9 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac ## Environment variables -Environment variables are contained in the directory `src/environments/` +Environment variables are contained in the `.env` file. See `.env.example` for a template. +Once loaded they will be populated in the directory `src/environments/`. It contains environment variables for development on `environment.ts` and production on `environment.prod.ts`. ## Further help diff --git a/package.json b/package.json index 1798feb..2ba6a71 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,14 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "config": "ts-node set-env.ts", - "start:dev": "npm run config --environment=dev && ng serve", - "start:prod": "npm run config --environment=prod && ng serve", - "build:dev": "npm run config --environment=dev && ng build", - "build:prod": "npm run config --environment=prod && ng build --prod", - "test:dev": "npm run config --environment=dev && ng test", - "test:prod": "npm run config --environment=prod && ng test", + "config:dev": "ts-node set-env.ts --environment=dev", + "config:prod": "ts-node set-env.ts --environment=prod", + "start:dev": "npm run config:dev && ng serve", + "start:prod": "npm run config:prod && ng serve", + "build:dev": "npm run config:dev && ng build", + "build:prod": "npm run config:prod && ng build --prod", + "test:dev": "npm run config:dev && ng test", + "test:prod": "npm run config:prod && ng test", "lint": "ng lint", "e2e": "ng e2e", "postinstall": "node patch-webpack.js"