@backstage/plugin-scaffolder-backend 0.15.12 → 0.15.13

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,17 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 0.15.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 26eb174ce8: Skip empty file names when scaffolding with nunjucks
8
+ - ecdcbd08ee: Expose template metadata to custom action handler in Scaffolder.
9
+ - Updated dependencies
10
+ - @backstage/catalog-client@0.5.2
11
+ - @backstage/catalog-model@0.9.7
12
+ - @backstage/backend-common@0.9.10
13
+ - @backstage/plugin-catalog-backend@0.17.4
14
+
3
15
  ## 0.15.12
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -434,6 +434,9 @@ function createFetchTemplateAction(options) {
434
434
  localOutputPath = templater.renderString(localOutputPath, context);
435
435
  }
436
436
  const outputPath = path.resolve(outputDir, localOutputPath);
437
+ if (outputDir === outputPath) {
438
+ continue;
439
+ }
437
440
  if (!renderContents && !extension) {
438
441
  ctx.logger.info(`Copying file/directory ${location} without processing.`);
439
442
  }
@@ -2175,6 +2178,9 @@ class HandlebarsWorkflowRunner {
2175
2178
  this.options.logger.debug(`Running ${action.id} with input`, {
2176
2179
  input: JSON.stringify(input, null, 2)
2177
2180
  });
2181
+ if (!task.spec.metadata) {
2182
+ console.warn("DEPRECATION NOTICE: metadata is undefined. metadata will be required in the future.");
2183
+ }
2178
2184
  await action.handler({
2179
2185
  baseUrl: task.spec.baseUrl,
2180
2186
  logger: taskLogger,
@@ -2189,7 +2195,8 @@ class HandlebarsWorkflowRunner {
2189
2195
  },
2190
2196
  output(name, value) {
2191
2197
  stepOutputs[name] = value;
2192
- }
2198
+ },
2199
+ metadata: task.spec.metadata
2193
2200
  });
2194
2201
  for (const tmpDir of tmpDirs) {
2195
2202
  await fs__default['default'].remove(tmpDir);
@@ -2350,6 +2357,9 @@ class NunjucksWorkflowRunner {
2350
2357
  }
2351
2358
  const tmpDirs = new Array();
2352
2359
  const stepOutput = {};
2360
+ if (!task.spec.metadata) {
2361
+ console.warn("DEPRECATION NOTICE: metadata is undefined. metadata will be required in the future.");
2362
+ }
2353
2363
  await action.handler({
2354
2364
  baseUrl: task.spec.baseUrl,
2355
2365
  input,
@@ -2363,7 +2373,8 @@ class NunjucksWorkflowRunner {
2363
2373
  },
2364
2374
  output(name, value) {
2365
2375
  stepOutput[name] = value;
2366
- }
2376
+ },
2377
+ metadata: task.spec.metadata
2367
2378
  });
2368
2379
  for (const tmpDir of tmpDirs) {
2369
2380
  await fs__default['default'].remove(tmpDir);
@@ -2583,7 +2594,7 @@ async function createRouter(options) {
2583
2594
  });
2584
2595
  res.json(actionsList);
2585
2596
  }).post("/v2/tasks", async (req, res) => {
2586
- var _a, _b, _c;
2597
+ var _a, _b, _c, _d, _e;
2587
2598
  const templateName = req.body.templateName;
2588
2599
  const values = req.body.values;
2589
2600
  const token = getBearerToken(req.headers.authorization);
@@ -2612,7 +2623,8 @@ async function createRouter(options) {
2612
2623
  name: (_b2 = step.name) != null ? _b2 : step.action
2613
2624
  };
2614
2625
  }),
2615
- output: (_b = template.spec.output) != null ? _b : {}
2626
+ output: (_b = template.spec.output) != null ? _b : {},
2627
+ metadata: {name: (_c = template.metadata) == null ? void 0 : _c.name}
2616
2628
  } : {
2617
2629
  apiVersion: template.apiVersion,
2618
2630
  baseUrl,
@@ -2625,7 +2637,8 @@ async function createRouter(options) {
2625
2637
  name: (_b2 = step.name) != null ? _b2 : step.action
2626
2638
  };
2627
2639
  }),
2628
- output: (_c = template.spec.output) != null ? _c : {}
2640
+ output: (_d = template.spec.output) != null ? _d : {},
2641
+ metadata: {name: (_e = template.metadata) == null ? void 0 : _e.name}
2629
2642
  };
2630
2643
  } else {
2631
2644
  throw new errors.InputError(`Unsupported apiVersion field in schema entity, ${template.apiVersion}`);