Skip to content

Latest commit

 

History

History
425 lines (367 loc) · 14.9 KB

utils-node.md

File metadata and controls

425 lines (367 loc) · 14.9 KB

NODEJS

BASIC

PACKAGE MANAGER

BUNDLER / BUILDER

STARTER

LIST

HOSTING: APP

HOSTING: SCHEDULING

UTILS NPM

UTILS ALL

MONITORING / LOGGING

LIBS: ALL

LIBS: WORKER THREAD

LIBS: TESTING

LIBS: SSE / SERVER SENT EVENT

LIBS: DOM

LIBS: REQUEST

LIBS: CRON

LIBS: TESTING

LIBS: ENV

LIBS: AUTH / OIDC

LIBS: CACHE

LIBS: AI

LIBS: IMAGES

LIBS: DATABASE / DB

LIBS: CLI / PROMPTS

LIBS: INSTALL / COMPILE

LIBS: GAME

SERVER: PROXY

SERVER: EXPRESS/ITTY

SERVER: INFRA

SERVER: EDGES

## SERVER: ALL

FRAMEWORKS

BASICS

The ECMAScript modules (ES or ESM modules) have a standard TC39 function that was not existing prior to Node version 14. This feature can only be used starting from Node16 and can be very helpful to charge the JavaScript modules. Unlike CommonJS, ESM provides an asynchronous API for loading modules. one advantage is an improved syntax via the import and export instructions. To use ESM you can declare "type": "module" in your file package.json.

NODE UPDATE WINDOWS

  1. download & install node : latest version from official website
  2. use npm-windows-upgrade to update npm

COMMANDS

NPM

Helper

npm list -g --depth 0 (list the global package installed)
npx ... (run directly a global or local package from the node_modules)
npx ngcc (example to run angular ngcc in an angular (v9) project)

npm run command --configuration production (pass simple param to the npm command, the same with yarn)
npm run command -- --configuration production (pass complex param to the npm command, the same with yarn)

Clean

# Clean node project before updgrade or reinstall
# Command for Linux
rm -rf package-lock.json
rm -rf yarn.lock
rm -rf node_modules

Or see for other OS Utils-cmd

Versions

  • package version has 3 parts - major.minor.patch
  • ^ = latest minor version will be installed
  • ~ = latest patch version will be installed
npm outdated # check the dep to update
npm update # update all to the wanted
npm update mypackage1 # update one to the wanted
npm update mypackage1 mypackage2 # update many to the wanted
npm install mypackage1@latest # update one to the latest (major)
npx npm-check-updates -u # update all to the latest (major)

MODULES