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(bootstrap): Allow to specify custom folder for packages symlinks #2081
Conversation
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.
Literally no tests added, not going to be accepted without them.
I'm unclear what problem this solves, aside from promoting dubious patterns like deeply-nested subpath imports (they should be exported from the module entry or factored into separate packages).
@@ -53,6 +53,9 @@ class Package { | |||
rootPath: { | |||
value: rootPath, | |||
}, | |||
symLinkDir: { |
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.
symlinkDir
, if you must. We don't call symlinks "sym-links", after all.
@@ -53,6 +53,9 @@ class Package { | |||
rootPath: { | |||
value: rootPath, | |||
}, | |||
symLinkDir: { | |||
value: pkg.symLinkDir, |
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.
Can you point me to an example of any other usage in the ecosystem? I don't want to add arbitrary fields to package.json just to satisfy a vanishingly small percentage of use cases.
@@ -77,7 +77,10 @@ function symlinkDependencies(packages, packageGraph, tracker) { | |||
}); | |||
|
|||
// create package symlink | |||
chain = chain.then(() => createSymlink(dependencyNode.location, targetDirectory, "junction")); | |||
const dependencyLocation = dependencyNode.pkg.symLinkDir | |||
? path.resolve(dependencyNode.location, dependencyNode.pkg.symLinkDir) |
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.
Wouldn't this be better served by the lerna bootstrap
equivalent of --contents
? This smells to high heaven of Angular-isms.
Looks like this is halfway there to closing #2209. The In a file within import { MyComponent } from '@org/core-components' This works for a published package but since import { MyComponent } from '@org/core-components/dist' This PR and #2209 would make that workflow much easier. @paul-roman are you planning to add tests/make any additional changes? Otherwise I could possibly take a stab at contributing this. Based on these discussions, what I'm seeing is some other changes:
|
I have opened a new PR that continues these changes: #2274 |
Closing in favor of #2274 |
Description
This allows to specify a
symLinkDir
in a packagepackage.json
to create the symbolic link from a specific folder of the package.Motivation and Context
This was motivated by the need to access to the folder structure of the transpiled source of one of our packages, thus we needed that only the
dist
folder was used in the symbolic link.How Has This Been Tested?
We added a
"symLinkDir": "dist"
field in one of our packagespackage.json
, we ranlerna bootstrap
and used another package which depends on the first one. Only thedist
folder was used for the symbolic link, allowing us to access to the whole folder structure of thedist
folder usingTypes of changes
Checklist: