Skip to content

zaro/yarn-plugin-deploy-lockfiles

 
 

Repository files navigation

Why this plugin

In the context of a Yarn 2+ monorepo with workspaces, you are supposed to have only one top-level yarn.lock file at the root of your monorepo.

You cannot create yarn.lock at package level, because they will be isolated from the rest of the monorepo, defeating the purpose of workspaces and disabling package hoisting.

Yet, you may need to generate individual lockfiles when publishing your packages, especially when they are applications or repos that may be published in individual read-only repositories.

See yarnpkg/berry#1223 for more details.

Install

  • yarn plugin import https://raw.githubusercontent.com/zaro/yarn-plugin-deploy-lockfiles/main/bundles/%40yarnpkg/plugin-deploy-lockfiles.js

Example:

"workspaces": {
    "packages": [
      "packages/*",
      "starters/*",
      "docusaurus"
    ]
  },

Eeach folder listed in the workspace will get a yarn.deploy.lock file generated inside of it.

Run

Simply run yarn: you'll see a few lockfiles popping out at each workspace folder. You can use those lockfiles as you wish, for example by setting

YARN_LOCKFILE_FILENAME=yarn.deploy.lock

to use them as the main lockfile for deployment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%