Skip to content

Commit 4af162c

Browse files
authored
fix(cli): override manually added resolutions (#2647)
fix(cli) override manually added resolutions This change ensures the CLI overrides any existing resolutions in a plugin's package.json to ensure the dynamic plugin's package.json properly refers to embedded packages. This fixes cases where a plugin package is using resolutions for more control of the dependencies to support offline builds. Signed-off-by: Stan Lewis <[email protected]>
1 parent cfca813 commit 4af162c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/metal-plums-bow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@janus-idp/cli": patch
3+
---
4+
5+
This change ensures the CLI properly updates any manually added resolutions a plugin has with the embedded version. This fixes cases where a plugin may be using resolutions for finer grained version control on packages the CLI would embed, such as native dependencies.

packages/cli/src/commands/export-dynamic-plugin/backend-embed-as-dependencies.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,9 @@ export function customizeForDynamicUse(options: {
785785
// See https://github.com/yarnpkg/yarn/issues/6373#issuecomment-760068356
786786
pkgToCustomize.devDependencies = {};
787787

788+
// additionalOverrides and additionalResolutions will override the
789+
// current package.json entries for "overrides" and "resolutions"
790+
// respectively
788791
const overrides = (pkgToCustomize as any).overrides || {};
789792
(pkgToCustomize as any).overrides = {
790793
// The following lines are a workaround for the fact that the @aws-sdk/util-utf8-browser package
@@ -795,8 +798,8 @@ export function customizeForDynamicUse(options: {
795798
'@aws-sdk/util-utf8-browser': {
796799
'@smithy/util-utf8': '^2.0.0',
797800
},
798-
...(options.additionalOverrides || {}),
799801
...overrides,
802+
...(options.additionalOverrides || {}),
800803
};
801804
const resolutions = (pkgToCustomize as any).resolutions || {};
802805
(pkgToCustomize as any).resolutions = {
@@ -806,8 +809,8 @@ export function customizeForDynamicUse(options: {
806809
//
807810
// See https://github.com/aws/aws-sdk-js-v3/issues/5305.
808811
'@aws-sdk/util-utf8-browser': 'npm:@smithy/util-utf8@~2',
809-
...(options.additionalResolutions || {}),
810812
...resolutions,
813+
...(options.additionalResolutions || {}),
811814
};
812815

813816
if (options.after) {

0 commit comments

Comments
 (0)