#PNPM workspace monorepo setup

6 messages · Page 1 of 1 (latest)

hollow sonnet
#

I'm trying to a simple monorepo with 3 subprojects. I want to be able to publish them all to npm, and I want the versions of all to always be the same.

I'm using pnpm, and I'm interested in using pnpm workspaces, but I have no experience with it.

Would also like to track changes via git.

Seems like this should be a really simple thing to do, but everything I find on monorepos seems drastically overcomplicated, or not properly explained.

PNPM workspaces docs page is here https://pnpm.io/workspaces but then it refers to separate projects for releases 😩

Just wondering if anything is familiar with monorepos and can help me with a simple setup?

pnpm has built-in support for monorepositories (AKA multi-package repositories,

#

Now I'm doing this

pnpm-workspace.yaml

packages:
  - 'client'
  - 'server'
  - 'shared'

version.cmd

@echo off
(
    npm --prefix shared version %*
) && (
    npm --prefix server version %* 
) && (
    npm --prefix client version %*
) && (
    git commit . -m "save for %*"
) && (
    npm version %* 
) && (
    cd shared && pnpm publish --access=public
) && (
    cd ../server && pnpm publish --access=public
) && (
    cd ../client && pnpm publish --access=public
)
hollow sonnet
#

Though I really want server and client to require the same version of shared as their own version

brittle glacier
#

Have you looked into project versioning tools such as Changeset or Semantic Release? You can wire up what you describe regarding fixed versioning relatively easy with those.

hollow sonnet
#

I started using "workspace:*" references for the shared package, and I think it is installed the same-version shared package when I do that