useful-npm-scripts
A collection of useful npm scripts
โ๏ธ Development tasks
npm run dev
watch for changes in files and relaunch the service, using Nodemon.
๐ฆ Linting tasks
npm run lint
review the filesnpm run lint:fix
review all the files and autofix them.
๐งช Testing tasks
npm run test
runs all the tests oncenpm run test:coverage
runs the tests and generates a coverage table and HTML report.npm run test:watch
runs the tests in watch mode.
๐ก๏ธ Security tasks
npm run security
runs all thesecurity:*
tasks in parallelnpm run security:lockfile
checks thepackage-lock.json
andyarn.lock
integrity in order to prevent poisoned dependencies by usinglockfile-lint
. More info in snyk blog | Why npm lockfiles can be a security blindspot for injecting malicious modulesnpm run security:gitleaks
scans the git history in order to find leaked credentials (using patterns) by running a docker imagezricethezav/gitleaks
. More info in Github zricethezav/gitleaksnpm run security:dependencies
runsnpm audit
andSnyk test
in order to detect dependencies with known vulnerabilities.npm run security:docker
use Snyk to scan yourDockerfile
and detect known vulnerabilities in the base image used for production mode.