-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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(type): add support for new link: dependency type #3359
Conversation
Awesome! |
Great PR! Seems good to merge, except for the way you're accessing the command line parameter - |
ping @mgcrea, we'd love to have it in 0.25 that we plan to cut tomorrow |
@arcanis / @bestander Is there precedent for that storage in config that we could follow? |
Sure, you can take a look at this commit, for example. You just have to use |
@benlangfeld Not exactly, but not far! Look at the commit I just pushed if you're interested; basically, instead of adding a @mgcrea I've added a test to make sure that everything works, and unfortunately it seems there's still a few issues (I quickly checked, and I think one of them is because the install command is trying to read the manifest from the location. The other one is inside the check command, which fails because it is trying to make sure that the package path exists, which might not be true if the link is a broken link, or if the link target has no package.json). Can you take a look at this? Don't bother about the rebase, I'll fix them directly on Github before merging. |
I've tested this branch and the package name is not inferred from the path: $ yarn add link:../i18n-import-webpack-plugin --dev
yarn add v0.25.0-0
[1/4] 🔍 Resolving packages...
error Package "@0.0.0" doesn't have a "name". I have to run the following instead: yarn add i18n-import-webpack-plugin@link:../i18n-import-webpack-plugin --dev The first command works with |
Ping @mgcrea ? 🙂 |
@arcanis I'll have a look today. Thanks for the patches. |
7f3946f
to
9210f9d
Compare
Did finish a first squash+rebase+update, had to add code since the functionality was broken by a few recent commits on master (mostly from the Looks like my existing workflow is still broken on master, so I'll have to dig a bit deeper to make sure I have the relevant unit tests. |
Thanks, @mgcrea |
src/package-fetcher.js
Outdated
@@ -37,6 +37,13 @@ export default class PackageFetcher { | |||
const dest = this.config.generateHardModulePath(ref); | |||
|
|||
const remote = ref.remote; | |||
|
|||
// Mock metedata for linked dependencies | |||
if (remote.type === 'link') { |
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.
Would it be a bit cleaner if LinkFetcher existed instead?
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.
@bestander iirc at the time I started to work on the feature, I had to diverge earlier in the stack so there were no use for a LinkFetcher. Might be worth revisiting though.
6a52f8b
to
ae00d87
Compare
I think we're getting close to something "ready". I've fixed and added a unit-test for the issue encountered by @bazyli-brzoska. Test are OK, rebase done. @bestander, regarding the Let me know if there is something else I can do. |
50d81bc
to
7ad1bec
Compare
@mgcrea, I agree about the fetcher, makes sense to have an if block rather than more complexity. |
It is ready to merge although windows tests fail:
|
@bestander can fix the tests (add a platform ternary) if you want. Blogpost is a great idea, I'll try to come up with something. |
If you could fix it, please go ahead
…On 30 May 2017 at 11:45, Olivier Louvignes ***@***.***> wrote:
@bestander <https://github.com/bestander> can fix the tests (add a
platform ternary) if you want.
Blogpost is a great idea, I'll try to come up with something.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3359 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWGEj7B9kabAT43YNxPbMZKLMxUcLks5r-_NKgaJpZM4NVfc6>
.
|
@@ -49,21 +49,33 @@ export async function verifyTreeCheck( | |||
const dependenciesToCheckVersion: PackageToVerify[] = []; | |||
if (rootManifest.dependencies) { | |||
for (const name in rootManifest.dependencies) { | |||
const version = rootManifest.dependencies[name]; | |||
// skip linked dependencies | |||
const isLinkedDepencency = /^link:/i.test(version) || (/^file:/i.test(version) && config.linkFileDependencies); |
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.
@bestander This is the last thing I don't really like, as regex testing feels a bit hackish, but I would need to change the parent method API to pass the proper type. So was unsure if it was worth it.
7370f51
to
38fb1b3
Compare
I've fixed the tests for windows, (looks like the test are still failing there but for unrelated reasons). |
Thanks, yeah one test got broken earlier, investigating |
https://github.com/zertosh/yarn-link-test is an example of how |
Much ❤️ to everyone involved here, particularly @mgcrea. You guys are awesome and this will make my team very happy. We owe you at least some drinks! |
@bestander I guess this will now go in 0.26.0? By the recent cadence of minor releases, that would likely be cut within the next two weeks. Is that a fair estimate? |
We plan to cut on Monday. |
So ... is this documented somewhere and/or example usage available? Is
equivalent to
? |
(Equivalent meaning: will both approaches result in the same symlink being present in |
Why is this feature not documented ? Can we use it safely ? |
Summary
Following the accepted 0000-link-dependency-type.md RFC, and as discussed in yarnpkg/rfcs#34, here is a rebase of my previous work implementing both:
link:
specifier--linkFileDependencies
to overridefile:
specifier handling.Test plan
Did not port previous unit test back for now as the idea is to first discuss the implementation with @arcanis and @bestander. Code is very likely to change. Will happily add unit tests once the implementation looks OK.
After rebasing the PR, tests are currently failing (master is failing too so probably ok).