@wolsok/nx-aws-cdk-v2 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -114,7 +114,18 @@ otherwise the workspace root. The Nx project name is the path below `<appsDir>`
|
|
|
114
114
|
The generated `tsconfig.json` extends `tsconfig.cdk.json` at the workspace root when that file
|
|
115
115
|
exists, otherwise `tsconfig.base.json`. Keep a `tsconfig.cdk.json` (extending `tsconfig.base.json`)
|
|
116
116
|
when your CDK apps need other compiler options than the rest of the workspace, such as a newer
|
|
117
|
-
`target` for the Node runtime while browser apps stay on an older one.
|
|
117
|
+
`target` for the Node runtime while browser apps stay on an older one. In a TS-solution workspace,
|
|
118
|
+
where `@nx/jest` lets `tsconfig.spec.json` extend `tsconfig.base.json` directly, the generator
|
|
119
|
+
points it at `tsconfig.cdk.json` as well.
|
|
120
|
+
|
|
121
|
+
The app's `tsconfig.json` sets `"module": "NodeNext"` and `"moduleResolution": "NodeNext"` itself,
|
|
122
|
+
since the app runs on Node, so it compiles whatever `module`/`moduleResolution` the root config
|
|
123
|
+
holds. It lists
|
|
124
|
+
only the `node` types; the Jest types live in `tsconfig.spec.json`.
|
|
125
|
+
|
|
126
|
+
> If your root `package.json` has `"type": "module"`, NodeNext checks `src/main.ts` as an ES module
|
|
127
|
+
> and asks for file extensions on relative imports: write `./stacks/app-stack.js` in `main.ts`
|
|
128
|
+
> (`tsx` runs the app either way).
|
|
118
129
|
|
|
119
130
|
The generator also adds `aws-cdk-lib` and `constructs` to `dependencies`, and the `aws-cdk` CLI plus
|
|
120
131
|
the TypeScript loader `tsx` to `devDependencies` of your workspace.
|
package/package.json
CHANGED
|
@@ -14,6 +14,25 @@ const BASE_TSCONFIG = 'tsconfig.base.json';
|
|
|
14
14
|
function baseTsconfig(host) {
|
|
15
15
|
return host.exists(CDK_TSCONFIG) ? CDK_TSCONFIG : BASE_TSCONFIG;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* In a TS-solution workspace `@nx/jest` writes a `tsconfig.spec.json` that extends
|
|
19
|
+
* `<offset>tsconfig.base.json` directly. Point it at the root tsconfig the app itself
|
|
20
|
+
* extends, so the specs compile with the same options as the app. Any other `extends`
|
|
21
|
+
* (`./tsconfig.json` outside a TS-solution workspace) is left as it is.
|
|
22
|
+
*/
|
|
23
|
+
function pointSpecTsconfigAtAppBase(host, options) {
|
|
24
|
+
const specTsconfig = `${options.projectRoot}/tsconfig.spec.json`;
|
|
25
|
+
if (options.baseTsconfig === BASE_TSCONFIG || !host.exists(specTsconfig)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const offset = (0, devkit_1.offsetFromRoot)(options.projectRoot);
|
|
29
|
+
(0, devkit_1.updateJson)(host, specTsconfig, (json) => {
|
|
30
|
+
if (json.extends === `${offset}${BASE_TSCONFIG}`) {
|
|
31
|
+
json.extends = `${offset}${options.baseTsconfig}`;
|
|
32
|
+
}
|
|
33
|
+
return json;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
17
36
|
function normalizeOptions(host, options) {
|
|
18
37
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
19
38
|
const projectDirectory = options.directory
|
|
@@ -102,6 +121,7 @@ async function applicationGenerator(host, options) {
|
|
|
102
121
|
};
|
|
103
122
|
const jestTask = await (0, jest_1.configurationGenerator)(host, jestConfigOptions);
|
|
104
123
|
tasks.push(jestTask);
|
|
124
|
+
pointSpecTsconfigAtAppBase(host, normalizedOptions);
|
|
105
125
|
addFiles(host, normalizedOptions, 'jest-files');
|
|
106
126
|
}
|
|
107
127
|
if (!options.skipFormat) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../../libs/public/nx-aws-cdk-v2/src/generators/application/application.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../../libs/public/nx-aws-cdk-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F;QAClF,MAAM,iBAAiB,GAAG;YACxB,OAAO,EAAE,iBAAiB,CAAC,WAAW;YACtC,SAAS,EAAE,MAAM;YACjB,eAAe,EAAE,IAAI;YACrB,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,KAAK;YAChB,eAAe,EAAE,MAAM;YACvB,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,MAAM;SACT,CAAC;QACX,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAsB,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACvE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,0BAA0B,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACpD,QAAQ,CAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,kBAAe,oBAAoB,CAAC;AACvB,QAAA,oBAAoB,GAAG,IAAA,2BAAkB,EAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "<%= offsetFromRoot %><%= baseTsconfig %>",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"module": "
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
5
6
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
6
|
-
"types": ["node"
|
|
7
|
+
"types": ["node"]
|
|
7
8
|
},
|
|
8
9
|
"include": [],
|
|
9
10
|
"files": [],
|