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 cleanupEditor 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:
Docker for Mac (edge version)
Helm (optional)
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:
ng add @nrwl/angular
ng add @nrwl/react
Web (no framework frontends)
ng add @nrwl/web
ng add @nrwl/nest
ng add @nrwl/express
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-runor-doption 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:
"Bump" the version in package.json
Update the CHANGELOG.md file
Commit the package.json and CHANGELOG.md files
Tag a new release in the git history
Build Library
Publish Library
bump
versioninlibs/ngx-utils/package.jsone.g.,0.0.6-alphafor alpha release or0.0.6for 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?