question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--use-workspaces and npm

See original GitHub issue

The docs state that --use-workspaces “enables integration with yarn workspaces”. However, it makes no mention of npm. This is strange because npm also supports the concept of workspaces and is Lerna’s default package manager.

So naturally, I am wondering if --use-workspaces is safe to use with npm workspaces or not. Really, I would just like the ability to tell Lerna to use the workspaces that I already have defined in package.json so that I don’t have to define them again.

https://github.com/lerna/lerna/blob/main/commands/bootstrap/README.md#--use-workspaces

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

9reactions
ghost91-commented, Jun 27, 2022

Hey, bumping again. Now that maintenance has been handed over to Nrwl, are there any plans to add proper support for npm workspaces? I think not much would actually need to be done, most of the necessary changes can probably be backported from Lerna Lite, which is only based on workspaces and dropped the whole custom bootstrapping process. I think the most important change would be properly handling the subpackage versions in the root package-lock.json file, when bumping versions (see https://github.com/ghiscoding/lerna-lite/blob/main/packages/version/src/version-command.ts#L657).

7reactions
johncmunsoncommented, Jan 18, 2022

Given the following root-level package.json…

{
  "workspaces": [
    "packages/*"
  ]
}

I can confirm that using “packages”…

{
  "packages": [
    "packages/*"
  ],
  "version": "0.0.0"
}

is NOT equivalent to “useWorkspaces”…

{
  "useWorkspaces": true,
  "version": "0.0.0"
}

At least not when using npm. I have not tested this with yarn.

But when you’re using npm, the two methods above will produce very different results when analyzing the structure of node_modules, both at the root level and at the workspace level.

It would be nice if the docs were more clear surrounding the intended usage of “useWorkspaces”, how exactly it operates, and whether or not it’s supposed to be compatible with npm workspaces.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspaces - npm Docs
Workspaces is a generic term that refers to the set of features in the npm cli that provides support to managing multiple packages...
Read more >
Getting Started with npm Workspaces - Ruan Martinelli
In fact, npm is not trying to reinvent the wheel. You can find similarities between all three Workspace implementations.
Read more >
Is Lerna needed anymore with NPM 7.0.0's workspaces?
NPM 7 is out and it supports workspaces. they will also continue to develop this domain in the upcoming releases,.
Read more >
Better dev environments with npm workspaces | oliverjam.es
As of version 7 npm now includes a feature called "workspaces". ... To use workspaces you need to be on the latest version...
Read more >
npm workspaces and overrides #DemoDays - YouTube
Darcy Clarke, Staff Software engineering manager walks us through two significant additions to the npm -cli, workspaces and overrides along ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found