pnpm All In One
pnpm All In One
Version: 7.x
bash shell
# Linux / macOS
$ curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
# Node.js is not preinstalled
$ curl -fsSL https://get.pnpm.io/install.sh | sh -
install
# Homebrew
$ brew install pnpm
# npm
$ npm install -g pnpm
# npx
$ npx pnpm add -g pnpm
#/Users/xgqfrms-mbp/.nvm/versions/node/v12.18.0/pnpm-global/5:
$ pnpm -v
# 6.32.3
$ pnpm -h
Version 6.32.3
Usage: pnpm [command] [flags]
pnpm [ -h | --help | -v | --version ]
Manage your dependencies:
add Installs a package and any packages that it depends
on. By default, any new package is installed as a
prod dependency
import Generates a pnpm-lock.yaml from an npm
package-lock.json (or npm-shrinkwrap.json) file
i, install Install all dependencies for a project
it, install-test Runs a pnpm install followed immediately by a pnpm
test
ln, link Connect the local project to another one
prune Removes extraneous packages
rb, rebuild Rebuild a package
rm, remove Removes packages from node_modules and from the
project's package.json
unlink Unlinks a package. Like yarn unlink but pnpm
re-installs the dependency after removing the
external link
up, update Updates packages to their latest version based on the
specified range
Review your dependencies:
audit Checks for known security issues with the installed
packages
ls, list Print all the versions of packages that are
installed, as well as their dependencies, in a
tree-structure
outdated Check for outdated packages
Run your scripts:
exec Executes a shell command in scope of a project
run Runs a defined package script
start Runs an arbitrary command specified in the package's
"start" property of its "scripts" object
t, test Runs a package's "test" script, if one was provided
Other:
pack
publish Publishes a package to the registry
root
Manage your store:
store add Adds new packages to the pnpm store directly. Does not
modify any projects or files outside the store
store prune Removes unreferenced (extraneous, orphan) packages from
the store
store status Checks for modified packages in the store
https://pnpm.io/installation#compatibility
CI/CD
.gitlab-ci.yml
stages:
- build
build:
stage: build
image: node:14.16.0-buster
before_script:
- curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6
- pnpm config set store-dir .pnpm-store
script:
- pnpm install # install dependencies
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .pnpm-store
.github/workflows/NAME.yml
name: pnpm Example Workflow
on:
push:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [15]
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.20.3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
.travis.yml
cache:
npm: false
directories:
- "~/.pnpm-store"
before_install:
- curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6
- pnpm config set store-dir ~/.pnpm-store
install:
- pnpm install
https://pnpm.io/continuous-integration
demo
$ pnpm create vite
$ yarn create vite
$ npm create vite@latest
https://vitejs.dev/guide/#scaffolding-your-first-vite-project
monorepo
https://en.wikipedia.org/wiki/Monorepo
https://www.toptal.com/front-end/guide-to-monorepos
-
yarn workspaces
-
lerna
https://github.com/lerna/lerna
git
git submodule
https://www.atlassian.com/git/tutorials/monorepos
https://git-scm.com/docs/git-submodule
https://git-scm.com/book/en/v2/Git-Tools-Submodules
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/15654797.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2020-12-07 TypeScript keyof & typeof All In One
2020-12-07 泛型是什么设计模式
2020-12-07 TypeScript Generics All In one
2020-12-07 设计模式六大原则 All In one
2020-12-07 TypeScript Config All In One
2020-12-07 GitHub Actions UTC 时间转换 All In One
2020-12-07 Apple Watch Series 6 字母图案 (图解教程) All In One