New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(link): Use publishConfig.directory
as symlink source if it exists to allow linking sub-directories
#2274
feat(link): Use publishConfig.directory
as symlink source if it exists to allow linking sub-directories
#2274
Conversation
…l-roman/lerna into feat/lernagh-2209/symlink-subdir
contents
as symlink source if it exists to allow linking sub-directoriespublishConfig.directory
as symlink source if it exists to allow linking sub-directories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding tests, they look good. A few more additions to make this "fully formed" and we're good to go.
I don't see this as a breaking change, really. If one is already using |
commands/link/__tests__/__fixtures__/with-contents/packages/package-3/cli1.js
Outdated
Show resolved
Hide resolved
commands/link/__tests__/__fixtures__/with-contents/packages/package-1/package.json
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much! Just remove the unused with-contents fixture under bootstrap, and we're good to go!
commands/bootstrap/__tests__/__fixtures__/with-contents/lerna.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Published in v3.17.0 |
Description
This is a fork of #2081 but uses the suggestions from #2209 (comment)
pkg.contents
to resolve symlink source path, allowing usage ofpublishConfig.directory
to link to a sub-directory--contents
tobootstrap
andlink
with docsTODO
directory
with regards tolink
commandOpen Questions
❓I believe this may be a breaking change, as anyone usingpublishConfig.directory
and who've runlerna link
before will experience a change in behavior. I could enhance this PR to include a flag forlink
, suggestions welcome.❓ I'm unclear what the comment "And probably need to make thepkg.bin
field resolvable from contents, as well (it's currently hard-code)" refers to. In the Jest snapshots, it looks correct for bin files (I think) but wondering if @evocateur had some more context for that comment that I should add to the PR.Motivation and Context
Closes #2209
There was an existing PR already #2081 but it needed tests and I believe the idea was to use
pkg.contents
instead of introducing a new config property.I explained my motivation/need in my comment (#2081 (comment)):
The
publishConfig.directory
works well for publishing. In our monorepo we have two packages,core
andbaked
.baked
uses components fromcore
. Since we use Rollup + Babel + TypeScript (these are libraries), we have adist
directory that we publish as the package. While we can publish new versions of thecore
components, for local development we're looking at usinglerna link
to make that easier to have a nicer workflow.In a file within
baked
you may have:This works for a published package but since
lerna link
symlinks the root directory and not thedist
directory, for local development you must change the path:How Has This Been Tested?
lerna
withnpm link
and tested within our own monorepo for our use casebaked
->core
and successfully consumed TypeScript-based components from the symlinkedcore
package.Types of changes
Checklist: