-
Notifications
You must be signed in to change notification settings - Fork 607
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
[rush] Copy resolutions section from source package.json for yarn #1360
Conversation
common/changes/@microsoft/rush/yarn-resolutions_2019-07-06-07-35.json
Outdated
Show resolved
Hide resolved
common/changes/@microsoft/node-core-library/yarn-resolutions_2019-07-06-07-35.json
Outdated
Show resolved
Hide resolved
@iclanton The latest change to use index signature is causing issues on CI but not locally. Local run on node 8.16.0 passes successfully.
With tslint version |
Sorry I didn't see this when you updated it. I'll take a look tomorrow when I'm at the office. |
The typescript version is 3.4. I fixed the issue you were seeing. |
@MasterLambaster - Can you take a look and respond to the open comments? |
@MasterLambaster @iclanton is there more work left here? I'd be happy to contribute, this change would be extremely useful to us. |
For whatever reasons there was one unresolved but yet redundant request open. It should be all good now. |
@iclanton can this be reviewed again? |
@iclanton any update? |
@apostolisms Could we get someone to review this? Overall the basic idea behind this PR seems sound to me. (Copy the If I remember right, this is the only way for Yarn to work around the |
Co-Authored-By: Ian Clanton-Thuon <[email protected]>
Co-Authored-By: Ian Clanton-Thuon <[email protected]>
478285e
to
87329b8
Compare
I just put together a repo to test this change and it doesn't seem to be working for me. Here's my test repo: This project has a "resolutions" field. and I checked in the However, no analogous resolution shows up in the Does someone have a repo where this is working? |
That's correct behavior. |
@MasterLambaster - but the resolution does seem to even be applying on the project level. I've specified a resolution in |
@iclanton could you please describe how do you verify it?
That resolutions are never making into It's been quite a while since initial PR and I'm struggling to recall why even having that within package were making sense 😂 |
The |
That's absolutely correct. In order to support that I need collect all resolutions from project Do you want me to restore this functionality? |
That behavior will probably produce undesired results. Perhaps I'm confused here. Can you provide a Rush repo where the a project's |
So, I've took a deeper look and tired to recall all circumstances. Having that said I can think of following possible solutions:
@iclanton do you see any other places that we can use to configure resolutions explicitly? |
When will it be merged? @octogonz |
@liyikun Lemme figure out what's up. For future reference, if a PR is getting overlooked, please let us know in the #contributor-helpline chat room. |
|
||
// NOTE: The "resolutions" field is a yarn specific feature that controls package | ||
// resolution override within yarn. | ||
private readonly _resolutions: { [name: string]: string }; |
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.
Should be a Map<string, string>
to match what others are doing
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.
Or I guess, Map<string, PackageJsonDependency>
if this matches a version specifier format?
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.
@D4N14L I agree that we should make this a complete PackageJsonEditor API rather than just a way to pass the options along. A config-file-with-data is generally preferable to a script-with-code, so for everyday problems, resolutions
is actually a better design than pnpmfile.js. (Although pnpmfile.js is still a good feature for advanced problems.)
I thought about adapting the PNPM shim to apply resolutions
for PNPM. But it turns out that PNPM later implemented this same feature, but they call it overrides
. (pnpm/pnpm#2946) Docs are here. In the issue pnpm/pnpm#1221 they point out that NPM reinvented the same feature in their "overrides" RFC but with some differences in its design. So all 3 package managers implement this feature in slightly different ways, all using different package.json fields.
We should support PNPM overrides and recommend it over pnpmfile.js. But that's not part of this PR. (I opened #2698 to track it)
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.
Fixed
/** | ||
* This field is a Yarn-specific feature that allows overriding of package resolution. | ||
*/ | ||
public get resolutions(): { [name: string]: string } { |
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.
ReadonlyArray<PackageJsonDependency>
if that type can be supported, otherwise return the a readonly object
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.
The structure is Record<string, string>
basically the same as "dependencies"
and "devDependenices"
, with the only difference being that the name can include glob-like patterns. I think we can model it the same way.
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.
Fixed
…tions # Conflicts: # apps/rush-lib/src/api/PackageJsonEditor.ts # apps/rush-lib/src/logic/InstallManager.ts # common/reviews/api/rush-lib.api.md
@D4N14L I have addressed your feedback |
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.
Approving to avoid blocking but comment needs to be addressed before merge
I tested this in a Rush repo with Yarn and confirmed that I also tested the error message for PNPM repos, but found that it is only printed with |
…son field is used without Yarn. This check only worked with useWorkspaces=false, and there may be valid use cases for packages that target multiple package managers
Released with Rush 5.47.0 |
Copy resolutions to the base
package.json
and to the project specific auto generated files.Fixes #831.