-
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 all 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 | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,10 @@ | ||||||
{ | ||||||
"changes": [ | ||||||
{ | ||||||
"packageName": "@rushstack/node-core-library", | ||||||
"comment": "Extend IDependenciesMetaTable interface to support custom properties in \"dependenciesMeta\" entries", | ||||||
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.
Suggested change
|
||||||
"type": "minor" | ||||||
} | ||||||
], | ||||||
"packageName": "@rushstack/node-core-library" | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -684,6 +684,14 @@ export interface _IOperationStateJson { | |
nonCachedDurationMs: number; | ||
} | ||
|
||
// @public (undocumented) | ||
export interface IPackageJsonDependencyMetaSourceData { | ||
// (undocumented) | ||
[key: string]: unknown; | ||
// (undocumented) | ||
injected?: boolean; | ||
} | ||
|
||
// @public | ||
export interface IPackageManagerOptionsJsonBase { | ||
environmentVariables?: IConfigurationEnvironment; | ||
|
@@ -1005,11 +1013,13 @@ export class PackageJsonDependency { | |
|
||
// @public (undocumented) | ||
export class PackageJsonDependencyMeta { | ||
constructor(name: string, injected: boolean, onChange: () => void); | ||
constructor(name: string, sourceData: IPackageJsonDependencyMetaSourceData, onChange: () => void); | ||
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. This is a breaking change. Can this be reworked to maintain compatability? |
||
// (undocumented) | ||
get injected(): boolean; | ||
// (undocumented) | ||
readonly name: string; | ||
// (undocumented) | ||
get sourceData(): IPackageJsonDependencyMetaSourceData; | ||
} | ||
|
||
// @public (undocumented) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ export interface IPeerDependenciesMetaTable { | |
export interface IDependenciesMetaTable { | ||
[dependencyName: string]: { | ||
injected?: boolean; | ||
[key: string]: unknown; | ||
Comment on lines
70
to
+71
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. Instead of duplicating this in libraries/rush-lib/src/api/PackageJsonEditor.ts, can you just extract this object to its own interface and use that in rush-lib? |
||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,12 @@ import type { IShrinkwrapFilePolicyValidatorOptions } from '../policy/Shrinkwrap | |
import { PNPM_SHRINKWRAP_YAML_FORMAT } from './PnpmYamlCommon'; | ||
import { RushConstants } from '../RushConstants'; | ||
import type { IExperimentsJson } from '../../api/ExperimentsConfiguration'; | ||
import { DependencyType, type PackageJsonDependency, PackageJsonEditor } from '../../api/PackageJsonEditor'; | ||
import { | ||
DependencyType, | ||
type PackageJsonDependency, | ||
type IPackageJsonDependencyMetaSourceData, | ||
PackageJsonEditor | ||
} from '../../api/PackageJsonEditor'; | ||
import type { RushConfigurationProject } from '../../api/RushConfigurationProject'; | ||
import { PnpmfileConfiguration } from './PnpmfileConfiguration'; | ||
import { PnpmProjectShrinkwrapFile } from './PnpmProjectShrinkwrapFile'; | ||
|
@@ -32,15 +37,14 @@ import { PnpmOptionsConfiguration } from './PnpmOptionsConfiguration'; | |
import type { IPnpmfile, IPnpmfileContext } from './IPnpmfile'; | ||
import type { Subspace } from '../../api/Subspace'; | ||
import { CustomTipId, type CustomTipsConfiguration } from '../../api/CustomTipsConfiguration'; | ||
import { objectsAreDeepEqual } from '../../utilities/objectUtilities'; | ||
|
||
const yamlModule: typeof import('js-yaml') = Import.lazy('js-yaml', require); | ||
|
||
export interface IPeerDependenciesMetaYaml { | ||
optional?: boolean; | ||
} | ||
export interface IDependenciesMetaYaml { | ||
injected?: boolean; | ||
} | ||
export type IDependenciesMetaYaml = IPackageJsonDependencyMetaSourceData; | ||
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. Just get rid of this and have other things reference the other type. |
||
|
||
export type IPnpmV7VersionSpecifier = string; | ||
export interface IPnpmV8VersionSpecifier { | ||
|
@@ -1040,8 +1044,8 @@ export class PnpmShrinkwrapFile extends BaseShrinkwrapFile { | |
} | ||
} | ||
|
||
for (const { name, injected } of dependencyMetaList) { | ||
if (importer.dependenciesMeta?.[name]?.injected === injected) { | ||
for (const { name, sourceData } of dependencyMetaList) { | ||
if (objectsAreDeepEqual(importer.dependenciesMeta?.[name], sourceData)) { | ||
importerDependenciesMeta.delete(name); | ||
} | ||
} | ||
|
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.