Skip to content
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

fix(monorepo): fix issues with monorepo-ts peer deps #602

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/monorepo/src/projects/typescript/monorepo-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ export class MonorepoTsProject
},
include: ["**/*.ts", ".projenrc.ts"],
},
peerDeps: ["nx@^16", ...(options.peerDeps || [])],
devDeps: ["nx@^16", "@aws/pdk@^0", ...(options.devDeps || [])],
deps: ["aws-cdk-lib", "constructs", "cdk-nag", ...(options.deps || [])],
});

this.nxConfigurator = new NxConfigurator(this, {
Expand Down Expand Up @@ -201,6 +204,12 @@ export class MonorepoTsProject
);
break;
}
case NodePackageManager.NPM: {
// Allow older versions of peer deps to resolv compatibility issues
this.tasks.tryFind("install")?.reset("npm install --legacy-peer-deps");
this.tasks.tryFind("install:ci")?.reset("npm ci --legacy-peer-deps");
break;
}
}

this.workspaceConfig = options.workspaceConfig;
Expand Down Expand Up @@ -272,10 +281,6 @@ export class MonorepoTsProject
});
}

// Add dependency on nx 16
this.addPeerDeps("nx@^16");
this.addDevDeps("nx@^16", "@aws/pdk@^0");
this.addDeps("aws-cdk-lib", "constructs", "cdk-nag"); // Needed as this can be bundled in @aws/pdk
this.package.addPackageResolutions(
"@types/[email protected]",
"wrap-ansi@^7.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/pdk/_scripts/exec-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const engines = JSON.parse(
).engines;

if (engines) {
const pkgMgr = engines.pnpm ? "pnpm" : engines.yarn ? "yarn" : "npm";
execa.commandSync(`${pkgMgr}${isSynth ? " projen" : ""} ${process.argv.join(" ")}`, { stdio: "inherit" });
const pkgMgrCmd = engines.pnpm ? "pnpm" : engines.yarn ? "yarn" : "npm run";
execa.commandSync(`${pkgMgrCmd}${isSynth ? " default" : ""} ${process.argv.join(" ")}`, { stdio: "inherit" });
} else {
execa.commandSync(`npx projen ${process.argv.join(" ")}`, { stdio: "inherit"});
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading