Skip to content

Commit

Permalink
fix(cli): adjust embedded module searching (#2577)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gashcrumb authored Dec 2, 2024
1 parent 3d22a7d commit 6d292af
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 @@ -611,13 +611,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 6d292af

Please sign in to comment.