wclr / yalc

Work with yarn/npm packages locally like a boss.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for "workspace:^" and "workspace:~"

javier-garcia-meteologica opened this issue · comments

The workspace protocol has 2 new specifications named workspace:^ and workspace:~.

They are already supported in pnpm and will supported by yarn in the near future.

commented

@javier-garcia-meteologica
Could you explain what is current behaviour/scenario and how this change will update it?

A monorepo contains the following packages.

  • my-package@1.0.0
  • foo@0.9.1
  • bar@2.3.4
  • another-package@1.2.3

There is a package with workspace dependencies.

{
  "name": "my-package",
  "version": "1.0.0",
  "dependencies": {
    "foo": "workspace:*",
    "bar": "workspace:^",
    "another-pkg": "workspace:~"
  }

Workspace dependency specifications only work within the monorepo. They have to be substituted when the project is packaged. pnpm and yarn would take care of this task but yalc doesn't invoke them. So if yalc packs the project it has to resolve those workspace version aliases and publish the following manifest.

{
  "name": "my-package",
  "version": "1.0.0",
  "dependencies": {
    "foo": "0.9.1",
    "bar": "^2.3.4",
    "another-pkg": "~1.2.3"
  }
commented

Ok, get it, thanks for the PR.