从Integrated-Repos上手nx

初始化 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

/nrwl/nx-recipes/tree/main/integrated

posted @ 2023-04-04 22:18  灯塔下的守望者  阅读(37)  评论(0编辑  收藏  举报