@backstage/plugin-scaffolder-backend 1.15.2-next.1 → 1.15.2-next.2
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/CHANGELOG.md +16 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +7 -7
- package/dist/cjs/{ScaffolderEntitiesProcessor-1d387347.cjs.js → ScaffolderEntitiesProcessor-82f18a18.cjs.js} +175 -31
- package/dist/cjs/ScaffolderEntitiesProcessor-82f18a18.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/package.json +10 -10
- package/dist/cjs/ScaffolderEntitiesProcessor-1d387347.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.15.2-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 33c76caef72a: Added examples for the fs:delete and fs:rename actions
|
|
8
|
+
- 0b1d775be05b: Adds examples to a few scaffolder actions.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/plugin-catalog-backend@1.12.0-next.2
|
|
11
|
+
- @backstage/backend-plugin-api@0.6.0-next.2
|
|
12
|
+
- @backstage/backend-tasks@0.5.5-next.2
|
|
13
|
+
- @backstage/plugin-scaffolder-node@0.1.6-next.2
|
|
14
|
+
- @backstage/backend-common@0.19.2-next.2
|
|
15
|
+
- @backstage/plugin-catalog-node@1.4.1-next.2
|
|
16
|
+
- @backstage/plugin-permission-node@0.7.11-next.2
|
|
17
|
+
- @backstage/plugin-auth-node@0.2.17-next.2
|
|
18
|
+
|
|
3
19
|
## 1.15.2-next.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -4,19 +4,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
6
|
var alpha = require('@backstage/plugin-catalog-node/alpha');
|
|
7
|
-
var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-
|
|
7
|
+
var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-82f18a18.cjs.js');
|
|
8
8
|
var alpha$1 = require('@backstage/plugin-scaffolder-common/alpha');
|
|
9
9
|
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
10
10
|
var backendCommon = require('@backstage/backend-common');
|
|
11
11
|
var integration = require('@backstage/integration');
|
|
12
12
|
var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
|
|
13
|
-
require('path');
|
|
14
13
|
require('@backstage/errors');
|
|
15
|
-
require('
|
|
14
|
+
require('@backstage/catalog-model');
|
|
16
15
|
require('fs-extra');
|
|
16
|
+
require('yaml');
|
|
17
|
+
require('zod');
|
|
18
|
+
require('path');
|
|
19
|
+
require('luxon');
|
|
20
|
+
require('globby');
|
|
17
21
|
require('isbinaryfile');
|
|
18
22
|
require('isolated-vm');
|
|
19
|
-
require('@backstage/catalog-model');
|
|
20
23
|
require('lodash/get');
|
|
21
24
|
require('azure-devops-node-api');
|
|
22
25
|
require('node-fetch');
|
|
@@ -34,9 +37,6 @@ require('@backstage/plugin-scaffolder-common');
|
|
|
34
37
|
require('express');
|
|
35
38
|
require('express-promise-router');
|
|
36
39
|
require('jsonschema');
|
|
37
|
-
require('zod');
|
|
38
|
-
require('yaml');
|
|
39
|
-
require('luxon');
|
|
40
40
|
require('uuid');
|
|
41
41
|
require('winston');
|
|
42
42
|
require('nunjucks');
|
|
@@ -81,14 +81,13 @@ var winston__namespace = /*#__PURE__*/_interopNamespace(winston);
|
|
|
81
81
|
var nunjucks__default = /*#__PURE__*/_interopDefaultLegacy(nunjucks);
|
|
82
82
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
83
83
|
|
|
84
|
-
const
|
|
85
|
-
const examples$4 = [
|
|
84
|
+
const examples$9 = [
|
|
86
85
|
{
|
|
87
86
|
description: "Register with the catalog",
|
|
88
87
|
example: yaml__default["default"].stringify({
|
|
89
88
|
steps: [
|
|
90
89
|
{
|
|
91
|
-
action:
|
|
90
|
+
action: "catalog:register",
|
|
92
91
|
id: "register-with-catalog",
|
|
93
92
|
name: "Register with the catalog",
|
|
94
93
|
input: {
|
|
@@ -99,12 +98,14 @@ const examples$4 = [
|
|
|
99
98
|
})
|
|
100
99
|
}
|
|
101
100
|
];
|
|
101
|
+
|
|
102
|
+
const id$4 = "catalog:register";
|
|
102
103
|
function createCatalogRegisterAction(options) {
|
|
103
104
|
const { catalogClient, integrations } = options;
|
|
104
105
|
return pluginScaffolderNode.createTemplateAction({
|
|
105
106
|
id: id$4,
|
|
106
107
|
description: "Registers entities from a catalog descriptor file in the workspace into the software catalog.",
|
|
107
|
-
examples: examples$
|
|
108
|
+
examples: examples$9,
|
|
108
109
|
schema: {
|
|
109
110
|
input: {
|
|
110
111
|
oneOf: [
|
|
@@ -228,14 +229,13 @@ function createCatalogRegisterAction(options) {
|
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
231
|
|
|
231
|
-
const
|
|
232
|
-
const examples$3 = [
|
|
232
|
+
const examples$8 = [
|
|
233
233
|
{
|
|
234
234
|
description: "Write a catalog yaml file",
|
|
235
235
|
example: yaml__namespace.stringify({
|
|
236
236
|
steps: [
|
|
237
237
|
{
|
|
238
|
-
action:
|
|
238
|
+
action: "catalog:write",
|
|
239
239
|
id: "create-catalog-info-file",
|
|
240
240
|
name: "Create catalog file",
|
|
241
241
|
input: {
|
|
@@ -258,6 +258,8 @@ const examples$3 = [
|
|
|
258
258
|
})
|
|
259
259
|
}
|
|
260
260
|
];
|
|
261
|
+
|
|
262
|
+
const id$3 = "catalog:write";
|
|
261
263
|
function createCatalogWriteAction() {
|
|
262
264
|
return pluginScaffolderNode.createTemplateAction({
|
|
263
265
|
id: id$3,
|
|
@@ -271,7 +273,7 @@ function createCatalogWriteAction() {
|
|
|
271
273
|
)
|
|
272
274
|
})
|
|
273
275
|
},
|
|
274
|
-
examples: examples$
|
|
276
|
+
examples: examples$8,
|
|
275
277
|
supportsDryRun: true,
|
|
276
278
|
async handler(ctx) {
|
|
277
279
|
ctx.logStream.write(`Writing catalog-info.yaml`);
|
|
@@ -285,14 +287,13 @@ function createCatalogWriteAction() {
|
|
|
285
287
|
});
|
|
286
288
|
}
|
|
287
289
|
|
|
288
|
-
const
|
|
289
|
-
const examples$2 = [
|
|
290
|
+
const examples$7 = [
|
|
290
291
|
{
|
|
291
292
|
description: "Fetch entity by reference",
|
|
292
293
|
example: yaml__default["default"].stringify({
|
|
293
294
|
steps: [
|
|
294
295
|
{
|
|
295
|
-
action:
|
|
296
|
+
action: "catalog:fetch",
|
|
296
297
|
id: "fetch",
|
|
297
298
|
name: "Fetch catalog entity",
|
|
298
299
|
input: {
|
|
@@ -303,11 +304,11 @@ const examples$2 = [
|
|
|
303
304
|
})
|
|
304
305
|
},
|
|
305
306
|
{
|
|
306
|
-
description: "Fetch multiple entities by
|
|
307
|
+
description: "Fetch multiple entities by reference",
|
|
307
308
|
example: yaml__default["default"].stringify({
|
|
308
309
|
steps: [
|
|
309
310
|
{
|
|
310
|
-
action:
|
|
311
|
+
action: "catalog:fetch",
|
|
311
312
|
id: "fetchMultiple",
|
|
312
313
|
name: "Fetch catalog entities",
|
|
313
314
|
input: {
|
|
@@ -318,12 +319,14 @@ const examples$2 = [
|
|
|
318
319
|
})
|
|
319
320
|
}
|
|
320
321
|
];
|
|
322
|
+
|
|
323
|
+
const id$2 = "catalog:fetch";
|
|
321
324
|
function createFetchCatalogEntityAction(options) {
|
|
322
325
|
const { catalogClient } = options;
|
|
323
326
|
return pluginScaffolderNode.createTemplateAction({
|
|
324
327
|
id: id$2,
|
|
325
328
|
description: "Returns entity or entities from the catalog by entity reference(s)",
|
|
326
|
-
examples: examples$
|
|
329
|
+
examples: examples$7,
|
|
327
330
|
supportsDryRun: true,
|
|
328
331
|
schema: {
|
|
329
332
|
input: zod.z.object({
|
|
@@ -398,14 +401,13 @@ function createFetchCatalogEntityAction(options) {
|
|
|
398
401
|
});
|
|
399
402
|
}
|
|
400
403
|
|
|
401
|
-
const
|
|
402
|
-
const examples$1 = [
|
|
404
|
+
const examples$6 = [
|
|
403
405
|
{
|
|
404
406
|
description: "Write a debug message",
|
|
405
407
|
example: yaml__default["default"].stringify({
|
|
406
408
|
steps: [
|
|
407
409
|
{
|
|
408
|
-
action:
|
|
410
|
+
action: "debug:log",
|
|
409
411
|
id: "write-debug-line",
|
|
410
412
|
name: 'Write "Hello Backstage!" log line',
|
|
411
413
|
input: {
|
|
@@ -420,7 +422,7 @@ const examples$1 = [
|
|
|
420
422
|
example: yaml__default["default"].stringify({
|
|
421
423
|
steps: [
|
|
422
424
|
{
|
|
423
|
-
action:
|
|
425
|
+
action: "debug:log",
|
|
424
426
|
id: "write-workspace-directory",
|
|
425
427
|
name: "List the workspace directory",
|
|
426
428
|
input: {
|
|
@@ -431,11 +433,13 @@ const examples$1 = [
|
|
|
431
433
|
})
|
|
432
434
|
}
|
|
433
435
|
];
|
|
436
|
+
|
|
437
|
+
const id$1 = "debug:log";
|
|
434
438
|
function createDebugLogAction() {
|
|
435
439
|
return pluginScaffolderNode.createTemplateAction({
|
|
436
440
|
id: id$1,
|
|
437
441
|
description: "Writes a message into the log or lists all files in the workspace.",
|
|
438
|
-
examples: examples$
|
|
442
|
+
examples: examples$6,
|
|
439
443
|
schema: {
|
|
440
444
|
input: {
|
|
441
445
|
type: "object",
|
|
@@ -482,15 +486,28 @@ async function recursiveReadDir(dir) {
|
|
|
482
486
|
return files.reduce((a, f) => a.concat(f), []);
|
|
483
487
|
}
|
|
484
488
|
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
489
|
+
const examples$5 = [
|
|
490
|
+
{
|
|
491
|
+
description: "Waiting for 50 milliseconds",
|
|
492
|
+
example: yaml__default["default"].stringify({
|
|
493
|
+
steps: [
|
|
494
|
+
{
|
|
495
|
+
action: "debug:wait",
|
|
496
|
+
id: "wait-milliseconds",
|
|
497
|
+
name: "Waiting for 50 milliseconds",
|
|
498
|
+
input: {
|
|
499
|
+
milliseconds: 50
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
]
|
|
503
|
+
})
|
|
504
|
+
},
|
|
488
505
|
{
|
|
489
506
|
description: "Waiting for 5 seconds",
|
|
490
507
|
example: yaml__default["default"].stringify({
|
|
491
508
|
steps: [
|
|
492
509
|
{
|
|
493
|
-
action:
|
|
510
|
+
action: "debug:wait",
|
|
494
511
|
id: "wait-5sec",
|
|
495
512
|
name: "Waiting for 5 seconds",
|
|
496
513
|
input: {
|
|
@@ -501,21 +518,24 @@ const examples = [
|
|
|
501
518
|
})
|
|
502
519
|
},
|
|
503
520
|
{
|
|
504
|
-
description: "Waiting for
|
|
521
|
+
description: "Waiting for 1 minutes",
|
|
505
522
|
example: yaml__default["default"].stringify({
|
|
506
523
|
steps: [
|
|
507
524
|
{
|
|
508
|
-
action:
|
|
509
|
-
id: "wait-
|
|
510
|
-
name: "Waiting for
|
|
525
|
+
action: "debug:wait",
|
|
526
|
+
id: "wait-1min",
|
|
527
|
+
name: "Waiting for 1 minutes",
|
|
511
528
|
input: {
|
|
512
|
-
minutes:
|
|
529
|
+
minutes: 1
|
|
513
530
|
}
|
|
514
531
|
}
|
|
515
532
|
]
|
|
516
533
|
})
|
|
517
534
|
}
|
|
518
535
|
];
|
|
536
|
+
|
|
537
|
+
const id = "debug:wait";
|
|
538
|
+
const MAX_WAIT_TIME_IN_ISO = "T00:00:30";
|
|
519
539
|
function createWaitAction(options) {
|
|
520
540
|
const toDuration = (maxWaitTime) => {
|
|
521
541
|
if (maxWaitTime) {
|
|
@@ -529,7 +549,7 @@ function createWaitAction(options) {
|
|
|
529
549
|
return pluginScaffolderNode.createTemplateAction({
|
|
530
550
|
id,
|
|
531
551
|
description: "Waits for a certain period of time.",
|
|
532
|
-
examples,
|
|
552
|
+
examples: examples$5,
|
|
533
553
|
schema: {
|
|
534
554
|
input: {
|
|
535
555
|
type: "object",
|
|
@@ -574,10 +594,46 @@ function createWaitAction(options) {
|
|
|
574
594
|
});
|
|
575
595
|
}
|
|
576
596
|
|
|
597
|
+
const examples$4 = [
|
|
598
|
+
{
|
|
599
|
+
description: "Downloads content and places it in the workspace.",
|
|
600
|
+
example: yaml__default["default"].stringify({
|
|
601
|
+
steps: [
|
|
602
|
+
{
|
|
603
|
+
action: "fetch:plain",
|
|
604
|
+
id: "fetch-plain",
|
|
605
|
+
name: "Fetch plain",
|
|
606
|
+
input: {
|
|
607
|
+
url: "https://github.com/backstage/community/tree/main/backstage-community-sessions/assets"
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
]
|
|
611
|
+
})
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
description: "Optionally, if you would prefer the data to be downloaded to a subdirectory in the workspace you may specify the \u2018targetPath\u2019 input option.",
|
|
615
|
+
example: yaml__default["default"].stringify({
|
|
616
|
+
steps: [
|
|
617
|
+
{
|
|
618
|
+
action: "fetch:plain",
|
|
619
|
+
id: "fetch-plain",
|
|
620
|
+
name: "Fetch plain",
|
|
621
|
+
input: {
|
|
622
|
+
url: "https://github.com/backstage/community/tree/main/backstage-community-sessions/assets",
|
|
623
|
+
targetPath: "fetched-data"
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
})
|
|
628
|
+
}
|
|
629
|
+
];
|
|
630
|
+
|
|
631
|
+
const ACTION_ID = "fetch:plain";
|
|
577
632
|
function createFetchPlainAction(options) {
|
|
578
633
|
const { reader, integrations } = options;
|
|
579
634
|
return pluginScaffolderNode.createTemplateAction({
|
|
580
|
-
id:
|
|
635
|
+
id: ACTION_ID,
|
|
636
|
+
examples: examples$4,
|
|
581
637
|
description: "Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
|
|
582
638
|
schema: {
|
|
583
639
|
input: {
|
|
@@ -614,11 +670,31 @@ function createFetchPlainAction(options) {
|
|
|
614
670
|
});
|
|
615
671
|
}
|
|
616
672
|
|
|
673
|
+
const examples$3 = [
|
|
674
|
+
{
|
|
675
|
+
description: "Downloads a file and places it in the workspace.",
|
|
676
|
+
example: yaml__default["default"].stringify({
|
|
677
|
+
steps: [
|
|
678
|
+
{
|
|
679
|
+
action: "fetch:plain:file",
|
|
680
|
+
id: "fetch-plain-file",
|
|
681
|
+
name: "Fetch plain file",
|
|
682
|
+
input: {
|
|
683
|
+
url: "https://github.com/backstage/community/tree/main/backstage-community-sessions/assets/Backstage%20Community%20Sessions.png",
|
|
684
|
+
targetPath: "target-path"
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
]
|
|
688
|
+
})
|
|
689
|
+
}
|
|
690
|
+
];
|
|
691
|
+
|
|
617
692
|
function createFetchPlainFileAction(options) {
|
|
618
693
|
const { reader, integrations } = options;
|
|
619
694
|
return pluginScaffolderNode.createTemplateAction({
|
|
620
695
|
id: "fetch:plain:file",
|
|
621
696
|
description: "Downloads single file and places it in the workspace.",
|
|
697
|
+
examples: examples$3,
|
|
622
698
|
schema: {
|
|
623
699
|
input: {
|
|
624
700
|
type: "object",
|
|
@@ -886,6 +962,31 @@ const createDefaultFilters = ({
|
|
|
886
962
|
};
|
|
887
963
|
};
|
|
888
964
|
|
|
965
|
+
const examples$2 = [
|
|
966
|
+
{
|
|
967
|
+
description: "Downloads a skelaton directory that lives alongside the template file and fill it out with values.",
|
|
968
|
+
example: yaml__default["default"].stringify({
|
|
969
|
+
steps: [
|
|
970
|
+
{
|
|
971
|
+
action: "fetch:template",
|
|
972
|
+
id: "fetch-template",
|
|
973
|
+
name: "Fetch template",
|
|
974
|
+
input: {
|
|
975
|
+
url: "./skeleton",
|
|
976
|
+
targetPath: "./target",
|
|
977
|
+
values: {
|
|
978
|
+
name: "test-project",
|
|
979
|
+
count: 1234,
|
|
980
|
+
itemList: ["first", "second", "third"],
|
|
981
|
+
showDummyFile: false
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
]
|
|
986
|
+
})
|
|
987
|
+
}
|
|
988
|
+
];
|
|
989
|
+
|
|
889
990
|
function createFetchTemplateAction(options) {
|
|
890
991
|
const {
|
|
891
992
|
reader,
|
|
@@ -897,6 +998,7 @@ function createFetchTemplateAction(options) {
|
|
|
897
998
|
return pluginScaffolderNode.createTemplateAction({
|
|
898
999
|
id: "fetch:template",
|
|
899
1000
|
description: "Downloads a skeleton, templates variables into file and directory names and content, and places the result in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
|
|
1001
|
+
examples: examples$2,
|
|
900
1002
|
schema: {
|
|
901
1003
|
input: {
|
|
902
1004
|
type: "object",
|
|
@@ -1101,10 +1203,29 @@ function containsSkippedContent(localOutputPath) {
|
|
|
1101
1203
|
return localOutputPath === "" || localOutputPath.startsWith("/") || localOutputPath.includes("//");
|
|
1102
1204
|
}
|
|
1103
1205
|
|
|
1206
|
+
const examples$1 = [
|
|
1207
|
+
{
|
|
1208
|
+
description: "Delete specified files",
|
|
1209
|
+
example: yaml__namespace.stringify({
|
|
1210
|
+
steps: [
|
|
1211
|
+
{
|
|
1212
|
+
action: "fs:delete",
|
|
1213
|
+
id: "deleteFiles",
|
|
1214
|
+
name: "Delete files",
|
|
1215
|
+
input: {
|
|
1216
|
+
files: ["file1.txt", "file2.txt"]
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
]
|
|
1220
|
+
})
|
|
1221
|
+
}
|
|
1222
|
+
];
|
|
1223
|
+
|
|
1104
1224
|
const createFilesystemDeleteAction = () => {
|
|
1105
1225
|
return pluginScaffolderNode.createTemplateAction({
|
|
1106
1226
|
id: "fs:delete",
|
|
1107
1227
|
description: "Deletes files and directories from the workspace",
|
|
1228
|
+
examples: examples$1,
|
|
1108
1229
|
schema: {
|
|
1109
1230
|
input: {
|
|
1110
1231
|
required: ["files"],
|
|
@@ -1141,10 +1262,33 @@ const createFilesystemDeleteAction = () => {
|
|
|
1141
1262
|
});
|
|
1142
1263
|
};
|
|
1143
1264
|
|
|
1265
|
+
const examples = [
|
|
1266
|
+
{
|
|
1267
|
+
description: "Rename specified files ",
|
|
1268
|
+
example: yaml__namespace.stringify({
|
|
1269
|
+
steps: [
|
|
1270
|
+
{
|
|
1271
|
+
action: "fs:rename",
|
|
1272
|
+
id: "renameFiles",
|
|
1273
|
+
name: "Rename files",
|
|
1274
|
+
input: {
|
|
1275
|
+
files: [
|
|
1276
|
+
{ from: "file1.txt", to: "file1Renamed.txt" },
|
|
1277
|
+
{ from: "file2.txt", to: "file2Renamed.txt" },
|
|
1278
|
+
{ from: "file3.txt", to: "file3Renamed.txt", overwrite: true }
|
|
1279
|
+
]
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
]
|
|
1283
|
+
})
|
|
1284
|
+
}
|
|
1285
|
+
];
|
|
1286
|
+
|
|
1144
1287
|
const createFilesystemRenameAction = () => {
|
|
1145
1288
|
return pluginScaffolderNode.createTemplateAction({
|
|
1146
1289
|
id: "fs:rename",
|
|
1147
1290
|
description: "Renames files and directories within the workspace",
|
|
1291
|
+
examples,
|
|
1148
1292
|
schema: {
|
|
1149
1293
|
input: {
|
|
1150
1294
|
required: ["files"],
|
|
@@ -6718,4 +6862,4 @@ exports.createRouter = createRouter;
|
|
|
6718
6862
|
exports.createWaitAction = createWaitAction;
|
|
6719
6863
|
exports.scaffolderActionRules = scaffolderActionRules;
|
|
6720
6864
|
exports.scaffolderTemplateRules = scaffolderTemplateRules;
|
|
6721
|
-
//# sourceMappingURL=ScaffolderEntitiesProcessor-
|
|
6865
|
+
//# sourceMappingURL=ScaffolderEntitiesProcessor-82f18a18.cjs.js.map
|