@backstage/plugin-scaffolder-backend 0.15.12 → 0.15.16
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 +47 -0
- package/assets/nunjucks.js.txt +10385 -0
- package/config.d.ts +12 -12
- package/dist/index.cjs.js +283 -191
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +67 -47
- package/package.json +20 -16
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Config } from '@backstage/config';
|
|
|
11
11
|
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
12
12
|
import { Octokit } from '@octokit/rest';
|
|
13
13
|
export { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter';
|
|
14
|
+
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
14
15
|
import { Knex } from 'knex';
|
|
15
16
|
import express from 'express';
|
|
16
17
|
import { TemplateEntityV1beta2, Entity, LocationSpec } from '@backstage/catalog-model';
|
|
@@ -140,56 +141,19 @@ declare class OctokitProvider {
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
declare type RunCommandOptions = {
|
|
144
|
+
/** command to run */
|
|
143
145
|
command: string;
|
|
146
|
+
/** arguments to pass the command */
|
|
144
147
|
args: string[];
|
|
148
|
+
/** options to pass to spawn */
|
|
149
|
+
options?: SpawnOptionsWithoutStdio;
|
|
150
|
+
/** stream to capture stdout and stderr output */
|
|
145
151
|
logStream?: Writable;
|
|
146
152
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
declare
|
|
151
|
-
declare type InputBase = Partial<{
|
|
152
|
-
[name: string]: PartialJsonValue;
|
|
153
|
-
}>;
|
|
154
|
-
declare type ActionContext<Input extends InputBase> = {
|
|
155
|
-
/**
|
|
156
|
-
* Base URL for the location of the task spec, typically the url of the source entity file.
|
|
157
|
-
*/
|
|
158
|
-
baseUrl?: string;
|
|
159
|
-
logger: Logger;
|
|
160
|
-
logStream: Writable;
|
|
161
|
-
/**
|
|
162
|
-
* User token forwarded from initial request, for use in subsequent api requests
|
|
163
|
-
*/
|
|
164
|
-
token?: string | undefined;
|
|
165
|
-
workspacePath: string;
|
|
166
|
-
input: Input;
|
|
167
|
-
output(name: string, value: JsonValue): void;
|
|
168
|
-
/**
|
|
169
|
-
* Creates a temporary directory for use by the action, which is then cleaned up automatically.
|
|
170
|
-
*/
|
|
171
|
-
createTemporaryDirectory(): Promise<string>;
|
|
172
|
-
};
|
|
173
|
-
declare type TemplateAction<Input extends InputBase> = {
|
|
174
|
-
id: string;
|
|
175
|
-
description?: string;
|
|
176
|
-
schema?: {
|
|
177
|
-
input?: Schema;
|
|
178
|
-
output?: Schema;
|
|
179
|
-
};
|
|
180
|
-
handler: (ctx: ActionContext<Input>) => Promise<void>;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
declare class TemplateActionRegistry {
|
|
184
|
-
private readonly actions;
|
|
185
|
-
register<Parameters extends InputBase>(action: TemplateAction<Parameters>): void;
|
|
186
|
-
get(actionId: string): TemplateAction<any>;
|
|
187
|
-
list(): TemplateAction<any>[];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
declare const createTemplateAction: <Input extends Partial<{
|
|
191
|
-
[name: string]: _backstage_types.JsonValue | Partial<_backstage_types.JsonObject> | undefined;
|
|
192
|
-
}>>(templateAction: TemplateAction<Input>) => TemplateAction<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Run a command in a sub-process, normally a shell command.
|
|
155
|
+
*/
|
|
156
|
+
declare const runCommand: ({ command, args, logStream, options, }: RunCommandOptions) => Promise<void>;
|
|
193
157
|
|
|
194
158
|
/**
|
|
195
159
|
* Status
|
|
@@ -234,6 +198,14 @@ declare type SerializedTaskEvent = {
|
|
|
234
198
|
type: TaskEventType;
|
|
235
199
|
createdAt: string;
|
|
236
200
|
};
|
|
201
|
+
/**
|
|
202
|
+
* TemplateMetadata
|
|
203
|
+
*
|
|
204
|
+
* @public
|
|
205
|
+
*/
|
|
206
|
+
declare type TemplateMetadata = {
|
|
207
|
+
name: string;
|
|
208
|
+
};
|
|
237
209
|
/**
|
|
238
210
|
* TaskSpecV1beta2
|
|
239
211
|
*
|
|
@@ -253,6 +225,7 @@ interface TaskSpecV1beta2 {
|
|
|
253
225
|
output: {
|
|
254
226
|
[name: string]: string;
|
|
255
227
|
};
|
|
228
|
+
metadata?: TemplateMetadata;
|
|
256
229
|
}
|
|
257
230
|
interface TaskStep {
|
|
258
231
|
id: string;
|
|
@@ -274,6 +247,7 @@ interface TaskSpecV1beta3 {
|
|
|
274
247
|
output: {
|
|
275
248
|
[name: string]: JsonValue;
|
|
276
249
|
};
|
|
250
|
+
metadata?: TemplateMetadata;
|
|
277
251
|
}
|
|
278
252
|
/**
|
|
279
253
|
* TaskSpec
|
|
@@ -379,6 +353,52 @@ interface TaskStore {
|
|
|
379
353
|
}>;
|
|
380
354
|
}
|
|
381
355
|
|
|
356
|
+
declare type PartialJsonObject = Partial<JsonObject>;
|
|
357
|
+
declare type PartialJsonValue = PartialJsonObject | JsonValue | undefined;
|
|
358
|
+
declare type InputBase = Partial<{
|
|
359
|
+
[name: string]: PartialJsonValue;
|
|
360
|
+
}>;
|
|
361
|
+
declare type ActionContext<Input extends InputBase> = {
|
|
362
|
+
/**
|
|
363
|
+
* Base URL for the location of the task spec, typically the url of the source entity file.
|
|
364
|
+
*/
|
|
365
|
+
baseUrl?: string;
|
|
366
|
+
logger: Logger;
|
|
367
|
+
logStream: Writable;
|
|
368
|
+
/**
|
|
369
|
+
* User token forwarded from initial request, for use in subsequent api requests
|
|
370
|
+
*/
|
|
371
|
+
token?: string | undefined;
|
|
372
|
+
workspacePath: string;
|
|
373
|
+
input: Input;
|
|
374
|
+
output(name: string, value: JsonValue): void;
|
|
375
|
+
/**
|
|
376
|
+
* Creates a temporary directory for use by the action, which is then cleaned up automatically.
|
|
377
|
+
*/
|
|
378
|
+
createTemporaryDirectory(): Promise<string>;
|
|
379
|
+
metadata?: TemplateMetadata;
|
|
380
|
+
};
|
|
381
|
+
declare type TemplateAction<Input extends InputBase> = {
|
|
382
|
+
id: string;
|
|
383
|
+
description?: string;
|
|
384
|
+
schema?: {
|
|
385
|
+
input?: Schema;
|
|
386
|
+
output?: Schema;
|
|
387
|
+
};
|
|
388
|
+
handler: (ctx: ActionContext<Input>) => Promise<void>;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
declare class TemplateActionRegistry {
|
|
392
|
+
private readonly actions;
|
|
393
|
+
register<Parameters extends InputBase>(action: TemplateAction<Parameters>): void;
|
|
394
|
+
get(actionId: string): TemplateAction<any>;
|
|
395
|
+
list(): TemplateAction<any>[];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
declare const createTemplateAction: <Input extends Partial<{
|
|
399
|
+
[name: string]: _backstage_types.JsonValue | Partial<_backstage_types.JsonObject> | undefined;
|
|
400
|
+
}>>(templateAction: TemplateAction<Input>) => TemplateAction<any>;
|
|
401
|
+
|
|
382
402
|
/**
|
|
383
403
|
* DatabaseTaskStore
|
|
384
404
|
*
|
|
@@ -518,4 +538,4 @@ declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
|
|
|
518
538
|
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
519
539
|
}
|
|
520
540
|
|
|
521
|
-
export { ActionContext, CatalogEntityClient, CompletedTaskState, CreateWorkerOptions, DatabaseTaskStore, DispatchResult, OctokitProvider, RouterOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, Status, TaskBroker, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskSpec, TaskSpecV1beta2, TaskSpecV1beta3, TaskState, TaskStore, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskWorker, TemplateAction, TemplateActionRegistry, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createRouter, createTemplateAction, fetchContents, runCommand };
|
|
541
|
+
export { ActionContext, CatalogEntityClient, CompletedTaskState, CreateWorkerOptions, DatabaseTaskStore, DispatchResult, OctokitProvider, RouterOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, Status, TaskBroker, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskSpec, TaskSpecV1beta2, TaskSpecV1beta3, TaskState, TaskStore, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateMetadata, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createRouter, createTemplateAction, fetchContents, runCommand };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend",
|
|
3
3
|
"description": "The Backstage backend plugin that helps you create new things",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.16",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -27,21 +27,22 @@
|
|
|
27
27
|
"test": "backstage-cli test",
|
|
28
28
|
"prepack": "backstage-cli prepack",
|
|
29
29
|
"postpack": "backstage-cli postpack",
|
|
30
|
-
"clean": "backstage-cli clean"
|
|
30
|
+
"clean": "backstage-cli clean",
|
|
31
|
+
"build:assets": "node scripts/build-nunjucks.js"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@backstage/backend-common": "^0.9.
|
|
34
|
-
"@backstage/catalog-client": "^0.5.
|
|
35
|
-
"@backstage/catalog-model": "^0.9.
|
|
34
|
+
"@backstage/backend-common": "^0.9.13",
|
|
35
|
+
"@backstage/catalog-client": "^0.5.2",
|
|
36
|
+
"@backstage/catalog-model": "^0.9.7",
|
|
36
37
|
"@backstage/config": "^0.1.11",
|
|
37
|
-
"@backstage/errors": "^0.1.
|
|
38
|
-
"@backstage/integration": "^0.6.
|
|
39
|
-
"@backstage/plugin-catalog-backend": "^0.
|
|
40
|
-
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.1.
|
|
38
|
+
"@backstage/errors": "^0.1.5",
|
|
39
|
+
"@backstage/integration": "^0.6.10",
|
|
40
|
+
"@backstage/plugin-catalog-backend": "^0.19.1",
|
|
41
|
+
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.1.5",
|
|
41
42
|
"@backstage/plugin-scaffolder-common": "^0.1.1",
|
|
42
43
|
"@backstage/types": "^0.1.1",
|
|
43
|
-
"@gitbeaker/core": "^
|
|
44
|
-
"@gitbeaker/node": "^
|
|
44
|
+
"@gitbeaker/core": "^34.6.0",
|
|
45
|
+
"@gitbeaker/node": "^34.6.0",
|
|
45
46
|
"@octokit/rest": "^18.5.3",
|
|
46
47
|
"@octokit/webhooks": "^9.14.1",
|
|
47
48
|
"@types/express": "^4.17.6",
|
|
@@ -49,7 +50,6 @@
|
|
|
49
50
|
"command-exists": "^1.2.9",
|
|
50
51
|
"compression": "^1.7.4",
|
|
51
52
|
"cors": "^2.8.5",
|
|
52
|
-
"cross-fetch": "^3.0.6",
|
|
53
53
|
"express": "^4.17.1",
|
|
54
54
|
"express-promise-router": "^4.1.0",
|
|
55
55
|
"fs-extra": "10.0.0",
|
|
@@ -64,21 +64,24 @@
|
|
|
64
64
|
"lodash": "^4.17.21",
|
|
65
65
|
"luxon": "^2.0.2",
|
|
66
66
|
"morgan": "^1.10.0",
|
|
67
|
+
"node-fetch": "^2.6.1",
|
|
67
68
|
"nunjucks": "^3.2.3",
|
|
68
69
|
"octokit-plugin-create-pull-request": "^3.10.0",
|
|
69
70
|
"uuid": "^8.2.0",
|
|
71
|
+
"vm2": "^3.9.5",
|
|
70
72
|
"winston": "^3.2.1",
|
|
71
73
|
"yaml": "^1.10.0"
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
|
-
"@backstage/cli": "^0.
|
|
75
|
-
"@backstage/test-utils": "^0.1.
|
|
76
|
+
"@backstage/cli": "^0.10.1",
|
|
77
|
+
"@backstage/test-utils": "^0.1.24",
|
|
76
78
|
"@types/command-exists": "^1.2.0",
|
|
77
79
|
"@types/fs-extra": "^9.0.1",
|
|
78
80
|
"@types/git-url-parse": "^9.0.0",
|
|
79
81
|
"@types/mock-fs": "^4.13.0",
|
|
80
82
|
"@types/nunjucks": "^3.1.4",
|
|
81
83
|
"@types/supertest": "^2.0.8",
|
|
84
|
+
"esbuild": "^0.14.1",
|
|
82
85
|
"jest-when": "^3.1.0",
|
|
83
86
|
"mock-fs": "^5.1.0",
|
|
84
87
|
"msw": "^0.35.0",
|
|
@@ -88,8 +91,9 @@
|
|
|
88
91
|
"files": [
|
|
89
92
|
"dist",
|
|
90
93
|
"migrations",
|
|
91
|
-
"config.d.ts"
|
|
94
|
+
"config.d.ts",
|
|
95
|
+
"assets"
|
|
92
96
|
],
|
|
93
97
|
"configSchema": "config.d.ts",
|
|
94
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "562be0b43016294e27af3ad024191bb86b13b1c1"
|
|
95
99
|
}
|