English (US) | 简体中文
Make sure you have pnpm and Turborepo installed globally.
npm -g install pnpm nx
npm -g exec pnpm setup
pnpm bootstrap
This will install deps with
pnpm install
, ant then setup all packages withnx run-many setup
.
pnpm dev
The example app will be available at http://localhost:8000 by default.
pnpm fix
# run ESLint/Stylelint/Prettier and attempt to fix found issues
pnpm lint
pnpm test
pnpm build
You may then serve the built app with pnpm serve
.
Use either the package name (the "name"
field in package.json
) or the relative
path to the package's folder (must be prefixed with ./
) to specify the package(s) on
which the command should be run.
pnpm --filter <package> <command> [...]
pnpm --filter web add react react-dom
pnpm --filter ./apps/web add react react-dom
# add react and react-dom as dependencies to the package named "web"
# whose folder is located at ./apps/web
pnpm --filter "@scope/*" run clean
pnpm --filter "./packages/*" run clean
# use glob to select multiple packages, the pattern must be quoted
add
for normal dependencies dependencies
pnpm --filter <package> add [dependency ...]
# pnpm --filter web add react react-dom
add -D
for development dependencies devDependencies
pnpm --filter <package> add -D [dependency ...]
# pnpm --filter web add -D jest
add --save-peer
for peer dependencies peerDependencies
pnpm --filter <package> add --save-peer [dependency ...]
# pnpm --filter ui add --save-peer react "monaco-editor@^0.31.0"
💡 for adding workspace packages as dependencies, use the same command as above, but
append --workspace
pnpm --filter <package> add [--save-dev|--save-peer] [dependency ...] --workspace
# pnpm --filter web add -D eslint-config-project --workspace