Playbook

Do-it-yourself step-by-step instructions to create this project structure from scratch.

Setup

Prerequisites

you need following tools. versions listed here are minimal versions tested.

Software

Version

Optional

Node

v13.5.0

Yarn

v1.21.1

Lerna

v3.20.2

Angular CLI

v9.0.0

@nrwl/workspace

v9.0.0

@nestjs/cli

v6.13.2

commitizen

v4.0.3

Install Prerequisites

# install or Update Node and Yarn with brew
brew update
brew install node
#brew upgrade node
brew install yarn
#brew upgrade yarn
yarn config set workspaces-experimental true
yarn global add lerna
brew cleanup

Editor Configuration

Codelyzer should work out of the box with Atom but for VSCode you will have to open Code > Preferences > User Settings, and enter the following config:

Install redux-devtools for Chrome (optional)

Install Kubernetes (optional)

follow instructions here to install kubernetes toolchain:

  1. Docker for Mac (edge version)

  2. Helm (optional)

  3. kubectx (optional)

Install Bazel (optional)

For Mac, install via Brew. Instructions

Install Global Packages

Install Chrome Extensions

Scaffold Project

steps below are for setting up a new project from the scratch.

for nx help yarn run help

Explicitly Passing Arguments to Angular CLI

nx/ng commands now accept a delimiter to distinguish the end of options for Nx and the beginning of options to Angular CLI with a (like npm run) according to Guideline 10 of POSIX.2 utility syntax guidelines.

yarn affected -- --target lint --uncommitted --parallel -- --fix

Create Workspace

Add nx plugins

Below are some nx plugins which you can add to your workspace:

  • Angular

    • ng add @nrwl/angular

  • React

    • ng add @nrwl/react

  • Web (no framework frontends)

    • ng add @nrwl/web

  • Nest

    • ng add @nrwl/nest

  • Express

    • ng add @nrwl/express

  • Node

    • ng add @nrwl/node

Dependencies

adding 3rd party modules/libs

update 3rd party modules/schematics

use --allow-dirty --next --force` flags as needed

Generate Artifacts

Add --dry-run or -d option to following commands to see which artifacts will be created, without actually creating them.

generate Lazy-loaded Feature Modules

with angular schematics (a.k.a. @nrwl/angular which is default in angular.json)

generate shared neutral libs

with no-framework (a.k.a. @nrwl/workspace schematics)

generate shared angular libs

with angular schematics (a.k.a. @nrwl/angular which is default in angular.json)

Workspace Schematics

Install

Update

Build

Run

Uint Test

E2E Test

Serve from dist

use this to test service-workers

Scullyio

Docs

generate docs

Deploy

deploy this app with mock config to gh-pages

Continuous Delivery

You may need to set an environment variable called GH_TOKEN in our CI/CD environment

Release

"release": "standard-version && git push — follow-tags origin master && yarn publish"

standard-version will now do the following:

  1. "Bump" the version in package.json

  2. Update the CHANGELOG.md file

  3. Commit the package.json and CHANGELOG.md files

  4. Tag a new release in the git history

Build Library

Publish Library

bump version in libs/ngx-utils/package.json e.g., 0.0.6-alpha for alpha release or 0.0.6 for latest release. Set your NPM_TOKEN

Publish Code Coverage

Analyze

Analyzing bundle size

Check

check if you on current versions.

Production build and deployment

The prod image serves the minified app (sources compiles with a minimal set of dependencies), via an Nginx server. It is self-contained, and can therefore be pushed to a Docker registry to be deployed somewhere else easily.

To start the container, use:

Now open your browser at http://localhost:80

IntelliJ/WebStorm

Right click on apps/webapp/src/styles in project vie --> Make Directory as --> Resources Root. Right click on apps/webapp/src in project vie --> Make Directory as --> Resources Root. Right click on docs in project view --> Make Directory as --> Excluded. Right click on dist in project view --> Make Directory as --> Excluded. Right click on coverage in project view --> Make Directory as --> Excluded.

Reference

Last updated

Was this helpful?