@flit/cdk-pipeline 1.4.3 → 1.5.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 CHANGED
@@ -1,101 +1,107 @@
1
1
  {
2
- "name": "@flit/cdk-pipeline",
3
- "version": "1.4.3",
4
- "description": "A highly customizable and extensible CI/CD pipeline intended as alternative to CDK's native CodePipeline",
5
- "keywords": [
6
- "aws",
7
- "cdk",
8
- "awscdk",
9
- "aws-cdk",
10
- "pipeline",
11
- "codepipeline",
12
- "cicd"
13
- ],
14
- "homepage": "https://github.com/vierroth/cdk-pipeline",
15
- "bugs": "https://github.com/vierroth/cdk-pipeline/issues",
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/vierroth/cdk-pipeline.git"
19
- },
20
- "license": "Apache-2.0",
21
- "author": {
22
- "name": "Luis Vierroth",
23
- "url": "https://github.com/p-mercury"
24
- },
25
- "main": "./dist/index.js",
26
- "types": "./dist/index.d.ts",
27
- "files": [
28
- "./dist",
29
- "./src",
30
- "./.jsii",
31
- "./LICENSE.txt",
32
- "./README.md"
33
- ],
34
- "workspaces": [
35
- "./example"
36
- ],
37
- "scripts": {
38
- "build": "jsii && (cd example && npm run build)",
39
- "prepack": "jsii"
40
- },
41
- "prettier": {
42
- "plugins": [
43
- "prettier-plugin-packagejson"
44
- ],
45
- "tabWidth": 2,
46
- "overrides": [
47
- {
48
- "files": "*.sublime-project",
49
- "options": {
50
- "parser": "json"
51
- }
52
- }
53
- ]
54
- },
55
- "devDependencies": {
56
- "@types/node": "^22.13.5",
57
- "aws-cdk-lib": "^2.174.0",
58
- "constructs": "^10.4.0",
59
- "jsii": "^5.7.6",
60
- "jsii-pacmak": "^1.108.0",
61
- "prettier": "^3.5.2",
62
- "prettier-plugin-packagejson": "^2.5.8",
63
- "typescript": "^5.7.3"
64
- },
65
- "peerDependencies": {
66
- "aws-cdk-lib": "^2.174.0",
67
- "constructs": "^10.4.0"
68
- },
69
- "publishConfig": {
70
- "access": "public"
71
- },
72
- "jsii": {
73
- "outdir": "./dist",
74
- "tsc": {
75
- "rootDir": "./src",
76
- "outDir": "./dist"
77
- },
78
- "targets": {
79
- "java": {
80
- "package": "flit.cdk-pipeline",
81
- "maven": {
82
- "groupId": "flit",
83
- "artifactId": "cdk-pipeline"
84
- }
85
- },
86
- "dotnet": {
87
- "namespace": "Flit.CDK.Pipeline",
88
- "packageId": "Flit.CDK.Pipeline"
89
- },
90
- "python": {
91
- "libName": "flit.cdk-pipeline",
92
- "module": "flit.cdk-pipeline",
93
- "classifiers": [
94
- "Framework :: AWS CDK",
95
- "Framework :: AWS CDK :: 2"
96
- ]
97
- }
98
- }
99
- },
100
- "stability": "stable"
2
+ "name": "@flit/cdk-pipeline",
3
+ "version": "1.5.0",
4
+ "description": "A highly customizable and extensible CI/CD pipeline intended as alternative to CDK's native CodePipeline",
5
+ "keywords": [
6
+ "aws",
7
+ "cdk",
8
+ "awscdk",
9
+ "aws-cdk",
10
+ "pipeline",
11
+ "codepipeline",
12
+ "cicd"
13
+ ],
14
+ "homepage": "https://github.com/vierroth/cdk-pipeline",
15
+ "bugs": "https://github.com/vierroth/cdk-pipeline/issues",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/vierroth/cdk-pipeline.git"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "author": {
22
+ "name": "Vierroth GmbH",
23
+ "url": "https://github.com/vierroth"
24
+ },
25
+ "contributors": [
26
+ {
27
+ "name": "Luis Vierroth",
28
+ "url": "https://github.com/p-mercury"
29
+ }
30
+ ],
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "files": [
34
+ "./dist",
35
+ "./src",
36
+ "./.jsii",
37
+ "./LICENSE.txt",
38
+ "./README.md"
39
+ ],
40
+ "workspaces": [
41
+ "./example"
42
+ ],
43
+ "scripts": {
44
+ "build": "jsii && (cd example && npm run build)",
45
+ "prepack": "jsii"
46
+ },
47
+ "prettier": {
48
+ "plugins": [
49
+ "prettier-plugin-packagejson"
50
+ ],
51
+ "tabWidth": 2,
52
+ "overrides": [
53
+ {
54
+ "files": "*.sublime-project",
55
+ "options": {
56
+ "parser": "json"
57
+ }
58
+ }
59
+ ]
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^24.2.1",
63
+ "aws-cdk-lib": "^2.210.0",
64
+ "constructs": "^10.4.2",
65
+ "jsii": "^5.9.1",
66
+ "jsii-pacmak": "^1.113.0",
67
+ "prettier": "^3.6.2",
68
+ "prettier-plugin-packagejson": "^2.5.19",
69
+ "typescript": "^5.9.2"
70
+ },
71
+ "peerDependencies": {
72
+ "aws-cdk-lib": "^2.210.0",
73
+ "constructs": "^10.4.2"
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ },
78
+ "jsii": {
79
+ "outdir": "./dist",
80
+ "tsc": {
81
+ "rootDir": "./src",
82
+ "outDir": "./dist"
83
+ },
84
+ "targets": {
85
+ "java": {
86
+ "package": "flit.cdk-pipeline",
87
+ "maven": {
88
+ "groupId": "flit",
89
+ "artifactId": "cdk-pipeline"
90
+ }
91
+ },
92
+ "dotnet": {
93
+ "namespace": "Flit.CDK.Pipeline",
94
+ "packageId": "Flit.CDK.Pipeline"
95
+ },
96
+ "python": {
97
+ "libName": "flit.cdk-pipeline",
98
+ "module": "flit.cdk-pipeline",
99
+ "classifiers": [
100
+ "Framework :: AWS CDK",
101
+ "Framework :: AWS CDK :: 2"
102
+ ]
103
+ }
104
+ }
105
+ },
106
+ "stability": "stable"
101
107
  }
