From f20035d617b4a3b5b9246e09b09948d2de1834ee Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Wed, 12 May 2021 17:12:02 +0300 Subject: [PATCH] Update README. --- README.md | 26 ++++++++++++++++++-------- package.json | 5 +++-- set-env.ts | 10 +++++----- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2d203d4..521e52e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,9 @@ Run `npm install -g @angular/cli` to install the angular CLI. ## Development server -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. +Run `ng serve` for a local server, `npm run start:dev` for a dev server and `npm run start:prod` for a prod server.. + +Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. ## Code scaffolding @@ -22,14 +24,21 @@ Run `ng generate module module-name --route module-name --module app.module` to ## Build -set you environment variables - set these via environment variables as found in set-env.ts -// TODO create a .env file so people don't have to set these one-by-one +Run `ng build` to build the project using local configurations. +The build artifacts will be stored in the `dist/` directory. -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. +Use the `npm run build:dev` script for a development build and the `npm run build:prod` script for a production build. + +## PWA + +The app supports Progressive Web App capabilities. + +Run `npm run start:pwa` to run the project in PWA mode. +PWA mode works using production configurations. ## Running unit tests -Run `npm run test:dev` to execute the unit tests via [Karma](https://karma-runner.github.io). +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). ## Running end-to-end tests @@ -37,11 +46,12 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac ## Environment variables -Environment variables are contained in the `.env` file. See `.env.example` for a template. +Default environment variables are located in the `src/environments/` directory. +Custom environment variables are contained in the `.env` file. See `.env.example` for a template. -Default environment variables are set in the `set-env.ts` file. +Custom environment variables are set via the `set-env.ts` file. 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`. +It contains environment variables for development on `environment.dev.ts` and production on `environment.prod.ts`. ## Further help diff --git a/package.json b/package.json index a51107f..eebb5d5 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,14 @@ "build:dev": "ng build -c dev", "build:prod": "ng build --prod", "start:pwa": "npm run build:prod && http-server -p 4200 dist/cic-staff-client", - "test:dev": "ng test", + "test": "ng test", "format:check": "prettier --config ./.prettierrc --list-different \"src/{app,environments,assets}/**/*.{ts,js,json,css,scss}\"", "format:refactor": "prettier --config ./.prettierrc --write \"src/{app,environments,assets}/**/*.{ts,js,json,css,scss}\"", "format:fix": "pretty-quick --staged", + "format:lint": "npm run format:refactor && npm run lint", "lint": "ng lint", "e2e": "ng e2e", - "precommit": "format:fix && lint", + "precommit": "npm run format:fix && npm run lint", "postinstall": "node patch-webpack.js", "prepare": "husky install" }, diff --git a/set-env.ts b/set-env.ts index 754d897..d53c85c 100644 --- a/set-env.ts +++ b/set-env.ts @@ -6,7 +6,7 @@ require('dotenv').config(); const environment = argv.environment; const isProduction = environment === 'prod'; -const targetPath = isProduction ? `./src/environments/environment.prod.ts` : `./src/environments/environment.ts`; +const targetPath = isProduction ? `./src/environments/environment.prod.ts` : `./src/environments/environment.dev.ts`; const environmentVars = `import {NgxLoggerLevel} from 'ngx-logger'; @@ -15,13 +15,13 @@ export const environment = { bloxbergChainId: ${process.env.CIC_CHAIN_ID || 8996}, logLevel: ${process.env.LOG_LEVEL || 'NgxLoggerLevel.ERROR'}, serverLogLevel: ${process.env.SERVER_LOG_LEVEL || 'NgxLoggerLevel.OFF'}, - loggingUrl: '${process.env.CIC_LOGGING_URL || 'http://localhost:8000'}', + loggingUrl: '${process.env.CIC_LOGGING_URL || ''}', cicMetaUrl: '${process.env.CIC_META_URL || 'https://meta.dev.grassrootseconomics.net'}', - publicKeysUrl: '${process.env.CIC_KEYS_URL || 'http://localhost:8000/keys.asc'}', + publicKeysUrl: '${process.env.CIC_KEYS_URL || 'https://dev.grassrootseconomics.net/.well-known/publickeys'}', cicCacheUrl: '${process.env.CIC_CACHE_URL || 'https://cache.dev.grassrootseconomics.net'}', - web3Provider: '${process.env.CIC_WEB3_PROVIDER || 'ws://localhost:63546'}', + web3Provider: '${process.env.CIC_WEB3_PROVIDER || 'wss://bloxberg-ws.dev.grassrootseconomics.net'}', cicUssdUrl: '${process.env.CIC_USSD_URL || 'https://ussd.dev.grassrootseconomics.net'}', - registryAddress: '${process.env.CIC_REGISTRY_ADDRESS || '0x6Ca3cB14aA6F761712E1C18646AfBA4d5Ae249E8'}', + registryAddress: '${process.env.CIC_REGISTRY_ADDRESS || '0xea6225212005e86a4490018ded4bf37f3e772161'}', trustedDeclaratorAddress: '${process.env.CIC_TRUSTED_ADDRESS || '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'}' }; `;