@enspirit/emb 0.0.9 → 0.1.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/README.md +50 -28
- package/dist/src/cli/abstract/BaseCommand.d.ts +6 -0
- package/dist/src/cli/abstract/BaseCommand.js +33 -0
- package/dist/src/cli/abstract/FlavouredCommand.d.ts +2 -1
- package/dist/src/cli/abstract/FlavouredCommand.js +4 -3
- package/dist/src/cli/abstract/index.d.ts +1 -0
- package/dist/src/cli/abstract/index.js +1 -0
- package/dist/src/cli/commands/clean.d.ts +2 -2
- package/dist/src/cli/commands/clean.js +7 -6
- package/dist/src/cli/commands/components/index.d.ts +5 -4
- package/dist/src/cli/commands/components/index.js +13 -15
- package/dist/src/cli/commands/config/print.d.ts +2 -2
- package/dist/src/cli/commands/containers/index.d.ts +2 -2
- package/dist/src/cli/commands/containers/index.js +3 -3
- package/dist/src/cli/commands/containers/prune.d.ts +2 -2
- package/dist/src/cli/commands/containers/prune.js +2 -2
- package/dist/src/cli/commands/images/delete.d.ts +2 -2
- package/dist/src/cli/commands/images/delete.js +3 -2
- package/dist/src/cli/commands/images/index.d.ts +2 -2
- package/dist/src/cli/commands/images/index.js +3 -3
- package/dist/src/cli/commands/images/prune.d.ts +2 -2
- package/dist/src/cli/commands/images/prune.js +3 -2
- package/dist/src/cli/commands/{components → resources}/build.d.ts +3 -3
- package/dist/src/cli/commands/{components → resources}/build.js +11 -10
- package/dist/src/cli/commands/resources/index.d.ts +9 -0
- package/dist/src/cli/commands/resources/index.js +28 -0
- package/dist/src/cli/commands/tasks/index.d.ts +2 -2
- package/dist/src/cli/commands/tasks/index.js +4 -4
- package/dist/src/cli/commands/tasks/run.d.ts +2 -2
- package/dist/src/cli/commands/tasks/run.js +12 -5
- package/dist/src/cli/commands/up.js +5 -4
- package/dist/src/cli/hooks/init.js +1 -26
- package/dist/src/cli/utils.d.ts +1 -0
- package/dist/src/cli/utils.js +26 -0
- package/dist/src/config/convert.d.ts +2 -4
- package/dist/src/config/convert.js +12 -35
- package/dist/src/config/index.d.ts +3 -4
- package/dist/src/config/index.js +2 -3
- package/dist/src/config/schema.d.ts +69 -48
- package/dist/src/config/schema.json +185 -99
- package/dist/src/config/types.d.ts +13 -46
- package/dist/src/config/types.js +1 -1
- package/dist/src/config/validation.d.ts +3 -3
- package/dist/src/config/validation.js +9 -9
- package/dist/src/context.d.ts +1 -1
- package/dist/src/context.js +1 -0
- package/dist/src/docker/images/index.d.ts +0 -1
- package/dist/src/docker/images/index.js +0 -1
- package/dist/src/docker/index.d.ts +1 -1
- package/dist/src/docker/index.js +1 -1
- package/dist/src/docker/operations/containers/ExecContainerOperation.js +2 -1
- package/dist/src/docker/operations/images/BuildImageOperation.d.ts +7 -8
- package/dist/src/docker/operations/images/BuildImageOperation.js +16 -10
- package/dist/src/docker/resources/DockerImageResource.js +56 -0
- package/dist/src/docker/resources/index.d.ts +1 -0
- package/dist/src/docker/resources/index.js +1 -0
- package/dist/src/docker/utils.d.ts +1 -7
- package/dist/src/docker/utils.js +3 -7
- package/dist/src/errors.d.ts +9 -6
- package/dist/src/errors.js +15 -9
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/monorepo/component.d.ts +14 -19
- package/dist/src/monorepo/component.js +42 -58
- package/dist/src/monorepo/config.d.ts +13 -15
- package/dist/src/monorepo/config.js +15 -46
- package/dist/src/monorepo/index.d.ts +1 -0
- package/dist/src/monorepo/index.js +1 -0
- package/dist/src/monorepo/monorepo.d.ts +13 -10
- package/dist/src/monorepo/monorepo.js +78 -19
- package/dist/src/monorepo/operations/components/index.d.ts +0 -1
- package/dist/src/monorepo/operations/components/index.js +0 -1
- package/dist/src/monorepo/operations/fs/CreateFileOperation.d.ts +11 -0
- package/dist/src/monorepo/operations/fs/CreateFileOperation.js +31 -0
- package/dist/src/monorepo/operations/fs/index.d.ts +1 -0
- package/dist/src/monorepo/operations/fs/index.js +1 -0
- package/dist/src/monorepo/operations/index.d.ts +1 -0
- package/dist/src/monorepo/operations/index.js +1 -0
- package/dist/src/monorepo/operations/resources/BuildResourcesOperation.d.ts +27 -0
- package/dist/src/monorepo/operations/resources/BuildResourcesOperation.js +146 -0
- package/dist/src/monorepo/operations/tasks/RunTasksOperation.js +1 -1
- package/dist/src/monorepo/plugins/{ComponentDiscoverPlugin.d.ts → AutoDockerPlugin.d.ts} +4 -4
- package/dist/src/monorepo/plugins/AutoDockerPlugin.js +46 -0
- package/dist/src/monorepo/plugins/EmbfileLoaderPlugin.js +9 -2
- package/dist/src/monorepo/plugins/index.d.ts +1 -1
- package/dist/src/monorepo/plugins/index.js +3 -3
- package/dist/src/monorepo/resources/FileResource.d.ts +1 -0
- package/dist/src/monorepo/resources/FileResource.js +13 -0
- package/dist/src/monorepo/resources/ResourceFactory.d.ts +23 -0
- package/dist/src/monorepo/resources/ResourceFactory.js +16 -0
- package/dist/src/monorepo/resources/index.d.ts +1 -0
- package/dist/src/monorepo/resources/index.js +1 -0
- package/dist/src/monorepo/store/index.d.ts +1 -1
- package/dist/src/monorepo/store/index.js +10 -2
- package/dist/src/monorepo/taskManagerFactory.d.ts +2 -2
- package/dist/src/monorepo/taskManagerFactory.js +1 -2
- package/dist/src/monorepo/types.d.ts +18 -5
- package/dist/src/monorepo/utils/{findRunOrder.d.ts → EMBCollection.d.ts} +3 -9
- package/dist/src/monorepo/utils/EMBCollection.js +101 -0
- package/dist/src/monorepo/utils/graph.d.ts +15 -0
- package/dist/src/monorepo/utils/graph.js +84 -0
- package/dist/src/monorepo/utils/index.d.ts +7 -1
- package/dist/src/monorepo/utils/index.js +14 -1
- package/dist/src/monorepo/utils/types.d.ts +2 -0
- package/dist/src/monorepo/utils/types.js +1 -0
- package/dist/src/operations/abstract/AbstractOperation.d.ts +3 -1
- package/dist/src/operations/abstract/AbstractOperation.js +3 -0
- package/dist/src/operations/types.d.ts +1 -1
- package/dist/src/prerequisites/GitPrerequisitePlugin.js +2 -2
- package/dist/src/utils/TemplateExpander.d.ts +2 -1
- package/dist/src/utils/TemplateExpander.js +3 -1
- package/oclif.manifest.json +105 -68
- package/package.json +7 -2
- package/dist/src/docker/images/buildImage.d.ts +0 -19
- package/dist/src/docker/images/buildImage.js +0 -64
- package/dist/src/docker/types.d.ts +0 -14
- package/dist/src/monorepo/operations/components/BuildComponentsOperation.d.ts +0 -23
- package/dist/src/monorepo/operations/components/BuildComponentsOperation.js +0 -157
- package/dist/src/monorepo/plugins/ComponentDiscoverPlugin.js +0 -44
- package/dist/src/monorepo/project.d.ts +0 -6
- package/dist/src/monorepo/project.js +0 -8
- package/dist/src/monorepo/utils/findRunOrder.js +0 -165
- /package/dist/src/docker/{types.js → resources/DockerImageResource.d.ts} +0 -0
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "/schemas/config",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "EMBConfig",
|
|
5
5
|
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
6
7
|
"properties": {
|
|
7
8
|
"project": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["name"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"name": {
|
|
13
|
+
"$ref": "#/$defs/Identifier",
|
|
14
|
+
"description": "The name of the project."
|
|
13
15
|
},
|
|
14
|
-
{
|
|
15
|
-
"type": "
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"name": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"minLength": 3,
|
|
21
|
-
"description": "The name of the project."
|
|
22
|
-
},
|
|
23
|
-
"rootDir": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"minLength": 1,
|
|
26
|
-
"description": "The root directory of the project."
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"additionalProperties": false
|
|
16
|
+
"rootDir": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1,
|
|
19
|
+
"description": "The root directory of the project."
|
|
30
20
|
}
|
|
31
|
-
|
|
21
|
+
},
|
|
22
|
+
"additionalProperties": false
|
|
32
23
|
},
|
|
33
24
|
"plugins": {
|
|
34
25
|
"type": "array",
|
|
@@ -37,7 +28,7 @@
|
|
|
37
28
|
"required": ["name"],
|
|
38
29
|
"properties": {
|
|
39
30
|
"name": {
|
|
40
|
-
"
|
|
31
|
+
"$ref": "#/$defs/Identifier"
|
|
41
32
|
},
|
|
42
33
|
"config": {}
|
|
43
34
|
},
|
|
@@ -57,31 +48,38 @@
|
|
|
57
48
|
"additionalProperties": true
|
|
58
49
|
},
|
|
59
50
|
"defaults": {
|
|
60
|
-
"$ref": "#/$defs/
|
|
51
|
+
"$ref": "#/$defs/DefaultsConfig"
|
|
61
52
|
},
|
|
62
53
|
"components": {
|
|
63
|
-
"type": "
|
|
64
|
-
"
|
|
65
|
-
"$ref": "#/$defs/
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": {
|
|
56
|
+
"$ref": "#/$defs/ComponentConfig"
|
|
66
57
|
}
|
|
67
58
|
},
|
|
68
59
|
"flavors": {
|
|
69
|
-
"type": "
|
|
70
|
-
"
|
|
71
|
-
"$ref": "#/$defs/
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": {
|
|
62
|
+
"$ref": "#/$defs/ProjectFlavorConfig"
|
|
72
63
|
}
|
|
73
64
|
},
|
|
74
65
|
"tasks": {
|
|
75
|
-
"type": "
|
|
76
|
-
"
|
|
77
|
-
"$ref": "#/$defs/
|
|
66
|
+
"type": "object",
|
|
67
|
+
"additionalProperties": {
|
|
68
|
+
"$ref": "#/$defs/TaskConfig"
|
|
78
69
|
}
|
|
79
70
|
}
|
|
80
71
|
},
|
|
81
72
|
"required": ["project"],
|
|
82
|
-
"additionalProperties": false,
|
|
83
73
|
"$defs": {
|
|
84
|
-
"
|
|
74
|
+
"Identifier": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"pattern": "^[a-zA-Z]+[\\w._-]+$"
|
|
77
|
+
},
|
|
78
|
+
"QualifiedIdentifier": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"pattern": "^([a-zA-Z]+[\\w._-]+:)?[a-zA-Z]+[\\w._-]+$"
|
|
81
|
+
},
|
|
82
|
+
"DefaultsConfig": {
|
|
85
83
|
"type": "object",
|
|
86
84
|
"description": "Default settings for build aspects",
|
|
87
85
|
"additionalProperties": false,
|
|
@@ -90,8 +88,12 @@
|
|
|
90
88
|
"type": "object",
|
|
91
89
|
"description": "Default docker build settings",
|
|
92
90
|
"properties": {
|
|
93
|
-
"tag": {
|
|
94
|
-
|
|
91
|
+
"tag": {
|
|
92
|
+
"type": "string"
|
|
93
|
+
},
|
|
94
|
+
"target": {
|
|
95
|
+
"$ref": "#/$defs/Identifier"
|
|
96
|
+
},
|
|
95
97
|
"buildArgs": {
|
|
96
98
|
"type": "object",
|
|
97
99
|
"additionalProperties": {
|
|
@@ -108,17 +110,14 @@
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
},
|
|
111
|
-
"
|
|
113
|
+
"TaskConfig": {
|
|
112
114
|
"type": "object",
|
|
113
|
-
"required": [
|
|
115
|
+
"required": [],
|
|
114
116
|
"anyOf": [
|
|
115
117
|
{ "required": ["script"] },
|
|
116
118
|
{ "required": ["pre"] }
|
|
117
119
|
],
|
|
118
120
|
"properties": {
|
|
119
|
-
"name": {
|
|
120
|
-
"type": "string"
|
|
121
|
-
},
|
|
122
121
|
"description": {
|
|
123
122
|
"type": "string"
|
|
124
123
|
},
|
|
@@ -126,7 +125,7 @@
|
|
|
126
125
|
"type": "string"
|
|
127
126
|
},
|
|
128
127
|
"executor": {
|
|
129
|
-
"
|
|
128
|
+
"$ref": "#/$defs/Identifier"
|
|
130
129
|
},
|
|
131
130
|
"options": {
|
|
132
131
|
"type": "object",
|
|
@@ -135,92 +134,179 @@
|
|
|
135
134
|
"pre": {
|
|
136
135
|
"type": "array",
|
|
137
136
|
"items": {
|
|
138
|
-
"
|
|
137
|
+
"$ref": "#/$defs/Identifier"
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
140
|
},
|
|
142
141
|
"additionalProperties": false
|
|
143
142
|
},
|
|
144
|
-
"
|
|
143
|
+
"ComponentConfig": {
|
|
145
144
|
"type": "object",
|
|
146
|
-
"required": [
|
|
145
|
+
"required": [],
|
|
147
146
|
"properties": {
|
|
148
|
-
"name": {
|
|
149
|
-
"type": "string",
|
|
150
|
-
"minLength": 3,
|
|
151
|
-
"description": "The name of the component."
|
|
152
|
-
},
|
|
153
|
-
"docker": {
|
|
154
|
-
"type": "object",
|
|
155
|
-
"properties": {
|
|
156
|
-
"context": {
|
|
157
|
-
"type": "string",
|
|
158
|
-
"minLength": 1,
|
|
159
|
-
"description": "The directory of the component."
|
|
160
|
-
},
|
|
161
|
-
"buildArgs": {
|
|
162
|
-
"type": "object",
|
|
163
|
-
"properties": {},
|
|
164
|
-
"additionalProperties": {
|
|
165
|
-
"type": "string"
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
"dependencies": {
|
|
169
|
-
"type": "array",
|
|
170
|
-
"items": {
|
|
171
|
-
"type": "string"
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
"target": {
|
|
175
|
-
"type": "string",
|
|
176
|
-
"description": "The stage to target for the build"
|
|
177
|
-
},
|
|
178
|
-
"dockerfile": {
|
|
179
|
-
"type": "string",
|
|
180
|
-
"description": "The Dockerfile to use"
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
"additionalProperties": false
|
|
184
|
-
},
|
|
185
147
|
"description": {
|
|
186
148
|
"type": "string",
|
|
187
149
|
"minLength": 1,
|
|
188
150
|
"description": "A description of the component."
|
|
189
151
|
},
|
|
190
152
|
"tasks": {
|
|
191
|
-
"type": "
|
|
192
|
-
"
|
|
193
|
-
"$ref": "#/$defs/
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": {
|
|
155
|
+
"$ref": "#/$defs/TaskConfig"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"resources": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"additionalProperties": {
|
|
161
|
+
"$ref": "#/$defs/ResourceConfig"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"flavors": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"additionalProperties": {
|
|
167
|
+
"$ref": "#/$defs/ComponentFlavorConfig"
|
|
194
168
|
}
|
|
195
169
|
}
|
|
196
170
|
},
|
|
197
171
|
"additionalProperties": false
|
|
198
172
|
},
|
|
199
|
-
"
|
|
173
|
+
"DockerImageConfig": {
|
|
200
174
|
"type": "object",
|
|
201
|
-
"required": ["name"],
|
|
202
175
|
"properties": {
|
|
203
|
-
"
|
|
204
|
-
"type": "string"
|
|
205
|
-
},
|
|
206
|
-
"env": {
|
|
176
|
+
"buildArgs": {
|
|
207
177
|
"type": "object",
|
|
208
|
-
"
|
|
178
|
+
"properties": {},
|
|
209
179
|
"additionalProperties": {
|
|
210
180
|
"type": "string"
|
|
211
181
|
}
|
|
212
182
|
},
|
|
213
|
-
"
|
|
183
|
+
"target": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"description": "The stage to target for the build"
|
|
186
|
+
},
|
|
187
|
+
"dockerfile": {
|
|
188
|
+
"type": "string",
|
|
189
|
+
"description": "The Dockerfile to use"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"additionalProperties": false
|
|
193
|
+
},
|
|
194
|
+
"ProjectFlavorConfig": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"additionalProperties": false,
|
|
197
|
+
"required": [],
|
|
198
|
+
"properties": {
|
|
199
|
+
"defaults": {
|
|
200
|
+
"$ref": "#/$defs/DefaultsConfig"
|
|
201
|
+
},
|
|
202
|
+
"patches": {
|
|
214
203
|
"type": "array",
|
|
215
204
|
"items": {
|
|
216
|
-
"$ref": "#/$defs/
|
|
205
|
+
"$ref": "#/$defs/JsonPatchOperation"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"ResourceConfig": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"required": ["type"],
|
|
213
|
+
"properties": {
|
|
214
|
+
"type": { "type": "string" },
|
|
215
|
+
"params": {},
|
|
216
|
+
"dependencies": {
|
|
217
|
+
"type": "array",
|
|
218
|
+
"items": {
|
|
219
|
+
"$ref": "#/$defs/QualifiedIdentifier"
|
|
220
|
+
},
|
|
221
|
+
"uniqueItems": true
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"additionalProperties": false,
|
|
225
|
+
"allOf": [
|
|
226
|
+
{
|
|
227
|
+
"if": {
|
|
228
|
+
"properties": { "type": { "const": "docker/DockerImageConfig" } },
|
|
229
|
+
"required": ["type"]
|
|
230
|
+
},
|
|
231
|
+
"then": {
|
|
232
|
+
"properties": { "params": { "$ref": "#/$defs/DockerImageConfig" } }
|
|
233
|
+
},
|
|
234
|
+
"else": {
|
|
235
|
+
"properties": { "params": { "type": "object" } }
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"ComponentFlavorConfig": {
|
|
241
|
+
"type": "object",
|
|
242
|
+
"additionalProperties": false,
|
|
243
|
+
"required": [],
|
|
244
|
+
"properties": {
|
|
245
|
+
"patches": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"items": {
|
|
248
|
+
"$ref": "#/$defs/JsonPatchOperation"
|
|
217
249
|
}
|
|
218
|
-
},
|
|
219
|
-
"defaults": {
|
|
220
|
-
"$ref": "#/$defs/defaults"
|
|
221
250
|
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"JsonPatchAddOperation": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"properties": {
|
|
256
|
+
"op": { "const": "add" },
|
|
257
|
+
"path": { "type": "string", "minLength": 1 },
|
|
258
|
+
"value": {}
|
|
259
|
+
},
|
|
260
|
+
"required": ["op", "path", "value"],
|
|
261
|
+
"additionalProperties": false
|
|
262
|
+
},
|
|
263
|
+
"JsonPatchRemoveOperation": {
|
|
264
|
+
"type": "object",
|
|
265
|
+
"properties": {
|
|
266
|
+
"op": { "const": "remove" },
|
|
267
|
+
"path": { "type": "string", "minLength": 1 }
|
|
222
268
|
},
|
|
269
|
+
"required": ["op", "path"],
|
|
223
270
|
"additionalProperties": false
|
|
271
|
+
},
|
|
272
|
+
"JsonPatchReplaceOperation": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"properties": {
|
|
275
|
+
"op": { "const": "replace" },
|
|
276
|
+
"path": { "type": "string", "minLength": 1 },
|
|
277
|
+
"value": {}
|
|
278
|
+
},
|
|
279
|
+
"required": ["op", "path", "value"],
|
|
280
|
+
"additionalProperties": false
|
|
281
|
+
},
|
|
282
|
+
"JsonPatchMoveOperation": {
|
|
283
|
+
"type": "object",
|
|
284
|
+
"properties": {
|
|
285
|
+
"op": { "const": "move" },
|
|
286
|
+
"path": { "type": "string", "minLength": 1 },
|
|
287
|
+
"from": { "type": "string", "minLength": 1 }
|
|
288
|
+
},
|
|
289
|
+
"required": ["op", "path", "from"],
|
|
290
|
+
"additionalProperties": false
|
|
291
|
+
},
|
|
292
|
+
"JsonPatchCopyOperation": {
|
|
293
|
+
"type": "object",
|
|
294
|
+
"properties": {
|
|
295
|
+
"op": { "const": "copy" },
|
|
296
|
+
"path": { "type": "string", "minLength": 1 },
|
|
297
|
+
"from": { "type": "string", "minLength": 1 }
|
|
298
|
+
},
|
|
299
|
+
"required": ["op", "path", "from"],
|
|
300
|
+
"additionalProperties": false
|
|
301
|
+
},
|
|
302
|
+
"JsonPatchOperation": {
|
|
303
|
+
"oneOf": [
|
|
304
|
+
{ "$ref": "#/$defs/JsonPatchAddOperation" },
|
|
305
|
+
{ "$ref": "#/$defs/JsonPatchRemoveOperation" },
|
|
306
|
+
{ "$ref": "#/$defs/JsonPatchReplaceOperation" },
|
|
307
|
+
{ "$ref": "#/$defs/JsonPatchMoveOperation" },
|
|
308
|
+
{ "$ref": "#/$defs/JsonPatchCopyOperation" }
|
|
309
|
+
]
|
|
224
310
|
}
|
|
225
311
|
}
|
|
226
312
|
}
|
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
labels?: Record<string, string>;
|
|
15
|
-
target?: string;
|
|
16
|
-
};
|
|
17
|
-
tasks?: Array<Task>;
|
|
18
|
-
};
|
|
19
|
-
export type DefaultSettings = {
|
|
20
|
-
docker?: {
|
|
21
|
-
buildArgs?: Record<string, string>;
|
|
22
|
-
labels?: Record<string, string>;
|
|
23
|
-
tag?: string;
|
|
24
|
-
target?: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export type FlavorConfig = {
|
|
28
|
-
components?: Array<ComponentConfig>;
|
|
29
|
-
defaults?: DefaultSettings;
|
|
30
|
-
env?: Record<string, string>;
|
|
31
|
-
name: string;
|
|
32
|
-
};
|
|
33
|
-
export type PluginConfig = {
|
|
34
|
-
config?: unknown;
|
|
35
|
-
name: string;
|
|
36
|
-
};
|
|
37
|
-
export type IMonorepoConfig = {
|
|
38
|
-
currentFlavor?: string;
|
|
39
|
-
components: Array<ComponentConfig>;
|
|
40
|
-
defaults?: DefaultSettings;
|
|
41
|
-
env?: Record<string, string>;
|
|
42
|
-
flavors?: Array<FlavorConfig>;
|
|
43
|
-
plugins?: Array<PluginConfig>;
|
|
44
|
-
project: IProjectConfig;
|
|
45
|
-
tasks?: Array<Task>;
|
|
46
|
-
vars?: Record<string, unknown>;
|
|
1
|
+
import { EMBConfig, ResourceConfig } from './schema.js';
|
|
2
|
+
export * from './schema.js';
|
|
3
|
+
type RemoveIndexSignature<T> = {
|
|
4
|
+
[K in keyof T as K extends string ? (string extends K ? never : K) : K]: T[K];
|
|
5
|
+
};
|
|
6
|
+
export type ProjectConfig = Required<EMBConfig['project']>;
|
|
7
|
+
export type UserConfig = EMBConfig & {
|
|
8
|
+
project: ProjectConfig;
|
|
9
|
+
};
|
|
10
|
+
export type PluginConfig = Required<EMBConfig>['plugins'][number];
|
|
11
|
+
export type IResourceConfig = RemoveIndexSignature<ResourceConfig>;
|
|
12
|
+
export type QualifiedResourceConfig = IResourceConfig & {
|
|
13
|
+
id: string;
|
|
47
14
|
};
|
package/dist/src/config/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './schema.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const validateUserConfig: (pathOrObject: string | unknown) => Promise<
|
|
3
|
-
export declare const validateEmbfile: (pathOrObject: string | unknown) => Promise<
|
|
1
|
+
import { ComponentConfig, UserConfig } from './types.js';
|
|
2
|
+
export declare const validateUserConfig: (pathOrObject: string | unknown) => Promise<UserConfig>;
|
|
3
|
+
export declare const validateEmbfile: (pathOrObject: string | unknown) => Promise<ComponentConfig>;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { Ajv } from 'ajv';
|
|
2
2
|
import { readFile, stat } from 'node:fs/promises';
|
|
3
3
|
import yaml from 'yaml';
|
|
4
|
-
import {
|
|
4
|
+
import { toUserConfig } from './convert.js';
|
|
5
5
|
import configSchema from './schema.json' with { type: 'json' };
|
|
6
6
|
const ajv = new Ajv();
|
|
7
7
|
ajv.addSchema(configSchema);
|
|
8
8
|
export const validateUserConfig = async (pathOrObject) => {
|
|
9
|
-
let
|
|
9
|
+
let embConfig;
|
|
10
10
|
if (typeof pathOrObject === 'string') {
|
|
11
11
|
if (await stat(pathOrObject)) {
|
|
12
12
|
const cfgYaml = (await readFile(pathOrObject)).toString();
|
|
13
|
-
|
|
13
|
+
embConfig = yaml.parse(cfgYaml.toString());
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
throw new Error(`Could not find file: ${pathOrObject}`);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
|
|
20
|
+
embConfig = pathOrObject;
|
|
21
21
|
}
|
|
22
|
-
if (!ajv.validate(configSchema,
|
|
23
|
-
ajv.errors
|
|
22
|
+
if (!ajv.validate(configSchema, embConfig)) {
|
|
23
|
+
ajv.errors?.forEach((err) => console.error(err));
|
|
24
24
|
throw new Error(`Your .emb.yml is incorrect`);
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return toUserConfig(embConfig);
|
|
27
27
|
};
|
|
28
28
|
export const validateEmbfile = async (pathOrObject) => {
|
|
29
29
|
let component;
|
|
@@ -39,12 +39,12 @@ export const validateEmbfile = async (pathOrObject) => {
|
|
|
39
39
|
else {
|
|
40
40
|
component = pathOrObject;
|
|
41
41
|
}
|
|
42
|
-
const validate = ajv.getSchema('/schemas/config#/$defs/
|
|
42
|
+
const validate = ajv.getSchema('/schemas/config#/$defs/ComponentConfig');
|
|
43
43
|
if (!validate) {
|
|
44
44
|
throw new Error('Could not find the JSON schema validator for Embfile');
|
|
45
45
|
}
|
|
46
46
|
if (!validate(component)) {
|
|
47
|
-
ajv.errors
|
|
47
|
+
ajv.errors?.forEach((err) => console.error(err));
|
|
48
48
|
throw new Error(`Your .emb.yml is incorrect`);
|
|
49
49
|
}
|
|
50
50
|
return component;
|
package/dist/src/context.d.ts
CHANGED
package/dist/src/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import './resources/index.js';
|
|
1
2
|
export * from './compose/index.js';
|
|
2
3
|
export * from './containers/index.js';
|
|
3
4
|
export * from './images/index.js';
|
|
4
5
|
export * from './operations/index.js';
|
|
5
6
|
export * from './protobuf/index.js';
|
|
6
|
-
export * from './types.js';
|
|
7
7
|
export * from './utils.js';
|
package/dist/src/docker/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import './resources/index.js';
|
|
1
2
|
export * from './compose/index.js';
|
|
2
3
|
export * from './containers/index.js';
|
|
3
4
|
export * from './images/index.js';
|
|
4
5
|
export * from './operations/index.js';
|
|
5
6
|
export * from './protobuf/index.js';
|
|
6
|
-
export * from './types.js';
|
|
7
7
|
export * from './utils.js';
|
|
@@ -58,8 +58,9 @@ export class ContainerExecOperation extends AbstractOperation {
|
|
|
58
58
|
const onError = (err) => reject(err);
|
|
59
59
|
const onEnd = async () => {
|
|
60
60
|
exec.inspect((error, res) => {
|
|
61
|
-
if (error)
|
|
61
|
+
if (error) {
|
|
62
62
|
return reject(error);
|
|
63
|
+
}
|
|
63
64
|
const code = res?.ExitCode ?? 0;
|
|
64
65
|
if (code !== 0) {
|
|
65
66
|
const msg = res?.ProcessConfig?.entrypoint
|
|
@@ -3,18 +3,17 @@ import { AbstractOperation } from '../../../operations/index.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* https://docs.docker.com/reference/api/engine/version/v1.37/#tag/Image/operation/ImageBuild
|
|
5
5
|
*/
|
|
6
|
-
declare const
|
|
7
|
-
buildArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
|
+
export declare const BuildImageOperationInputSchema: z.ZodObject<{
|
|
8
7
|
context: z.ZodString;
|
|
9
|
-
dockerfile: z.ZodString
|
|
10
|
-
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
8
|
+
dockerfile: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
11
9
|
src: z.ZodArray<z.ZodString>;
|
|
12
|
-
tag: z.ZodString
|
|
10
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
11
|
+
buildArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
13
13
|
target: z.ZodOptional<z.ZodString>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
|
-
export declare class BuildImageOperation extends AbstractOperation<typeof
|
|
15
|
+
export declare class BuildImageOperation extends AbstractOperation<typeof BuildImageOperationInputSchema, Array<unknown>> {
|
|
16
16
|
private observer?;
|
|
17
17
|
constructor(observer?: ((progress: string) => void) | undefined);
|
|
18
|
-
protected _run(input: z.input<typeof
|
|
18
|
+
protected _run(input: z.input<typeof BuildImageOperationInputSchema>): Promise<Array<unknown>>;
|
|
19
19
|
}
|
|
20
|
-
export {};
|
|
@@ -4,29 +4,35 @@ import { AbstractOperation } from '../../../operations/index.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* https://docs.docker.com/reference/api/engine/version/v1.37/#tag/Image/operation/ImageBuild
|
|
6
6
|
*/
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
.record(z.string(), z.string())
|
|
10
|
-
.optional()
|
|
11
|
-
.describe('Map of string pairs for build-time variables'),
|
|
7
|
+
export const BuildImageOperationInputSchema = z.object({
|
|
8
|
+
//
|
|
12
9
|
context: z.string().describe('Path to the build context'),
|
|
13
10
|
dockerfile: z
|
|
14
11
|
.string()
|
|
15
|
-
.describe('Path within the build context to the Dockerfile.'),
|
|
16
|
-
labels: z
|
|
17
|
-
.record(z.string(), z.string())
|
|
18
12
|
.optional()
|
|
19
|
-
.
|
|
13
|
+
.default('Dockerfile')
|
|
14
|
+
.describe('Path within the build context to the Dockerfile.'),
|
|
20
15
|
src: z.array(z.string()),
|
|
21
16
|
tag: z.z
|
|
22
17
|
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('latest')
|
|
23
20
|
.describe('A name and optional tag to apply to the image in the name:tag'),
|
|
21
|
+
//
|
|
22
|
+
buildArgs: z
|
|
23
|
+
.record(z.string(), z.string())
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Map of string pairs for build-time variables'),
|
|
26
|
+
labels: z
|
|
27
|
+
.record(z.string(), z.string())
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Arbitrary key/value labels to set on the image, as a JSON map of string pairs.'),
|
|
24
30
|
target: z.string().optional().describe('Target build stage'),
|
|
25
31
|
});
|
|
26
32
|
export class BuildImageOperation extends AbstractOperation {
|
|
27
33
|
observer;
|
|
28
34
|
constructor(observer) {
|
|
29
|
-
super(
|
|
35
|
+
super(BuildImageOperationInputSchema);
|
|
30
36
|
this.observer = observer;
|
|
31
37
|
}
|
|
32
38
|
async _run(input) {
|