package/src/pipeline.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { App, Stack, StackProps } from "aws-cdk-lib";
2
2
  import { Construct } from "constructs";
3
3
  import {
4
- Pipeline as AwsPipeline,
5
- IAction,
6
- PipelineType,
4
+ Pipeline as AwsPipeline,
5
+ IAction,
6
+ PipelineType,
7
7
  } from "aws-cdk-lib/aws-codepipeline";
8
8
  import * as path from "path";
9
9
 
@@ -12,120 +12,120 @@ import { isSource } from "./source-segment";
12
12
  import { isPipeline } from "./pipeline-segment";
13
13
 
14
14
  export interface PipelineProps extends StackProps {
15
- /**
16
- * The name of the generated pipeline.
17
- * @default Stack ID
18
- */
19
- readonly pipelineName?: string;
20
- /**
21
- * The path to the cdk projects root directory containing the cdk.json file
22
- * relative to the asset root
23
- * @default "."
24
- */
25
- readonly rootDir?: string;
26
- /**
27
- * The segments to populating the pipeline.
28
- */
29
- readonly segments: (Segment | Segment[])[];
15
+ /**
16
+ * The name of the generated pipeline.
17
+ * @default Stack ID
18
+ */
19
+ readonly pipelineName?: string;
20
+ /**
21
+ * The path to the cdk projects root directory containing the cdk.json file
22
+ * relative to the asset root
23
+ * @default "."
24
+ */
25
+ readonly rootDir?: string;
26
+ /**
27
+ * The segments to populating the pipeline.
28
+ */
29
+ readonly segments: (Segment | Segment[])[];
30
30
  }
31
31
 
32
32
  /**
33
33
  * @category Constructs
34
34
  */
