- Install pnpm
npm install -g pnpm
- Install dependencies (for the entire workspace)
pnpm i
- Start
# Start the open source version
pnpm dev:oss
# Start daas
pnpm start:daas
- Command Line Arguments
Common parameters include
--port
and--dest
,For more details vue-cli
# In the root directory, start with a specified port (an additional `--` may be needed on Windows)
pnpm start:daas --port=8100
# Equivalent to
cd apps/daas
pnpm start:test --port=8100
- Set Registry
# Using nrm
npm i -g nrm
nrm use taobao
# Or set manually
pnpm set registry https://registry.npmmirror.com/
# Check the set source
pnpm get registry
Use git worktree to develop multiple branches simultaneously
- For example, to check out the
main
branch into a specified directory:
git worktree add ../main main
# Develop in the main directory:
cd ../main
pnpm i
pnpm dev:oss
- Prune an abandoned checked-out branch
rm -rf ../dfs
git worktree prune
# 或者
git worktree remove ../dfs
- git worktree allows for rapid parallel development, with multiple branches of the same project evolving in parallel.
- Commits from git worktree can be shared within the same project.
- Compared to cloning the project separately, git worktree saves hard drive space and, because it uses hard links, is much faster than cloning.
npm | pnpm |
---|---|
npm install |
pnpm install |
npm i <pkg> |
pnpm add <pkg> |
npm run <cmd> |
pnpm <cmd> |
npm uninstall <pkg> |
pnpm remove <pkg> |
npm update <pkg> |
pnpm update/up <pkg> |
# pnpm-workspace.yaml
packages:
# Module packages
- 'packages/*'
# Application packages
- 'apps/*'
Command | Meaning |
---|---|
pnpm add sax |
Save to dependencies |
pnpm add -D sax |
Save to devDependencies |
pnpm add -O sax |
Save to optionalDependencies |
pnpm add sax@next |
Install from the next tag |
pnpm add [email protected] |
Specify version 3.0.0 |
- Add dependencies in the root workspace:
# -D --> devDependencies
pnpm add prettier -w -D
- Add a dependency in daas with --filter
pnpm add qs --filter daas
- Add a dependency in all packages:
pnpm add qs -r
pnpm run start
# The `run` can be omitted
pnpm start
# Partial execution
pnpm start --filter daas