@aligent/nx-cdk 0.4.0 → 0.6.0
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/package.json +1 -1
- package/src/generators/helpers/configs/base-package/package.json +89 -0
- package/src/generators/helpers/utilities.d.ts +2 -35
- package/src/generators/helpers/utilities.js +28 -11
- package/src/generators/preset/files/.git-hooks/{pre-push.template → pre-commit.template} +1 -2
- package/src/generators/preset/files/application/bin/main.ts.template +15 -13
- package/src/generators/preset/files/application/cdk.json.template +1 -1
- package/src/generators/preset/files/eslint.config.mjs.template +0 -1
- package/src/generators/preset/files/libs/infra/src/index.ts.template +19 -16
- package/src/generators/preset/schema.d.ts +1 -1
- package/src/generators/preset/schema.json +11 -0
- package/src/generators/service/files/src/index.ts.template +16 -42
- package/src/generators/helpers/configs/packageJson.d.ts +0 -84
- package/src/generators/helpers/configs/packageJson.js +0 -83
package/package.json
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Aligent",
|
|
3
|
+
"private": true,
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "nx affected -t test --coverage",
|
|
8
|
+
"test:all": "nx run-many -t test --coverage",
|
|
9
|
+
"lint": "nx affected -t lint",
|
|
10
|
+
"lint:all": "nx run-many -t lint",
|
|
11
|
+
"typecheck": "nx affected -t typecheck",
|
|
12
|
+
"typecheck:all": "nx run-many -t typecheck",
|
|
13
|
+
"audit": "nx run-many -t lint typecheck test --configuration coverage --skip-nx-cache",
|
|
14
|
+
"pg:synth": "nx run application:pg:synth --bundle-mode=dev --profile playground",
|
|
15
|
+
"pg:deploy": "nx run application:pg:deploy --bundle-mode=dev --method=direct --require-approval never --profile playground",
|
|
16
|
+
"pg:diff": "nx run application:pg:diff --profile playground",
|
|
17
|
+
"pg:destroy": "nx run application:pg:destroy --profile playground",
|
|
18
|
+
"postinstall": "[ -d .git ] && git config core.hooksPath '.git-hooks' && chmod +x .git-hooks/* || true"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@aligent/microservice-util-lib": "^1.2.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@aligent/cdk-aspects": "^0.5.0",
|
|
25
|
+
"@aligent/cdk-step-function-from-file": "^0.3.2",
|
|
26
|
+
"@aligent/nx-openapi": "^1.0.0",
|
|
27
|
+
"@aligent/ts-code-standards": "^4.1.0",
|
|
28
|
+
"@nx/eslint": "22.1.3",
|
|
29
|
+
"@nx/eslint-plugin": "22.1.3",
|
|
30
|
+
"@nx/js": "22.1.3",
|
|
31
|
+
"@nx/vitest": "22.1.3",
|
|
32
|
+
"@nx/workspace": "22.1.3",
|
|
33
|
+
"@swc-node/register": "^1.10.10",
|
|
34
|
+
"@swc/core": "^1.13.3",
|
|
35
|
+
"@swc/helpers": "^0.5.17",
|
|
36
|
+
"@types/aws-lambda": "^8.10.152",
|
|
37
|
+
"@types/node": "^22.17.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "8.44.0",
|
|
39
|
+
"@typescript-eslint/parser": "8.44.0",
|
|
40
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
41
|
+
"@vitest/ui": "^3.2.4",
|
|
42
|
+
"aws-cdk": "^2.1033.0",
|
|
43
|
+
"aws-cdk-lib": "^2.235.1",
|
|
44
|
+
"cdk-nag": "^2.37.55",
|
|
45
|
+
"constructs": "^10.4.3",
|
|
46
|
+
"eslint": "^9.32.0",
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-plugin-import": "^2.32.0",
|
|
49
|
+
"fast-glob": "^3.3.3",
|
|
50
|
+
"jiti": "2.5.1",
|
|
51
|
+
"jsonc-eslint-parser": "^2.4.0",
|
|
52
|
+
"nx": "22.1.3",
|
|
53
|
+
"prettier": "^3.6.2",
|
|
54
|
+
"rolldown": "1.0.0-rc.1",
|
|
55
|
+
"store-parameters": "^1.1.3",
|
|
56
|
+
"tslib": "^2.8.1",
|
|
57
|
+
"tsx": "^4.21.0",
|
|
58
|
+
"typescript": "~5.9.2",
|
|
59
|
+
"vite": "^7.2.6",
|
|
60
|
+
"vitest": "^3.2.4"
|
|
61
|
+
},
|
|
62
|
+
"nx": {
|
|
63
|
+
"includedScripts": [],
|
|
64
|
+
"targets": {
|
|
65
|
+
"parameters": {
|
|
66
|
+
"executor": "nx:run-commands",
|
|
67
|
+
"options": {
|
|
68
|
+
"color": true,
|
|
69
|
+
"cwd": "parameters"
|
|
70
|
+
},
|
|
71
|
+
"configurations": {
|
|
72
|
+
"import": {
|
|
73
|
+
"command": "store-parameters import {args.file} --delimiter=|"
|
|
74
|
+
},
|
|
75
|
+
"export": {
|
|
76
|
+
"command": "store-parameters export {args.file} --path={args.path} --delimiter=|"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"workspaces": [
|
|
83
|
+
"application",
|
|
84
|
+
"clients",
|
|
85
|
+
"libs/*",
|
|
86
|
+
"services/*"
|
|
87
|
+
],
|
|
88
|
+
"packageManager": "yarn@4.12.0+sha512.f45ab632439a67f8bc759bf32ead036a1f413287b9042726b7cc4818b7b49e14e9423ba49b18f9e06ea4941c1ad062385b1d8760a8d5091a1a31e5f6219afca8"
|
|
89
|
+
}
|
|
@@ -11,44 +11,11 @@ interface Service {
|
|
|
11
11
|
stack: string;
|
|
12
12
|
}
|
|
13
13
|
export declare function constructPackageJsonFile(input: PackageJsonInput): {
|
|
14
|
-
[k: string]: string |
|
|
15
|
-
readonly test: "nx affected -t test --coverage";
|
|
16
|
-
readonly 'test:all': "nx run-many -t test --coverage";
|
|
17
|
-
readonly lint: "nx affected -t lint";
|
|
18
|
-
readonly 'lint:all': "nx run-many -t lint";
|
|
19
|
-
readonly typecheck: "nx affected -t typecheck";
|
|
20
|
-
readonly 'typecheck:all': "nx run-many -t typecheck";
|
|
21
|
-
readonly audit: "nx run-many -t lint typecheck test --configuration coverage --skip-nx-cache";
|
|
22
|
-
readonly 'pg:synth': "nx run application:pg:synth --bundle-mode=dev --profile playground";
|
|
23
|
-
readonly 'pg:deploy': "nx run application:pg:deploy --bundle-mode=dev --method=direct --require-approval never --profile playground";
|
|
24
|
-
readonly 'pg:diff': "nx run application:pg:diff --profile playground";
|
|
25
|
-
readonly 'pg:destroy': "nx run application:pg:destroy --profile playground";
|
|
26
|
-
readonly postinstall: "[ -d .git ] && git config core.hooksPath '.git-hooks' && chmod +x .git-hooks/* || true";
|
|
27
|
-
} | {
|
|
28
|
-
readonly '@aligent/microservice-util-lib': "^1.2.0";
|
|
29
|
-
} | {
|
|
14
|
+
[k: string]: string | boolean | string[] | Record<string, string> | {
|
|
30
15
|
[k: string]: string;
|
|
31
16
|
} | {
|
|
32
17
|
node: string;
|
|
33
18
|
} | {
|
|
34
|
-
includedScripts: readonly [];
|
|
35
|
-
targets: {
|
|
36
|
-
readonly parameters: {
|
|
37
|
-
readonly executor: "nx:run-commands";
|
|
38
|
-
readonly options: {
|
|
39
|
-
readonly color: true;
|
|
40
|
-
readonly cwd: "parameters";
|
|
41
|
-
};
|
|
42
|
-
readonly configurations: {
|
|
43
|
-
readonly import: {
|
|
44
|
-
readonly command: "store-parameters import {args.file} --delimiter=|";
|
|
45
|
-
};
|
|
46
|
-
readonly export: {
|
|
47
|
-
readonly command: "store-parameters export {args.file} --path={args.path} --delimiter=|";
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
19
|
name: string;
|
|
53
20
|
node?: never;
|
|
54
21
|
};
|
|
@@ -93,7 +60,7 @@ export declare function getGeneratorVersion(): string;
|
|
|
93
60
|
*
|
|
94
61
|
* @throws {Error} If the ApplicationStage constructor cannot be found in service-stacks.ts
|
|
95
62
|
*/
|
|
96
|
-
export declare function addServiceStackToMainApplication(tree: Tree, service: Service, projectName: string):
|
|
63
|
+
export declare function addServiceStackToMainApplication(tree: Tree, service: Service, projectName: string): void;
|
|
97
64
|
/**
|
|
98
65
|
* Splits a kebab-case name into an array of capitalized parts.
|
|
99
66
|
*
|
|
@@ -7,24 +7,35 @@ exports.addServiceStackToMainApplication = addServiceStackToMainApplication;
|
|
|
7
7
|
exports.splitInputName = splitInputName;
|
|
8
8
|
/* v8 ignore start */
|
|
9
9
|
const devkit_1 = require("@nx/devkit");
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
10
|
const path_1 = require("path");
|
|
12
11
|
const ts_morph_1 = require("ts-morph");
|
|
13
|
-
const packageJson_1 = require("./configs/packageJson");
|
|
14
12
|
const tsConfigs_1 = require("./configs/tsConfigs");
|
|
13
|
+
/**
|
|
14
|
+
* Reads the base package.json configuration from a JSON file.
|
|
15
|
+
*
|
|
16
|
+
* The configuration is stored as a standalone JSON file rather than a TypeScript constant
|
|
17
|
+
* so that Dependabot can automatically detect and upgrade the dependency versions within it.
|
|
18
|
+
*
|
|
19
|
+
* @returns The parsed package.json configuration.
|
|
20
|
+
*/
|
|
21
|
+
function readPackageJsonConfig() {
|
|
22
|
+
const configPath = (0, path_1.join)(__dirname, './configs/base-package/package.json');
|
|
23
|
+
return (0, devkit_1.readJsonFile)(configPath);
|
|
24
|
+
}
|
|
15
25
|
function constructPackageJsonFile(input) {
|
|
26
|
+
const config = readPackageJsonConfig();
|
|
16
27
|
const devDependencies = Object.fromEntries(Object.entries({
|
|
17
28
|
'@aligent/nx-cdk': input.version,
|
|
18
|
-
...
|
|
29
|
+
...config.devDependencies,
|
|
19
30
|
}).sort());
|
|
20
31
|
const packageJson = Object.fromEntries(Object.entries({
|
|
21
32
|
name: `@${input.name}/integrations`,
|
|
22
33
|
description: `${input.projectName} integrations mono-repository`,
|
|
23
34
|
version: input.version,
|
|
24
|
-
...
|
|
35
|
+
...config,
|
|
25
36
|
devDependencies,
|
|
26
37
|
engines: { node: `^${input.nodeVersion}` },
|
|
27
|
-
nx: { name: `${input.name}-int`, ...
|
|
38
|
+
nx: { name: `${input.name}-int`, ...config.nx },
|
|
28
39
|
}));
|
|
29
40
|
return packageJson;
|
|
30
41
|
}
|
|
@@ -66,18 +77,24 @@ function getGeneratorVersion() {
|
|
|
66
77
|
*
|
|
67
78
|
* @throws {Error} If the ApplicationStage constructor cannot be found in service-stacks.ts
|
|
68
79
|
*/
|
|
69
|
-
|
|
80
|
+
function addServiceStackToMainApplication(tree, service, projectName) {
|
|
70
81
|
const application = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
71
82
|
if (application.root.includes('..')) {
|
|
72
83
|
throw new Error('Invalid application root path');
|
|
73
84
|
}
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
85
|
+
const stacksRelativePath = (0, path_1.join)(application.root, 'lib/service-stacks.ts');
|
|
86
|
+
if (!tree.exists(stacksRelativePath)) {
|
|
76
87
|
console.log('Service Stacks does not exist, skipping service stacks registration.');
|
|
77
88
|
return;
|
|
78
89
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
90
|
+
const content = tree.read(stacksRelativePath, 'utf-8');
|
|
91
|
+
if (content === null) {
|
|
92
|
+
throw new Error(`Failed to read file: ${stacksRelativePath}`);
|
|
93
|
+
}
|
|
94
|
+
const fs = new ts_morph_1.InMemoryFileSystemHost();
|
|
95
|
+
fs.writeFileSync(stacksRelativePath, content);
|
|
96
|
+
const project = new ts_morph_1.Project({ fileSystem: fs });
|
|
97
|
+
const stackSource = project.addSourceFileAtPath(stacksRelativePath);
|
|
81
98
|
const applicationStage = stackSource.getClassOrThrow('ApplicationStage');
|
|
82
99
|
const stageConstructor = applicationStage.getConstructors()[0];
|
|
83
100
|
if (!stageConstructor) {
|
|
@@ -90,7 +107,7 @@ async function addServiceStackToMainApplication(tree, service, projectName) {
|
|
|
90
107
|
const sharedInfra = stageConstructor.getVariableStatement('sharedInfra');
|
|
91
108
|
const sharedPropsStatement = sharedInfra ? `...sharedInfra.getProps(),` : '';
|
|
92
109
|
stageConstructor.addStatements(`new ${service.stack}(this, ${service.constant}.NAME, { ...props, ${sharedPropsStatement} description: ${service.constant}.DESCRIPTION });`);
|
|
93
|
-
|
|
110
|
+
tree.write(stacksRelativePath, stackSource.getFullText());
|
|
94
111
|
}
|
|
95
112
|
/**
|
|
96
113
|
* Splits a kebab-case name into an array of capitalized parts.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Script adapted from https://github.com/kaczor6418/git-hooks-example/blob/master/git-hooks/pre-commit
|
|
3
3
|
|
|
4
|
-
# Support using VSCode to commit
|
|
5
|
-
# This loads nvm.sh and sets the correct PATH before running hook
|
|
4
|
+
# Support using VSCode to commit. This loads nvm.sh and sets the correct PATH before running hook
|
|
6
5
|
export NVM_DIR="$HOME/.nvm"
|
|
7
6
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
8
7
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
DynamoDbDefaultsAspect,
|
|
3
4
|
LambdaAndStepFunctionVersioningAspect,
|
|
4
5
|
LogGroupDefaultsAspect,
|
|
5
6
|
MicroserviceChecks,
|
|
6
7
|
NodeJsFunctionDefaultsAspect,
|
|
7
8
|
ResourcePrefixAspect,
|
|
9
|
+
S3DefaultsAspect,
|
|
8
10
|
StepFunctionsDefaultsAspect,
|
|
9
11
|
} from '@aligent/cdk-aspects';
|
|
10
|
-
import { App, AspectOptions, AspectPriority, Aspects, IAspect,
|
|
12
|
+
import { App, AspectOptions, AspectPriority, Aspects, IAspect, Tags } from 'aws-cdk-lib';
|
|
13
|
+
import { Runtime } from 'aws-cdk-lib/aws-lambda';
|
|
11
14
|
import { ApplicationStage } from '../lib/service-stacks.js';
|
|
12
15
|
|
|
13
16
|
const APPLICATION_CONTEXT = { NAME: '<%= name %>-int', OWNER: 'Aligent' } as const;
|
|
@@ -76,22 +79,21 @@ commonAspectsWithOptions.forEach(({ aspect, options }) => {
|
|
|
76
79
|
Aspects.of(stage).add(aspect, options);
|
|
77
80
|
});
|
|
78
81
|
|
|
82
|
+
const defaultAspectsOptions: AspectOptions = { priority: AspectPriority.MUTATING };
|
|
83
|
+
let duration: 'SHORT' | 'MEDIUM' | 'LONG' = 'SHORT';
|
|
84
|
+
|
|
79
85
|
switch (stageName) {
|
|
80
86
|
case 'prd':
|
|
81
|
-
Aspects.of(stage).add(new
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
Aspects.of(stage).add(new LambdaAndStepFunctionVersioningAspect(), {
|
|
85
|
-
priority: AspectPriority.MUTATING,
|
|
86
|
-
});
|
|
87
|
+
Aspects.of(stage).add(new LambdaAndStepFunctionVersioningAspect(), defaultAspectsOptions);
|
|
88
|
+
duration = 'LONG';
|
|
87
89
|
break;
|
|
88
90
|
case 'stg':
|
|
89
|
-
|
|
90
|
-
priority: AspectPriority.MUTATING,
|
|
91
|
-
});
|
|
91
|
+
duration = 'MEDIUM';
|
|
92
92
|
break;
|
|
93
93
|
default:
|
|
94
|
-
|
|
95
|
-
priority: AspectPriority.MUTATING,
|
|
96
|
-
});
|
|
94
|
+
duration = 'SHORT';
|
|
97
95
|
}
|
|
96
|
+
|
|
97
|
+
Aspects.of(stage).add(new LogGroupDefaultsAspect({ duration }), defaultAspectsOptions);
|
|
98
|
+
Aspects.of(stage).add(new DynamoDbDefaultsAspect({ duration }), defaultAspectsOptions);
|
|
99
|
+
Aspects.of(stage).add(new S3DefaultsAspect({ duration }), defaultAspectsOptions);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Stack, Stage,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { Stack, Stage, StackProps, Tags } from 'aws-cdk-lib';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
<% if (example) { %>import { Secret } from 'aws-cdk-lib/aws-secretsmanager';
|
|
4
|
+
import { IStringParameter, StringParameter } from 'aws-cdk-lib/aws-ssm';<% } %>
|
|
5
5
|
|
|
6
6
|
export interface SharedInfraProps {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
<% if (example) { %>paramExample: IStringParameter;
|
|
8
|
+
secretExample: Secret;<% } %>
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export class SharedInfraStack extends Stack {
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
12
|
+
<% if (example) { %>readonly paramExample: IStringParameter;
|
|
13
|
+
readonly secretExample: Secret;<% } %>
|
|
14
14
|
|
|
15
15
|
constructor(scope: Construct, id: string, props?: StackProps) {
|
|
16
16
|
super(scope, id, props);
|
|
@@ -19,22 +19,25 @@ export class SharedInfraStack extends Stack {
|
|
|
19
19
|
throw new Error('This construct must be used within a CDK Stage');
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
this.
|
|
22
|
+
Tags.of(this).add('SERVICE', id);
|
|
23
|
+
<% if (example) { %>
|
|
24
|
+
this.paramExample = StringParameter.fromStringParameterName(
|
|
23
25
|
this,
|
|
24
|
-
'
|
|
25
|
-
`/
|
|
26
|
+
'ParamExample',
|
|
27
|
+
`/example/param`
|
|
26
28
|
);
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
description: 'E-Commerce API credentials shared across services',
|
|
30
|
+
this.secretExample = new Secret(this, 'SecretExample', {
|
|
31
|
+
description: 'Example secret shared across services',
|
|
31
32
|
});
|
|
33
|
+
<% } %>
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
getProps(): SharedInfraProps {
|
|
35
37
|
return {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
<% if (example) { %>paramExample: this.paramExample,
|
|
39
|
+
secretExample: this.secretExample,
|
|
40
|
+
<% } %>
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
}
|
|
@@ -26,6 +26,17 @@
|
|
|
26
26
|
"x-prompt": "What is the target Node.js version the project?",
|
|
27
27
|
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
|
|
28
28
|
"patternErrorMessage": "Node.js version must be a valid semantic version (semver), e.g. 22.10.0 or 24.10.0"
|
|
29
|
+
},
|
|
30
|
+
"destination": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The destination directory for the generated workspace",
|
|
33
|
+
"pattern": "^[a-zA-Z0-9_./-]+$",
|
|
34
|
+
"patternErrorMessage": "Destination must be a valid path containing only alphanumeric characters, dashes, underscores, dots, and slashes"
|
|
35
|
+
},
|
|
36
|
+
"example": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"description": "Generate example code with sample resources",
|
|
39
|
+
"default": false
|
|
29
40
|
}
|
|
30
41
|
},
|
|
31
42
|
"required": ["name"]
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { SharedInfraProps } from '@libs/infra';
|
|
2
2
|
import { Stack, StackProps, Stage, Tags } from 'aws-cdk-lib';
|
|
3
|
-
import { Code } from 'aws-cdk-lib/aws-lambda';
|
|
4
3
|
import { Construct } from 'constructs';
|
|
5
|
-
import path from 'node:path';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* @important
|
|
@@ -24,53 +22,29 @@ interface Props extends StackProps, SharedInfraProps {
|
|
|
24
22
|
*
|
|
25
23
|
* Instantiate in a CDK Application Stage to deploy to AWS.
|
|
26
24
|
*
|
|
27
|
-
*
|
|
25
|
+
* @note Aligent provides the following standard CDK constructs:
|
|
26
|
+
* - {@link NodejsFunctionFromEntry} from '@aligent/cdk-nodejs-function-from-entry'
|
|
27
|
+
* - {@link StepFunctionFromFile} from '@aligent/cdk-step-function-from-file'
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* new NodejsFunctionFromEntry(this, 'ExampleLambda', {
|
|
31
|
+
* baseDir: import.meta.dirname,
|
|
32
|
+
* entry: 'runtime/handlers/example.ts',
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* new StepFunctionFromFile(this, 'ExampleStepFunction', {
|
|
36
|
+
* baseDir: import.meta.dirname,
|
|
37
|
+
* filepath: 'infra/stepfunctions/example.json',
|
|
38
|
+
* });
|
|
28
39
|
*/
|
|
29
40
|
export class <%= stack %> extends Stack {
|
|
30
|
-
constructor(scope: Construct, id: Id, props
|
|
41
|
+
constructor(scope: Construct, id: Id, props: Props) {
|
|
31
42
|
super(scope, id, props);
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
if (!STAGE) {
|
|
44
|
+
if (!Stage.of(this)?.stageName) {
|
|
35
45
|
throw new Error('This construct must be used within a CDK Stage');
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
Tags.of(this).add('SERVICE', id);
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Resolves a path to infra assets relative to this stack
|
|
44
|
-
*
|
|
45
|
-
* @param assetPath - The path to the asset.
|
|
46
|
-
* @returns The resolved path.
|
|
47
|
-
*/
|
|
48
|
-
export function resolveAssetPath(assetPath: `${'infra/'}${string}`) {
|
|
49
|
-
return path.resolve(import.meta.dirname, assetPath);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Return an object with the default bundled code asset and
|
|
54
|
-
* handler property for use with the NodejsFunction construct.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* new NodejsFunction(this, 'FetchData', {
|
|
59
|
-
* ...resolveLambdaHandler('runtime/handlers/fetch-data.ts'),
|
|
60
|
-
* });
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @param assetPath - The path to the typescript handler file.
|
|
64
|
-
* @returns The resolved bundled code path and handler name.
|
|
65
|
-
*/
|
|
66
|
-
export function resolveLambdaHandler(assetPath: `${'runtime/handlers/'}${string}${'.ts'}`) {
|
|
67
|
-
// Replace 'runtime/handlers/' with '..dist/' and remove the file extension
|
|
68
|
-
const bundledPath = assetPath.replace(
|
|
69
|
-
/^runtime\/handlers\/(?<path>.*)\.ts$/,
|
|
70
|
-
'../dist/$<path>'
|
|
71
|
-
);
|
|
72
|
-
return {
|
|
73
|
-
code: Code.fromAsset(path.resolve(import.meta.dirname, bundledPath)),
|
|
74
|
-
handler: 'index.handler',
|
|
75
|
-
};
|
|
76
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export declare const PACKAGE_JSON: {
|
|
2
|
-
readonly author: "Aligent";
|
|
3
|
-
readonly private: true;
|
|
4
|
-
readonly license: "MIT";
|
|
5
|
-
readonly type: "module";
|
|
6
|
-
readonly scripts: {
|
|
7
|
-
readonly test: "nx affected -t test --coverage";
|
|
8
|
-
readonly 'test:all': "nx run-many -t test --coverage";
|
|
9
|
-
readonly lint: "nx affected -t lint";
|
|
10
|
-
readonly 'lint:all': "nx run-many -t lint";
|
|
11
|
-
readonly typecheck: "nx affected -t typecheck";
|
|
12
|
-
readonly 'typecheck:all': "nx run-many -t typecheck";
|
|
13
|
-
readonly audit: "nx run-many -t lint typecheck test --configuration coverage --skip-nx-cache";
|
|
14
|
-
readonly 'pg:synth': "nx run application:pg:synth --bundle-mode=dev --profile playground";
|
|
15
|
-
readonly 'pg:deploy': "nx run application:pg:deploy --bundle-mode=dev --method=direct --require-approval never --profile playground";
|
|
16
|
-
readonly 'pg:diff': "nx run application:pg:diff --profile playground";
|
|
17
|
-
readonly 'pg:destroy': "nx run application:pg:destroy --profile playground";
|
|
18
|
-
readonly postinstall: "[ -d .git ] && git config core.hooksPath '.git-hooks' && chmod +x .git-hooks/* || true";
|
|
19
|
-
};
|
|
20
|
-
readonly dependencies: {
|
|
21
|
-
readonly '@aligent/microservice-util-lib': "^1.2.0";
|
|
22
|
-
};
|
|
23
|
-
readonly devDependencies: {
|
|
24
|
-
readonly '@aligent/cdk-aspects': "^0.4.0";
|
|
25
|
-
readonly '@aligent/cdk-step-function-from-file': "^0.3.2";
|
|
26
|
-
readonly '@aligent/nx-openapi': "^1.0.0";
|
|
27
|
-
readonly '@aligent/ts-code-standards': "^4.1.0";
|
|
28
|
-
readonly '@nx/eslint': "22.1.3";
|
|
29
|
-
readonly '@nx/eslint-plugin': "22.1.3";
|
|
30
|
-
readonly '@nx/js': "22.1.3";
|
|
31
|
-
readonly '@nx/vitest': "22.1.3";
|
|
32
|
-
readonly '@nx/workspace': "22.1.3";
|
|
33
|
-
readonly '@swc-node/register': "^1.10.10";
|
|
34
|
-
readonly '@swc/core': "^1.13.3";
|
|
35
|
-
readonly '@swc/helpers': "^0.5.17";
|
|
36
|
-
readonly '@types/aws-lambda': "^8.10.152";
|
|
37
|
-
readonly '@types/node': "^22.17.0";
|
|
38
|
-
readonly '@typescript-eslint/eslint-plugin': "8.44.0";
|
|
39
|
-
readonly '@typescript-eslint/parser': "8.44.0";
|
|
40
|
-
readonly '@vitest/coverage-v8': "^3.2.4";
|
|
41
|
-
readonly '@vitest/ui': "^3.2.4";
|
|
42
|
-
readonly 'aws-cdk': "^2.1033.0";
|
|
43
|
-
readonly 'aws-cdk-lib': "^2.235.1";
|
|
44
|
-
readonly 'cdk-nag': "^2.37.55";
|
|
45
|
-
readonly constructs: "^10.4.3";
|
|
46
|
-
readonly eslint: "^9.32.0";
|
|
47
|
-
readonly 'eslint-config-prettier': "^10.1.8";
|
|
48
|
-
readonly 'eslint-plugin-import': "^2.32.0";
|
|
49
|
-
readonly 'fast-glob': "^3.3.3";
|
|
50
|
-
readonly jiti: "2.5.1";
|
|
51
|
-
readonly 'jsonc-eslint-parser': "^2.4.0";
|
|
52
|
-
readonly nx: "22.1.3";
|
|
53
|
-
readonly prettier: "^3.6.2";
|
|
54
|
-
readonly rolldown: "1.0.0-rc.1";
|
|
55
|
-
readonly 'store-parameters': "^1.1.3";
|
|
56
|
-
readonly tslib: "^2.8.1";
|
|
57
|
-
readonly tsx: "^4.21.0";
|
|
58
|
-
readonly typescript: "~5.9.2";
|
|
59
|
-
readonly vite: "^7.2.6";
|
|
60
|
-
readonly vitest: "^3.2.4";
|
|
61
|
-
};
|
|
62
|
-
readonly nx: {
|
|
63
|
-
readonly includedScripts: readonly [];
|
|
64
|
-
readonly targets: {
|
|
65
|
-
readonly parameters: {
|
|
66
|
-
readonly executor: "nx:run-commands";
|
|
67
|
-
readonly options: {
|
|
68
|
-
readonly color: true;
|
|
69
|
-
readonly cwd: "parameters";
|
|
70
|
-
};
|
|
71
|
-
readonly configurations: {
|
|
72
|
-
readonly import: {
|
|
73
|
-
readonly command: "store-parameters import {args.file} --delimiter=|";
|
|
74
|
-
};
|
|
75
|
-
readonly export: {
|
|
76
|
-
readonly command: "store-parameters export {args.file} --path={args.path} --delimiter=|";
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
readonly workspaces: readonly ["application", "clients", "libs/*", "services/*"];
|
|
83
|
-
readonly packageManager: "yarn@4.12.0+sha512.f45ab632439a67f8bc759bf32ead036a1f413287b9042726b7cc4818b7b49e14e9423ba49b18f9e06ea4941c1ad062385b1d8760a8d5091a1a31e5f6219afca8";
|
|
84
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PACKAGE_JSON = void 0;
|
|
4
|
-
exports.PACKAGE_JSON = {
|
|
5
|
-
author: 'Aligent',
|
|
6
|
-
private: true,
|
|
7
|
-
license: 'MIT',
|
|
8
|
-
type: 'module',
|
|
9
|
-
scripts: {
|
|
10
|
-
test: 'nx affected -t test --coverage',
|
|
11
|
-
'test:all': 'nx run-many -t test --coverage',
|
|
12
|
-
lint: 'nx affected -t lint',
|
|
13
|
-
'lint:all': 'nx run-many -t lint',
|
|
14
|
-
typecheck: 'nx affected -t typecheck',
|
|
15
|
-
'typecheck:all': 'nx run-many -t typecheck',
|
|
16
|
-
audit: 'nx run-many -t lint typecheck test --configuration coverage --skip-nx-cache',
|
|
17
|
-
'pg:synth': 'nx run application:pg:synth --bundle-mode=dev --profile playground',
|
|
18
|
-
'pg:deploy': 'nx run application:pg:deploy --bundle-mode=dev --method=direct --require-approval never --profile playground',
|
|
19
|
-
'pg:diff': 'nx run application:pg:diff --profile playground',
|
|
20
|
-
'pg:destroy': 'nx run application:pg:destroy --profile playground',
|
|
21
|
-
postinstall: `[ -d .git ] && git config core.hooksPath '.git-hooks' && chmod +x .git-hooks/* || true`,
|
|
22
|
-
},
|
|
23
|
-
dependencies: {
|
|
24
|
-
'@aligent/microservice-util-lib': '^1.2.0',
|
|
25
|
-
},
|
|
26
|
-
devDependencies: {
|
|
27
|
-
'@aligent/cdk-aspects': '^0.4.0',
|
|
28
|
-
'@aligent/cdk-step-function-from-file': '^0.3.2',
|
|
29
|
-
'@aligent/nx-openapi': '^1.0.0',
|
|
30
|
-
'@aligent/ts-code-standards': '^4.1.0',
|
|
31
|
-
'@nx/eslint': '22.1.3',
|
|
32
|
-
'@nx/eslint-plugin': '22.1.3',
|
|
33
|
-
'@nx/js': '22.1.3',
|
|
34
|
-
'@nx/vitest': '22.1.3',
|
|
35
|
-
'@nx/workspace': '22.1.3',
|
|
36
|
-
'@swc-node/register': '^1.10.10',
|
|
37
|
-
'@swc/core': '^1.13.3',
|
|
38
|
-
'@swc/helpers': '^0.5.17',
|
|
39
|
-
'@types/aws-lambda': '^8.10.152',
|
|
40
|
-
'@types/node': '^22.17.0',
|
|
41
|
-
'@typescript-eslint/eslint-plugin': '8.44.0',
|
|
42
|
-
'@typescript-eslint/parser': '8.44.0',
|
|
43
|
-
'@vitest/coverage-v8': '^3.2.4',
|
|
44
|
-
'@vitest/ui': '^3.2.4',
|
|
45
|
-
'aws-cdk': '^2.1033.0',
|
|
46
|
-
'aws-cdk-lib': '^2.235.1',
|
|
47
|
-
'cdk-nag': '^2.37.55',
|
|
48
|
-
constructs: '^10.4.3',
|
|
49
|
-
eslint: '^9.32.0',
|
|
50
|
-
'eslint-config-prettier': '^10.1.8',
|
|
51
|
-
'eslint-plugin-import': '^2.32.0',
|
|
52
|
-
'fast-glob': '^3.3.3',
|
|
53
|
-
jiti: '2.5.1',
|
|
54
|
-
'jsonc-eslint-parser': '^2.4.0',
|
|
55
|
-
nx: '22.1.3',
|
|
56
|
-
prettier: '^3.6.2',
|
|
57
|
-
// FIXME: [MI-251] Rolldown is still in RC. We pin the version and can upgrade with precaution.
|
|
58
|
-
rolldown: '1.0.0-rc.1',
|
|
59
|
-
'store-parameters': '^1.1.3',
|
|
60
|
-
tslib: '^2.8.1',
|
|
61
|
-
tsx: '^4.21.0',
|
|
62
|
-
typescript: '~5.9.2',
|
|
63
|
-
vite: '^7.2.6',
|
|
64
|
-
vitest: '^3.2.4',
|
|
65
|
-
},
|
|
66
|
-
nx: {
|
|
67
|
-
includedScripts: [],
|
|
68
|
-
targets: {
|
|
69
|
-
parameters: {
|
|
70
|
-
executor: 'nx:run-commands',
|
|
71
|
-
options: { color: true, cwd: 'parameters' },
|
|
72
|
-
configurations: {
|
|
73
|
-
import: { command: 'store-parameters import {args.file} --delimiter=|' },
|
|
74
|
-
export: {
|
|
75
|
-
command: 'store-parameters export {args.file} --path={args.path} --delimiter=|',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
workspaces: ['application', 'clients', 'libs/*', 'services/*'],
|
|
82
|
-
packageManager: 'yarn@4.12.0+sha512.f45ab632439a67f8bc759bf32ead036a1f413287b9042726b7cc4818b7b49e14e9423ba49b18f9e06ea4941c1ad062385b1d8760a8d5091a1a31e5f6219afca8',
|
|
83
|
-
};
|