35
35
  export class Pipeline extends Stack {
36
- readonly pipelineName: string;
37
- readonly rootDir: string;
38
- readonly buildDir: string;
36
+ readonly pipelineName: string;
37
+ readonly rootDir: string;
38
+ readonly buildDir: string;
39
39
 
40
- constructor(
41
- scope: Construct,
42
- id: string,
43
- readonly props: PipelineProps,
44
- ) {
45
- super(scope, id, props);
40
+ constructor(
41
+ scope: Construct,
42
+ id: string,
43
+ readonly props: PipelineProps,
44
+ ) {
45
+ super(scope, id, props);
46
46
 
47
- this.pipelineName = props.pipelineName || id;
48
- this.rootDir = props.rootDir || ".";
49
- this.buildDir = path.join(this.rootDir, (this.node.root as App).outdir);
47
+ this.pipelineName = props.pipelineName || id;
48
+ this.rootDir = props.rootDir || ".";
49
+ this.buildDir = path.join(this.rootDir, (this.node.root as App).outdir);
50
50
 
51
- if (!this.bundlingRequired) return;
51
+ if (!this.bundlingRequired) return;
52
52
 
53
- const segments = props.segments.map((segment) =>
54
- Array.isArray(segment) ? segment : [segment],
55
- );
53
+ const segments = props.segments.map((segment) =>
54
+ Array.isArray(segment) ? segment : [segment],
55
+ );
56
56
 
57
- segments.forEach((unit) => {
58
- unit.forEach((segment) => {
59
- segment.inputs.forEach((artifact) => {
60
- if (!artifact.producer) {
61
- throw new Error("Artifact consumed but never produced.");
62
- }
63
- });
64
- });
65
- });
57
+ segments.forEach((unit) => {
58
+ unit.forEach((segment) => {
59
+ segment.inputs.forEach((artifact) => {
60
+ if (!artifact.producer) {
61
+ throw new Error("Artifact consumed but never produced.");
62
+ }
63
+ });
64
+ });
65
+ });
66
66
 
67
- if (segments[0].filter(isSource).length !== segments[0].length) {
68
- throw new Error("First segment must contain only source segments");
69
- }
67
+ if (segments[0].filter(isSource).length !== segments[0].length) {
68
+ throw new Error("First segment must contain only source segments");
69
+ }
70
70
 
71
- if (segments.slice(1).find((unit) => unit.filter(isSource).length)) {
72
- throw new Error("Only the first segment can contain source segments");
73
- }
71
+ if (segments.slice(1).find((unit) => unit.filter(isSource).length)) {
72
+ throw new Error("Only the first segment can contain source segments");
73
+ }
74
74
 
75
- if (
76
- segments[1].length === 1 &&
77
- segments[1].filter(isPipeline).length !== segments[0].length
78
- ) {
79
- throw new Error("Second segment must be the pipeline segment");
80
- }
75
+ if (
76
+ segments[1].length === 1 &&
77
+ segments[1].filter(isPipeline).length !== segments[1].length
78
+ ) {
79
+ throw new Error("Second segment must be the pipeline segment");
80
+ }
81
81
 
82
- if (segments.slice(2).find((unit) => unit.filter(isPipeline).length)) {
83
- throw new Error("Only the second segment can be the pipeline segment");
84
- }
82
+ if (segments.slice(2).find((unit) => unit.filter(isPipeline).length)) {
83
+ throw new Error("Only the second segment can be the pipeline segment");
84
+ }
85
85
 
86
- new AwsPipeline(this, "Pipeline", {
87
- pipelineName: props.pipelineName,
88
- restartExecutionOnUpdate: true,
89
- pipelineType: PipelineType.V2,
90
- stages: [
91
- {
92
- stageName: "Source",
93
- actions: [
94
- ...segments[0].reduce(
95
- (actions, segment) => [
96
- ...actions,
97
- ...segment.construct(this).actions,
98
- ],
99
- [] as IAction[],
100
- ),
101
- ],
102
- },
103
- {
104
- stageName: "Pipeline",
105
- actions: [
106
- ...segments[1].reduce(
107
- (actions, segment) => [
108
- ...actions,
109
- ...segment.construct(this).actions,
110
- ],
111
- [] as IAction[],
112
- ),
113
- ],
114
- },
115
- ...segments.slice(2).map((unit) => {
116
- const builds = unit.reduce(
117
- (segments, segment) => [...segments, segment.construct(this)],
118
- [] as SegmentConstructed[],
119
- );
120
- return {
121
- stageName: builds.map((build) => build.name).join(""),
122
- actions: builds.reduce(
123
- (actions, build) => [...actions, ...build.actions],
124
- [] as IAction[],
125
- ),
126
- };
127
- }),
128
- ],
129
- });
130
- }
86
+ new AwsPipeline(this, "Pipeline", {
87
+ pipelineName: props.pipelineName,
88
+ restartExecutionOnUpdate: true,
89
+ pipelineType: PipelineType.V2,
90
+ stages: [
91
+ {
92
+ stageName: "Source",
93
+ actions: [
94
+ ...segments[0].reduce(
95
+ (actions, segment) => [
96
+ ...actions,
97
+ ...segment.construct(this).actions,
98
+ ],
99
+ [] as IAction[],
100
+ ),
101
+ ],
102
+ },
103
+ {
104
+ stageName: "Pipeline",
105
+ actions: [
106
+ ...segments[1].reduce(
107
+ (actions, segment) => [
108
+ ...actions,
109
+ ...segment.construct(this).actions,
110
+ ],
111
+ [] as IAction[],
112
+ ),
113
+ ],
114
+ },
115
+ ...segments.slice(2).map((unit) => {
116
+ const builds = unit.reduce(
117
+ (segments, segment) => [...segments, segment.construct(this)],
118
+ [] as SegmentConstructed[],
119
+ );
120
+ return {
121
+ stageName: builds.map((build) => build.name).join("-"),
122
+ actions: builds.reduce(
123
+ (actions, build) => [...actions, ...build.actions],
124
+ [] as IAction[],
125
+ ),
126
+ };
127
+ }),
128
+ ],
129
+ });
130
+ }
131
131
  }