Greenhand notes
.npmrc
@private:registry=https://git.gitlab.com/api/v4/projects/project_id/packages/npm/
//git.gitlab.com/api/v4/projects/project_id/packages/npm/:_authToken="${NPM_TOKEN}"
npm install --loglevel verbose # view install logs
How can I prevent my package from being published in the official registry?
"publishConfig": {
"@npm:registry": "https://git.gitlab.com/api/v4/projects/project_id/packages/npm/"
}
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
git config --global url."https://github.com/".insteadOf git@github.com:
# For an organization-scoped package, replace my-org with the name of your organization:
npm init --scope=@my-org
# For a user-scoped package, replace my-username with your username:
npm init --scope=@my-username
How do I publish npm package to private registyry
npm config set @private:registry=https://git.gitlab.com/api/v4/projects/project_id/packages/npm/
NPM_TOKEN=your_token npm publish
Using private packages in a CI/CD workflow
How to use private Github repo as npm dependency
config
npm config list
npm config set proxy=http://127.0.0.1:8087
npm config set https-proxy http://127.0.0.1:8087
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
npm config delete proxy
npm config delete https-proxy
npm config set strict-ssl false // SSL error
npm config get registry
npm config set registry https://registry.npmmirror.com/ // 设置淘宝源(已更新)
npm config set registry https://registry.npmjs.org/
npm config set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass/
npm config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver
npm config set electron_mirror https://registry.npmmirror.com/mirrors/electron/
yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver
yarn config set electron_mirror https://registry.npmmirror.com/mirrors/electron/
yarn config set registry https://registry.npmmirror.com/
yarn config set registry https://registry.yarnpkg.com
yarn config set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass/
yarn config set phantomjs_cdnurl http://cnpmjs.org/downloads
yarn config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/
yarn config set profiler_binary_host_mirror https://registry.npmmirror.com/mirrors/node-inspector/
Package update
# `npm-check-updates` a utility that automatically adjusts a package.json file with the latest version of all dependencies
npm i -g npm-check-updates
ncu -u
npm install
# use npx
npx npm-check-updates -u
npm install
# To see which modules are outdated, just run `npm outdated`.
# It will list any installed dependencies that have newer versions available.
npm outdated
# To update one dependency to its lastest version without having to manually open the `package.json`
npm install {package-name}@* {save flags?}
# 1. have a valid `yarn.lock` file
# 2. delete `package-lock.json` at first
yarn upgrade-interactive --latest