javascriptnode.jspnpmpnpm-workspace

Pnpm workspace config to publish pakcages under a specific directory only


I have created a monorepo, and the folder structure is like the below screenshot.

Currently, if I run pnpm publish in the root directory, it will publish the root project pnpm-trial and all the libs under packages directory, which is not what I expected.

I want to only publish all the packages(common, my-ui-library) under the packages folder, how can I do it?

BTW, you can think my package name is the same as the directory name in this example.

enter image description here


Solution

  • It seems we can use --filter to achieve it:

    pnpm --filter \"./packages/**\" publish
    

    https://pnpm.io/filtering