Code Monkey home page Code Monkey logo

pnpm-workspace's Introduction

根目录

安装依赖

共用的依赖都安装到根目录

pnpm install typescript -D -W

packages 下的项目没有安装 ts,但是倘若在项目中使用到,就会通过依赖递归查找的原则逐级往上寻找,自然会找到 monorepo 中根目录的依赖。

子项目

创建子项目

package.json 的 name 格式如:@pnpm-workspace/share ,需与根目录的 package.json 对齐

安装依赖

方式一

cd packages/xxx
pnpm i lodash -S

方式二

# 支持指定多个 --filter
pnpm i lodash -r --filter @pnpm-workspace/test1

引用其他子项目

如 test1 引用 share

# 安装 share 包
pnpm i -S @pnpm-workspace/share@* --filter @pnpm-workspace/test1

然后就可以使用了

import { isString } from '@pnpm-workspace/share';
console.log(isString('123'));

pnpm-workspace's People

Contributors

wenfujie 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.