@backstage/plugin-scaffolder-node 0.4.0 → 0.4.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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # @backstage/plugin-scaffolder-node
2
2
 
3
+ ## 0.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-common@0.21.6
9
+ - @backstage/backend-plugin-api@0.6.16
10
+ - @backstage/catalog-model@1.4.5
11
+ - @backstage/errors@1.2.4
12
+ - @backstage/integration@1.9.1
13
+ - @backstage/types@1.1.1
14
+ - @backstage/plugin-scaffolder-common@1.5.1
15
+
16
+ ## 0.4.1
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+ - @backstage/backend-common@0.21.5
22
+ - @backstage/backend-plugin-api@0.6.15
23
+ - @backstage/catalog-model@1.4.5
24
+ - @backstage/errors@1.2.4
25
+ - @backstage/integration@1.9.1
26
+ - @backstage/types@1.1.1
27
+ - @backstage/plugin-scaffolder-common@1.5.1
28
+
3
29
  ## 0.4.0
4
30
 
5
31
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-node",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var backendPluginApi = require('@backstage/backend-plugin-api');
6
4
 
7
5
  const scaffolderActionsExtensionPoint = backendPluginApi.createExtensionPoint({
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\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 {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n TaskBroker,\n} from '@backstage/plugin-scaffolder-node';\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\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport interface ScaffolderTaskBrokerExtensionPoint {\n setTaskBroker(taskBroker: TaskBroker): void;\n}\n\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport const scaffolderTaskBrokerExtensionPoint =\n createExtensionPoint<ScaffolderTaskBrokerExtensionPoint>({\n id: 'scaffolder.taskBroker',\n });\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport interface ScaffolderTemplatingExtensionPoint {\n addTemplateFilters(filters: Record<string, TemplateFilter>): void;\n addTemplateGlobals(filters: Record<string, TemplateGlobal>): void;\n}\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport const scaffolderTemplatingExtensionPoint =\n createExtensionPoint<ScaffolderTemplatingExtensionPoint>({\n id: 'scaffolder.templating',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;;;AAsCO,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC,EAAA;AAgBI,MAAM,qCACXA,qCAAyD,CAAA;AAAA,EACvD,EAAI,EAAA,uBAAA;AACN,CAAC,EAAA;AAiBI,MAAM,qCACXA,qCAAyD,CAAA;AAAA,EACvD,EAAI,EAAA,uBAAA;AACN,CAAC;;;;;;"}
1
+ {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\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 {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n TaskBroker,\n} from '@backstage/plugin-scaffolder-node';\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\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport interface ScaffolderTaskBrokerExtensionPoint {\n setTaskBroker(taskBroker: TaskBroker): void;\n}\n\n/**\n * Extension point for replacing the scaffolder task broker.\n *\n * @alpha\n */\nexport const scaffolderTaskBrokerExtensionPoint =\n createExtensionPoint<ScaffolderTaskBrokerExtensionPoint>({\n id: 'scaffolder.taskBroker',\n });\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport interface ScaffolderTemplatingExtensionPoint {\n addTemplateFilters(filters: Record<string, TemplateFilter>): void;\n addTemplateGlobals(filters: Record<string, TemplateGlobal>): void;\n}\n\n/**\n * Extension point for adding template filters and globals.\n *\n * @alpha\n */\nexport const scaffolderTemplatingExtensionPoint =\n createExtensionPoint<ScaffolderTemplatingExtensionPoint>({\n id: 'scaffolder.templating',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AAsCO,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC,EAAA;AAgBI,MAAM,qCACXA,qCAAyD,CAAA;AAAA,EACvD,EAAI,EAAA,uBAAA;AACN,CAAC,EAAA;AAiBI,MAAM,qCACXA,qCAAyD,CAAA;AAAA,EACvD,EAAI,EAAA,uBAAA;AACN,CAAC;;;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -45,4 +45,4 @@ interface ScaffolderTemplatingExtensionPoint {
45
45
  */
46
46
  declare const scaffolderTemplatingExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<ScaffolderTemplatingExtensionPoint>;
47
47
 
48
- export { ScaffolderActionsExtensionPoint, ScaffolderTaskBrokerExtensionPoint, ScaffolderTemplatingExtensionPoint, scaffolderActionsExtensionPoint, scaffolderTaskBrokerExtensionPoint, scaffolderTemplatingExtensionPoint };
48
+ export { type ScaffolderActionsExtensionPoint, type ScaffolderTaskBrokerExtensionPoint, type ScaffolderTemplatingExtensionPoint, scaffolderActionsExtensionPoint, scaffolderTaskBrokerExtensionPoint, scaffolderTemplatingExtensionPoint };
package/dist/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var zodToJsonSchema = require('zod-to-json-schema');
6
4
  var child_process = require('child_process');
7
5
  var stream = require('stream');
@@ -13,18 +11,18 @@ var fs$1 = require('fs');
13
11
  var globby = require('globby');
14
12
  var limiterFactory = require('p-limit');
15
13
 
16
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
17
15
 
18
- var zodToJsonSchema__default = /*#__PURE__*/_interopDefaultLegacy(zodToJsonSchema);
19
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
20
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
21
- var globby__default = /*#__PURE__*/_interopDefaultLegacy(globby);
22
- var limiterFactory__default = /*#__PURE__*/_interopDefaultLegacy(limiterFactory);
16
+ var zodToJsonSchema__default = /*#__PURE__*/_interopDefaultCompat(zodToJsonSchema);
17
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
18
+ var path__default = /*#__PURE__*/_interopDefaultCompat(path);
19
+ var globby__default = /*#__PURE__*/_interopDefaultCompat(globby);
20
+ var limiterFactory__default = /*#__PURE__*/_interopDefaultCompat(limiterFactory);
23
21
 
24
22
  const createTemplateAction = (action) => {
25
23
  var _a, _b, _c, _d;
26
- const inputSchema = ((_a = action.schema) == null ? void 0 : _a.input) && "safeParseAsync" in action.schema.input ? zodToJsonSchema__default["default"](action.schema.input) : (_b = action.schema) == null ? void 0 : _b.input;
27
- const outputSchema = ((_c = action.schema) == null ? void 0 : _c.output) && "safeParseAsync" in action.schema.output ? zodToJsonSchema__default["default"](action.schema.output) : (_d = action.schema) == null ? void 0 : _d.output;
24
+ const inputSchema = ((_a = action.schema) == null ? void 0 : _a.input) && "safeParseAsync" in action.schema.input ? zodToJsonSchema__default.default(action.schema.input) : (_b = action.schema) == null ? void 0 : _b.input;
25
+ const outputSchema = ((_c = action.schema) == null ? void 0 : _c.output) && "safeParseAsync" in action.schema.output ? zodToJsonSchema__default.default(action.schema.output) : (_d = action.schema) == null ? void 0 : _d.output;
28
26
  return {
29
27
  ...action,
30
28
  schema: {
@@ -76,12 +74,12 @@ async function fetchContents(options) {
76
74
  const fetchUrlIsAbsolute = isFetchUrlAbsolute(fetchUrl);
77
75
  if (!fetchUrlIsAbsolute && (baseUrl == null ? void 0 : baseUrl.startsWith("file://"))) {
78
76
  const basePath = baseUrl.slice("file://".length);
79
- const srcDir = backendCommon.resolveSafeChildPath(path__default["default"].dirname(basePath), fetchUrl);
80
- await fs__default["default"].copy(srcDir, outputPath);
77
+ const srcDir = backendCommon.resolveSafeChildPath(path__default.default.dirname(basePath), fetchUrl);
78
+ await fs__default.default.copy(srcDir, outputPath);
81
79
  } else {
82
80
  const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);
83
81
  const res = await reader.readTree(readUrl, { token });
84
- await fs__default["default"].ensureDir(outputPath);
82
+ await fs__default.default.ensureDir(outputPath);
85
83
  await res.dir({ targetDir: outputPath });
86
84
  }
87
85
  }
@@ -97,14 +95,14 @@ async function fetchFile(options) {
97
95
  const fetchUrlIsAbsolute = isFetchUrlAbsolute(fetchUrl);
98
96
  if (!fetchUrlIsAbsolute && (baseUrl == null ? void 0 : baseUrl.startsWith("file://"))) {
99
97
  const basePath = baseUrl.slice("file://".length);
100
- const src = backendCommon.resolveSafeChildPath(path__default["default"].dirname(basePath), fetchUrl);
101
- await fs__default["default"].copyFile(src, outputPath);
98
+ const src = backendCommon.resolveSafeChildPath(path__default.default.dirname(basePath), fetchUrl);
99
+ await fs__default.default.copyFile(src, outputPath);
102
100
  } else {
103
101
  const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);
104
102
  const res = await reader.readUrl(readUrl, { token });
105
- await fs__default["default"].ensureDir(path__default["default"].dirname(outputPath));
103
+ await fs__default.default.ensureDir(path__default.default.dirname(outputPath));
106
104
  const buffer = await res.buffer();
107
- await fs__default["default"].outputFile(outputPath, buffer);
105
+ await fs__default.default.outputFile(outputPath, buffer);
108
106
  }
109
107
  }
110
108
  function isFetchUrlAbsolute(fetchUrl) {
@@ -358,7 +356,7 @@ async function asyncFilter(array, callback) {
358
356
  }
359
357
  async function serializeDirectoryContents(sourcePath, options) {
360
358
  var _a;
361
- const paths = await globby__default["default"]((_a = options == null ? void 0 : options.globPatterns) != null ? _a : DEFAULT_GLOB_PATTERNS, {
359
+ const paths = await globby__default.default((_a = options == null ? void 0 : options.globPatterns) != null ? _a : DEFAULT_GLOB_PATTERNS, {
362
360
  cwd: sourcePath,
363
361
  dot: true,
364
362
  gitignore: options == null ? void 0 : options.gitignore,
@@ -369,7 +367,7 @@ async function serializeDirectoryContents(sourcePath, options) {
369
367
  objectMode: true,
370
368
  stats: true
371
369
  });
372
- const limiter = limiterFactory__default["default"](10);
370
+ const limiter = limiterFactory__default.default(10);
373
371
  const valid = await asyncFilter(paths, async ({ dirent, path }) => {
374
372
  if (dirent.isDirectory())
375
373
  return false;
@@ -402,8 +400,8 @@ async function serializeDirectoryContents(sourcePath, options) {
402
400
  async function deserializeDirectoryContents(targetPath, files) {
403
401
  for (const file of files) {
404
402
  const filePath = backendCommon.resolveSafeChildPath(targetPath, file.path);
405
- await fs__default["default"].ensureDir(path.dirname(filePath));
406
- await fs__default["default"].writeFile(filePath, file.content);
403
+ await fs__default.default.ensureDir(path.dirname(filePath));
404
+ await fs__default.default.writeFile(filePath, file.content);
407
405
  }
408
406
  }
409
407
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/actions/createTemplateAction.ts","../src/actions/executeShellCommand.ts","../src/actions/fetch.ts","../src/actions/gitHelpers.ts","../src/actions/util.ts","../src/files/serializeDirectoryContents.ts","../src/files/deserializeDirectoryContents.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 TemplateExample = {\n description: string;\n example: string;\n};\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?: TemplateExample[];\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 as TInputSchema,\n output: outputSchema as TOutputSchema,\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 token?: string;\n}) {\n const {\n reader,\n integrations,\n baseUrl,\n fetchUrl = '.',\n outputPath,\n token,\n } = 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, { token });\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 token?: string;\n}) {\n const {\n reader,\n integrations,\n baseUrl,\n fetchUrl = '.',\n outputPath,\n token,\n } = 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, { token });\n await fs.ensureDir(path.dirname(outputPath));\n const buffer = await res.buffer();\n await fs.outputFile(outputPath, buffer);\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 2023 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 { Git } from '@backstage/backend-common';\nimport { Logger } from 'winston';\n\n/**\n * @public\n */\nexport async function initRepoAndPush(input: {\n dir: string;\n remoteUrl: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger: Logger;\n defaultBranch?: string;\n commitMessage?: string;\n gitAuthorInfo?: { name?: string; email?: string };\n}): Promise<{ commitHash: string }> {\n const {\n dir,\n remoteUrl,\n auth,\n logger,\n defaultBranch = 'master',\n commitMessage = 'Initial commit',\n gitAuthorInfo,\n } = input;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.init({\n dir,\n defaultBranch,\n });\n\n await git.add({ dir, filepath: '.' });\n\n // use provided info if possible, otherwise use fallbacks\n const authorInfo = {\n name: gitAuthorInfo?.name ?? 'Scaffolder',\n email: gitAuthorInfo?.email ?? 'scaffolder@backstage.io',\n };\n\n const commitHash = await git.commit({\n dir,\n message: commitMessage,\n author: authorInfo,\n committer: authorInfo,\n });\n await git.addRemote({\n dir,\n url: remoteUrl,\n remote: 'origin',\n });\n\n await git.push({\n dir,\n remote: 'origin',\n });\n\n return { commitHash };\n}\n\n/**\n * @public\n */\nexport async function commitAndPushRepo(input: {\n dir: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger: Logger;\n commitMessage: string;\n gitAuthorInfo?: { name?: string; email?: string };\n branch?: string;\n remoteRef?: string;\n}): Promise<{ commitHash: string }> {\n const {\n dir,\n auth,\n logger,\n commitMessage,\n gitAuthorInfo,\n branch = 'master',\n remoteRef,\n } = input;\n\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.fetch({ dir });\n await git.checkout({ dir, ref: branch });\n await git.add({ dir, filepath: '.' });\n\n // use provided info if possible, otherwise use fallbacks\n const authorInfo = {\n name: gitAuthorInfo?.name ?? 'Scaffolder',\n email: gitAuthorInfo?.email ?? 'scaffolder@backstage.io',\n };\n\n const commitHash = await git.commit({\n dir,\n message: commitMessage,\n author: authorInfo,\n committer: authorInfo,\n });\n\n await git.push({\n dir,\n remote: 'origin',\n remoteRef: remoteRef ?? `refs/heads/${branch}`,\n });\n\n return { commitHash };\n}\n\n/**\n * @public\n */\nexport async function cloneRepo(options: {\n url: string;\n dir: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n ref?: string | undefined;\n depth?: number | undefined;\n noCheckout?: boolean | undefined;\n}): Promise<void> {\n const { url, dir, auth, logger, ref, depth, noCheckout } = options;\n\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.clone({ url, dir, ref, depth, noCheckout });\n}\n\n/**\n * @public\n */\nexport async function createBranch(options: {\n dir: string;\n ref: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n}): Promise<void> {\n const { dir, ref, auth, logger } = options;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.checkout({ dir, ref });\n}\n\n/**\n * @public\n */\nexport async function addFiles(options: {\n dir: string;\n filepath: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n}): Promise<void> {\n const { dir, filepath, auth, logger } = options;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.add({ dir, filepath });\n}\n\n/**\n * @public\n */\nexport async function commitAndPushBranch(options: {\n dir: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n commitMessage: string;\n gitAuthorInfo?: { name?: string; email?: string };\n branch?: string;\n remoteRef?: string;\n remote?: string;\n}): Promise<{ commitHash: string }> {\n const {\n dir,\n auth,\n logger,\n commitMessage,\n gitAuthorInfo,\n branch = 'master',\n remoteRef,\n remote = 'origin',\n } = options;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n // use provided info if possible, otherwise use fallbacks\n const authorInfo = {\n name: gitAuthorInfo?.name ?? 'Scaffolder',\n email: gitAuthorInfo?.email ?? 'scaffolder@backstage.io',\n };\n\n const commitHash = await git.commit({\n dir,\n message: commitMessage,\n author: authorInfo,\n committer: authorInfo,\n });\n\n await git.push({\n dir,\n remote,\n remoteRef: remoteRef ?? `refs/heads/${branch}`,\n });\n\n return { commitHash };\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 { InputError } from '@backstage/errors';\nimport { isChildPath } from '@backstage/backend-common';\nimport { join as joinPath, normalize as normalizePath } from 'path';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\n\n/**\n * @public\n */\nexport const getRepoSourceDirectory = (\n workspacePath: string,\n sourcePath: string | undefined,\n) => {\n if (sourcePath) {\n const safeSuffix = normalizePath(sourcePath).replace(\n /^(\\.\\.(\\/|\\\\|$))+/,\n '',\n );\n const path = joinPath(workspacePath, safeSuffix);\n if (!isChildPath(workspacePath, path)) {\n throw new Error('Invalid source path');\n }\n return path;\n }\n return workspacePath;\n};\n\n/**\n * @public\n */\nexport const parseRepoUrl = (\n repoUrl: string,\n integrations: ScmIntegrationRegistry,\n): {\n repo: string;\n host: string;\n owner?: string;\n organization?: string;\n workspace?: string;\n project?: string;\n} => {\n let parsed;\n try {\n parsed = new URL(`https://${repoUrl}`);\n } catch (error) {\n throw new InputError(\n `Invalid repo URL passed to publisher, got ${repoUrl}, ${error}`,\n );\n }\n const host = parsed.host;\n const owner = parsed.searchParams.get('owner') ?? undefined;\n const organization = parsed.searchParams.get('organization') ?? undefined;\n const workspace = parsed.searchParams.get('workspace') ?? undefined;\n const project = parsed.searchParams.get('project') ?? undefined;\n\n const type = integrations.byHost(host)?.type;\n\n if (!type) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n\n const repo: string = parsed.searchParams.get('repo')!;\n switch (type) {\n case 'bitbucket': {\n if (host === 'www.bitbucket.org') {\n checkRequiredParams(parsed, 'workspace');\n }\n checkRequiredParams(parsed, 'project', 'repo');\n break;\n }\n case 'gitlab': {\n // project is the projectID, and if defined, owner and repo won't be needed.\n if (!project) {\n checkRequiredParams(parsed, 'owner', 'repo');\n }\n break;\n }\n case 'gitea': {\n checkRequiredParams(parsed, 'repo');\n break;\n }\n case 'gerrit': {\n checkRequiredParams(parsed, 'repo');\n break;\n }\n default: {\n checkRequiredParams(parsed, 'repo', 'owner');\n break;\n }\n }\n\n return { host, owner, repo, organization, workspace, project };\n};\n\nfunction checkRequiredParams(repoUrl: URL, ...params: string[]) {\n for (let i = 0; i < params.length; i++) {\n if (!repoUrl.searchParams.get(params[i])) {\n throw new InputError(\n `Invalid repo URL passed to publisher: ${repoUrl.toString()}, missing ${\n params[i]\n }`,\n );\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 { promises as fs } from 'fs';\nimport globby from 'globby';\nimport limiterFactory from 'p-limit';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport { SerializedFile } from './types';\nimport { isError } from '@backstage/errors';\n\nconst DEFAULT_GLOB_PATTERNS = ['./**', '!.git'];\n\nexport const isExecutable = (fileMode: number | undefined) => {\n if (!fileMode) {\n return false;\n }\n\n const executeBitMask = 0o000111;\n const res = fileMode & executeBitMask;\n return res > 0;\n};\n\nasync function asyncFilter<T>(\n array: T[],\n callback: (value: T, index: number, array: T[]) => Promise<boolean>,\n): Promise<T[]> {\n const filterMap = await Promise.all(array.map(callback));\n return array.filter((_value, index) => filterMap[index]);\n}\n\n/**\n * @public\n */\nexport async function serializeDirectoryContents(\n sourcePath: string,\n options?: {\n gitignore?: boolean;\n globPatterns?: string[];\n },\n): Promise<SerializedFile[]> {\n const paths = await globby(options?.globPatterns ?? DEFAULT_GLOB_PATTERNS, {\n cwd: sourcePath,\n dot: true,\n gitignore: options?.gitignore,\n followSymbolicLinks: false,\n // In order to pick up 'broken' symlinks, we oxymoronically request files AND folders yet we filter out folders\n // This is because broken symlinks aren't classed as files so we need to glob everything\n onlyFiles: false,\n objectMode: true,\n stats: true,\n });\n\n const limiter = limiterFactory(10);\n\n const valid = await asyncFilter(paths, async ({ dirent, path }) => {\n if (dirent.isDirectory()) return false;\n if (!dirent.isSymbolicLink()) return true;\n\n const safePath = resolveSafeChildPath(sourcePath, path);\n\n // we only want files that don't exist\n try {\n await fs.stat(safePath);\n return false;\n } catch (e) {\n return isError(e) && e.code === 'ENOENT';\n }\n });\n\n return Promise.all(\n valid.map(async ({ dirent, path, stats }) => ({\n path,\n content: await limiter(async () => {\n const absFilePath = resolveSafeChildPath(sourcePath, path);\n if (dirent.isSymbolicLink()) {\n return fs.readlink(absFilePath, 'buffer');\n }\n return fs.readFile(absFilePath);\n }),\n executable: isExecutable(stats?.mode),\n symlink: dirent.isSymbolicLink(),\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 fs from 'fs-extra';\nimport { dirname } from 'path';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport { SerializedFile } from './types';\n\n/**\n * Deserializes a list of serialized files into the target directory.\n *\n * This method uses `resolveSafeChildPath` to make sure that files are\n * not written outside of the target directory.\n *\n * @public\n */\nexport async function deserializeDirectoryContents(\n targetPath: string,\n files: SerializedFile[],\n): Promise<void> {\n for (const file of files) {\n const filePath = resolveSafeChildPath(targetPath, file.path);\n await fs.ensureDir(dirname(filePath));\n await fs.writeFile(filePath, file.content); // Ignore file mode\n }\n}\n"],"names":["zodToJsonSchema","PassThrough","spawn","resolveSafeChildPath","path","fs","InputError","Git","normalizePath","joinPath","isChildPath","globby","limiterFactory","isError","dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmDa,MAAA,oBAAA,GAAuB,CAoBlC,MAMgD,KAAA;AA7ElD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA8EE,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;;ACxDA,eAAsB,oBACpB,OACe,EAAA;AACf,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,IAAA;AAAA,IACA,OAAS,EAAA,YAAA;AAAA,IACT,SAAA,GAAY,IAAIC,kBAAY,EAAA;AAAA,GAC1B,GAAA,OAAA,CAAA;AAE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ions/gitHelpers.ts","../src/actions/util.ts","../src/files/serializeDirectoryContents.ts","../src/files/deserializeDirectoryContents.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 TemplateExample = {\n description: string;\n example: string;\n};\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?: TemplateExample[];\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 as TInputSchema,\n output: outputSchema as TOutputSchema,\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 token?: string;\n}) {\n const {\n reader,\n integrations,\n baseUrl,\n fetchUrl = '.',\n outputPath,\n token,\n } = 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, { token });\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 token?: string;\n}) {\n const {\n reader,\n integrations,\n baseUrl,\n fetchUrl = '.',\n outputPath,\n token,\n } = 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, { token });\n await fs.ensureDir(path.dirname(outputPath));\n const buffer = await res.buffer();\n await fs.outputFile(outputPath, buffer);\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 2023 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 { Git } from '@backstage/backend-common';\nimport { Logger } from 'winston';\n\n/**\n * @public\n */\nexport async function initRepoAndPush(input: {\n dir: string;\n remoteUrl: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger: Logger;\n defaultBranch?: string;\n commitMessage?: string;\n gitAuthorInfo?: { name?: string; email?: string };\n}): Promise<{ commitHash: string }> {\n const {\n dir,\n remoteUrl,\n auth,\n logger,\n defaultBranch = 'master',\n commitMessage = 'Initial commit',\n gitAuthorInfo,\n } = input;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.init({\n dir,\n defaultBranch,\n });\n\n await git.add({ dir, filepath: '.' });\n\n // use provided info if possible, otherwise use fallbacks\n const authorInfo = {\n name: gitAuthorInfo?.name ?? 'Scaffolder',\n email: gitAuthorInfo?.email ?? 'scaffolder@backstage.io',\n };\n\n const commitHash = await git.commit({\n dir,\n message: commitMessage,\n author: authorInfo,\n committer: authorInfo,\n });\n await git.addRemote({\n dir,\n url: remoteUrl,\n remote: 'origin',\n });\n\n await git.push({\n dir,\n remote: 'origin',\n });\n\n return { commitHash };\n}\n\n/**\n * @public\n */\nexport async function commitAndPushRepo(input: {\n dir: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger: Logger;\n commitMessage: string;\n gitAuthorInfo?: { name?: string; email?: string };\n branch?: string;\n remoteRef?: string;\n}): Promise<{ commitHash: string }> {\n const {\n dir,\n auth,\n logger,\n commitMessage,\n gitAuthorInfo,\n branch = 'master',\n remoteRef,\n } = input;\n\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.fetch({ dir });\n await git.checkout({ dir, ref: branch });\n await git.add({ dir, filepath: '.' });\n\n // use provided info if possible, otherwise use fallbacks\n const authorInfo = {\n name: gitAuthorInfo?.name ?? 'Scaffolder',\n email: gitAuthorInfo?.email ?? 'scaffolder@backstage.io',\n };\n\n const commitHash = await git.commit({\n dir,\n message: commitMessage,\n author: authorInfo,\n committer: authorInfo,\n });\n\n await git.push({\n dir,\n remote: 'origin',\n remoteRef: remoteRef ?? `refs/heads/${branch}`,\n });\n\n return { commitHash };\n}\n\n/**\n * @public\n */\nexport async function cloneRepo(options: {\n url: string;\n dir: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n ref?: string | undefined;\n depth?: number | undefined;\n noCheckout?: boolean | undefined;\n}): Promise<void> {\n const { url, dir, auth, logger, ref, depth, noCheckout } = options;\n\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.clone({ url, dir, ref, depth, noCheckout });\n}\n\n/**\n * @public\n */\nexport async function createBranch(options: {\n dir: string;\n ref: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n}): Promise<void> {\n const { dir, ref, auth, logger } = options;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.checkout({ dir, ref });\n}\n\n/**\n * @public\n */\nexport async function addFiles(options: {\n dir: string;\n filepath: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n}): Promise<void> {\n const { dir, filepath, auth, logger } = options;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n await git.add({ dir, filepath });\n}\n\n/**\n * @public\n */\nexport async function commitAndPushBranch(options: {\n dir: string;\n // For use cases where token has to be used with Basic Auth\n // it has to be provided as password together with a username\n // which may be a fixed value defined by the provider.\n auth: { username: string; password: string } | { token: string };\n logger?: Logger | undefined;\n commitMessage: string;\n gitAuthorInfo?: { name?: string; email?: string };\n branch?: string;\n remoteRef?: string;\n remote?: string;\n}): Promise<{ commitHash: string }> {\n const {\n dir,\n auth,\n logger,\n commitMessage,\n gitAuthorInfo,\n branch = 'master',\n remoteRef,\n remote = 'origin',\n } = options;\n const git = Git.fromAuth({\n ...auth,\n logger,\n });\n\n // use provided info if possible, otherwise use fallbacks\n const authorInfo = {\n name: gitAuthorInfo?.name ?? 'Scaffolder',\n email: gitAuthorInfo?.email ?? 'scaffolder@backstage.io',\n };\n\n const commitHash = await git.commit({\n dir,\n message: commitMessage,\n author: authorInfo,\n committer: authorInfo,\n });\n\n await git.push({\n dir,\n remote,\n remoteRef: remoteRef ?? `refs/heads/${branch}`,\n });\n\n return { commitHash };\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 { InputError } from '@backstage/errors';\nimport { isChildPath } from '@backstage/backend-common';\nimport { join as joinPath, normalize as normalizePath } from 'path';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\n\n/**\n * @public\n */\nexport const getRepoSourceDirectory = (\n workspacePath: string,\n sourcePath: string | undefined,\n) => {\n if (sourcePath) {\n const safeSuffix = normalizePath(sourcePath).replace(\n /^(\\.\\.(\\/|\\\\|$))+/,\n '',\n );\n const path = joinPath(workspacePath, safeSuffix);\n if (!isChildPath(workspacePath, path)) {\n throw new Error('Invalid source path');\n }\n return path;\n }\n return workspacePath;\n};\n\n/**\n * @public\n */\nexport const parseRepoUrl = (\n repoUrl: string,\n integrations: ScmIntegrationRegistry,\n): {\n repo: string;\n host: string;\n owner?: string;\n organization?: string;\n workspace?: string;\n project?: string;\n} => {\n let parsed;\n try {\n parsed = new URL(`https://${repoUrl}`);\n } catch (error) {\n throw new InputError(\n `Invalid repo URL passed to publisher, got ${repoUrl}, ${error}`,\n );\n }\n const host = parsed.host;\n const owner = parsed.searchParams.get('owner') ?? undefined;\n const organization = parsed.searchParams.get('organization') ?? undefined;\n const workspace = parsed.searchParams.get('workspace') ?? undefined;\n const project = parsed.searchParams.get('project') ?? undefined;\n\n const type = integrations.byHost(host)?.type;\n\n if (!type) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n\n const repo: string = parsed.searchParams.get('repo')!;\n switch (type) {\n case 'bitbucket': {\n if (host === 'www.bitbucket.org') {\n checkRequiredParams(parsed, 'workspace');\n }\n checkRequiredParams(parsed, 'project', 'repo');\n break;\n }\n case 'gitlab': {\n // project is the projectID, and if defined, owner and repo won't be needed.\n if (!project) {\n checkRequiredParams(parsed, 'owner', 'repo');\n }\n break;\n }\n case 'gitea': {\n checkRequiredParams(parsed, 'repo');\n break;\n }\n case 'gerrit': {\n checkRequiredParams(parsed, 'repo');\n break;\n }\n default: {\n checkRequiredParams(parsed, 'repo', 'owner');\n break;\n }\n }\n\n return { host, owner, repo, organization, workspace, project };\n};\n\nfunction checkRequiredParams(repoUrl: URL, ...params: string[]) {\n for (let i = 0; i < params.length; i++) {\n if (!repoUrl.searchParams.get(params[i])) {\n throw new InputError(\n `Invalid repo URL passed to publisher: ${repoUrl.toString()}, missing ${\n params[i]\n }`,\n );\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 { promises as fs } from 'fs';\nimport globby from 'globby';\nimport limiterFactory from 'p-limit';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport { SerializedFile } from './types';\nimport { isError } from '@backstage/errors';\n\nconst DEFAULT_GLOB_PATTERNS = ['./**', '!.git'];\n\nexport const isExecutable = (fileMode: number | undefined) => {\n if (!fileMode) {\n return false;\n }\n\n const executeBitMask = 0o000111;\n const res = fileMode & executeBitMask;\n return res > 0;\n};\n\nasync function asyncFilter<T>(\n array: T[],\n callback: (value: T, index: number, array: T[]) => Promise<boolean>,\n): Promise<T[]> {\n const filterMap = await Promise.all(array.map(callback));\n return array.filter((_value, index) => filterMap[index]);\n}\n\n/**\n * @public\n */\nexport async function serializeDirectoryContents(\n sourcePath: string,\n options?: {\n gitignore?: boolean;\n globPatterns?: string[];\n },\n): Promise<SerializedFile[]> {\n const paths = await globby(options?.globPatterns ?? DEFAULT_GLOB_PATTERNS, {\n cwd: sourcePath,\n dot: true,\n gitignore: options?.gitignore,\n followSymbolicLinks: false,\n // In order to pick up 'broken' symlinks, we oxymoronically request files AND folders yet we filter out folders\n // This is because broken symlinks aren't classed as files so we need to glob everything\n onlyFiles: false,\n objectMode: true,\n stats: true,\n });\n\n const limiter = limiterFactory(10);\n\n const valid = await asyncFilter(paths, async ({ dirent, path }) => {\n if (dirent.isDirectory()) return false;\n if (!dirent.isSymbolicLink()) return true;\n\n const safePath = resolveSafeChildPath(sourcePath, path);\n\n // we only want files that don't exist\n try {\n await fs.stat(safePath);\n return false;\n } catch (e) {\n return isError(e) && e.code === 'ENOENT';\n }\n });\n\n return Promise.all(\n valid.map(async ({ dirent, path, stats }) => ({\n path,\n content: await limiter(async () => {\n const absFilePath = resolveSafeChildPath(sourcePath, path);\n if (dirent.isSymbolicLink()) {\n return fs.readlink(absFilePath, 'buffer');\n }\n return fs.readFile(absFilePath);\n }),\n executable: isExecutable(stats?.mode),\n symlink: dirent.isSymbolicLink(),\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 fs from 'fs-extra';\nimport { dirname } from 'path';\nimport { resolveSafeChildPath } from '@backstage/backend-common';\nimport { SerializedFile } from './types';\n\n/**\n * Deserializes a list of serialized files into the target directory.\n *\n * This method uses `resolveSafeChildPath` to make sure that files are\n * not written outside of the target directory.\n *\n * @public\n */\nexport async function deserializeDirectoryContents(\n targetPath: string,\n files: SerializedFile[],\n): Promise<void> {\n for (const file of files) {\n const filePath = resolveSafeChildPath(targetPath, file.path);\n await fs.ensureDir(dirname(filePath));\n await fs.writeFile(filePath, file.content); // Ignore file mode\n }\n}\n"],"names":["zodToJsonSchema","PassThrough","spawn","resolveSafeChildPath","path","fs","InputError","Git","normalizePath","joinPath","isChildPath","globby","limiterFactory","isError","dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmDa,MAAA,oBAAA,GAAuB,CAoBlC,MAMgD,KAAA;AA7ElD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA8EE,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,gCAAA,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,gCAAA,CAAgB,OAAO,MAAO,CAAA,MAAM,CACpC,G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;ACnEsB,eAAA,4BAAA,CACpB,YACA,KACe,EAAA;AACf,EAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,IAAA,MAAM,QAAW,GAAAF,kCAAA,CAAqB,UAAY,EAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAC3D,IAAA,MAAME,mBAAG,CAAA,SAAA,CAAUS,YAAQ,CAAA,QAAQ,CAAC,CAAA,CAAA;AACpC,IAAA,MAAMT,mBAAG,CAAA,SAAA,CAAU,QAAU,EAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAAA,GAC3C;AACF;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -441,4 +441,4 @@ type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
441
441
  /** @public */
442
442
  type TemplateGlobal = ((...args: JsonValue[]) => JsonValue | undefined) | JsonValue;
443
443
 
444
- export { ActionContext, ExecuteShellCommandOptions, SerializedFile, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskSecrets, TaskStatus, TemplateAction, TemplateActionOptions, TemplateExample, TemplateFilter, TemplateGlobal, addFiles, cloneRepo, commitAndPushBranch, commitAndPushRepo, createBranch, createTemplateAction, deserializeDirectoryContents, executeShellCommand, fetchContents, fetchFile, getRepoSourceDirectory, initRepoAndPush, parseRepoUrl, serializeDirectoryContents };
444
+ export { type ActionContext, type ExecuteShellCommandOptions, type SerializedFile, type SerializedTask, type SerializedTaskEvent, type TaskBroker, type TaskBrokerDispatchOptions, type TaskBrokerDispatchResult, type TaskCompletionState, type TaskContext, type TaskEventType, type TaskSecrets, type TaskStatus, type TemplateAction, type TemplateActionOptions, type TemplateExample, type TemplateFilter, type TemplateGlobal, addFiles, cloneRepo, commitAndPushBranch, commitAndPushRepo, createBranch, createTemplateAction, deserializeDirectoryContents, executeShellCommand, fetchContents, fetchFile, getRepoSourceDirectory, initRepoAndPush, parseRepoUrl, serializeDirectoryContents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-node",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "The plugin-scaffolder-node module for @backstage/plugin-scaffolder-backend",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -44,8 +44,8 @@
44
44
  "test": "backstage-cli package test"
45
45
  },
46
46
  "dependencies": {
47
- "@backstage/backend-common": "^0.21.4",
48
- "@backstage/backend-plugin-api": "^0.6.14",
47
+ "@backstage/backend-common": "^0.21.6",
48
+ "@backstage/backend-plugin-api": "^0.6.16",
49
49
  "@backstage/catalog-model": "^1.4.5",
50
50
  "@backstage/errors": "^1.2.4",
51
51
  "@backstage/integration": "^1.9.1",
@@ -60,8 +60,8 @@
60
60
  "zod-to-json-schema": "^3.20.4"
61
61
  },
62
62
  "devDependencies": {
63
- "@backstage/backend-test-utils": "^0.3.4",
64
- "@backstage/cli": "^0.26.0",
63
+ "@backstage/backend-test-utils": "^0.3.6",
64
+ "@backstage/cli": "^0.26.2",
65
65
  "@backstage/config": "^1.2.0"
66
66
  }
67
67
  }