This repo is intended to allow spooling up Angular projects in a monorepo rapidly, with a minimum of configuration.
- Angular 18 (with Node 20)
- Parallel server/client execution
- Bare-bones api proxy to the back-end
- SASS boilerplate included
- Frontend environment detection/switching
- Auto-unsub from subscriptions and component variables
- Heroku deployment
- Google Analytics
- Cookie API
- Service worker to persist app and manage versions
- Hot module replacement for faster dev iteration
- Typescript with node for back-end
- Client & Server unit testing via jasmine
- Benchmark memory usage and response times (throttled for mobile) in tests
- Internationalization (i18n) with Transloco
- e2e testing with puppeteer + snapshots
- CI/CD (jenkins, sonar, etc?)
- Tree-shaking/build optimization
- Google Analytics reports on site activity
- Feature flags
- IndexedDB for offline storage
- Websockets to reconcile disparities between server and local data
- public api with GraphQL
- DB caching for external requests AND similar DB api calls (solr or the like)
- Ionic & Electron integration
- Elf state management
- Immutable.js to minimize mutation
- Auth-agnostic (or maybe just Firebase) user management (emails and password resetting and deliverability)
Install node 18.12.1. Recommended to install NVM to manage node versions.
Install NPM 8.19.2 (should be bundled with node; later versions have caused problems).
Install Angular CLI to allow executing commands: npm i -g @angular/cli
From the root, run npm ci --workspaces
Create your .env
file from the .env.example
and never commit sensitive information like API keys or passwords or usernames or email addresses
Develop against branches from dev feature branch using prefix feature/
. Main is for production releases, staging is to test prod.
In the project directory, you can run:
Runs the front- and back-end concurrently. See above.
This is the preferred method of running a local
Runs only the front-end of the app (on port 4200) in development mode.
Open http://localhost:4200 to view it in the browser.
The page will reload if you make edits.
Runs only the back-end of the app (on port 4201) in development mode.
Open http://localhost:4201 to view it in the browser.
This will display the API responses.
tbd
This command starts Testcafe in Live mode (-L) while launching the dev server first.
if the server is running, do:
Run the Testcafe command with more parameters, since with this one we're taking screenshots and prepping to compare them.
-
npx testcafe chrome tests -s tests/e2e/screenshots --take-snapshot base
Takes the base screenshot. Run this once when the site is working. Be careful when running this, this will overrite the "working" screenshots in the directory. -
npx testcafe chrome tests -s tests/e2e/screenshots --take-snapshot actual
Takes an actual screenshot of the current site. Once taken, we use this to compare wit the "base" working screenshots to check for userflow errors. -
npx testcafe-blink-diff tests/e2e/screenshots --compare base:actual --open --threshold 0.005
The CLI command to compare base:actual screenshots for differences. The report will be in generated/index.html. -
npm run rebase
Accept all screenshot diffs and overwrite base comparisons.
- mac (requires homebrew):
brew tap heroku/brew && brew install heroku
- linux:
sudo snap install --classic heroku
heroku git:remote -a <APP_NAME>-dev
git remote rename heroku dev
heroku git:remote -a <APP_NAME>-staging
git remote rename heroku staging
heroku git:remote -a <APP_NAME>
git remote rename heroku production
git push dev dev:main
from staging branch:
git push staging staging:main
from main branch:
git push production main:main