Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  28] [ 5]  / answers: 1 / hits: 6516  / 5 Years ago, wed, september 18, 2019, 12:00:00

Yarn's link allows you to register a local package for symlinking into another local package. To use link you cd into the package directory and run yarn link. This works fine on individual packages, however I have a monorepo, using Yarn's workspaces alongside Lerna. There are many packages, and I would like a simple way of linking all the packages within the monorepo.



My package.json:




workspaces: [
packages/*
],



My lerna.json:



{
npmClient: yarn,
useWorkspaces: true,
packages: [
packages/*
],

}


Is there a simple way to run yarn link (and yarn unlink) on each package?


More From » yarnpkg

 Answers
1

Lerna provides the exec command to 'Run an arbitrary command in each package':



link.sh



lerna exec -- yarn link


unlink.sh



lerna exec -- yarn unlink

[#6210] Monday, September 16, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaelynncherokeeg

Total Points: 697
Total Questions: 109
Total Answers: 104

Location: France
Member since Thu, Mar 18, 2021
3 Years ago
jaelynncherokeeg questions
Thu, May 27, 21, 00:00, 3 Years ago
Fri, Jan 24, 20, 00:00, 4 Years ago
Thu, Nov 14, 19, 00:00, 5 Years ago
Wed, May 15, 19, 00:00, 5 Years ago
;