Skip to content

Commit

Permalink
chore(nx-monorepo)!: improve nx project and target configs
Browse files Browse the repository at this point in the history
- enable PDKProject direct nx project config
- move default nx build target to workspace
- remove legacy nx override logic
- separate out aws-arch generate task and enable caching

BREAKING CHANGE: modified nx-monorepo config settings for Nx
1. `WorkspaceConfig.nxConfig` type `NxConfig => Nx.WorkspaceConfig`
2. `overrideProjectTargets` removed in favor of `PDKProject.nx`
config to manage Nx project

See [PR 231](#231)
  • Loading branch information
JeremyJonas authored and agdimech committed Jan 16, 2023
1 parent 4cafb59 commit be8c6c8
Show file tree
Hide file tree
Showing 26 changed files with 465 additions and 551 deletions.
23 changes: 22 additions & 1 deletion nx.json

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

2 changes: 1 addition & 1 deletion packages/aws-arch/.projen/tasks.json

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

49 changes: 32 additions & 17 deletions packages/aws-arch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,40 +167,55 @@
"NOTICE",
"jsii"
],
"resolutions": {
"@types/prettier": "2.6.0",
"ansi-regex": "^5.0.1",
"underscore": "^1.12.1",
"deep-extend": "^0.5.1",
"argparse": "^1.0.10",
"debug": "^2.6.9",
"minimist": "^1.2.6",
"ejs": "^3.1.7",
"async": "^2.6.4",
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/lib",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/test-reports",
"{projectRoot}/target",
"{projectRoot}/.jsii",
"{projectRoot}/assets",
"{projectRoot}/src/generated"
"{projectRoot}/LICENSE_THIRD_PARTY",
"{projectRoot}/.jsii"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
},
{
"target": "generate",
"projects": "dependencies"
}
]
},
"generate": {
"inputs": [
"{projectRoot}/scripts/**",
"!{projectRoot}/src/*",
"{projectRoot}/src/!(generated)/**"
],
"outputs": [
"{projectRoot}/assets",
"{projectRoot}/src/generated"
]
}
}
},
"resolutions": {
"@types/prettier": "2.6.0",
"ansi-regex": "^5.0.1",
"underscore": "^1.12.1",
"deep-extend": "^0.5.1",
"argparse": "^1.0.10",
"debug": "^2.6.9",
"minimist": "^1.2.6",
"ejs": "^3.1.7",
"async": "^2.6.4",
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
48 changes: 25 additions & 23 deletions packages/aws-prototyping-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,37 +157,17 @@
"bundle": {
"exclude": true
},
"exports": {
".": "./index.js",
"./package.json": "./package.json",
"./.jsii": "./.jsii",
"./.warnings.jsii.js": "./.warnings.jsii.js",
"./nx-monorepo": "./nx-monorepo/index.js",
"./pdk-nag": "./pdk-nag/index.js",
"./pipeline": "./pipeline/index.js"
},
"resolutions": {
"@types/prettier": "2.6.0",
"ansi-regex": "^5.0.1",
"underscore": "^1.12.1",
"deep-extend": "^0.5.1",
"argparse": "^1.0.10",
"debug": "^2.6.9",
"minimist": "^1.2.6",
"ejs": "^3.1.7",
"async": "^2.6.4",
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/lib",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/test-reports",
"{projectRoot}/target",
"{projectRoot}/LICENSE_THIRD_PARTY",
"{projectRoot}/.jsii",
"{projectRoot}/nx-monorepo",
"{projectRoot}/pdk-nag",
Expand All @@ -202,5 +182,27 @@
}
}
},
"exports": {
".": "./index.js",
"./package.json": "./package.json",
"./.jsii": "./.jsii",
"./.warnings.jsii.js": "./.warnings.jsii.js",
"./nx-monorepo": "./nx-monorepo/index.js",
"./pdk-nag": "./pdk-nag/index.js",
"./pipeline": "./pipeline/index.js"
},
"resolutions": {
"@types/prettier": "2.6.0",
"ansi-regex": "^5.0.1",
"underscore": "^1.12.1",
"deep-extend": "^0.5.1",
"argparse": "^1.0.10",
"debug": "^2.6.9",
"minimist": "^1.2.6",
"ejs": "^3.1.7",
"async": "^2.6.4",
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
20 changes: 0 additions & 20 deletions packages/cdk-graph-plugin-diagram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,5 @@
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/target",
"{projectRoot}/.jsii"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
20 changes: 0 additions & 20 deletions packages/cdk-graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,5 @@
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/target",
"{projectRoot}/.jsii"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
20 changes: 0 additions & 20 deletions packages/cloudscape-react-ts-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,5 @@
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/target",
"{projectRoot}/.jsii"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
19 changes: 0 additions & 19 deletions packages/cloudscape-react-ts-website/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,5 @@
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/target"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
20 changes: 0 additions & 20 deletions packages/identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,5 @@
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/target",
"{projectRoot}/.jsii"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}
9 changes: 6 additions & 3 deletions packages/nx-monorepo/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
The nx-monorepo package vends a NxMonorepoProject Projen construct that adds [NX](https://nx.dev/getting-started/intro) monorepo support and manages your yarn/npm/pnpm workspaces on your behalf. This construct enables polygot builds (and inter language build dependencies), build caching, dependency visualization and much, much more.
The nx-monorepo package vends a NxMonorepoProject Projen construct that adds [NX](https://nx.dev/getting-started/intro) monorepo support and manages your yarn/npm/pnpm workspaces on your behalf. This construct enables polyglot builds (and inter language build dependencies), build caching, dependency visualization and much, much more.

The PDK itself uses the nx-monorepo project itself and is a good reference for seeing how a complex, polygot monorepo can be set up.
The PDK itself uses the nx-monorepo project itself and is a good reference for seeing how a complex, polyglot monorepo can be set up.

> **BREAKING CHANGES** (pre-release)
> - v0.13.0: `WorkspaceConfig.nxConfig` type `NxConfig => Nx.WorkspaceConfig`, and `overrideProjectTargets` removed in favor of `PDKProject.nx` config to manage Nx project configurations. See [PR 231](https://github.com/aws/aws-prototyping-sdk/pull/231).
To get started simply run the following command in an empty directory:

```bash
npx projen new --from aws-prototyping-sdk nx-monorepo
```

This will boostrap a new Projen monorepo and contain the following in the .projenrc.ts:
This will bootstrap a new Projen monorepo and contain the following in the .projenrc.ts:

```ts
import { nx_monorepo } from "aws-prototyping-sdk";
Expand Down
20 changes: 0 additions & 20 deletions packages/nx-monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,5 @@
"nth-check": "^2.0.1",
"got": "^11.8.5"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/build",
"{projectRoot}/coverage",
"{projectRoot}/lib",
"{projectRoot}/target",
"{projectRoot}/.jsii"
],
"dependsOn": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
}

0 comments on commit be8c6c8

Please sign in to comment.