fix(js): failing e2e test due to dependency (#31676)

This PR updates our `e2e-js` test to include dependencies for all
package managers and not just pnpm.

E2E Matrix for `e2e-js` is now passing:
https://github.com/nrwl/nx/actions/runs/15786673606/job/44504580439
This commit is contained in:
Nicholas Cunningham 2025-06-20 14:28:49 -06:00 committed by GitHub
parent 1f493bf251
commit df75799ed7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,18 +90,23 @@ ${content}`
addImports(viteParentLib);
const pm = getSelectedPackageManager();
if (pm === 'pnpm') {
// for pnpm we need to add the local packages as dependencies to each consumer package.json
// Add local packages as dependencies to each consumer package.json
// This is required for all package managers to satisfy dependency checks
const addDeps = (parentLib: string, includeRollupChildLib = false) => {
updateJson(`packages/${parentLib}/package.json`, (json) => {
json.dependencies ??= {};
json.dependencies[`@proj/${esbuildChildLib}`] = 'workspace:*';
json.dependencies[`@proj/${esbuildChildLib}`] =
pm === 'pnpm' ? 'workspace:*' : '*';
if (includeRollupChildLib) {
json.dependencies[`@proj/${rollupChildLib}`] = 'workspace:*';
json.dependencies[`@proj/${rollupChildLib}`] =
pm === 'pnpm' ? 'workspace:*' : '*';
}
json.dependencies[`@proj/${swcChildLib}`] = 'workspace:*';
json.dependencies[`@proj/${tscChildLib}`] = 'workspace:*';
json.dependencies[`@proj/${viteChildLib}`] = 'workspace:*';
json.dependencies[`@proj/${swcChildLib}`] =
pm === 'pnpm' ? 'workspace:*' : '*';
json.dependencies[`@proj/${tscChildLib}`] =
pm === 'pnpm' ? 'workspace:*' : '*';
json.dependencies[`@proj/${viteChildLib}`] =
pm === 'pnpm' ? 'workspace:*' : '*';
return json;
});
};
@ -112,6 +117,7 @@ ${content}`
addDeps(tscParentLib);
addDeps(viteParentLib);
if (pm === 'pnpm') {
const pmc = getPackageManagerCommand({ packageManager: pm });
runCommand(pmc.install);
}