project-env
1.1.6 • Public • Published
- Lock Node.js Version
- Lock PackageManager Version (npm/yarn/pnpm)
- install n
npx project-env node=20.11.1 pnpm=8.15.4
"scripts": {
"project-env": "npx -y project-env node=18.19.1 pnpm=8.15.4",
"preinstall": "npx -y project-env onlyAllow",
"prestart": "npx -y project-env dev",
"dev": "npm run start",
}
"scripts": { "dev": "npx project-env dev && echo hello-dev" }
- run
npm run dev
auto switch node versions
node=20.11.1
pnpm=8.15.4
npmMirror=https://registry.npmmirror.com/
nodeMirror=https://npmmirror.com/mirrors/node
debug=false
-
engines=true
设置为false则不切换node版本
// Expected environment
const wanted = getWanted()
// Current environment
const current = whichPmRuns()
// Config .gitignore
const lockFileSuccess = await gitignoreLockfile(wanted.name)
// Config .npmrc
const npmrcSuccess = await npmrcSettings()
// Config package.json
const packagejsonSuccess = await packageJson()
// Check Node.js version
const nodeSuccess = await checkNode(wanted, current)
// Check PackageManager version
const pmSuccess = await checkNpm(wanted)
Package Sidebar
Install
Weekly Downloads