projen-cdktf-hybrid-construct 0.1.1

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/.gitattributes ADDED
@@ -0,0 +1,25 @@
1
+ # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
2
+
3
+ *.snap linguist-generated
4
+ /.eslintrc.json linguist-generated
5
+ /.gitattributes linguist-generated
6
+ /.github/pull_request_template.md linguist-generated
7
+ /.github/workflows/auto-approve.yml linguist-generated
8
+ /.github/workflows/build.yml linguist-generated
9
+ /.github/workflows/pull-request-lint.yml linguist-generated
10
+ /.github/workflows/release.yml linguist-generated
11
+ /.github/workflows/upgrade-main.yml linguist-generated
12
+ /.gitignore linguist-generated
13
+ /.mergify.yml linguist-generated
14
+ /.npmignore linguist-generated
15
+ /.prettierignore linguist-generated
16
+ /.prettierrc.json linguist-generated
17
+ /.projen/** linguist-generated
18
+ /.projen/deps.json linguist-generated
19
+ /.projen/files.json linguist-generated
20
+ /.projen/tasks.json linguist-generated
21
+ /LICENSE linguist-generated
22
+ /package.json linguist-generated
23
+ /tsconfig.dev.json linguist-generated
24
+ /tsconfig.json linguist-generated
25
+ /yarn.lock linguist-generated
@@ -0,0 +1 @@
1
+ # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
@@ -0,0 +1,3 @@
1
+ {
2
+ "overrides": []
3
+ }
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2022 Daniel Schmidt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Projen-CDKTF-Hybrid-Construct
2
+
3
+ Projen template for CDKTF Constructs that should also be used as Terraform Modules.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ mkdir my-new-hybrid-construct
9
+ cd my-new-hybrid-construct
10
+ npx projen typescript
11
+ npm install projen-cdktf-hybrid-construct
12
+ ```
13
+
14
+ Edit the `.projenrc.js`:
15
+
16
+ ```js
17
+ const { HybridModule } = require("projen-cdktf-hybrid-construct");
18
+
19
+ const project = new HybridModule({
20
+ defaultReleaseBranch: "main",
21
+ name: "my-new-hybrid-construct",
22
+
23
+ // All options available in the Projen Typescript template
24
+ // deps: [], /* Runtime dependencies of this module. */
25
+ // description: undefined, /* The description is just a string that helps people understand the purpose of the package. */
26
+ // devDeps: [], /* Build dependencies for this module. */
27
+ // packageName: undefined, /* The "name" in package.json. */
28
+ });
29
+ project.synth();
30
+ ```
31
+
32
+ ### Roadmap
33
+
34
+ - [x] Add dedicated file for HCL templates
35
+ - [x] Add example folder
36
+ - [ ] Add `terraform` example folder
37
+ - [ ] [Auto-generate parts of the docs](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/e90c877a741ab3cc4215376a70f7bcc360b6a3d2/.github/workflows/pre-commit.yml)
38
+ - [ ] Add testing strategy
39
+ - [ ] Add deployment scripts to Artifactory
40
+ - [ ] Add deployment scripts to Github Packages
41
+ - [ ] Add construct / option / docs to publish existing module as construct
42
+ - [ ] Add construct for managing multiple repos like this
43
+ - [ ] Add option to manager projen template to bootstrap cdktf app that deploys Artifactory?
@@ -0,0 +1,24 @@
1
+ # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
2
+
3
+ *.snap linguist-generated
4
+ /.eslintrc.json linguist-generated
5
+ /.gitattributes linguist-generated
6
+ /.github/pull_request_template.md linguist-generated
7
+ /.github/workflows/build.yml linguist-generated
8
+ /.github/workflows/pull-request-lint.yml linguist-generated
9
+ /.github/workflows/release.yml linguist-generated
10
+ /.github/workflows/upgrade-main.yml linguist-generated
11
+ /.gitignore linguist-generated
12
+ /.mergify.yml linguist-generated
13
+ /.npmignore linguist-generated
14
+ /.prettierignore linguist-generated
15
+ /.prettierrc.json linguist-generated
16
+ /.projen/** linguist-generated
17
+ /.projen/deps.json linguist-generated
18
+ /.projen/files.json linguist-generated
19
+ /.projen/tasks.json linguist-generated
20
+ /LICENSE linguist-generated
21
+ /package.json linguist-generated
22
+ /scripts/copy-modules.sh linguist-generated
23
+ /tsconfig.dev.json linguist-generated
24
+ /yarn.lock linguist-generated
package/example/.jsii ADDED
@@ -0,0 +1,210 @@
1
+ {
2
+ "author": {
3
+ "email": "danielmschmidt92@gmail.com",
4
+ "name": "Daniel Schmidt",
5
+ "roles": [
6
+ "author"
7
+ ]
8
+ },
9
+ "dependencies": {
10
+ "cdktf": "^0.9.4",
11
+ "cdktf-tf-module-stack": "^0.0.8",
12
+ "constructs": "^10.0.25"
13
+ },
14
+ "dependencyClosure": {
15
+ "cdktf": {
16
+ "submodules": {
17
+ "cdktf.testingMatchers": {}
18
+ },
19
+ "targets": {
20
+ "dotnet": {
21
+ "namespace": "HashiCorp.Cdktf",
22
+ "packageId": "HashiCorp.Cdktf"
23
+ },
24
+ "go": {
25
+ "moduleName": "github.com/hashicorp/terraform-cdk-go",
26
+ "packageName": "cdktf"
27
+ },
28
+ "java": {
29
+ "maven": {
30
+ "artifactId": "cdktf",
31
+ "groupId": "com.hashicorp"
32
+ },
33
+ "package": "com.hashicorp.cdktf"
34
+ },
35
+ "js": {
36
+ "npm": "cdktf"
37
+ },
38
+ "python": {
39
+ "distName": "cdktf",
40
+ "module": "cdktf"
41
+ }
42
+ }
43
+ },
44
+ "cdktf-tf-module-stack": {
45
+ "targets": {
46
+ "js": {
47
+ "npm": "cdktf-tf-module-stack"
48
+ },
49
+ "python": {
50
+ "distName": "cdktf-tf-module-stack",
51
+ "module": "cdktf_tf_module_stack"
52
+ }
53
+ }
54
+ },
55
+ "constructs": {
56
+ "targets": {
57
+ "dotnet": {
58
+ "namespace": "Constructs",
59
+ "packageId": "Constructs"
60
+ },
61
+ "go": {
62
+ "moduleName": "github.com/aws/constructs-go"
63
+ },
64
+ "java": {
65
+ "maven": {
66
+ "artifactId": "constructs",
67
+ "groupId": "software.constructs"
68
+ },
69
+ "package": "software.constructs"
70
+ },
71
+ "js": {
72
+ "npm": "constructs"
73
+ },
74
+ "python": {
75
+ "distName": "constructs",
76
+ "module": "constructs"
77
+ }
78
+ }
79
+ }
80
+ },
81
+ "description": "my-module",
82
+ "docs": {
83
+ "stability": "stable"
84
+ },
85
+ "homepage": "github.com/DanielMSchmidt/my-module",
86
+ "jsiiVersion": "1.55.1 (build 07d2d90)",
87
+ "keywords": [
88
+ "cdk",
89
+ "cdktf",
90
+ "cdktf-hybrid"
91
+ ],
92
+ "license": "Apache-2.0",
93
+ "metadata": {
94
+ "jsii": {
95
+ "pacmak": {
96
+ "hasDefaultInterfaces": true
97
+ }
98
+ },
99
+ "tscRootDir": "src"
100
+ },
101
+ "name": "my-module",
102
+ "readme": {
103
+ "markdown": "# replace this"
104
+ },
105
+ "repository": {
106
+ "type": "git",
107
+ "url": "github.com/DanielMSchmidt/my-module"
108
+ },
109
+ "schema": "jsii/0.10.0",
110
+ "targets": {
111
+ "js": {
112
+ "npm": "my-module"
113
+ }
114
+ },
115
+ "types": {
116
+ "my-module.MyConstruct": {
117
+ "assembly": "my-module",
118
+ "base": "constructs.Construct",
119
+ "docs": {
120
+ "stability": "stable"
121
+ },
122
+ "fqn": "my-module.MyConstruct",
123
+ "initializer": {
124
+ "docs": {
125
+ "stability": "stable"
126
+ },
127
+ "locationInModule": {
128
+ "filename": "src/index.ts",
129
+ "line": 8
130
+ },
131
+ "parameters": [
132
+ {
133
+ "name": "scope",
134
+ "type": {
135
+ "fqn": "constructs.Construct"
136
+ }
137
+ },
138
+ {
139
+ "name": "id",
140
+ "type": {
141
+ "primitive": "string"
142
+ }
143
+ },
144
+ {
145
+ "name": "config",
146
+ "type": {
147
+ "fqn": "my-module.MyConstructOptions"
148
+ }
149
+ }
150
+ ]
151
+ },
152
+ "kind": "class",
153
+ "locationInModule": {
154
+ "filename": "src/index.ts",
155
+ "line": 7
156
+ },
157
+ "name": "MyConstruct",
158
+ "properties": [
159
+ {
160
+ "docs": {
161
+ "stability": "stable"
162
+ },
163
+ "locationInModule": {
164
+ "filename": "src/index.ts",
165
+ "line": 8
166
+ },
167
+ "name": "config",
168
+ "type": {
169
+ "fqn": "my-module.MyConstructOptions"
170
+ }
171
+ }
172
+ ],
173
+ "symbolId": "src/index:MyConstruct"
174
+ },
175
+ "my-module.MyConstructOptions": {
176
+ "assembly": "my-module",
177
+ "datatype": true,
178
+ "docs": {
179
+ "stability": "stable"
180
+ },
181
+ "fqn": "my-module.MyConstructOptions",
182
+ "kind": "interface",
183
+ "locationInModule": {
184
+ "filename": "src/index.ts",
185
+ "line": 3
186
+ },
187
+ "name": "MyConstructOptions",
188
+ "properties": [
189
+ {
190
+ "abstract": true,
191
+ "docs": {
192
+ "stability": "stable"
193
+ },
194
+ "immutable": true,
195
+ "locationInModule": {
196
+ "filename": "src/index.ts",
197
+ "line": 4
198
+ },
199
+ "name": "propertyA",
200
+ "type": {
201
+ "primitive": "string"
202
+ }
203
+ }
204
+ ],
205
+ "symbolId": "src/index:MyConstructOptions"
206
+ }
207
+ },
208
+ "version": "0.0.0",
209
+ "fingerprint": "LXRNBKCxxunulhAB9xLnKA+HxpjBvVIPGPTWDGAv1/s="
210
+ }
@@ -0,0 +1 @@
1
+ # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
@@ -0,0 +1,3 @@
1
+ {
2
+ "overrides": []
3
+ }
package/example/API.md ADDED
@@ -0,0 +1,160 @@
1
+ # API Reference <a name="API Reference" id="api-reference"></a>
2
+
3
+ ## Constructs <a name="Constructs" id="Constructs"></a>
4
+
5
+ ### MyConstruct <a name="MyConstruct" id="my-module.MyConstruct"></a>
6
+
7
+ #### Initializers <a name="Initializers" id="my-module.MyConstruct.Initializer"></a>
8
+
9
+ ```typescript
10
+ import { MyConstruct } from 'my-module'
11
+
12
+ new MyConstruct(scope: Construct, id: string, config: MyConstructOptions)
13
+ ```
14
+
15
+ | **Name** | **Type** | **Description** |
16
+ | --- | --- | --- |
17
+ | <code><a href="#my-module.MyConstruct.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
18
+ | <code><a href="#my-module.MyConstruct.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
19
+ | <code><a href="#my-module.MyConstruct.Initializer.parameter.config">config</a></code> | <code><a href="#my-module.MyConstructOptions">MyConstructOptions</a></code> | *No description.* |
20
+
21
+ ---
22
+
23
+ ##### `scope`<sup>Required</sup> <a name="scope" id="my-module.MyConstruct.Initializer.parameter.scope"></a>
24
+
25
+ - *Type:* constructs.Construct
26
+
27
+ ---
28
+
29
+ ##### `id`<sup>Required</sup> <a name="id" id="my-module.MyConstruct.Initializer.parameter.id"></a>
30
+
31
+ - *Type:* string
32
+
33
+ ---
34
+
35
+ ##### `config`<sup>Required</sup> <a name="config" id="my-module.MyConstruct.Initializer.parameter.config"></a>
36
+
37
+ - *Type:* <a href="#my-module.MyConstructOptions">MyConstructOptions</a>
38
+
39
+ ---
40
+
41
+ #### Methods <a name="Methods" id="Methods"></a>
42
+
43
+ | **Name** | **Description** |
44
+ | --- | --- |
45
+ | <code><a href="#my-module.MyConstruct.toString">toString</a></code> | Returns a string representation of this construct. |
46
+
47
+ ---
48
+
49
+ ##### `toString` <a name="toString" id="my-module.MyConstruct.toString"></a>
50
+
51
+ ```typescript
52
+ public toString(): string
53
+ ```
54
+
55
+ Returns a string representation of this construct.
56
+
57
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
58
+
59
+ | **Name** | **Description** |
60
+ | --- | --- |
61
+ | <code><a href="#my-module.MyConstruct.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
62
+
63
+ ---
64
+
65
+ ##### `isConstruct` <a name="isConstruct" id="my-module.MyConstruct.isConstruct"></a>
66
+
67
+ ```typescript
68
+ import { MyConstruct } from 'my-module'
69
+
70
+ MyConstruct.isConstruct(x: any)
71
+ ```
72
+
73
+ Checks if `x` is a construct.
74
+
75
+ Use this method instead of `instanceof` to properly detect `Construct`
76
+ instances, even when the construct library is symlinked.
77
+
78
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
79
+ disk are seen as independent, completely different libraries. As a
80
+ consequence, the class `Construct` in each copy of the `constructs` library
81
+ is seen as a different class, and an instance of one class will not test as
82
+ `instanceof` the other class. `npm install` will not create installations
83
+ like this, but users may manually symlink construct libraries together or
84
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
85
+ library can be accidentally installed, and `instanceof` will behave
86
+ unpredictably. It is safest to avoid using `instanceof`, and using
87
+ this type-testing method instead.
88
+
89
+ ###### `x`<sup>Required</sup> <a name="x" id="my-module.MyConstruct.isConstruct.parameter.x"></a>
90
+
91
+ - *Type:* any
92
+
93
+ Any object.
94
+
95
+ ---
96
+
97
+ #### Properties <a name="Properties" id="Properties"></a>
98
+
99
+ | **Name** | **Type** | **Description** |
100
+ | --- | --- | --- |
101
+ | <code><a href="#my-module.MyConstruct.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
102
+ | <code><a href="#my-module.MyConstruct.property.config">config</a></code> | <code><a href="#my-module.MyConstructOptions">MyConstructOptions</a></code> | *No description.* |
103
+
104
+ ---
105
+
106
+ ##### `node`<sup>Required</sup> <a name="node" id="my-module.MyConstruct.property.node"></a>
107
+
108
+ ```typescript
109
+ public readonly node: Node;
110
+ ```
111
+
112
+ - *Type:* constructs.Node
113
+
114
+ The tree node.
115
+
116
+ ---
117
+
118
+ ##### `config`<sup>Required</sup> <a name="config" id="my-module.MyConstruct.property.config"></a>
119
+
120
+ ```typescript
121
+ public readonly config: MyConstructOptions;
122
+ ```
123
+
124
+ - *Type:* <a href="#my-module.MyConstructOptions">MyConstructOptions</a>
125
+
126
+ ---
127
+
128
+
129
+ ## Structs <a name="Structs" id="Structs"></a>
130
+
131
+ ### MyConstructOptions <a name="MyConstructOptions" id="my-module.MyConstructOptions"></a>
132
+
133
+ #### Initializer <a name="Initializer" id="my-module.MyConstructOptions.Initializer"></a>
134
+
135
+ ```typescript
136
+ import { MyConstructOptions } from 'my-module'
137
+
138
+ const myConstructOptions: MyConstructOptions = { ... }
139
+ ```
140
+
141
+ #### Properties <a name="Properties" id="Properties"></a>
142
+
143
+ | **Name** | **Type** | **Description** |
144
+ | --- | --- | --- |
145
+ | <code><a href="#my-module.MyConstructOptions.property.propertyA">propertyA</a></code> | <code>string</code> | *No description.* |
146
+
147
+ ---
148
+
149
+ ##### `propertyA`<sup>Required</sup> <a name="propertyA" id="my-module.MyConstructOptions.property.propertyA"></a>
150
+
151
+ ```typescript
152
+ public readonly propertyA: string;
153
+ ```
154
+
155
+ - *Type:* string
156
+
157
+ ---
158
+
159
+
160
+