@backstage/plugin-scaffolder-node 0.1.6-next.0 → 0.1.6-next.1
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 +15 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +54 -0
- package/dist/index.beta.d.ts +54 -0
- package/dist/index.cjs.js +96 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +54 -0
- package/package.json +14 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-node
|
|
2
2
|
|
|
3
|
+
## 0.1.6-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 12a8c94eda8d: Add package repository and homepage metadata
|
|
8
|
+
- d3b31a791eb1: Deprecated `executeShellCommand`, `RunCommandOptions`, and `fetchContents` from `@backstage/plugin-scaffolder-backend`, since they are useful for Scaffolder modules (who should not be importing from the plugin package itself). You should now import these from `@backstage/plugin-scaffolder-backend-node` instead. `RunCommandOptions` was renamed in the Node package as `ExecuteShellCommandOptions`, for consistency.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/backend-common@0.19.2-next.1
|
|
11
|
+
- @backstage/backend-plugin-api@0.6.0-next.1
|
|
12
|
+
- @backstage/integration@1.5.1
|
|
13
|
+
- @backstage/catalog-model@1.4.1
|
|
14
|
+
- @backstage/errors@1.2.1
|
|
15
|
+
- @backstage/types@1.1.0
|
|
16
|
+
- @backstage/plugin-scaffolder-common@1.3.2
|
|
17
|
+
|
|
3
18
|
## 0.1.6-next.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
|
10
10
|
import { JsonObject } from '@backstage/types';
|
|
11
11
|
import { Logger } from 'winston';
|
|
12
12
|
import { Schema } from 'jsonschema';
|
|
13
|
+
import { ScmIntegrations } from '@backstage/integration';
|
|
14
|
+
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
13
15
|
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
16
|
+
import { UrlReader } from '@backstage/backend-common';
|
|
14
17
|
import { UserEntity } from '@backstage/catalog-model';
|
|
15
18
|
import { Writable } from 'stream';
|
|
16
19
|
import { z } from 'zod';
|
|
@@ -62,6 +65,57 @@ export declare type ActionContext<TActionInput extends JsonObject, TActionOutput
|
|
|
62
65
|
*/
|
|
63
66
|
export declare const createTemplateAction: <TInputParams extends JsonObject = JsonObject, TOutputParams extends JsonObject = JsonObject, TInputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TOutputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TActionInput extends JsonObject = TInputSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : TInputParams, TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<any, any, infer IReturn_1> ? IReturn_1 : TOutputParams>(action: TemplateActionOptions<TActionInput, TActionOutput, TInputSchema, TOutputSchema>) => TemplateAction<TActionInput, TActionOutput>;
|
|
64
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Run a command in a sub-process, normally a shell command.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare function executeShellCommand(options: ExecuteShellCommandOptions): Promise<void>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Options for {@link executeShellCommand}.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export declare type ExecuteShellCommandOptions = {
|
|
81
|
+
/** command to run */
|
|
82
|
+
command: string;
|
|
83
|
+
/** arguments to pass the command */
|
|
84
|
+
args: string[];
|
|
85
|
+
/** options to pass to spawn */
|
|
86
|
+
options?: SpawnOptionsWithoutStdio;
|
|
87
|
+
/** stream to capture stdout and stderr output */
|
|
88
|
+
logStream?: Writable;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A helper function that reads the contents of a directory from the given URL.
|
|
93
|
+
* Can be used in your own actions, and also used behind fetch:template and fetch:plain
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export declare function fetchContents(options: {
|
|
98
|
+
reader: UrlReader;
|
|
99
|
+
integrations: ScmIntegrations;
|
|
100
|
+
baseUrl?: string;
|
|
101
|
+
fetchUrl?: string;
|
|
102
|
+
outputPath: string;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A helper function that reads the content of a single file from the given URL.
|
|
107
|
+
* Can be used in your own actions, and also used behind `fetch:plain:file`
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export declare function fetchFile(options: {
|
|
112
|
+
reader: UrlReader;
|
|
113
|
+
integrations: ScmIntegrations;
|
|
114
|
+
baseUrl?: string;
|
|
115
|
+
fetchUrl?: string;
|
|
116
|
+
outputPath: string;
|
|
117
|
+
}): Promise<void>;
|
|
118
|
+
|
|
65
119
|
/**
|
|
66
120
|
* Extension point for managing scaffolder actions.
|
|
67
121
|
*
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
|
10
10
|
import { JsonObject } from '@backstage/types';
|
|
11
11
|
import { Logger } from 'winston';
|
|
12
12
|
import { Schema } from 'jsonschema';
|
|
13
|
+
import { ScmIntegrations } from '@backstage/integration';
|
|
14
|
+
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
13
15
|
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
16
|
+
import { UrlReader } from '@backstage/backend-common';
|
|
14
17
|
import { UserEntity } from '@backstage/catalog-model';
|
|
15
18
|
import { Writable } from 'stream';
|
|
16
19
|
import { z } from 'zod';
|
|
@@ -62,6 +65,57 @@ export declare type ActionContext<TActionInput extends JsonObject, TActionOutput
|
|
|
62
65
|
*/
|
|
63
66
|
export declare const createTemplateAction: <TInputParams extends JsonObject = JsonObject, TOutputParams extends JsonObject = JsonObject, TInputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TOutputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TActionInput extends JsonObject = TInputSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : TInputParams, TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<any, any, infer IReturn_1> ? IReturn_1 : TOutputParams>(action: TemplateActionOptions<TActionInput, TActionOutput, TInputSchema, TOutputSchema>) => TemplateAction<TActionInput, TActionOutput>;
|
|
64
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Run a command in a sub-process, normally a shell command.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare function executeShellCommand(options: ExecuteShellCommandOptions): Promise<void>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Options for {@link executeShellCommand}.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export declare type ExecuteShellCommandOptions = {
|
|
81
|
+
/** command to run */
|
|
82
|
+
command: string;
|
|
83
|
+
/** arguments to pass the command */
|
|
84
|
+
args: string[];
|
|
85
|
+
/** options to pass to spawn */
|
|
86
|
+
options?: SpawnOptionsWithoutStdio;
|
|
87
|
+
/** stream to capture stdout and stderr output */
|
|
88
|
+
logStream?: Writable;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A helper function that reads the contents of a directory from the given URL.
|
|
93
|
+
* Can be used in your own actions, and also used behind fetch:template and fetch:plain
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export declare function fetchContents(options: {
|
|
98
|
+
reader: UrlReader;
|
|
99
|
+
integrations: ScmIntegrations;
|
|
100
|
+
baseUrl?: string;
|
|
101
|
+
fetchUrl?: string;
|
|
102
|
+
outputPath: string;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A helper function that reads the content of a single file from the given URL.
|
|
107
|
+
* Can be used in your own actions, and also used behind `fetch:plain:file`
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export declare function fetchFile(options: {
|
|
112
|
+
reader: UrlReader;
|
|
113
|
+
integrations: ScmIntegrations;
|
|
114
|
+
baseUrl?: string;
|
|
115
|
+
fetchUrl?: string;
|
|
116
|
+
outputPath: string;
|
|
117
|
+
}): Promise<void>;
|
|
118
|
+
|
|
65
119
|
/* Excluded from this release type: ScaffolderActionsExtensionPoint */
|
|
66
120
|
|
|
67
121
|
/* Excluded from this release type: scaffolderActionsExtensionPoint */
|
package/dist/index.cjs.js
CHANGED
|
@@ -3,11 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var zodToJsonSchema = require('zod-to-json-schema');
|
|
6
|
+
var child_process = require('child_process');
|
|
7
|
+
var stream = require('stream');
|
|
8
|
+
var backendCommon = require('@backstage/backend-common');
|
|
9
|
+
var errors = require('@backstage/errors');
|
|
10
|
+
var fs = require('fs-extra');
|
|
11
|
+
var path = require('path');
|
|
6
12
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
7
13
|
|
|
8
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
15
|
|
|
10
16
|
var zodToJsonSchema__default = /*#__PURE__*/_interopDefaultLegacy(zodToJsonSchema);
|
|
17
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
18
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
11
19
|
|
|
12
20
|
const createTemplateAction = (action) => {
|
|
13
21
|
var _a, _b, _c, _d;
|
|
@@ -23,10 +31,98 @@ const createTemplateAction = (action) => {
|
|
|
23
31
|
};
|
|
24
32
|
};
|
|
25
33
|
|
|
34
|
+
async function executeShellCommand(options) {
|
|
35
|
+
const {
|
|
36
|
+
command,
|
|
37
|
+
args,
|
|
38
|
+
options: spawnOptions,
|
|
39
|
+
logStream = new stream.PassThrough()
|
|
40
|
+
} = options;
|
|
41
|
+
await new Promise((resolve, reject) => {
|
|
42
|
+
const process = child_process.spawn(command, args, spawnOptions);
|
|
43
|
+
process.stdout.on("data", (stream) => {
|
|
44
|
+
logStream.write(stream);
|
|
45
|
+
});
|
|
46
|
+
process.stderr.on("data", (stream) => {
|
|
47
|
+
logStream.write(stream);
|
|
48
|
+
});
|
|
49
|
+
process.on("error", (error) => {
|
|
50
|
+
return reject(error);
|
|
51
|
+
});
|
|
52
|
+
process.on("close", (code) => {
|
|
53
|
+
if (code !== 0) {
|
|
54
|
+
return reject(
|
|
55
|
+
new Error(`Command ${command} failed, exit code: ${code}`)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return resolve();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function fetchContents(options) {
|
|
64
|
+
const { reader, integrations, baseUrl, fetchUrl = ".", outputPath } = options;
|
|
65
|
+
const fetchUrlIsAbsolute = isFetchUrlAbsolute(fetchUrl);
|
|
66
|
+
if (!fetchUrlIsAbsolute && (baseUrl == null ? void 0 : baseUrl.startsWith("file://"))) {
|
|
67
|
+
const basePath = baseUrl.slice("file://".length);
|
|
68
|
+
const srcDir = backendCommon.resolveSafeChildPath(path__default["default"].dirname(basePath), fetchUrl);
|
|
69
|
+
await fs__default["default"].copy(srcDir, outputPath);
|
|
70
|
+
} else {
|
|
71
|
+
const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);
|
|
72
|
+
const res = await reader.readTree(readUrl);
|
|
73
|
+
await fs__default["default"].ensureDir(outputPath);
|
|
74
|
+
await res.dir({ targetDir: outputPath });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function fetchFile(options) {
|
|
78
|
+
const { reader, integrations, baseUrl, fetchUrl = ".", outputPath } = options;
|
|
79
|
+
const fetchUrlIsAbsolute = isFetchUrlAbsolute(fetchUrl);
|
|
80
|
+
if (!fetchUrlIsAbsolute && (baseUrl == null ? void 0 : baseUrl.startsWith("file://"))) {
|
|
81
|
+
const basePath = baseUrl.slice("file://".length);
|
|
82
|
+
const src = backendCommon.resolveSafeChildPath(path__default["default"].dirname(basePath), fetchUrl);
|
|
83
|
+
await fs__default["default"].copyFile(src, outputPath);
|
|
84
|
+
} else {
|
|
85
|
+
const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);
|
|
86
|
+
const res = await reader.readUrl(readUrl);
|
|
87
|
+
await fs__default["default"].ensureDir(path__default["default"].dirname(outputPath));
|
|
88
|
+
const buffer = await res.buffer();
|
|
89
|
+
await fs__default["default"].outputFile(outputPath, buffer.toString());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function isFetchUrlAbsolute(fetchUrl) {
|
|
93
|
+
let fetchUrlIsAbsolute = false;
|
|
94
|
+
try {
|
|
95
|
+
new URL(fetchUrl);
|
|
96
|
+
fetchUrlIsAbsolute = true;
|
|
97
|
+
} catch {
|
|
98
|
+
}
|
|
99
|
+
return fetchUrlIsAbsolute;
|
|
100
|
+
}
|
|
101
|
+
function getReadUrl(fetchUrl, baseUrl, integrations) {
|
|
102
|
+
if (isFetchUrlAbsolute(fetchUrl)) {
|
|
103
|
+
return fetchUrl;
|
|
104
|
+
} else if (baseUrl) {
|
|
105
|
+
const integration = integrations.byUrl(baseUrl);
|
|
106
|
+
if (!integration) {
|
|
107
|
+
throw new errors.InputError(`No integration found for location ${baseUrl}`);
|
|
108
|
+
}
|
|
109
|
+
return integration.resolveUrl({
|
|
110
|
+
url: fetchUrl,
|
|
111
|
+
base: baseUrl
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
throw new errors.InputError(
|
|
115
|
+
`Failed to fetch, template location could not be determined and the fetch URL is relative, ${fetchUrl}`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
26
119
|
const scaffolderActionsExtensionPoint = backendPluginApi.createExtensionPoint({
|
|
27
120
|
id: "scaffolder.actions"
|
|
28
121
|
});
|
|
29
122
|
|
|
30
123
|
exports.createTemplateAction = createTemplateAction;
|
|
124
|
+
exports.executeShellCommand = executeShellCommand;
|
|
125
|
+
exports.fetchContents = fetchContents;
|
|
126
|
+
exports.fetchFile = fetchFile;
|
|
31
127
|
exports.scaffolderActionsExtensionPoint = scaffolderActionsExtensionPoint;
|
|
32
128
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/actions/createTemplateAction.ts","../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { ActionContext, TemplateAction } from './types';\nimport { z } from 'zod';\nimport { Schema } from 'jsonschema';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { JsonObject } from '@backstage/types';\n\n/** @public */\nexport type TemplateActionOptions<\n TActionInput extends JsonObject = {},\n TActionOutput extends JsonObject = {},\n TInputSchema extends Schema | z.ZodType = {},\n TOutputSchema extends Schema | z.ZodType = {},\n> = {\n id: string;\n description?: string;\n examples?: { description: string; example: string }[];\n supportsDryRun?: boolean;\n schema?: {\n input?: TInputSchema;\n output?: TOutputSchema;\n };\n handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;\n};\n\n/**\n * This function is used to create new template actions to get type safety.\n * Will convert zod schemas to json schemas for use throughout the system.\n * @public\n */\nexport const createTemplateAction = <\n TInputParams extends JsonObject = JsonObject,\n TOutputParams extends JsonObject = JsonObject,\n TInputSchema extends Schema | z.ZodType = {},\n TOutputSchema extends Schema | z.ZodType = {},\n TActionInput extends JsonObject = TInputSchema extends z.ZodType<\n any,\n any,\n infer IReturn\n >\n ? IReturn\n : TInputParams,\n TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<\n any,\n any,\n infer IReturn\n >\n ? IReturn\n : TOutputParams,\n>(\n action: TemplateActionOptions<\n TActionInput,\n TActionOutput,\n TInputSchema,\n TOutputSchema\n >,\n): TemplateAction<TActionInput, TActionOutput> => {\n const inputSchema =\n action.schema?.input && 'safeParseAsync' in action.schema.input\n ? zodToJsonSchema(action.schema.input)\n : action.schema?.input;\n\n const outputSchema =\n action.schema?.output && 'safeParseAsync' in action.schema.output\n ? zodToJsonSchema(action.schema.output)\n : action.schema?.output;\n\n return {\n ...action,\n schema: {\n ...action.schema,\n input: inputSchema,\n output: outputSchema,\n },\n };\n};\n","/*\n * Copyright 2022 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 { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { TemplateAction } from './actions';\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport interface ScaffolderActionsExtensionPoint {\n addActions(...actions: TemplateAction<any, any>[]): void;\n}\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport const scaffolderActionsExtensionPoint =\n createExtensionPoint<ScaffolderActionsExtensionPoint>({\n id: 'scaffolder.actions',\n });\n"],"names":["zodToJsonSchema","createExtensionPoint"],"mappings":";;;;;;;;;;;AA6Ca,MAAA,oBAAA,GAAuB,CAoBlC,MAMgD,KAAA;AAvElD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwEE,EAAA,MAAM,gBACJ,EAAO,GAAA,MAAA,CAAA,MAAA,KAAP,IAAe,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAS,oBAAoB,MAAO,CAAA,MAAA,CAAO,KACtD,GAAAA,mCAAA,CAAgB,OAAO,MAAO,CAAA,KAAK,CACnC,GAAA,CAAA,EAAA,GAAA,MAAA,CAAO,WAAP,IAAe,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,CAAA;AAErB,EAAA,MAAM,iBACJ,EAAO,GAAA,MAAA,CAAA,MAAA,KAAP,IAAe,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,KAAU,oBAAoB,MAAO,CAAA,MAAA,CAAO,MACvD,GAAAA,mCAAA,CAAgB,OAAO,MAAO,CAAA,MAAM,CACpC,GAAA,CAAA,EAAA,GAAA,MAAA,CAAO,WAAP,IAAe,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,CAAA;AAErB,EAAO,OAAA;AAAA,IACL,GAAG,MAAA;AAAA,IACH,MAAQ,EAAA;AAAA,MACN,GAAG,MAAO,CAAA,MAAA;AAAA,MACV,KAAO,EAAA,WAAA;AAAA,MACP,MAAQ,EAAA,YAAA;AAAA,KACV;AAAA,GACF,CAAA;AACF;;ACzDO,MAAM,kCACXC,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/actions/createTemplateAction.ts","../src/actions/executeShellCommand.ts","../src/actions/fetch.ts","../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { ActionContext, TemplateAction } from './types';\nimport { z } from 'zod';\nimport { Schema } from 'jsonschema';\nimport zodToJsonSchema from 'zod-to-json-schema';\nimport { JsonObject } from '@backstage/types';\n\n/** @public */\nexport type TemplateActionOptions<\n TActionInput extends JsonObject = {},\n TActionOutput extends JsonObject = {},\n TInputSchema extends Schema | z.ZodType = {},\n TOutputSchema extends Schema | z.ZodType = {},\n> = {\n id: string;\n description?: string;\n examples?: { description: string; example: string }[];\n supportsDryRun?: boolean;\n schema?: {\n input?: TInputSchema;\n output?: TOutputSchema;\n };\n handler: (ctx: ActionContext<TActionInput, TActionOutput>) => Promise<void>;\n};\n\n/**\n * This function is used to create new template actions to get type safety.\n * Will convert zod schemas to json schemas for use throughout the system.\n * @public\n */\nexport const createTemplateAction = <\n TInputParams extends JsonObject = JsonObject,\n TOutputParams extends JsonObject = JsonObject,\n TInputSchema extends Schema | z.ZodType = {},\n TOutputSchema extends Schema | z.ZodType = {},\n TActionInput extends JsonObject = TInputSchema extends z.ZodType<\n any,\n any,\n infer IReturn\n >\n ? IReturn\n : TInputParams,\n TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<\n any,\n any,\n infer IReturn\n >\n ? IReturn\n : TOutputParams,\n>(\n action: TemplateActionOptions<\n TActionInput,\n TActionOutput,\n TInputSchema,\n TOutputSchema\n >,\n): TemplateAction<TActionInput, TActionOutput> => {\n const inputSchema =\n action.schema?.input && 'safeParseAsync' in action.schema.input\n ? zodToJsonSchema(action.schema.input)\n : action.schema?.input;\n\n const outputSchema =\n action.schema?.output && 'safeParseAsync' in action.schema.output\n ? zodToJsonSchema(action.schema.output)\n : action.schema?.output;\n\n return {\n ...action,\n schema: {\n ...action.schema,\n input: inputSchema,\n output: outputSchema,\n },\n };\n};\n","/*\n * Copyright 2021 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 { spawn, SpawnOptionsWithoutStdio } from 'child_process';\nimport { PassThrough, Writable } from 'stream';\n\n/**\n * Options for {@link executeShellCommand}.\n *\n * @public\n */\nexport type ExecuteShellCommandOptions = {\n /** command to run */\n command: string;\n /** arguments to pass the command */\n args: string[];\n /** options to pass to spawn */\n options?: SpawnOptionsWithoutStdio;\n /** stream to capture stdout and stderr output */\n logStream?: Writable;\n};\n\n/**\n * Run a command in a sub-process, normally a shell command.\n *\n * @public\n */\nexport async function executeShellCommand(\n options: ExecuteShellCommandOptions,\n): Promise<void> {\n const {\n command,\n args,\n options: spawnOptions,\n logStream = new PassThrough(),\n } = options;\n\n await new Promise<void>((resolve, reject) => {\n const process = spawn(command, args, spawnOptions);\n\n process.stdout.on('data', stream => {\n logStream.write(stream);\n });\n\n process.stderr.on('data', stream => {\n logStream.write(stream);\n });\n\n process.on('error', error => {\n return reject(error);\n });\n\n process.on('close', code => {\n if (code !== 0) {\n return reject(\n new Error(`Command ${command} failed, exit code: ${code}`),\n );\n }\n return resolve();\n });\n });\n}\n","/*\n * Copyright 2021 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 { resolveSafeChildPath, UrlReader } from '@backstage/backend-common';\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrations } from '@backstage/integration';\nimport fs from 'fs-extra';\nimport path from 'path';\n\n/**\n * A helper function that reads the contents of a directory from the given URL.\n * Can be used in your own actions, and also used behind fetch:template and fetch:plain\n *\n * @public\n */\nexport async function fetchContents(options: {\n reader: UrlReader;\n integrations: ScmIntegrations;\n baseUrl?: string;\n fetchUrl?: string;\n outputPath: string;\n}) {\n const { reader, integrations, baseUrl, fetchUrl = '.', outputPath } = options;\n\n const fetchUrlIsAbsolute = isFetchUrlAbsolute(fetchUrl);\n\n // We handle both file locations and url ones\n if (!fetchUrlIsAbsolute && baseUrl?.startsWith('file://')) {\n const basePath = baseUrl.slice('file://'.length);\n const srcDir = resolveSafeChildPath(path.dirname(basePath), fetchUrl);\n await fs.copy(srcDir, outputPath);\n } else {\n const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);\n\n const res = await reader.readTree(readUrl);\n await fs.ensureDir(outputPath);\n await res.dir({ targetDir: outputPath });\n }\n}\n\n/**\n * A helper function that reads the content of a single file from the given URL.\n * Can be used in your own actions, and also used behind `fetch:plain:file`\n *\n * @public\n */\nexport async function fetchFile(options: {\n reader: UrlReader;\n integrations: ScmIntegrations;\n baseUrl?: string;\n fetchUrl?: string;\n outputPath: string;\n}) {\n const { reader, integrations, baseUrl, fetchUrl = '.', outputPath } = options;\n\n const fetchUrlIsAbsolute = isFetchUrlAbsolute(fetchUrl);\n\n // We handle both file locations and url ones\n if (!fetchUrlIsAbsolute && baseUrl?.startsWith('file://')) {\n const basePath = baseUrl.slice('file://'.length);\n const src = resolveSafeChildPath(path.dirname(basePath), fetchUrl);\n await fs.copyFile(src, outputPath);\n } else {\n const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);\n\n const res = await reader.readUrl(readUrl);\n await fs.ensureDir(path.dirname(outputPath));\n const buffer = await res.buffer();\n await fs.outputFile(outputPath, buffer.toString());\n }\n}\n\nfunction isFetchUrlAbsolute(fetchUrl: string) {\n let fetchUrlIsAbsolute = false;\n try {\n // eslint-disable-next-line no-new\n new URL(fetchUrl);\n fetchUrlIsAbsolute = true;\n } catch {\n /* ignored */\n }\n return fetchUrlIsAbsolute;\n}\n\nfunction getReadUrl(\n fetchUrl: string,\n baseUrl: string | undefined,\n integrations: ScmIntegrations,\n) {\n if (isFetchUrlAbsolute(fetchUrl)) {\n return fetchUrl;\n } else if (baseUrl) {\n const integration = integrations.byUrl(baseUrl);\n if (!integration) {\n throw new InputError(`No integration found for location ${baseUrl}`);\n }\n\n return integration.resolveUrl({\n url: fetchUrl,\n base: baseUrl,\n });\n }\n throw new InputError(\n `Failed to fetch, template location could not be determined and the fetch URL is relative, ${fetchUrl}`,\n );\n}\n","/*\n * Copyright 2022 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 { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { TemplateAction } from './actions';\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport interface ScaffolderActionsExtensionPoint {\n addActions(...actions: TemplateAction<any, any>[]): void;\n}\n\n/**\n * Extension point for managing scaffolder actions.\n *\n * @alpha\n */\nexport const scaffolderActionsExtensionPoint =\n createExtensionPoint<ScaffolderActionsExtensionPoint>({\n id: 'scaffolder.actions',\n });\n"],"names":["zodToJsonSchema","PassThrough","spawn","resolveSafeChildPath","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CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
|
10
10
|
import { JsonObject } from '@backstage/types';
|
|
11
11
|
import { Logger } from 'winston';
|
|
12
12
|
import { Schema } from 'jsonschema';
|
|
13
|
+
import { ScmIntegrations } from '@backstage/integration';
|
|
14
|
+
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
13
15
|
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
16
|
+
import { UrlReader } from '@backstage/backend-common';
|
|
14
17
|
import { UserEntity } from '@backstage/catalog-model';
|
|
15
18
|
import { Writable } from 'stream';
|
|
16
19
|
import { z } from 'zod';
|
|
@@ -62,6 +65,57 @@ export declare type ActionContext<TActionInput extends JsonObject, TActionOutput
|
|
|
62
65
|
*/
|
|
63
66
|
export declare const createTemplateAction: <TInputParams extends JsonObject = JsonObject, TOutputParams extends JsonObject = JsonObject, TInputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TOutputSchema extends z.ZodType<any, z.ZodTypeDef, any> | Schema = {}, TActionInput extends JsonObject = TInputSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : TInputParams, TActionOutput extends JsonObject = TOutputSchema extends z.ZodType<any, any, infer IReturn_1> ? IReturn_1 : TOutputParams>(action: TemplateActionOptions<TActionInput, TActionOutput, TInputSchema, TOutputSchema>) => TemplateAction<TActionInput, TActionOutput>;
|
|
64
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Run a command in a sub-process, normally a shell command.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare function executeShellCommand(options: ExecuteShellCommandOptions): Promise<void>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Options for {@link executeShellCommand}.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export declare type ExecuteShellCommandOptions = {
|
|
81
|
+
/** command to run */
|
|
82
|
+
command: string;
|
|
83
|
+
/** arguments to pass the command */
|
|
84
|
+
args: string[];
|
|
85
|
+
/** options to pass to spawn */
|
|
86
|
+
options?: SpawnOptionsWithoutStdio;
|
|
87
|
+
/** stream to capture stdout and stderr output */
|
|
88
|
+
logStream?: Writable;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A helper function that reads the contents of a directory from the given URL.
|
|
93
|
+
* Can be used in your own actions, and also used behind fetch:template and fetch:plain
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export declare function fetchContents(options: {
|
|
98
|
+
reader: UrlReader;
|
|
99
|
+
integrations: ScmIntegrations;
|
|
100
|
+
baseUrl?: string;
|
|
101
|
+
fetchUrl?: string;
|
|
102
|
+
outputPath: string;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A helper function that reads the content of a single file from the given URL.
|
|
107
|
+
* Can be used in your own actions, and also used behind `fetch:plain:file`
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
export declare function fetchFile(options: {
|
|
112
|
+
reader: UrlReader;
|
|
113
|
+
integrations: ScmIntegrations;
|
|
114
|
+
baseUrl?: string;
|
|
115
|
+
fetchUrl?: string;
|
|
116
|
+
outputPath: string;
|
|
117
|
+
}): Promise<void>;
|
|
118
|
+
|
|
65
119
|
/* Excluded from this release type: ScaffolderActionsExtensionPoint */
|
|
66
120
|
|
|
67
121
|
/* Excluded from this release type: scaffolderActionsExtensionPoint */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-node",
|
|
3
3
|
"description": "The plugin-scaffolder-node module for @backstage/plugin-scaffolder-backend",
|
|
4
|
-
"version": "0.1.6-next.
|
|
4
|
+
"version": "0.1.6-next.1",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
"backstage": {
|
|
15
15
|
"role": "node-library"
|
|
16
16
|
},
|
|
17
|
+
"homepage": "https://backstage.io",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/backstage/backstage",
|
|
21
|
+
"directory": "plugins/scaffolder-node"
|
|
22
|
+
},
|
|
17
23
|
"scripts": {
|
|
18
24
|
"start": "backstage-cli package start",
|
|
19
25
|
"build": "backstage-cli package build --experimental-type-build",
|
|
@@ -24,17 +30,22 @@
|
|
|
24
30
|
"postpack": "backstage-cli package postpack"
|
|
25
31
|
},
|
|
26
32
|
"dependencies": {
|
|
27
|
-
"@backstage/backend-
|
|
33
|
+
"@backstage/backend-common": "^0.19.2-next.1",
|
|
34
|
+
"@backstage/backend-plugin-api": "^0.6.0-next.1",
|
|
28
35
|
"@backstage/catalog-model": "^1.4.1",
|
|
36
|
+
"@backstage/errors": "^1.2.1",
|
|
37
|
+
"@backstage/integration": "^1.5.1",
|
|
29
38
|
"@backstage/plugin-scaffolder-common": "^1.3.2",
|
|
30
39
|
"@backstage/types": "^1.1.0",
|
|
40
|
+
"fs-extra": "10.1.0",
|
|
31
41
|
"jsonschema": "^1.2.6",
|
|
32
42
|
"winston": "^3.2.1",
|
|
33
43
|
"zod": "^3.21.4",
|
|
34
44
|
"zod-to-json-schema": "^3.20.4"
|
|
35
45
|
},
|
|
36
46
|
"devDependencies": {
|
|
37
|
-
"@backstage/cli": "^0.22.10-next.
|
|
47
|
+
"@backstage/cli": "^0.22.10-next.1",
|
|
48
|
+
"@backstage/config": "^1.0.8"
|
|
38
49
|
},
|
|
39
50
|
"files": [
|
|
40
51
|
"alpha",
|