@backstage/plugin-scaffolder-backend 0.0.0-nightly-20220714025131 → 0.0.0-nightly-20220717025420

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,6 +1,6 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
- ## 0.0.0-nightly-20220714025131
3
+ ## 0.0.0-nightly-20220717025420
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### Patch Changes
12
12
 
13
+ - ff316b86d8: Add `copyWithoutTemplating` to the fetch template action input. `copyWithoutTemplating` also accepts an array of glob patterns. Contents of matched files or directories are copied without being processed, but paths are subject to rendering.
14
+
15
+ Deprecate `copyWithoutRender` in favor of `copyWithoutTemplating`.
16
+
13
17
  - 801d606909: Improve error messaging when passing in malformed auth
14
18
  - 089d846962: Fix issues with optional directories and files
15
19
  - ea6dcb84a4: Don't resolve symlinks, treat them as binary files and copy them as-is
@@ -36,15 +40,15 @@
36
40
  - 945a27fa6a: Add sourcePath option to publish:gerrit action
37
41
  - 1764296a68: Allow to create Gerrit project using default owner
38
42
  - Updated dependencies
39
- - @backstage/backend-plugin-api@0.0.0-nightly-20220714025131
40
- - @backstage/plugin-catalog-backend@0.0.0-nightly-20220714025131
41
- - @backstage/backend-common@0.0.0-nightly-20220714025131
42
- - @backstage/catalog-model@0.0.0-nightly-20220714025131
43
- - @backstage/plugin-catalog-node@0.0.0-nightly-20220714025131
44
- - @backstage/integration@0.0.0-nightly-20220714025131
45
- - @backstage/catalog-client@0.0.0-nightly-20220714025131
46
- - @backstage/errors@0.0.0-nightly-20220714025131
47
- - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220714025131
43
+ - @backstage/backend-plugin-api@0.0.0-nightly-20220717025420
44
+ - @backstage/plugin-catalog-backend@0.0.0-nightly-20220717025420
45
+ - @backstage/backend-common@0.0.0-nightly-20220717025420
46
+ - @backstage/catalog-model@0.0.0-nightly-20220717025420
47
+ - @backstage/plugin-catalog-node@0.0.0-nightly-20220717025420
48
+ - @backstage/integration@0.0.0-nightly-20220717025420
49
+ - @backstage/catalog-client@0.0.0-nightly-20220717025420
50
+ - @backstage/errors@0.0.0-nightly-20220717025420
51
+ - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220717025420
48
52
 
49
53
  ## 1.4.0-next.3
50
54
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "0.0.0-nightly-20220714025131",
3
+ "version": "0.0.0-nightly-20220717025420",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -161,7 +161,11 @@ url: string;
161
161
  targetPath?: string | undefined;
162
162
  values: any;
163
163
  templateFileExtension?: string | boolean | undefined;
164
+ /**
165
+ * @deprecated This field is deprecated in favor of copyWithoutTemplating.
166
+ */
164
167
  copyWithoutRender?: string[] | undefined;
168
+ copyWithoutTemplating?: string[] | undefined;
165
169
  cookiecutterCompat?: boolean | undefined;
166
170
  }>;
167
171
 
@@ -161,7 +161,11 @@ url: string;
161
161
  targetPath?: string | undefined;
162
162
  values: any;
163
163
  templateFileExtension?: string | boolean | undefined;
164
+ /**
165
+ * @deprecated This field is deprecated in favor of copyWithoutTemplating.
166
+ */
164
167
  copyWithoutRender?: string[] | undefined;
168
+ copyWithoutTemplating?: string[] | undefined;
165
169
  cookiecutterCompat?: boolean | undefined;
166
170
  }>;
167
171
 
package/dist/index.cjs.js CHANGED
@@ -473,13 +473,21 @@ function createFetchTemplateAction(options) {
473
473
  type: "object"
474
474
  },
475
475
  copyWithoutRender: {
476
- title: "Copy Without Render",
476
+ title: "[Deprecated] Copy Without Render",
477
477
  description: "An array of glob patterns. Any files or directories which match are copied without being processed as templates.",
478
478
  type: "array",
479
479
  items: {
480
480
  type: "string"
481
481
  }
482
482
  },
