@enspirit/emb 0.0.8 → 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 -27
- 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 +4 -3
- package/dist/src/cli/commands/resources/build.js +42 -0
- 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/compose/operations/ComposeUpOperation.js +13 -12
- 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 +17 -11
- 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 +5 -13
- 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 +2 -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 +157 -112
- package/package.json +7 -2
- package/dist/src/cli/commands/components/build.js +0 -34
- 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 -21
- package/dist/src/monorepo/operations/components/BuildComponentsOperation.js +0 -135
- 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
package/oclif.manifest.json
CHANGED
|
@@ -70,7 +70,6 @@
|
|
|
70
70
|
"pluginAlias": "@enspirit/emb",
|
|
71
71
|
"pluginName": "@enspirit/emb",
|
|
72
72
|
"pluginType": "core",
|
|
73
|
-
"strict": true,
|
|
74
73
|
"enableJsonFlag": true,
|
|
75
74
|
"isESM": true,
|
|
76
75
|
"relativePath": [
|
|
@@ -118,7 +117,6 @@
|
|
|
118
117
|
"pluginAlias": "@enspirit/emb",
|
|
119
118
|
"pluginName": "@enspirit/emb",
|
|
120
119
|
"pluginType": "core",
|
|
121
|
-
"strict": true,
|
|
122
120
|
"enableJsonFlag": true,
|
|
123
121
|
"isESM": true,
|
|
124
122
|
"relativePath": [
|
|
@@ -129,18 +127,12 @@
|
|
|
129
127
|
"up.js"
|
|
130
128
|
]
|
|
131
129
|
},
|
|
132
|
-
"components
|
|
130
|
+
"components": {
|
|
133
131
|
"aliases": [],
|
|
134
|
-
"args": {
|
|
135
|
-
|
|
136
|
-
"description": "List of components to build (defaults to all)",
|
|
137
|
-
"name": "component",
|
|
138
|
-
"required": false
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
"description": "Build the components of the monorepo",
|
|
132
|
+
"args": {},
|
|
133
|
+
"description": "List components.",
|
|
142
134
|
"examples": [
|
|
143
|
-
"<%= config.bin %> <%= command.id %>
|
|
135
|
+
"<%= config.bin %> <%= command.id %>"
|
|
144
136
|
],
|
|
145
137
|
"flags": {
|
|
146
138
|
"json": {
|
|
@@ -157,22 +149,14 @@
|
|
|
157
149
|
"hasDynamicHelp": false,
|
|
158
150
|
"multiple": false,
|
|
159
151
|
"type": "option"
|
|
160
|
-
},
|
|
161
|
-
"dry-run": {
|
|
162
|
-
"description": "Do not build the components but only produce build meta information",
|
|
163
|
-
"name": "dry-run",
|
|
164
|
-
"required": false,
|
|
165
|
-
"allowNo": false,
|
|
166
|
-
"type": "boolean"
|
|
167
152
|
}
|
|
168
153
|
},
|
|
169
154
|
"hasDynamicHelp": false,
|
|
170
155
|
"hiddenAliases": [],
|
|
171
|
-
"id": "components
|
|
156
|
+
"id": "components",
|
|
172
157
|
"pluginAlias": "@enspirit/emb",
|
|
173
158
|
"pluginName": "@enspirit/emb",
|
|
174
159
|
"pluginType": "core",
|
|
175
|
-
"strict": false,
|
|
176
160
|
"enableJsonFlag": true,
|
|
177
161
|
"isESM": true,
|
|
178
162
|
"relativePath": [
|
|
@@ -181,13 +165,13 @@
|
|
|
181
165
|
"cli",
|
|
182
166
|
"commands",
|
|
183
167
|
"components",
|
|
184
|
-
"
|
|
168
|
+
"index.js"
|
|
185
169
|
]
|
|
186
170
|
},
|
|
187
|
-
"
|
|
171
|
+
"config:print": {
|
|
188
172
|
"aliases": [],
|
|
189
173
|
"args": {},
|
|
190
|
-
"description": "
|
|
174
|
+
"description": "Print the current config.",
|
|
191
175
|
"examples": [
|
|
192
176
|
"<%= config.bin %> <%= command.id %>"
|
|
193
177
|
],
|
|
@@ -210,7 +194,50 @@
|
|
|
210
194
|
},
|
|
211
195
|
"hasDynamicHelp": false,
|
|
212
196
|
"hiddenAliases": [],
|
|
213
|
-
"id": "
|
|
197
|
+
"id": "config:print",
|
|
198
|
+
"pluginAlias": "@enspirit/emb",
|
|
199
|
+
"pluginName": "@enspirit/emb",
|
|
200
|
+
"pluginType": "core",
|
|
201
|
+
"enableJsonFlag": true,
|
|
202
|
+
"isESM": true,
|
|
203
|
+
"relativePath": [
|
|
204
|
+
"dist",
|
|
205
|
+
"src",
|
|
206
|
+
"cli",
|
|
207
|
+
"commands",
|
|
208
|
+
"config",
|
|
209
|
+
"print.js"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
"containers": {
|
|
213
|
+
"aliases": [
|
|
214
|
+
"ps"
|
|
215
|
+
],
|
|
216
|
+
"args": {},
|
|
217
|
+
"description": "List docker containers.",
|
|
218
|
+
"examples": [
|
|
219
|
+
"<%= config.bin %> <%= command.id %>"
|
|
220
|
+
],
|
|
221
|
+
"flags": {
|
|
222
|
+
"json": {
|
|
223
|
+
"description": "Format output as json.",
|
|
224
|
+
"helpGroup": "GLOBAL",
|
|
225
|
+
"name": "json",
|
|
226
|
+
"allowNo": false,
|
|
227
|
+
"type": "boolean"
|
|
228
|
+
},
|
|
229
|
+
"all": {
|
|
230
|
+
"char": "a",
|
|
231
|
+
"description": "Retun all containers. By default, only running containers are shown",
|
|
232
|
+
"name": "all",
|
|
233
|
+
"required": false,
|
|
234
|
+
"allowNo": false,
|
|
235
|
+
"type": "boolean"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"hasDynamicHelp": false,
|
|
239
|
+
"hiddenAliases": [],
|
|
240
|
+
"id": "containers",
|
|
214
241
|
"pluginAlias": "@enspirit/emb",
|
|
215
242
|
"pluginName": "@enspirit/emb",
|
|
216
243
|
"pluginType": "core",
|
|
@@ -222,14 +249,48 @@
|
|
|
222
249
|
"src",
|
|
223
250
|
"cli",
|
|
224
251
|
"commands",
|
|
225
|
-
"
|
|
252
|
+
"containers",
|
|
226
253
|
"index.js"
|
|
227
254
|
]
|
|
228
255
|
},
|
|
229
|
-
"
|
|
256
|
+
"containers:prune": {
|
|
230
257
|
"aliases": [],
|
|
231
258
|
"args": {},
|
|
232
|
-
"description": "
|
|
259
|
+
"description": "Prune containers.",
|
|
260
|
+
"examples": [
|
|
261
|
+
"<%= config.bin %> <%= command.id %>"
|
|
262
|
+
],
|
|
263
|
+
"flags": {
|
|
264
|
+
"json": {
|
|
265
|
+
"description": "Format output as json.",
|
|
266
|
+
"helpGroup": "GLOBAL",
|
|
267
|
+
"name": "json",
|
|
268
|
+
"allowNo": false,
|
|
269
|
+
"type": "boolean"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
"hasDynamicHelp": false,
|
|
273
|
+
"hiddenAliases": [],
|
|
274
|
+
"id": "containers:prune",
|
|
275
|
+
"pluginAlias": "@enspirit/emb",
|
|
276
|
+
"pluginName": "@enspirit/emb",
|
|
277
|
+
"pluginType": "core",
|
|
278
|
+
"strict": true,
|
|
279
|
+
"enableJsonFlag": true,
|
|
280
|
+
"isESM": true,
|
|
281
|
+
"relativePath": [
|
|
282
|
+
"dist",
|
|
283
|
+
"src",
|
|
284
|
+
"cli",
|
|
285
|
+
"commands",
|
|
286
|
+
"containers",
|
|
287
|
+
"prune.js"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
"images:delete": {
|
|
291
|
+
"aliases": [],
|
|
292
|
+
"args": {},
|
|
293
|
+
"description": "Delete project images.",
|
|
233
294
|
"examples": [
|
|
234
295
|
"<%= config.bin %> <%= command.id %>"
|
|
235
296
|
],
|
|
@@ -241,18 +302,18 @@
|
|
|
241
302
|
"allowNo": false,
|
|
242
303
|
"type": "boolean"
|
|
243
304
|
},
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
305
|
+
"force": {
|
|
306
|
+
"char": "f",
|
|
307
|
+
"description": "Remove the image even if it is being used by stopped containers or has other tags",
|
|
308
|
+
"name": "force",
|
|
247
309
|
"required": false,
|
|
248
|
-
"
|
|
249
|
-
"
|
|
250
|
-
"type": "option"
|
|
310
|
+
"allowNo": false,
|
|
311
|
+
"type": "boolean"
|
|
251
312
|
}
|
|
252
313
|
},
|
|
253
314
|
"hasDynamicHelp": false,
|
|
254
315
|
"hiddenAliases": [],
|
|
255
|
-
"id": "
|
|
316
|
+
"id": "images:delete",
|
|
256
317
|
"pluginAlias": "@enspirit/emb",
|
|
257
318
|
"pluginName": "@enspirit/emb",
|
|
258
319
|
"pluginType": "core",
|
|
@@ -264,16 +325,14 @@
|
|
|
264
325
|
"src",
|
|
265
326
|
"cli",
|
|
266
327
|
"commands",
|
|
267
|
-
"
|
|
268
|
-
"
|
|
328
|
+
"images",
|
|
329
|
+
"delete.js"
|
|
269
330
|
]
|
|
270
331
|
},
|
|
271
|
-
"
|
|
272
|
-
"aliases": [
|
|
273
|
-
"ps"
|
|
274
|
-
],
|
|
332
|
+
"images": {
|
|
333
|
+
"aliases": [],
|
|
275
334
|
"args": {},
|
|
276
|
-
"description": "List docker
|
|
335
|
+
"description": "List docker images.",
|
|
277
336
|
"examples": [
|
|
278
337
|
"<%= config.bin %> <%= command.id %>"
|
|
279
338
|
],
|
|
@@ -287,7 +346,7 @@
|
|
|
287
346
|
},
|
|
288
347
|
"all": {
|
|
289
348
|
"char": "a",
|
|
290
|
-
"description": "
|
|
349
|
+
"description": "Show all images. Only images from a final layer (no children) are shown by default.",
|
|
291
350
|
"name": "all",
|
|
292
351
|
"required": false,
|
|
293
352
|
"allowNo": false,
|
|
@@ -296,7 +355,7 @@
|
|
|
296
355
|
},
|
|
297
356
|
"hasDynamicHelp": false,
|
|
298
357
|
"hiddenAliases": [],
|
|
299
|
-
"id": "
|
|
358
|
+
"id": "images",
|
|
300
359
|
"pluginAlias": "@enspirit/emb",
|
|
301
360
|
"pluginName": "@enspirit/emb",
|
|
302
361
|
"pluginType": "core",
|
|
@@ -308,14 +367,14 @@
|
|
|
308
367
|
"src",
|
|
309
368
|
"cli",
|
|
310
369
|
"commands",
|
|
311
|
-
"
|
|
370
|
+
"images",
|
|
312
371
|
"index.js"
|
|
313
372
|
]
|
|
314
373
|
},
|
|
315
|
-
"
|
|
374
|
+
"images:prune": {
|
|
316
375
|
"aliases": [],
|
|
317
376
|
"args": {},
|
|
318
|
-
"description": "Prune
|
|
377
|
+
"description": "Prune project images.",
|
|
319
378
|
"examples": [
|
|
320
379
|
"<%= config.bin %> <%= command.id %>"
|
|
321
380
|
],
|
|
@@ -326,11 +385,19 @@
|
|
|
326
385
|
"name": "json",
|
|
327
386
|
"allowNo": false,
|
|
328
387
|
"type": "boolean"
|
|
388
|
+
},
|
|
389
|
+
"all": {
|
|
390
|
+
"char": "a",
|
|
391
|
+
"description": "Prune all images. When set to true all images will be pruned, not only dangling ones",
|
|
392
|
+
"name": "all",
|
|
393
|
+
"required": false,
|
|
394
|
+
"allowNo": false,
|
|
395
|
+
"type": "boolean"
|
|
329
396
|
}
|
|
330
397
|
},
|
|
331
398
|
"hasDynamicHelp": false,
|
|
332
399
|
"hiddenAliases": [],
|
|
333
|
-
"id": "
|
|
400
|
+
"id": "images:prune",
|
|
334
401
|
"pluginAlias": "@enspirit/emb",
|
|
335
402
|
"pluginName": "@enspirit/emb",
|
|
336
403
|
"pluginType": "core",
|
|
@@ -342,7 +409,7 @@
|
|
|
342
409
|
"src",
|
|
343
410
|
"cli",
|
|
344
411
|
"commands",
|
|
345
|
-
"
|
|
412
|
+
"images",
|
|
346
413
|
"prune.js"
|
|
347
414
|
]
|
|
348
415
|
},
|
|
@@ -439,12 +506,18 @@
|
|
|
439
506
|
"run.js"
|
|
440
507
|
]
|
|
441
508
|
},
|
|
442
|
-
"
|
|
509
|
+
"resources:build": {
|
|
443
510
|
"aliases": [],
|
|
444
|
-
"args": {
|
|
445
|
-
|
|
511
|
+
"args": {
|
|
512
|
+
"component": {
|
|
513
|
+
"description": "List of resources to build (defaults to all)",
|
|
514
|
+
"name": "component",
|
|
515
|
+
"required": false
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
"description": "Build the resources of the monorepo",
|
|
446
519
|
"examples": [
|
|
447
|
-
"<%= config.bin %> <%= command.id %>"
|
|
520
|
+
"<%= config.bin %> <%= command.id %> build --flavor development"
|
|
448
521
|
],
|
|
449
522
|
"flags": {
|
|
450
523
|
"json": {
|
|
@@ -454,52 +527,25 @@
|
|
|
454
527
|
"allowNo": false,
|
|
455
528
|
"type": "boolean"
|
|
456
529
|
},
|
|
457
|
-
"
|
|
458
|
-
"
|
|
459
|
-
"
|
|
460
|
-
"
|
|
530
|
+
"flavor": {
|
|
531
|
+
"description": "Specify the flavor to use.",
|
|
532
|
+
"name": "flavor",
|
|
533
|
+
"required": false,
|
|
534
|
+
"hasDynamicHelp": false,
|
|
535
|
+
"multiple": false,
|
|
536
|
+
"type": "option"
|
|
537
|
+
},
|
|
538
|
+
"dry-run": {
|
|
539
|
+
"description": "Do not build the resources but only produce build meta information",
|
|
540
|
+
"name": "dry-run",
|
|
461
541
|
"required": false,
|
|
462
|
-
"allowNo": false,
|
|
463
|
-
"type": "boolean"
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
"hasDynamicHelp": false,
|
|
467
|
-
"hiddenAliases": [],
|
|
468
|
-
"id": "images:delete",
|
|
469
|
-
"pluginAlias": "@enspirit/emb",
|
|
470
|
-
"pluginName": "@enspirit/emb",
|
|
471
|
-
"pluginType": "core",
|
|
472
|
-
"strict": true,
|
|
473
|
-
"enableJsonFlag": true,
|
|
474
|
-
"isESM": true,
|
|
475
|
-
"relativePath": [
|
|
476
|
-
"dist",
|
|
477
|
-
"src",
|
|
478
|
-
"cli",
|
|
479
|
-
"commands",
|
|
480
|
-
"images",
|
|
481
|
-
"delete.js"
|
|
482
|
-
]
|
|
483
|
-
},
|
|
484
|
-
"images": {
|
|
485
|
-
"aliases": [],
|
|
486
|
-
"args": {},
|
|
487
|
-
"description": "List docker images.",
|
|
488
|
-
"examples": [
|
|
489
|
-
"<%= config.bin %> <%= command.id %>"
|
|
490
|
-
],
|
|
491
|
-
"flags": {
|
|
492
|
-
"json": {
|
|
493
|
-
"description": "Format output as json.",
|
|
494
|
-
"helpGroup": "GLOBAL",
|
|
495
|
-
"name": "json",
|
|
496
542
|
"allowNo": false,
|
|
497
543
|
"type": "boolean"
|
|
498
544
|
},
|
|
499
|
-
"
|
|
500
|
-
"char": "
|
|
501
|
-
"description": "
|
|
502
|
-
"name": "
|
|
545
|
+
"force": {
|
|
546
|
+
"char": "f",
|
|
547
|
+
"description": "Bypass the cache and force the build",
|
|
548
|
+
"name": "force",
|
|
503
549
|
"required": false,
|
|
504
550
|
"allowNo": false,
|
|
505
551
|
"type": "boolean"
|
|
@@ -507,11 +553,11 @@
|
|
|
507
553
|
},
|
|
508
554
|
"hasDynamicHelp": false,
|
|
509
555
|
"hiddenAliases": [],
|
|
510
|
-
"id": "
|
|
556
|
+
"id": "resources:build",
|
|
511
557
|
"pluginAlias": "@enspirit/emb",
|
|
512
558
|
"pluginName": "@enspirit/emb",
|
|
513
559
|
"pluginType": "core",
|
|
514
|
-
"strict":
|
|
560
|
+
"strict": false,
|
|
515
561
|
"enableJsonFlag": true,
|
|
516
562
|
"isESM": true,
|
|
517
563
|
"relativePath": [
|
|
@@ -519,14 +565,14 @@
|
|
|
519
565
|
"src",
|
|
520
566
|
"cli",
|
|
521
567
|
"commands",
|
|
522
|
-
"
|
|
523
|
-
"
|
|
568
|
+
"resources",
|
|
569
|
+
"build.js"
|
|
524
570
|
]
|
|
525
571
|
},
|
|
526
|
-
"
|
|
572
|
+
"resources": {
|
|
527
573
|
"aliases": [],
|
|
528
574
|
"args": {},
|
|
529
|
-
"description": "
|
|
575
|
+
"description": "List resources.",
|
|
530
576
|
"examples": [
|
|
531
577
|
"<%= config.bin %> <%= command.id %>"
|
|
532
578
|
],
|
|
@@ -538,22 +584,21 @@
|
|
|
538
584
|
"allowNo": false,
|
|
539
585
|
"type": "boolean"
|
|
540
586
|
},
|
|
541
|
-
"
|
|
542
|
-
"
|
|
543
|
-
"
|
|
544
|
-
"name": "all",
|
|
587
|
+
"flavor": {
|
|
588
|
+
"description": "Specify the flavor to use.",
|
|
589
|
+
"name": "flavor",
|
|
545
590
|
"required": false,
|
|
546
|
-
"
|
|
547
|
-
"
|
|
591
|
+
"hasDynamicHelp": false,
|
|
592
|
+
"multiple": false,
|
|
593
|
+
"type": "option"
|
|
548
594
|
}
|
|
549
595
|
},
|
|
550
596
|
"hasDynamicHelp": false,
|
|
551
597
|
"hiddenAliases": [],
|
|
552
|
-
"id": "
|
|
598
|
+
"id": "resources",
|
|
553
599
|
"pluginAlias": "@enspirit/emb",
|
|
554
600
|
"pluginName": "@enspirit/emb",
|
|
555
601
|
"pluginType": "core",
|
|
556
|
-
"strict": true,
|
|
557
602
|
"enableJsonFlag": true,
|
|
558
603
|
"isESM": true,
|
|
559
604
|
"relativePath": [
|
|
@@ -561,10 +606,10 @@
|
|
|
561
606
|
"src",
|
|
562
607
|
"cli",
|
|
563
608
|
"commands",
|
|
564
|
-
"
|
|
565
|
-
"
|
|
609
|
+
"resources",
|
|
610
|
+
"index.js"
|
|
566
611
|
]
|
|
567
612
|
}
|
|
568
613
|
},
|
|
569
|
-
"version": "0.0
|
|
614
|
+
"version": "0.1.0"
|
|
570
615
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enspirit/emb",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"keywords": ["monorepo", "docker", "taskrunner", "ci", "docker compose", "sentinel", "makefile"],
|
|
6
6
|
"author": "Louis Lambeau <louis.lambeau@enspirit.be>",
|
|
7
7
|
"license": "ISC",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"build": "rimraf dist && npm run build:types && npm run build:ts && npm run copy:proto",
|
|
14
14
|
"copy:proto": "cp -r src/docker/protobuf/*.proto dist/src/docker/protobuf/",
|
|
15
15
|
"build:ts": "tsc -b && tsc-alias",
|
|
16
|
+
"build:ts:watch": "tsc --watch",
|
|
16
17
|
"build:types": "json2ts src/config/schema.json > src/config/schema.ts",
|
|
17
18
|
"lint": "eslint",
|
|
18
19
|
"lint:fix": "eslint --fix",
|
|
@@ -22,9 +23,11 @@
|
|
|
22
23
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
23
24
|
"posttest": "npm run lint",
|
|
24
25
|
"prepack": "oclif manifest && oclif readme",
|
|
25
|
-
"test": "npm run build:types && npm run test:unit",
|
|
26
|
+
"test": "npm run build:types && npm run test:unit && npm run test:integration",
|
|
26
27
|
"test:unit": "vitest run tests/unit",
|
|
28
|
+
"test:unit:watch": "vitest tests/unit",
|
|
27
29
|
"test:integration": "vitest run tests/integration",
|
|
30
|
+
"test:integration:watch": "vitest tests/integration",
|
|
28
31
|
"test:watch": "vitest",
|
|
29
32
|
"version": "oclif readme && git add README.md"
|
|
30
33
|
},
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
"dockerode": "^4.0.7",
|
|
44
47
|
"dotenv": "^17.2.1",
|
|
45
48
|
"execa": "^9.6.0",
|
|
49
|
+
"fast-json-patch": "^3.1.1",
|
|
46
50
|
"find-up": "^7.0.0",
|
|
47
51
|
"glob": "^11.0.3",
|
|
48
52
|
"graphlib": "^2.1.8",
|
|
@@ -111,6 +115,7 @@
|
|
|
111
115
|
"topics": {
|
|
112
116
|
"images": {"description": "List, delete, prune docker containers" },
|
|
113
117
|
"containers": {"description": "List, delete, prune docker images" },
|
|
118
|
+
"resources": {"description": "List, clean, build resources" },
|
|
114
119
|
"components": {"description": "List & build components resources" },
|
|
115
120
|
"config": {"description": "It's all about config" },
|
|
116
121
|
"tasks": {"description": "List and run tasks" }
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import { FlavoredCommand, getContext } from '../../index.js';
|
|
3
|
-
import { BuildComponentsOperation } from '../../../monorepo/index.js';
|
|
4
|
-
export default class BuildCommand extends FlavoredCommand {
|
|
5
|
-
static args = {
|
|
6
|
-
component: Args.string({
|
|
7
|
-
description: 'List of components to build (defaults to all)',
|
|
8
|
-
required: false,
|
|
9
|
-
}),
|
|
10
|
-
};
|
|
11
|
-
static description = 'Build the components of the monorepo';
|
|
12
|
-
static examples = [
|
|
13
|
-
`<%= config.bin %> <%= command.id %> build --flavor development`,
|
|
14
|
-
];
|
|
15
|
-
static flags = {
|
|
16
|
-
'dry-run': Flags.boolean({
|
|
17
|
-
required: false,
|
|
18
|
-
description: 'Do not build the components but only produce build meta information',
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
static enableJsonFlag = true;
|
|
22
|
-
static strict = false;
|
|
23
|
-
async run() {
|
|
24
|
-
const { argv, flags } = await this.parse(BuildCommand);
|
|
25
|
-
const { monorepo } = getContext();
|
|
26
|
-
return monorepo.run(new BuildComponentsOperation(), {
|
|
27
|
-
dryRun: flags['dry-run'],
|
|
28
|
-
silent: flags.json,
|
|
29
|
-
components: argv.length > 0
|
|
30
|
-
? argv
|
|
31
|
-
: monorepo.components.map((c) => c.name),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Writable } from 'node:stream';
|
|
2
|
-
import { DockerComponentBuild } from '../index.js';
|
|
3
|
-
import { Component } from '../../monorepo/index.js';
|
|
4
|
-
export type MobyTrace = {
|
|
5
|
-
aux: unknown;
|
|
6
|
-
error?: string;
|
|
7
|
-
id: string;
|
|
8
|
-
};
|
|
9
|
-
export type Progress = {
|
|
10
|
-
error?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
};
|
|
13
|
-
export type DockerBuildExtraOptions = {
|
|
14
|
-
output?: Writable;
|
|
15
|
-
};
|
|
16
|
-
export type BuildDockerImageOutput = DockerComponentBuild & {
|
|
17
|
-
traces: Array<MobyTrace>;
|
|
18
|
-
};
|
|
19
|
-
export declare const buildDockerImage: (component: Component, opts?: DockerBuildExtraOptions, progress?: (progress: Progress) => void) => Promise<BuildDockerImageOutput | undefined>;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { getContext } from '../../index.js';
|
|
2
|
-
import { decodeBuildkitStatusResponse, getSentinelFile, } from '../index.js';
|
|
3
|
-
import { FilePrerequisitePlugin } from '../../prerequisites/index.js';
|
|
4
|
-
export const buildDockerImage = async (component, opts = {}, progress) => {
|
|
5
|
-
const cmp = await component.toDockerBuild();
|
|
6
|
-
const files = (cmp.prerequisites || []).map((f) => f.path);
|
|
7
|
-
const { docker, monorepo } = getContext();
|
|
8
|
-
/** SENTINEL LOGIC */
|
|
9
|
-
// TODO: make configurable
|
|
10
|
-
const prereqPlugin = new FilePrerequisitePlugin();
|
|
11
|
-
const preBuildMeta = await prereqPlugin.meta(component, cmp.prerequisites, 'pre');
|
|
12
|
-
const sentinelFile = getSentinelFile(component);
|
|
13
|
-
let lastValue;
|
|
14
|
-
try {
|
|
15
|
-
lastValue = (await monorepo.store.readFile(sentinelFile)).toString();
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
lastValue = undefined;
|
|
19
|
-
}
|
|
20
|
-
if (lastValue) {
|
|
21
|
-
const diff = await prereqPlugin.diff(component, cmp.prerequisites, lastValue, preBuildMeta);
|
|
22
|
-
if (!diff) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const stream = await docker.buildImage({
|
|
27
|
-
context: cmp.context,
|
|
28
|
-
src: [...files],
|
|
29
|
-
}, {
|
|
30
|
-
buildargs: cmp.buildArgs,
|
|
31
|
-
dockerfile: cmp.dockerfile,
|
|
32
|
-
labels: cmp.labels,
|
|
33
|
-
t: cmp.name + ':' + (cmp.tag || 'latest'),
|
|
34
|
-
target: cmp.target,
|
|
35
|
-
version: '2',
|
|
36
|
-
});
|
|
37
|
-
if (opts.output) {
|
|
38
|
-
stream.pipe(opts.output);
|
|
39
|
-
}
|
|
40
|
-
stream.on('close', async () => {
|
|
41
|
-
const sentinelValue = await prereqPlugin.meta(component, cmp.prerequisites, 'post');
|
|
42
|
-
await monorepo.store.writeFile(sentinelFile, sentinelValue);
|
|
43
|
-
});
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
docker.modem.followProgress(stream, (err, traces) => {
|
|
46
|
-
return err ? reject(err) : resolve({ ...cmp, traces });
|
|
47
|
-
}, async (trace) => {
|
|
48
|
-
if (trace.error) {
|
|
49
|
-
reject(new Error(trace.error));
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
try {
|
|
53
|
-
const { vertexes } = await decodeBuildkitStatusResponse(trace.aux);
|
|
54
|
-
vertexes.forEach((v) => {
|
|
55
|
-
progress?.(v);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
console.error(error);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FilePrerequisite } from '../prerequisites/index.js';
|
|
2
|
-
export type EnvVariable = {
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
5
|
-
export interface DockerComponentBuild {
|
|
6
|
-
buildArgs?: Record<string, string>;
|
|
7
|
-
context: string;
|
|
8
|
-
dockerfile: string;
|
|
9
|
-
labels?: Record<string, string>;
|
|
10
|
-
name: string;
|
|
11
|
-
prerequisites: Array<FilePrerequisite>;
|
|
12
|
-
tag: string;
|
|
13
|
-
target?: string;
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
import { DockerComponentBuild } from '../../../docker/index.js';
|
|
3
|
-
import { AbstractOperation } from '../../../operations/index.js';
|
|
4
|
-
export type BuildComponentMeta = {
|
|
5
|
-
dryRun?: boolean;
|
|
6
|
-
cacheHit?: boolean;
|
|
7
|
-
build: DockerComponentBuild;
|
|
8
|
-
preBuildMeta?: string;
|
|
9
|
-
sentinelFile: string;
|
|
10
|
-
};
|
|
11
|
-
declare const schema: z.ZodObject<{
|
|
12
|
-
components: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
-
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
-
silent: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
export declare class BuildComponentsOperation extends AbstractOperation<typeof schema, Record<string, BuildComponentMeta>> {
|
|
17
|
-
constructor();
|
|
18
|
-
protected _run(input: z.input<typeof schema>): Promise<Record<string, BuildComponentMeta>>;
|
|
19
|
-
private buildComponent;
|
|
20
|
-
}
|
|
21
|
-
export {};
|