@backstage/plugin-scaffolder-common 0.2.3 → 1.0.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/CHANGELOG.md +63 -0
- package/dist/index.cjs.js +0 -229
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +68 -73
- package/dist/index.esm.js +1 -229
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-common
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- b58c70c223: This package has been promoted to v1.0! To understand how this change affects the package, please check out our [versioning policy](https://backstage.io/docs/overview/versioning-policy).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- c8475ab3bb: Adding some documentation for exported things
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/catalog-model@1.0.0
|
|
14
|
+
- @backstage/types@1.0.0
|
|
15
|
+
|
|
16
|
+
## 0.3.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 310e905998: The following deprecations are now breaking and have been removed:
|
|
21
|
+
|
|
22
|
+
- **BREAKING**: Support for `backstage.io/v1beta2` Software Templates has been removed. Please migrate your legacy templates to the new `scaffolder.backstage.io/v1beta3` `apiVersion` by following the [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3)
|
|
23
|
+
|
|
24
|
+
- **BREAKING**: Removed the deprecated `TemplateMetadata`. Please use `TemplateInfo` instead.
|
|
25
|
+
|
|
26
|
+
- **BREAKING**: Removed the deprecated `context.baseUrl`. It's now available on `context.templateInfo.baseUrl`.
|
|
27
|
+
|
|
28
|
+
- **BREAKING**: Removed the deprecated `DispatchResult`, use `TaskBrokerDispatchResult` instead.
|
|
29
|
+
|
|
30
|
+
- **BREAKING**: Removed the deprecated `runCommand`, use `executeShellCommond` instead.
|
|
31
|
+
|
|
32
|
+
- **BREAKING**: Removed the deprecated `Status` in favour of `TaskStatus` instead.
|
|
33
|
+
|
|
34
|
+
- **BREAKING**: Removed the deprecated `TaskState` in favour of `CurrentClaimedTask` instead.
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @backstage/catalog-model@0.13.0
|
|
40
|
+
|
|
41
|
+
## 0.3.0-next.0
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- 310e905998: The following deprecations are now breaking and have been removed:
|
|
46
|
+
|
|
47
|
+
- **BREAKING**: Support for `backstage.io/v1beta2` Software Templates has been removed. Please migrate your legacy templates to the new `scaffolder.backstage.io/v1beta3` `apiVersion` by following the [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3)
|
|
48
|
+
|
|
49
|
+
- **BREAKING**: Removed the deprecated `TemplateMetadata`. Please use `TemplateInfo` instead.
|
|
50
|
+
|
|
51
|
+
- **BREAKING**: Removed the deprecated `context.baseUrl`. It's now available on `context.templateInfo.baseUrl`.
|
|
52
|
+
|
|
53
|
+
- **BREAKING**: Removed the deprecated `DispatchResult`, use `TaskBrokerDispatchResult` instead.
|
|
54
|
+
|
|
55
|
+
- **BREAKING**: Removed the deprecated `runCommand`, use `executeShellCommond` instead.
|
|
56
|
+
|
|
57
|
+
- **BREAKING**: Removed the deprecated `Status` in favour of `TaskStatus` instead.
|
|
58
|
+
|
|
59
|
+
- **BREAKING**: Removed the deprecated `TaskState` in favour of `CurrentClaimedTask` instead.
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @backstage/catalog-model@0.13.0-next.0
|
|
65
|
+
|
|
3
66
|
## 0.2.3
|
|
4
67
|
|
|
5
68
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -4,234 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var catalogModel = require('@backstage/catalog-model');
|
|
6
6
|
|
|
7
|
-
var $schema$1 = "http://json-schema.org/draft-07/schema";
|
|
8
|
-
var $id$1 = "TemplateV1beta2";
|
|
9
|
-
var description$1 = "A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.";
|
|
10
|
-
var examples$1 = [
|
|
11
|
-
{
|
|
12
|
-
apiVersion: "backstage.io/v1beta2",
|
|
13
|
-
kind: "Template",
|
|
14
|
-
metadata: {
|
|
15
|
-
name: "react-ssr-template",
|
|
16
|
-
title: "React SSR Template",
|
|
17
|
-
description: "Next.js application skeleton for creating isomorphic web applications.",
|
|
18
|
-
tags: [
|
|
19
|
-
"recommended",
|
|
20
|
-
"react"
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
spec: {
|
|
24
|
-
owner: "artist-relations-team",
|
|
25
|
-
type: "website",
|
|
26
|
-
parameters: {
|
|
27
|
-
required: [
|
|
28
|
-
"name",
|
|
29
|
-
"description"
|
|
30
|
-
],
|
|
31
|
-
properties: {
|
|
32
|
-
name: {
|
|
33
|
-
title: "Name",
|
|
34
|
-
type: "string",
|
|
35
|
-
description: "Unique name of the component"
|
|
36
|
-
},
|
|
37
|
-
description: {
|
|
38
|
-
title: "Description",
|
|
39
|
-
type: "string",
|
|
40
|
-
description: "Description of the component"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
steps: [
|
|
45
|
-
{
|
|
46
|
-
id: "fetch",
|
|
47
|
-
name: "Fetch",
|
|
48
|
-
action: "fetch:plain",
|
|
49
|
-
parameters: {
|
|
50
|
-
url: "./template"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: "publish",
|
|
55
|
-
name: "Publish to GitHub",
|
|
56
|
-
action: "publish:github",
|
|
57
|
-
parameters: {
|
|
58
|
-
repoUrl: "{{ parameters.repoUrl }}"
|
|
59
|
-
},
|
|
60
|
-
"if": "{{ parameters.repoUrl }}"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
output: {
|
|
64
|
-
catalogInfoUrl: "{{ steps.publish.output.catalogInfoUrl }}"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
];
|
|
69
|
-
var allOf$1 = [
|
|
70
|
-
{
|
|
71
|
-
$ref: "Entity"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: "object",
|
|
75
|
-
required: [
|
|
76
|
-
"spec"
|
|
77
|
-
],
|
|
78
|
-
properties: {
|
|
79
|
-
apiVersion: {
|
|
80
|
-
"enum": [
|
|
81
|
-
"backstage.io/v1beta2"
|
|
82
|
-
]
|
|
83
|
-
},
|
|
84
|
-
kind: {
|
|
85
|
-
"enum": [
|
|
86
|
-
"Template"
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
spec: {
|
|
90
|
-
type: "object",
|
|
91
|
-
required: [
|
|
92
|
-
"type",
|
|
93
|
-
"steps"
|
|
94
|
-
],
|
|
95
|
-
properties: {
|
|
96
|
-
type: {
|
|
97
|
-
type: "string",
|
|
98
|
-
description: "The type of component created by the template. The software catalog accepts any type value, but an organization should take great care to establish a proper taxonomy for these. Tools including Backstage itself may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Backstage interface that is specific to just websites.",
|
|
99
|
-
examples: [
|
|
100
|
-
"service",
|
|
101
|
-
"website",
|
|
102
|
-
"library"
|
|
103
|
-
],
|
|
104
|
-
minLength: 1
|
|
105
|
-
},
|
|
106
|
-
parameters: {
|
|
107
|
-
oneOf: [
|
|
108
|
-
{
|
|
109
|
-
type: "object",
|
|
110
|
-
description: "The JSONSchema describing the inputs for the template."
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
type: "array",
|
|
114
|
-
description: "A list of separate forms to collect parameters.",
|
|
115
|
-
items: {
|
|
116
|
-
type: "object",
|
|
117
|
-
description: "The JSONSchema describing the inputs for the template."
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
},
|
|
122
|
-
steps: {
|
|
123
|
-
type: "array",
|
|
124
|
-
description: "A list of steps to execute.",
|
|
125
|
-
items: {
|
|
126
|
-
type: "object",
|
|
127
|
-
description: "A description of the step to execute.",
|
|
128
|
-
required: [
|
|
129
|
-
"action"
|
|
130
|
-
],
|
|
131
|
-
properties: {
|
|
132
|
-
id: {
|
|
133
|
-
type: "string",
|
|
134
|
-
description: "The ID of the step, which can be used to refer to its outputs."
|
|
135
|
-
},
|
|
136
|
-
name: {
|
|
137
|
-
type: "string",
|
|
138
|
-
description: "The name of the step, which will be displayed in the UI during the scaffolding process."
|
|
139
|
-
},
|
|
140
|
-
action: {
|
|
141
|
-
type: "string",
|
|
142
|
-
description: "The name of the action to execute."
|
|
143
|
-
},
|
|
144
|
-
input: {
|
|
145
|
-
type: "object",
|
|
146
|
-
description: "A templated object describing the inputs to the action."
|
|
147
|
-
},
|
|
148
|
-
"if": {
|
|
149
|
-
type: [
|
|
150
|
-
"string",
|
|
151
|
-
"boolean"
|
|
152
|
-
],
|
|
153
|
-
description: "A templated condition that skips the step when evaluated to false. If the condition is true or not defined, the step is executed. The condition is true, if the input is not `false`, `undefined`, `null`, `\"\"`, `0`, or `[]`."
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
output: {
|
|
159
|
-
type: "object",
|
|
160
|
-
description: "A templated object describing the outputs of the scaffolding task.",
|
|
161
|
-
properties: {
|
|
162
|
-
links: {
|
|
163
|
-
type: "array",
|
|
164
|
-
description: "A list of external hyperlinks, typically pointing to resources created or updated by the template",
|
|
165
|
-
items: {
|
|
166
|
-
type: "object",
|
|
167
|
-
required: [
|
|
168
|
-
],
|
|
169
|
-
properties: {
|
|
170
|
-
url: {
|
|
171
|
-
type: "string",
|
|
172
|
-
description: "A url in a standard uri format.",
|
|
173
|
-
examples: [
|
|
174
|
-
"https://github.com/my-org/my-new-repo"
|
|
175
|
-
],
|
|
176
|
-
minLength: 1
|
|
177
|
-
},
|
|
178
|
-
entityRef: {
|
|
179
|
-
type: "string",
|
|
180
|
-
description: "An entity reference to an entity in the catalog.",
|
|
181
|
-
examples: [
|
|
182
|
-
"Component:default/my-app"
|
|
183
|
-
],
|
|
184
|
-
minLength: 1
|
|
185
|
-
},
|
|
186
|
-
title: {
|
|
187
|
-
type: "string",
|
|
188
|
-
description: "A user friendly display name for the link.",
|
|
189
|
-
examples: [
|
|
190
|
-
"View new repo"
|
|
191
|
-
],
|
|
192
|
-
minLength: 1
|
|
193
|
-
},
|
|
194
|
-
icon: {
|
|
195
|
-
type: "string",
|
|
196
|
-
description: "A key representing a visual icon to be displayed in the UI.",
|
|
197
|
-
examples: [
|
|
198
|
-
"dashboard"
|
|
199
|
-
],
|
|
200
|
-
minLength: 1
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
additionalProperties: {
|
|
207
|
-
type: "string"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
owner: {
|
|
211
|
-
type: "string",
|
|
212
|
-
description: "The user (or group) owner of the template",
|
|
213
|
-
minLength: 1
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
];
|
|
220
|
-
var schema$1 = {
|
|
221
|
-
$schema: $schema$1,
|
|
222
|
-
$id: $id$1,
|
|
223
|
-
description: description$1,
|
|
224
|
-
examples: examples$1,
|
|
225
|
-
allOf: allOf$1
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const validator$1 = catalogModel.entityKindSchemaValidator(schema$1);
|
|
229
|
-
const templateEntityV1beta2Validator = {
|
|
230
|
-
async check(data) {
|
|
231
|
-
return validator$1(data) === data;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
|
|
235
7
|
var $schema = "http://json-schema.org/draft-07/schema";
|
|
236
8
|
var $id = "TemplateV1beta3";
|
|
237
9
|
var description = "A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.";
|
|
@@ -465,6 +237,5 @@ const templateEntityV1beta3Validator = {
|
|
|
465
237
|
}
|
|
466
238
|
};
|
|
467
239
|
|
|
468
|
-
exports.templateEntityV1beta2Validator = templateEntityV1beta2Validator;
|
|
469
240
|
exports.templateEntityV1beta3Validator = templateEntityV1beta3Validator;
|
|
470
241
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/TemplateEntityV1beta3.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n entityKindSchemaValidator,\n KindValidator,\n} from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\nimport schema from './Template.v1beta3.schema.json';\n\n/**\n * Backstage catalog Template kind Entity. Templates are used by the Scaffolder\n * plugin to create new entities, such as Components.\n *\n * @public\n */\nexport interface TemplateEntityV1beta3 extends Entity {\n /**\n * The apiVersion string of the TaskSpec.\n */\n apiVersion: 'scaffolder.backstage.io/v1beta3';\n /**\n * The kind of the entity\n */\n kind: 'Template';\n /**\n * The specification of the Template Entity\n */\n spec: {\n /**\n * The type that the Template will create. For example service, website or library.\n */\n type: string;\n /**\n * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\n * to collect user input and validate it against that schema. This can then be used in the `steps` part below to template\n * variables passed from the user into each action in the template.\n */\n parameters?: JsonObject | JsonObject[];\n /**\n * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\n * javascript action and some optional input parameters that may or may not have been collected from the end user.\n */\n steps: Array<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\n /**\n * The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n */\n output?: { [name: string]: string };\n /**\n * The owner entityRef of the TemplateEntity\n */\n owner?: string;\n };\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta3}.\n *\n * @public\n */\nexport const templateEntityV1beta3Validator: KindValidator = {\n // TODO(freben): Emulate the old KindValidator until we fix that type\n async check(data: Entity) {\n return validator(data) === data;\n },\n};\n"],"names":["entityKindSchemaValidator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,MAAM,YAAYA,sCAA0B,CAAA,MAAA,CAAA,CAAA;AAOrC,MAAM,8BAAgD,GAAA;AAAA,EAAA,MAErD,MAAM,IAAc,EAAA;AACxB,IAAA,OAAO,UAAU,IAAU,CAAA,KAAA,IAAA,CAAA;AAAA,GAAA;AAAA;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { JsonObject, JsonValue } from '@backstage/types';
|
|
2
2
|
import { Entity, KindValidator } from '@backstage/catalog-model';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Metadata about the Template that was the originator of a scaffolder task, as
|
|
6
|
-
* stored in the database.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
* @deprecated use templateInfo on the spec instead
|
|
10
|
-
*/
|
|
11
|
-
declare type TemplateMetadata = {
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
4
|
/**
|
|
15
5
|
* Information about a template that is stored on a task specification.
|
|
16
6
|
* Includes a stringified entityRef, and the baseUrl which is usually the relative path of the template definition
|
|
@@ -18,7 +8,13 @@ declare type TemplateMetadata = {
|
|
|
18
8
|
* @public
|
|
19
9
|
*/
|
|
20
10
|
declare type TemplateInfo = {
|
|
11
|
+
/**
|
|
12
|
+
* The entityRef of the template
|
|
13
|
+
*/
|
|
21
14
|
entityRef: string;
|
|
15
|
+
/**
|
|
16
|
+
* Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths.
|
|
17
|
+
*/
|
|
22
18
|
baseUrl?: string;
|
|
23
19
|
};
|
|
24
20
|
/**
|
|
@@ -27,33 +23,27 @@ declare type TemplateInfo = {
|
|
|
27
23
|
* @public
|
|
28
24
|
*/
|
|
29
25
|
interface TaskStep {
|
|
26
|
+
/**
|
|
27
|
+
* A unqiue identifier for this step.
|
|
28
|
+
*/
|
|
30
29
|
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* A display name to show the user.
|
|
32
|
+
*/
|
|
31
33
|
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* The underlying action ID that will be called as part of running this step.
|
|
36
|
+
*/
|
|
32
37
|
action: string;
|
|
38
|
+
/**
|
|
39
|
+
* Additional data that will be passed to the action.
|
|
40
|
+
*/
|
|
33
41
|
input?: JsonObject;
|
|
42
|
+
/**
|
|
43
|
+
* When this is false, or if the templated value string evaluates to something that is falsy the step will be skipped.
|
|
44
|
+
*/
|
|
34
45
|
if?: string | boolean;
|
|
35
46
|
}
|
|
36
|
-
/**
|
|
37
|
-
* A scaffolder task as stored in the database, generated from a v1beta2
|
|
38
|
-
* apiVersion Template.
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
* @deprecated Please convert your templates to TaskSpecV1beta3 on apiVersion
|
|
42
|
-
* scaffolder.backstage.io/v1beta3
|
|
43
|
-
*/
|
|
44
|
-
interface TaskSpecV1beta2 {
|
|
45
|
-
apiVersion: 'backstage.io/v1beta2';
|
|
46
|
-
/** @deprecated use templateInfo.baseUrl instead */
|
|
47
|
-
baseUrl?: string;
|
|
48
|
-
values: JsonObject;
|
|
49
|
-
steps: TaskStep[];
|
|
50
|
-
output: {
|
|
51
|
-
[name: string]: string;
|
|
52
|
-
};
|
|
53
|
-
/** @deprecated use templateInfo instead */
|
|
54
|
-
metadata?: TemplateMetadata;
|
|
55
|
-
templateInfo?: TemplateInfo;
|
|
56
|
-
}
|
|
57
47
|
/**
|
|
58
48
|
* A scaffolder task as stored in the database, generated from a v1beta3
|
|
59
49
|
* apiVersion Template.
|
|
@@ -61,16 +51,30 @@ interface TaskSpecV1beta2 {
|
|
|
61
51
|
* @public
|
|
62
52
|
*/
|
|
63
53
|
interface TaskSpecV1beta3 {
|
|
54
|
+
/**
|
|
55
|
+
* The apiVersion string of the TaskSpec.
|
|
56
|
+
*/
|
|
64
57
|
apiVersion: 'scaffolder.backstage.io/v1beta3';
|
|
65
|
-
/**
|
|
66
|
-
|
|
58
|
+
/**
|
|
59
|
+
* This is a JSONSchema which is used to render a form in the frontend
|
|
60
|
+
* to collect user input and validate it against that schema. This can then be used in the `steps` part below to template
|
|
61
|
+
* variables passed from the user into each action in the template.
|
|
62
|
+
*/
|
|
67
63
|
parameters: JsonObject;
|
|
64
|
+
/**
|
|
65
|
+
* A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying
|
|
66
|
+
* javascript action and some optional input parameters that may or may not have been collected from the end user.
|
|
67
|
+
*/
|
|
68
68
|
steps: TaskStep[];
|
|
69
|
+
/**
|
|
70
|
+
* The output is an object where template authors can pull out information from template actions and return them in a known standard way.
|
|
71
|
+
*/
|
|
69
72
|
output: {
|
|
70
73
|
[name: string]: JsonValue;
|
|
71
74
|
};
|
|
72
|
-
/**
|
|
73
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Some information about the template that is stored on the task spec.
|
|
77
|
+
*/
|
|
74
78
|
templateInfo?: TemplateInfo;
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
@@ -78,43 +82,7 @@ interface TaskSpecV1beta3 {
|
|
|
78
82
|
*
|
|
79
83
|
* @public
|
|
80
84
|
*/
|
|
81
|
-
declare type TaskSpec =
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Backstage catalog Template kind Entity. Templates are used by the Scaffolder
|
|
85
|
-
* plugin to create new entities, such as Components.
|
|
86
|
-
*
|
|
87
|
-
* @public
|
|
88
|
-
* @deprecated Please convert your templates to TemplateEntityV1beta3 on
|
|
89
|
-
* apiVersion scaffolder.backstage.io/v1beta3
|
|
90
|
-
*/
|
|
91
|
-
interface TemplateEntityV1beta2 extends Entity {
|
|
92
|
-
apiVersion: 'backstage.io/v1beta2';
|
|
93
|
-
kind: 'Template';
|
|
94
|
-
spec: {
|
|
95
|
-
type: string;
|
|
96
|
-
parameters?: JsonObject | JsonObject[];
|
|
97
|
-
steps: Array<{
|
|
98
|
-
id?: string;
|
|
99
|
-
name?: string;
|
|
100
|
-
action: string;
|
|
101
|
-
input?: JsonObject;
|
|
102
|
-
if?: string | boolean;
|
|
103
|
-
}>;
|
|
104
|
-
output?: {
|
|
105
|
-
[name: string]: string;
|
|
106
|
-
};
|
|
107
|
-
owner?: string;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Entity data validator for {@link TemplateEntityV1beta2}.
|
|
112
|
-
*
|
|
113
|
-
* @public
|
|
114
|
-
* @deprecated Please convert your templates to TemplateEntityV1beta3 on
|
|
115
|
-
* apiVersion scaffolder.backstage.io/v1beta3
|
|
116
|
-
*/
|
|
117
|
-
declare const templateEntityV1beta2Validator: KindValidator;
|
|
85
|
+
declare type TaskSpec = TaskSpecV1beta3;
|
|
118
86
|
|
|
119
87
|
/**
|
|
120
88
|
* Backstage catalog Template kind Entity. Templates are used by the Scaffolder
|
|
@@ -123,11 +91,32 @@ declare const templateEntityV1beta2Validator: KindValidator;
|
|
|
123
91
|
* @public
|
|
124
92
|
*/
|
|
125
93
|
interface TemplateEntityV1beta3 extends Entity {
|
|
94
|
+
/**
|
|
95
|
+
* The apiVersion string of the TaskSpec.
|
|
96
|
+
*/
|
|
126
97
|
apiVersion: 'scaffolder.backstage.io/v1beta3';
|
|
98
|
+
/**
|
|
99
|
+
* The kind of the entity
|
|
100
|
+
*/
|
|
127
101
|
kind: 'Template';
|
|
102
|
+
/**
|
|
103
|
+
* The specification of the Template Entity
|
|
104
|
+
*/
|
|
128
105
|
spec: {
|
|
106
|
+
/**
|
|
107
|
+
* The type that the Template will create. For example service, website or library.
|
|
108
|
+
*/
|
|
129
109
|
type: string;
|
|
110
|
+
/**
|
|
111
|
+
* This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend
|
|
112
|
+
* to collect user input and validate it against that schema. This can then be used in the `steps` part below to template
|
|
113
|
+
* variables passed from the user into each action in the template.
|
|
114
|
+
*/
|
|
130
115
|
parameters?: JsonObject | JsonObject[];
|
|
116
|
+
/**
|
|
117
|
+
* A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying
|
|
118
|
+
* javascript action and some optional input parameters that may or may not have been collected from the end user.
|
|
119
|
+
*/
|
|
131
120
|
steps: Array<{
|
|
132
121
|
id?: string;
|
|
133
122
|
name?: string;
|
|
@@ -135,9 +124,15 @@ interface TemplateEntityV1beta3 extends Entity {
|
|
|
135
124
|
input?: JsonObject;
|
|
136
125
|
if?: string | boolean;
|
|
137
126
|
}>;
|
|
127
|
+
/**
|
|
128
|
+
* The output is an object where template authors can pull out information from template actions and return them in a known standard way.
|
|
129
|
+
*/
|
|
138
130
|
output?: {
|
|
139
131
|
[name: string]: string;
|
|
140
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* The owner entityRef of the TemplateEntity
|
|
135
|
+
*/
|
|
141
136
|
owner?: string;
|
|
142
137
|
};
|
|
143
138
|
}
|
|
@@ -148,4 +143,4 @@ interface TemplateEntityV1beta3 extends Entity {
|
|
|
148
143
|
*/
|
|
149
144
|
declare const templateEntityV1beta3Validator: KindValidator;
|
|
150
145
|
|
|
151
|
-
export { TaskSpec,
|
|
146
|
+
export { TaskSpec, TaskSpecV1beta3, TaskStep, TemplateEntityV1beta3, TemplateInfo, templateEntityV1beta3Validator };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,233 +1,5 @@
|
|
|
1
1
|
import { entityKindSchemaValidator } from '@backstage/catalog-model';
|
|
2
2
|
|
|
3
|
-
var $schema$1 = "http://json-schema.org/draft-07/schema";
|
|
4
|
-
var $id$1 = "TemplateV1beta2";
|
|
5
|
-
var description$1 = "A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.";
|
|
6
|
-
var examples$1 = [
|
|
7
|
-
{
|
|
8
|
-
apiVersion: "backstage.io/v1beta2",
|
|
9
|
-
kind: "Template",
|
|
10
|
-
metadata: {
|
|
11
|
-
name: "react-ssr-template",
|
|
12
|
-
title: "React SSR Template",
|
|
13
|
-
description: "Next.js application skeleton for creating isomorphic web applications.",
|
|
14
|
-
tags: [
|
|
15
|
-
"recommended",
|
|
16
|
-
"react"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
spec: {
|
|
20
|
-
owner: "artist-relations-team",
|
|
21
|
-
type: "website",
|
|
22
|
-
parameters: {
|
|
23
|
-
required: [
|
|
24
|
-
"name",
|
|
25
|
-
"description"
|
|
26
|
-
],
|
|
27
|
-
properties: {
|
|
28
|
-
name: {
|
|
29
|
-
title: "Name",
|
|
30
|
-
type: "string",
|
|
31
|
-
description: "Unique name of the component"
|
|
32
|
-
},
|
|
33
|
-
description: {
|
|
34
|
-
title: "Description",
|
|
35
|
-
type: "string",
|
|
36
|
-
description: "Description of the component"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
steps: [
|
|
41
|
-
{
|
|
42
|
-
id: "fetch",
|
|
43
|
-
name: "Fetch",
|
|
44
|
-
action: "fetch:plain",
|
|
45
|
-
parameters: {
|
|
46
|
-
url: "./template"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "publish",
|
|
51
|
-
name: "Publish to GitHub",
|
|
52
|
-
action: "publish:github",
|
|
53
|
-
parameters: {
|
|
54
|
-
repoUrl: "{{ parameters.repoUrl }}"
|
|
55
|
-
},
|
|
56
|
-
"if": "{{ parameters.repoUrl }}"
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
output: {
|
|
60
|
-
catalogInfoUrl: "{{ steps.publish.output.catalogInfoUrl }}"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
var allOf$1 = [
|
|
66
|
-
{
|
|
67
|
-
$ref: "Entity"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "object",
|
|
71
|
-
required: [
|
|
72
|
-
"spec"
|
|
73
|
-
],
|
|
74
|
-
properties: {
|
|
75
|
-
apiVersion: {
|
|
76
|
-
"enum": [
|
|
77
|
-
"backstage.io/v1beta2"
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
kind: {
|
|
81
|
-
"enum": [
|
|
82
|
-
"Template"
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
spec: {
|
|
86
|
-
type: "object",
|
|
87
|
-
required: [
|
|
88
|
-
"type",
|
|
89
|
-
"steps"
|
|
90
|
-
],
|
|
91
|
-
properties: {
|
|
92
|
-
type: {
|
|
93
|
-
type: "string",
|
|
94
|
-
description: "The type of component created by the template. The software catalog accepts any type value, but an organization should take great care to establish a proper taxonomy for these. Tools including Backstage itself may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Backstage interface that is specific to just websites.",
|
|
95
|
-
examples: [
|
|
96
|
-
"service",
|
|
97
|
-
"website",
|
|
98
|
-
"library"
|
|
99
|
-
],
|
|
100
|
-
minLength: 1
|
|
101
|
-
},
|
|
102
|
-
parameters: {
|
|
103
|
-
oneOf: [
|
|
104
|
-
{
|
|
105
|
-
type: "object",
|
|
106
|
-
description: "The JSONSchema describing the inputs for the template."
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
type: "array",
|
|
110
|
-
description: "A list of separate forms to collect parameters.",
|
|
111
|
-
items: {
|
|
112
|
-
type: "object",
|
|
113
|
-
description: "The JSONSchema describing the inputs for the template."
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
},
|
|
118
|
-
steps: {
|
|
119
|
-
type: "array",
|
|
120
|
-
description: "A list of steps to execute.",
|
|
121
|
-
items: {
|
|
122
|
-
type: "object",
|
|
123
|
-
description: "A description of the step to execute.",
|
|
124
|
-
required: [
|
|
125
|
-
"action"
|
|
126
|
-
],
|
|
127
|
-
properties: {
|
|
128
|
-
id: {
|
|
129
|
-
type: "string",
|
|
130
|
-
description: "The ID of the step, which can be used to refer to its outputs."
|
|
131
|
-
},
|
|
132
|
-
name: {
|
|
133
|
-
type: "string",
|
|
134
|
-
description: "The name of the step, which will be displayed in the UI during the scaffolding process."
|
|
135
|
-
},
|
|
136
|
-
action: {
|
|
137
|
-
type: "string",
|
|
138
|
-
description: "The name of the action to execute."
|
|
139
|
-
},
|
|
140
|
-
input: {
|
|
141
|
-
type: "object",
|
|
142
|
-
description: "A templated object describing the inputs to the action."
|
|
143
|
-
},
|
|
144
|
-
"if": {
|
|
145
|
-
type: [
|
|
146
|
-
"string",
|
|
147
|
-
"boolean"
|
|
148
|
-
],
|
|
149
|
-
description: "A templated condition that skips the step when evaluated to false. If the condition is true or not defined, the step is executed. The condition is true, if the input is not `false`, `undefined`, `null`, `\"\"`, `0`, or `[]`."
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
output: {
|
|
155
|
-
type: "object",
|
|
156
|
-
description: "A templated object describing the outputs of the scaffolding task.",
|
|
157
|
-
properties: {
|
|
158
|
-
links: {
|
|
159
|
-
type: "array",
|
|
160
|
-
description: "A list of external hyperlinks, typically pointing to resources created or updated by the template",
|
|
161
|
-
items: {
|
|
162
|
-
type: "object",
|
|
163
|
-
required: [
|
|
164
|
-
],
|
|
165
|
-
properties: {
|
|
166
|
-
url: {
|
|
167
|
-
type: "string",
|
|
168
|
-
description: "A url in a standard uri format.",
|
|
169
|
-
examples: [
|
|
170
|
-
"https://github.com/my-org/my-new-repo"
|
|
171
|
-
],
|
|
172
|
-
minLength: 1
|
|
173
|
-
},
|
|
174
|
-
entityRef: {
|
|
175
|
-
type: "string",
|
|
176
|
-
description: "An entity reference to an entity in the catalog.",
|
|
177
|
-
examples: [
|
|
178
|
-
"Component:default/my-app"
|
|
179
|
-
],
|
|
180
|
-
minLength: 1
|
|
181
|
-
},
|
|
182
|
-
title: {
|
|
183
|
-
type: "string",
|
|
184
|
-
description: "A user friendly display name for the link.",
|
|
185
|
-
examples: [
|
|
186
|
-
"View new repo"
|
|
187
|
-
],
|
|
188
|
-
minLength: 1
|
|
189
|
-
},
|
|
190
|
-
icon: {
|
|
191
|
-
type: "string",
|
|
192
|
-
description: "A key representing a visual icon to be displayed in the UI.",
|
|
193
|
-
examples: [
|
|
194
|
-
"dashboard"
|
|
195
|
-
],
|
|
196
|
-
minLength: 1
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
additionalProperties: {
|
|
203
|
-
type: "string"
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
owner: {
|
|
207
|
-
type: "string",
|
|
208
|
-
description: "The user (or group) owner of the template",
|
|
209
|
-
minLength: 1
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
];
|
|
216
|
-
var schema$1 = {
|
|
217
|
-
$schema: $schema$1,
|
|
218
|
-
$id: $id$1,
|
|
219
|
-
description: description$1,
|
|
220
|
-
examples: examples$1,
|
|
221
|
-
allOf: allOf$1
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const validator$1 = entityKindSchemaValidator(schema$1);
|
|
225
|
-
const templateEntityV1beta2Validator = {
|
|
226
|
-
async check(data) {
|
|
227
|
-
return validator$1(data) === data;
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
3
|
var $schema = "http://json-schema.org/draft-07/schema";
|
|
232
4
|
var $id = "TemplateV1beta3";
|
|
233
5
|
var description = "A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.";
|
|
@@ -461,5 +233,5 @@ const templateEntityV1beta3Validator = {
|
|
|
461
233
|
}
|
|
462
234
|
};
|
|
463
235
|
|
|
464
|
-
export {
|
|
236
|
+
export { templateEntityV1beta3Validator };
|
|
465
237
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/TemplateEntityV1beta3.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n entityKindSchemaValidator,\n KindValidator,\n} from '@backstage/catalog-model';\nimport { JsonObject } from '@backstage/types';\nimport schema from './Template.v1beta3.schema.json';\n\n/**\n * Backstage catalog Template kind Entity. Templates are used by the Scaffolder\n * plugin to create new entities, such as Components.\n *\n * @public\n */\nexport interface TemplateEntityV1beta3 extends Entity {\n /**\n * The apiVersion string of the TaskSpec.\n */\n apiVersion: 'scaffolder.backstage.io/v1beta3';\n /**\n * The kind of the entity\n */\n kind: 'Template';\n /**\n * The specification of the Template Entity\n */\n spec: {\n /**\n * The type that the Template will create. For example service, website or library.\n */\n type: string;\n /**\n * This is a JSONSchema or an array of JSONSchema's which is used to render a form in the frontend\n * to collect user input and validate it against that schema. This can then be used in the `steps` part below to template\n * variables passed from the user into each action in the template.\n */\n parameters?: JsonObject | JsonObject[];\n /**\n * A list of steps to be executed in sequence which are defined by the template. These steps are a list of the underlying\n * javascript action and some optional input parameters that may or may not have been collected from the end user.\n */\n steps: Array<{\n id?: string;\n name?: string;\n action: string;\n input?: JsonObject;\n if?: string | boolean;\n }>;\n /**\n * The output is an object where template authors can pull out information from template actions and return them in a known standard way.\n */\n output?: { [name: string]: string };\n /**\n * The owner entityRef of the TemplateEntity\n */\n owner?: string;\n };\n}\n\nconst validator = entityKindSchemaValidator(schema);\n\n/**\n * Entity data validator for {@link TemplateEntityV1beta3}.\n *\n * @public\n */\nexport const templateEntityV1beta3Validator: KindValidator = {\n // TODO(freben): Emulate the old KindValidator until we fix that type\n async check(data: Entity) {\n return validator(data) === data;\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,MAAM,YAAY,yBAA0B,CAAA,MAAA,CAAA,CAAA;AAOrC,MAAM,8BAAgD,GAAA;AAAA,EAAA,MAErD,MAAM,IAAc,EAAA;AACxB,IAAA,OAAO,UAAU,IAAU,CAAA,KAAA,IAAA,CAAA;AAAA,GAAA;AAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-common",
|
|
3
3
|
"description": "Common functionalities for the scaffolder, to be shared between scaffolder and scaffolder-backend plugin",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"url": "https://github.com/backstage/backstage/issues"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@backstage/catalog-model": "^0.
|
|
43
|
-
"@backstage/types": "^0.
|
|
42
|
+
"@backstage/catalog-model": "^1.0.0",
|
|
43
|
+
"@backstage/types": "^1.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@backstage/cli": "^0.
|
|
46
|
+
"@backstage/cli": "^0.16.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e9496f746b31600dbfac7fa76987479e66426257",
|
|
49
49
|
"module": "dist/index.esm.js"
|
|
50
50
|
}
|