Skip to content

Latest commit

 

History

History
106 lines (73 loc) · 2.27 KB

CONTRIBUTING.md

File metadata and controls

106 lines (73 loc) · 2.27 KB

English (US) | 简体中文

Contributing

Development

Make sure you have pnpm and Turborepo installed globally.

npm -g install pnpm nx
npm -g exec pnpm setup

First time setup

pnpm bootstrap

This will install deps with pnpm install, ant then setup all packages with nx run-many setup.

Starting the dev server

pnpm dev

The example app will be available at http://localhost:8000 by default.

Formatting

pnpm fix
# run ESLint/Stylelint/Prettier and attempt to fix found issues

Linting and testing

pnpm lint
pnpm test

Building

pnpm build

You may then serve the built app with pnpm serve.

Per-package operations

https://pnpm.io/filtering

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

Adding dependencies

https://pnpm.io/cli/add

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