GithubHelp home page GithubHelp logo

pnpm-workspace-demo's Introduction

pnpm workspace

搭建

在项目父工程下创建 pnpm-workspace.yaml文件,里面声明需要加入workspace的目录

packages:
  # all packages in direct subdirs of packages/
  - 'packages/*'
  # all packages in subdirs of components/
  - 'components/**'
  # exclude packages that are inside test directories
  - '!**/test/**'

初始化你的子项目工程,并添加package.json文件,修改文件中的 name(项目名)和main(项目入口文件)两个字段,这关系到后面多个项目间互相引用依赖

安装依赖

  • 一次性安装父工程和子工程的所有依赖:pnpm i

  • 安装依赖到父工程:pnpm add <dependent name> -w/pnpm add <dependent name> -wD

  • 安装依赖到指定的子工程:pnpm add <dependent name> -r --filter <project name>

运行子工程命令

  • 运行某个子工程命令:pnpm run --filter <project name> <scripts name>

子工程互相引用

子工程互相引用的前提是package.json中的namemain字段得配置好

  • 在A工程中引用B工程:pnpm add nameA -r --filter nameB

pnpm-workspace-demo's People

Contributors

hjc0930 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.