np icon indicating copy to clipboard operation
np copied to clipboard

yarn workspaces

Open Ore4444 opened this issue 5 years ago • 6 comments

Description

Support can be added to selectively publish one/some of your subpackges in a Yarn workspace. I imagine it would then seamlessly integrate with tools like Lerna. As of today, I couldn't find a tool to simply publish a single package (together with its inter-package deps) from a workspace

Ore4444 avatar Jun 12 '19 12:06 Ore4444

Related to: #141

Ore4444 avatar Mar 21 '20 20:03 Ore4444

Without lerna, Yarn Workspaces support would require looking at the top-level yarn.lock – otherwise np will try to use npm (and probably fail) or if you specify --yarn it will also fail because there is no lockfile that it can find.

Perhaps a simple solution would be to exec np from the root directory (with the yarn.lock) but specify a workspace package.json path?

mshwery avatar Jan 20 '21 22:01 mshwery

@mshwery I am also trying to get np with yarn workspaces working. I tried to execute np from the root but it didn't work. What do you mean exactly by specifying a workspace package.json path? Would be great if you could give an example.

konstantinmuenster avatar May 01 '21 18:05 konstantinmuenster

I don't think this is something you can achieve with np today.

My suggesting was to add a feature that could detect when yarn workspaces are used (by looking at the root package.json file's workspaces key).

You would probably need a way to also specify which workspace to publish. All np checks (like build, test and other lifecycle hooks) would likely need to be scoped to the workspace you want to publish.

mshwery avatar May 01 '21 19:05 mshwery

Hm, I hoped for an easy solution 😄 but anyways thanks for the quick response!

konstantinmuenster avatar May 02 '21 17:05 konstantinmuenster

It would be amazing to have equivalents to npm's --workspace and --workspaces flags for np.

fb55 avatar Jan 10 '22 23:01 fb55

I think this is too big of an ask for np. Monorepos already have plenty of their own publishing workflows

fregante avatar Feb 03 '23 10:02 fregante