Cleaning up npm
I did a little deep dive learning today on npm modules. There were some vulnerabilities and dependencies that were in the wrong places in the package.json file. View commit.
I added some notes to the README.md file on how to interact with the package manager. The code is also below:
# CD to the UI folder.
cd ${GOPATH}/src/app/ui
# Check the versions of packages.
npm outdated
# Update all the packages to the latest version (specified by the tag config),
# respecting semver.
# https://docs.npmjs.com/cli-commands/update.html
npm update
# Scan your project for vulnerabilities and automatically install any compatible
# updates to vulnerable dependencies.
# https://docs.npmjs.com/cli/audit
npm audit fix
# Get a verion number and a list of all packages that rely on another package.
# https://docs.npmjs.com/cli/ls
npm ls typescript
# View all top level packages.
npm ls --depth=0
# Install the latest version of a package.
# https://bytearcher.com/articles/using-npm-update-and-npm-outdated-to-update-dependencies/
npm install eslint@latest
# Install the latest verson package of a major version.
npm install eslint@^5.0.0
# Install the exact version of a package.
npm install lodash@4.17.4
# Remove a package.
# https://docs.npmjs.com/cli/uninstall
npm uninstall eslint-config-standard
# Use --save (-S) to add a package to the package.json dependencies (packages
# required when the app is built).
# Use --save-dev (-D) to add a package to the package.json devDependencies
# (packages used during dev to build, bundle, lint).