Skip to content

Commit

Permalink
[release-1.4] fix(cli): adjust embedded module searching (#2578)
Browse files Browse the repository at this point in the history
fix(cli): adjust embedded module searching

This change adjusts the directory used when the CLI attempts a require
call when discovering a built embedded package from using the dynamic
plugin package to using the package of the discovered built embedded
package.

Signed-off-by: Stan Lewis <gashcrumb@gmail.com>
Co-authored-by: Stan Lewis <gashcrumb@gmail.com>
  • Loading branch information
openshift-cherrypick-robot and gashcrumb authored Dec 2, 2024
1 parent 86fb3cd commit 318af8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-turtles-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@janus-idp/cli": patch
---

fix(cli): adjust embedded module searching. The CLI attempts a require call to detect built embedded packages, this change adjusts the directory this require is attempted from to be at the level of discovered package instead of the dynamic plugin package.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function backend(opts: OptionValues): Promise<string> {
pkg,
packagesToEmbed,
monoRepoPackages,
createRequire(`${paths.targetDir}/package.json`),
createRequire(path.join(paths.targetDir, 'package.json')),
[],
);
const embeddedPackages = embeddedResolvedPackages.map(e => e.packageName);
Expand Down Expand Up @@ -614,13 +614,13 @@ async function searchEmbedded(
parentPackageName: pkg.name,
alreadyPacked,
});

// scan for embedded packages under the resolved package
resolved.push(
...(await searchEmbedded(
resolvedPackage,
embedded,
monoRepoPackages,
req,
createRequire(path.join(resolvedPackageDir, 'package.json')),
[...alreadyResolved, ...resolved],
)),
);
Expand Down

0 comments on commit 318af8b

Please sign in to comment.