初始化 nx 工作空間
npx create-nx-workspace zhi --package-manager=pnpm --preset=ts
創建 package
pnpm nx generate @nrwl/js:library zhi-env --publishable --importPath zhi-env
構建
構建單個包
pnpm nx build zhi-env
構建所有的包
pnpm nx run-many --target=build
只構建改變了的
pnpm nx affected --target=build
發佈
pnpm nx publish zhi-env
校驗
pnpm nx lint zhi-env
測試
pnpm nx test zhi-env
瞭解更多
Core Features Read about the core features of Nx.
Mental Model Get a deeper understanding of the mental model.
Adopting Nx Learn how to add Nx to your existing repo.
Integrated Repos vs Package-Based Repos Learn about two styles of monorepos.
React Tutorial A step-by-step tutorial showing how to build an integrated monorepo with React applications sharing code.
Node.js Tutorial A step-by-step tutorial showing how to build an integrated monorepo with Node.js applications sharing code.
參考
https://nx.dev/getting-started/integrated-repo-tutorial - Nx