Skip to content

Technical maintenance

Jean-Michel Gonet edited this page Mar 5, 2023 · 1 revision

How to install and maintain this application on your machine

The nodejs ecosystem is constantly evolving. Keeping up with latest versions is a nightmare. Below are some of my notes that I took on the go. They're not thorough, but they contain the basics.

Updating to the latest packages

Best advice - don't let too much time pass between updates.

ng update vs npm update

When requesting updates, it took me a while before understanding the difference between ng update and npm update:

  • ng update - Updates to the latest available version
  • npm update - This command will update all the packages listed to the latest version (specified by the tag config), respecting semver.

npm update will only inspect top-level packages. To recursively inspect all dependencies, use npm --depth 9999 update.

Reference: https://stackoverflow.com/questions/52128687/what-is-the-difference-between-ng-update-and-npm-update

Vulnerabilities

As soon as github or npm complain about vulnerabilities:

  • Check that you've got the latest nodejs version.
  • Check that you're at the latest angular version.
  • Then fix the vulnerability.

Nodejs

To keep your machine updated with nodejs:

  • On mac os: brew upgrade nodejs
  • On windows: Reinstall node from the original distribution: https://nodejs.org/en/download/
  • On linux: I don't use linux (I know I should).

Angular

Once you're up to date with nodejs, go to the angular upgrade guide:

And upgrade one major version after the other. Run tests and test the application after each upgrade.

ts-node

ts-node is a runtime transpiler so it allow you to import typescript files in runtime when using node.

To update ts-node:

ng update ts-node

Reference: https://stackoverflow.com/questions/63742790/unable-to-import-esm-ts-module-in-node/65163089#65163089