-
Notifications
You must be signed in to change notification settings - Fork 604
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] Fix an issue where usage of custom fields in dependenciesMeta caused rush install to think that shrinkwrap file is outdated #4992
base: main
Are you sure you want to change the base?
Changes from 3 commits
5d59dfe
5066bd6
5873c07
d0fc9cd
042b190
173d345
e8b8220
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@microsoft/rush", | ||
"comment": "Fix an issue where usage of custom fields in dependenciesMeta caused rush install to think that shrinkwrap file is outdated", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@microsoft/rush" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,19 +50,23 @@ export class PackageJsonDependency { | |
* @public | ||
*/ | ||
export class PackageJsonDependencyMeta { | ||
private _injected: boolean; | ||
private _sourceData: object; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And then use the more complete type here and in other places. |
||
private _onChange: () => void; | ||
|
||
public readonly name: string; | ||
|
||
public constructor(name: string, injected: boolean, onChange: () => void) { | ||
public constructor(name: string, sourceData: object, onChange: () => void) { | ||
this.name = name; | ||
this._injected = injected; | ||
this._sourceData = sourceData; | ||
this._onChange = onChange; | ||
} | ||
|
||
public get sourceData(): object { | ||
return this._sourceData; | ||
} | ||
|
||
public get injected(): boolean { | ||
return this._injected; | ||
return (this._sourceData as { injected?: boolean }).injected ?? false; | ||
} | ||
} | ||
|
||
|
@@ -107,7 +111,7 @@ export class PackageJsonEditor { | |
const devDependencies: { [key: string]: string } = data.devDependencies || {}; | ||
const resolutions: { [key: string]: string } = data.resolutions || {}; | ||
|
||
const dependenciesMeta: { [key: string]: { [key: string]: boolean } } = data.dependenciesMeta || {}; | ||
const dependenciesMeta: { [key: string]: object } = data.dependenciesMeta || {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this just reference |
||
|
||
const _onChange: () => void = this._onChange.bind(this); | ||
|
||
|
@@ -183,7 +187,7 @@ export class PackageJsonEditor { | |
Object.keys(dependenciesMeta || {}).forEach((packageName: string) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we update this to use |
||
this._dependenciesMeta.set( | ||
packageName, | ||
new PackageJsonDependencyMeta(packageName, dependenciesMeta[packageName].injected, _onChange) | ||
new PackageJsonDependencyMeta(packageName, dependenciesMeta[packageName], _onChange) | ||
); | ||
}); | ||
|
||
|
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.