483
+ copyWithoutTemplating: {
484
+ title: "Copy Without Templating",
485
+ description: "An array of glob patterns. Contents of matched files or directories are copied without being processed, but paths are subject to rendering.",
486
+ type: "array",
487
+ items: {
488
+ type: "string"
489
+ }
490
+ },
483
491
  cookiecutterCompat: {
484
492
  title: "Cookiecutter compatibility mode",
485
493
  description: "Enable features to maximise compatibility with templates built for fetch:cookiecutter",
@@ -501,11 +509,24 @@ function createFetchTemplateAction(options) {
501
509
  const templateDir = backendCommon.resolveSafeChildPath(workDir, "template");
502
510
  const targetPath = (_a = ctx.input.targetPath) != null ? _a : "./";
503
511
  const outputDir = backendCommon.resolveSafeChildPath(ctx.workspacePath, targetPath);
504
- if (ctx.input.copyWithoutRender && !Array.isArray(ctx.input.copyWithoutRender)) {
505
- throw new errors.InputError("Fetch action input copyWithoutRender must be an Array");
512
+ if (ctx.input.copyWithoutRender && ctx.input.copyWithoutTemplating) {
513
+ throw new errors.InputError("Fetch action input copyWithoutRender and copyWithoutTemplating can not be used at the same time");
514
+ }
515
+ let copyOnlyPatterns;
516
+ let renderFilename;
517
+ if (ctx.input.copyWithoutRender) {
518
+ ctx.logger.warn("[Deprecated] Please use copyWithoutTemplating instead.");
519
+ copyOnlyPatterns = ctx.input.copyWithoutRender;
520
+ renderFilename = false;
521
+ } else {
522
+ copyOnlyPatterns = ctx.input.copyWithoutTemplating;
523
+ renderFilename = true;
506
524
  }
507
- if (ctx.input.templateFileExtension && (ctx.input.copyWithoutRender || ctx.input.cookiecutterCompat)) {
508
- throw new errors.InputError("Fetch action input extension incompatible with copyWithoutRender and cookiecutterCompat");
525
+ if (copyOnlyPatterns && !Array.isArray(copyOnlyPatterns)) {
526
+ throw new errors.InputError("Fetch action input copyWithoutRender/copyWithoutTemplating must be an Array");
527
+ }
528
+ if (ctx.input.templateFileExtension && (copyOnlyPatterns || ctx.input.cookiecutterCompat)) {
529
+ throw new errors.InputError("Fetch action input extension incompatible with copyWithoutRender/copyWithoutTemplating and cookiecutterCompat");
509
530
  }
510
531
  let extension = false;
511
532
  if (ctx.input.templateFileExtension) {
@@ -529,7 +550,7 @@ function createFetchTemplateAction(options) {
529
550
  markDirectories: true,
530
551
  followSymbolicLinks: false
531
552
  });
532
- const nonTemplatedEntries = new Set((await Promise.all((ctx.input.copyWithoutRender || []).map((pattern) => globby__default["default"](pattern, {
553
+ const nonTemplatedEntries = new Set((await Promise.all((copyOnlyPatterns || []).map((pattern) => globby__default["default"](pattern, {
533
554
  cwd: templateDir,
534
555
  dot: true,
535
556
  onlyFiles: false,
@@ -546,20 +567,21 @@ function createFetchTemplateAction(options) {
546
567
  additionalTemplateFilters
547
568
  });
548
569
  for (const location of allEntriesInTemplate) {
549
- let renderFilename;
550
570
  let renderContents;
551
571
  let localOutputPath = location;
552
572
  if (extension) {
553
- renderFilename = true;
554
573
  renderContents = path.extname(localOutputPath) === extension;
555
574
  if (renderContents) {
556
575
  localOutputPath = localOutputPath.slice(0, -extension.length);
557
576
  }
558
- } else {
559
- renderFilename = renderContents = !nonTemplatedEntries.has(location);
560
- }
561
- if (renderFilename) {
562
577
  localOutputPath = renderTemplate(localOutputPath, context);
578
+ } else {
579
+ renderContents = !nonTemplatedEntries.has(location);
580
+ if (renderFilename) {
581
+ localOutputPath = renderTemplate(localOutputPath, context);
582
+ } else {
583
+ localOutputPath = renderContents ? renderTemplate(localOutputPath, context) : localOutputPath;
584
+ }
563
585
  }
564
586
  if (containsSkippedContent(localOutputPath)) {
565
587
  continue;