@backstage-community/plugin-scaffolder-backend-module-annotator 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## @janus-idp/backstage-scaffolder-backend-module-annotator [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.2.1...@janus-idp/backstage-scaffolder-backend-module-annotator@1.3.0) (2024-07-25)
2
2
 
3
+ ## 2.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 68a0e98: Adds a new scaffolder action to the scaffolder-backend-module-annotator to faciliate better lifecycle management when used alongside the `catalog:scaffolded-from` scaffolder action.
8
+
9
+ The `catalog:template:version` scaffolder action can be used to annotate the entities that a template generates using the annotation `backstage.io/template-version`. The versioning information can either come from the template itself (as an annotation) or be passed as input to the new action.
10
+
11
+ Also included in the changes are template examples for all scaffolder actions included in the scaffolder-backend-module-annotator plugin.
12
+
13
+ ### Patch Changes
14
+
15
+ - 6a59fcf: remove support and lifecycle keywords in package.json
16
+
3
17
  ## 2.7.0
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -8,11 +8,12 @@ This module allows users to create custom actions for annotating their entity ob
8
8
 
9
9
  ### Available custom actions
10
10
 
11
- | Action | Description |
12
- | ------------------------- | :-----------------------------------------------------------------------------------------------------: |
13
- | `catalog:timestamping` | Adds the `backstage.io/createdAt` annotation containing the current timestamp to your entity object |
14
- | `catalog:scaffolded-from` | Adds `scaffoldedFrom` spec containing the template entityRef to your entity object |
15
- | `catalog:annotate` | Allows you to annotate your entity object with specified label(s), annotation(s) and spec property(ies) |
11
+ | Action | Description |
12
+ | -------------------------- | :---------------------------------------------------------------------------------------------------------------: |
13
+ | `catalog:timestamping` | Adds the `backstage.io/createdAt` annotation containing the current timestamp to your entity object |
14
+ | `catalog:scaffolded-from` | Adds `scaffoldedFrom` spec containing the template entityRef to your entity object |
15
+ | `catalog:annotate` | Allows you to annotate your entity object with specified label(s), annotation(s) and spec property(ies) |
16
+ | `catalog:template:version` | Adds the `backstage.io/template-version` annotation containing the version of your template to your entity object |
16
17
 
17
18
  To begin, install the module package into the backend workspace of your backstage instance:
18
19
 
@@ -107,3 +108,30 @@ To annotate the entity file, add your custom action to your template file after
107
108
  }
108
109
  // highlight-add-end
109
110
  ```
111
+
112
+ ## Software Template Versioning
113
+
114
+ This section explains how to version your software templates using the preloaded custom actions `catalog:scaffolded-from` and `catalog:template:version` within the scaffolder backend module. By using the actions together, you can both track the version of your scaffolder template and the corresponding version of the entities created from it, facilitating better lifecycle management.
115
+
116
+ ### catalog:scaffolded-from action
117
+
118
+ The `catalog:scaffolded-from` action adds the `scaffoldedFrom` specification of your template to the entity created by it. This allows you to easily identify the template used to generate a specific entity. This action accepts all inputs available from the annotator template action.
119
+
120
+ ### catalog:template:version action
121
+
122
+ The `catalog:template:version` action adds the annotation `backstage.io/template-version` to the entity generated by your software template. This annotation helps in tracking the specific version of a template used to create a particular entity.
123
+
124
+ There are two methods to version your templates:
125
+
126
+ - Include the `backstage.io/template-version` annotation in your template: When this annotation is present in your template, it will be automatically used to annotate your catalog entity.
127
+
128
+ - Pass the `backstage.io/template-version` annotation as input to the action: This method takes precedence over the annotation in the template itself. It allows the user running the template to specify the version they wish to generate.
129
+
130
+ ```yaml
131
+ - id: version-templateRef
132
+ name: Append the version of this template to the entityRef
133
+ action: catalog:template:version
134
+ input:
135
+ annotations:
136
+ backstage.io/template-version: ${{ parameters.version }}
137
+ ```
@@ -6,6 +6,7 @@ var fs = require('fs-extra');
6
6
  var yaml = require('yaml');
7
7
  var getObjectToAnnotate = require('../../utils/getObjectToAnnotate.cjs.js');
8
8
  var resolveSpec = require('../../utils/resolveSpec.cjs.js');
9
+ var resolveAnnotation = require('../../utils/resolveAnnotation.cjs.js');
9
10
 
10
11
  function _interopNamespaceCompat(e) {
11
12
  if (e && typeof e === 'object' && 'default' in e) return e;
@@ -28,9 +29,10 @@ function _interopNamespaceCompat(e) {
28
29
  var fs__namespace = /*#__PURE__*/_interopNamespaceCompat(fs);
29
30
  var yaml__namespace = /*#__PURE__*/_interopNamespaceCompat(yaml);
30
31
 
31
- const createAnnotatorAction = (actionId = "catalog:annotate", actionDescription, loggerInfoMsg, annotateEntityObjectProvider) => {
32
+ const createAnnotatorAction = (actionId = "catalog:annotate", actionDescription, loggerInfoMsg, annotateEntityObjectProvider, examples) => {
32
33
  return pluginScaffolderNode.createTemplateAction({
33
34
  id: actionId,
35
+ examples,
34
36
  description: actionDescription || "Creates a new scaffolder action to annotate the entity object with specified label(s), annotation(s) and spec property(ies).",
35
37
  schema: {
36
38
  input: {
@@ -96,6 +98,7 @@ const createAnnotatorAction = (actionId = "catalog:annotate", actionDescription,
96
98
  annotations: {
97
99
  ...objToAnnotate.metadata.annotations || {},
98
100
  ...annotateEntityObject?.annotations || {},
101
+ ...resolveAnnotation.resolveAnnotation(annotateEntityObject?.annotations, ctx),
99
102
  ...ctx.input?.annotations || {}
100
103
  },
101
104
  labels: {
@@ -1 +1 @@
1
- {"version":3,"file":"annotator.cjs.js","sources":["../../../src/actions/annotator/annotator.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { resolveSafeChildPath } from '@backstage/backend-plugin-api';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\n\nimport * as fs from 'fs-extra';\nimport * as yaml from 'yaml';\n\nimport { getObjectToAnnotate } from '../../utils/getObjectToAnnotate';\nimport { resolveSpec, Value } from '../../utils/resolveSpec';\n\n/**\n * Creates a new Scaffolder action to annotate an entity object with specified label(s), annotation(s) and spec property(ies).\n *\n */\n\nexport const createAnnotatorAction = (\n actionId: string = 'catalog:annotate',\n actionDescription?: string,\n loggerInfoMsg?: string,\n annotateEntityObjectProvider?: () => {\n annotations?: { [key: string]: string };\n labels?: { [key: string]: string };\n spec?: { [key: string]: Value };\n },\n) => {\n return createTemplateAction<{\n labels?: { [key: string]: string };\n annotations?: { [key: string]: string };\n spec?: { [key: string]: string };\n entityFilePath?: string;\n objectYaml?: { [key: string]: string };\n writeToFile?: string;\n }>({\n id: actionId,\n description:\n actionDescription ||\n 'Creates a new scaffolder action to annotate the entity object with specified label(s), annotation(s) and spec property(ies).',\n schema: {\n input: {\n type: 'object',\n properties: {\n labels: {\n title: 'Labels',\n description:\n 'Labels that will be applied to the `metadata.labels` of the entity object',\n type: 'object',\n },\n annotations: {\n title: 'Annotations',\n description:\n 'Annotations that will be applied to the `metadata.annotations` of the entity object',\n type: 'object',\n },\n spec: {\n title: 'Spec',\n description:\n 'Key-Value pair(s) that will be applied to the `spec` of the entity object',\n type: 'object',\n },\n entityFilePath: {\n title: 'Entity File Path',\n description: 'Path to the entity yaml you want to annotate',\n type: 'string',\n },\n objectYaml: {\n title: 'Object Yaml',\n description: 'Entity object yaml you want to annotate',\n type: 'object',\n },\n writeToFile: {\n title: 'Write To File',\n description:\n 'Path to the file you want to write. Default path `./catalog-info.yaml`',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n annotatedObject: {\n type: 'object',\n title:\n 'The entity object annotated with your desired annotation(s), label(s) and spec property(ies)',\n },\n },\n },\n },\n async handler(ctx) {\n const annotateEntityObject = annotateEntityObjectProvider?.();\n let objToAnnotate: { [key: string]: any };\n\n if (ctx.input?.objectYaml) {\n objToAnnotate = { ...ctx.input?.objectYaml };\n } else {\n objToAnnotate = await getObjectToAnnotate(\n ctx.workspacePath,\n ctx.input?.entityFilePath,\n );\n }\n const annotatedObj = {\n ...objToAnnotate,\n metadata: {\n ...objToAnnotate.metadata,\n annotations: {\n ...(objToAnnotate.metadata.annotations || {}),\n ...(annotateEntityObject?.annotations || {}),\n ...(ctx.input?.annotations || {}),\n },\n labels: {\n ...(objToAnnotate.metadata.labels || {}),\n ...(annotateEntityObject?.labels || {}),\n ...(ctx.input?.labels || {}),\n },\n },\n spec: {\n ...(objToAnnotate.spec || {}),\n ...resolveSpec(annotateEntityObject?.spec, ctx),\n ...(ctx.input?.spec || {}),\n },\n };\n\n const result = yaml.stringify(annotatedObj);\n if (\n Object.keys(\n annotateEntityObject?.labels ||\n annotateEntityObject?.annotations ||\n annotateEntityObject?.spec ||\n ctx.input?.labels ||\n ctx.input?.annotations ||\n ctx.input?.spec ||\n {},\n ).length > 0\n ) {\n ctx.logger.info(loggerInfoMsg || 'Annotating your object');\n\n await fs.writeFile(\n resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input?.writeToFile || './catalog-info.yaml',\n ),\n result,\n 'utf8',\n );\n }\n\n ctx.output('annotatedObject', result);\n },\n });\n};\n"],"names":["createTemplateAction","getObjectToAnnotate","resolveSpec","yaml","fs","resolveSafeChildPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,wBAAwB,CACnC,QAAA,GAAmB,kBACnB,EAAA,iBAAA,EACA,eACA,4BAKG,KAAA;AACH,EAAA,OAAOA,yCAOJ,CAAA;AAAA,IACD,EAAI,EAAA,QAAA;AAAA,IACJ,aACE,iBACA,IAAA,8HAAA;AAAA,IACF,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,MAAQ,EAAA;AAAA,YACN,KAAO,EAAA,QAAA;AAAA,YACP,WACE,EAAA,2EAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,WAAa,EAAA;AAAA,YACX,KAAO,EAAA,aAAA;AAAA,YACP,WACE,EAAA,qFAAA;A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ator.cjs.js","sources":["../../../src/actions/annotator/annotator.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { resolveSafeChildPath } from '@backstage/backend-plugin-api';\nimport {\n createTemplateAction,\n TemplateExample,\n} from '@backstage/plugin-scaffolder-node';\n\nimport * as fs from 'fs-extra';\nimport * as yaml from 'yaml';\n\nimport { getObjectToAnnotate } from '../../utils/getObjectToAnnotate';\nimport { resolveSpec, Value } from '../../utils/resolveSpec';\nimport { resolveAnnotation } from '../../utils/resolveAnnotation';\n\n/**\n * Creates a new Scaffolder action to annotate an entity object with specified label(s), annotation(s) and spec property(ies).\n *\n */\n\nexport const createAnnotatorAction = (\n actionId: string = 'catalog:annotate',\n actionDescription?: string,\n loggerInfoMsg?: string,\n annotateEntityObjectProvider?: () => {\n annotations?: { [key: string]: Value };\n labels?: { [key: string]: string };\n spec?: { [key: string]: Value };\n },\n examples?: TemplateExample[],\n) => {\n return createTemplateAction<{\n labels?: { [key: string]: string };\n annotations?: { [key: string]: string };\n spec?: { [key: string]: string };\n entityFilePath?: string;\n objectYaml?: { [key: string]: string };\n writeToFile?: string;\n }>({\n id: actionId,\n examples,\n description:\n actionDescription ||\n 'Creates a new scaffolder action to annotate the entity object with specified label(s), annotation(s) and spec property(ies).',\n schema: {\n input: {\n type: 'object',\n properties: {\n labels: {\n title: 'Labels',\n description:\n 'Labels that will be applied to the `metadata.labels` of the entity object',\n type: 'object',\n },\n annotations: {\n title: 'Annotations',\n description:\n 'Annotations that will be applied to the `metadata.annotations` of the entity object',\n type: 'object',\n },\n spec: {\n title: 'Spec',\n description:\n 'Key-Value pair(s) that will be applied to the `spec` of the entity object',\n type: 'object',\n },\n entityFilePath: {\n title: 'Entity File Path',\n description: 'Path to the entity yaml you want to annotate',\n type: 'string',\n },\n objectYaml: {\n title: 'Object Yaml',\n description: 'Entity object yaml you want to annotate',\n type: 'object',\n },\n writeToFile: {\n title: 'Write To File',\n description:\n 'Path to the file you want to write. Default path `./catalog-info.yaml`',\n type: 'string',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n annotatedObject: {\n type: 'object',\n title:\n 'The entity object annotated with your desired annotation(s), label(s) and spec property(ies)',\n },\n },\n },\n },\n async handler(ctx) {\n const annotateEntityObject = annotateEntityObjectProvider?.();\n let objToAnnotate: { [key: string]: any };\n\n if (ctx.input?.objectYaml) {\n objToAnnotate = { ...ctx.input?.objectYaml };\n } else {\n objToAnnotate = await getObjectToAnnotate(\n ctx.workspacePath,\n ctx.input?.entityFilePath,\n );\n }\n const annotatedObj = {\n ...objToAnnotate,\n metadata: {\n ...objToAnnotate.metadata,\n annotations: {\n ...(objToAnnotate.metadata.annotations || {}),\n ...(annotateEntityObject?.annotations || {}),\n ...resolveAnnotation(annotateEntityObject?.annotations, ctx),\n ...(ctx.input?.annotations || {}),\n },\n labels: {\n ...(objToAnnotate.metadata.labels || {}),\n ...(annotateEntityObject?.labels || {}),\n ...(ctx.input?.labels || {}),\n },\n },\n spec: {\n ...(objToAnnotate.spec || {}),\n ...resolveSpec(annotateEntityObject?.spec, ctx),\n ...(ctx.input?.spec || {}),\n },\n };\n\n const result = yaml.stringify(annotatedObj);\n if (\n Object.keys(\n annotateEntityObject?.labels ||\n annotateEntityObject?.annotations ||\n annotateEntityObject?.spec ||\n ctx.input?.labels ||\n ctx.input?.annotations ||\n ctx.input?.spec ||\n {},\n ).length > 0\n ) {\n ctx.logger.info(loggerInfoMsg || 'Annotating your object');\n\n await fs.writeFile(\n resolveSafeChildPath(\n ctx.workspacePath,\n ctx.input?.writeToFile || './catalog-info.yaml',\n ),\n result,\n 'utf8',\n );\n }\n\n ctx.output('annotatedObject', result);\n },\n });\n};\n"],"names":["createTemplateAction","getObjectToAnnotate","resolveAnnotation","resolveSpec","yaml","fs","resolveSafeChildPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAM,wBAAwB,CACnC,QAAA,GAAmB,oBACnB,iBACA,EAAA,aAAA,EACA,8BAKA,QACG,KAAA;AACH,EAAA,OAAOA,yCAOJ,CAAA;AAAA,IACD,EAAI,EAAA,QAAA;AAAA,IACJ,QAAA;AAAA,IACA,aACE,iBACA,IAAA,8HAAA;AAAA,IACF,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,MAAQ,EAAA;AAAA,YACN,KAAO,EAAA,QAAA;AAAA,YACP,WACE,EAAA,2EAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,WAAa,EAAA;AAAA,YACX,KAAO,EAAA,aAAA;AAAA,YACP,WACE,EAAA,qFAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,IAAM,EAAA;AAAA,YACJ,KAAO,EAAA,MAAA;AAAA,YACP,WACE,EAAA,2EAAA;AAAA,YACF,IAAM,EAAA;AAAA,WACR;AAAA,UACA,cAAgB,EAAA;AAAA,YACd,KAAO,EAAA,kBAAA;AAAA,YACP,WAAa,EAAA,8CAAA;AAAA,YACb,IAAM,EAAA;AAAA,WACR;AAAA,UACA,UAAY,EAAA;AAAA,YACV,KAAO,EAAA,aAAA;AAAA,YACP,WAAa,EAAA,yCAAA;AAAA,YACb,IAAM,EAAA;AAAA,WACR;AAAA,UACA,WAAa,EAAA;AAAA,YACX,KAAO,EAAA,eAAA;AAAA,YACP,WACE,EAAA,wEAAA;AAAA,YACF,IAAM,EAAA;AAAA;AACR;AACF,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,QAAA;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,GAAI,GAAA,CAAI,KAAO,EAAA,IAAA,IAAQ;AAAC;AAC1B,OACF;AAEA,MAAM,MAAA,MAAA,GAASC,eAAK,CAAA,SAAA,CAAU,YAAY,CAAA;AAC1C,MAAA,IACE,MAAO,CAAA,IAAA;AAAA,QACL,oBAAsB,EAAA,MAAA,IACpB,oBAAsB,EAAA,WAAA,IACtB,sBAAsB,IACtB,IAAA,GAAA,CAAI,KAAO,EAAA,MAAA,IACX,IAAI,KAAO,EAAA,WAAA,IACX,GAAI,CAAA,KAAA,EAAO,QACX;AAAC,OACL,CAAE,SAAS,CACX,EAAA;AACA,QAAI,GAAA,CAAA,MAAA,CAAO,IAAK,CAAA,aAAA,IAAiB,wBAAwB,CAAA;AAEzD,QAAA,MAAMC,aAAG,CAAA,SAAA;AAAA,UACPC,qCAAA;AAAA,YACE,GAAI,CAAA,aAAA;AAAA,YACJ,GAAA,CAAI,OAAO,WAAe,IAAA;AAAA,WAC5B;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACF;AAAA;AAGF,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,MAAM,CAAA;AAAA;AACtC,GACD,CAAA;AACH;;;;"}
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var annotator = require('../annotator/annotator.cjs.js');
4
+ var createScaffoldedFromAction_examples = require('./createScaffoldedFromAction.examples.cjs.js');
4
5
 
5
6
  const createScaffoldedFromAction = () => {
6
7
  return annotator.createAnnotatorAction(
@@ -13,7 +14,8 @@ const createScaffoldedFromAction = () => {
13
14
  scaffoldedFrom: { readFromContext: "templateInfo.entityRef" }
14
15
  }
15
16
  };
16
- }
17
+ },
18
+ createScaffoldedFromAction_examples.examples
17
19
  );
18
20
  };
19
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"createScaffoldedFromAction.cjs.js","sources":["../../../src/actions/customActions/createScaffoldedFromAction.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { createAnnotatorAction } from '../annotator/annotator';\n\nexport const createScaffoldedFromAction = () => {\n return createAnnotatorAction(\n 'catalog:scaffolded-from',\n 'Creates a new `catalog:scaffolded-from` scaffolder action to update a catalog-info.yaml with the entityRef of the template that created it.',\n 'Annotating catalog-info.yaml with template entityRef',\n () => {\n return {\n spec: {\n scaffoldedFrom: { readFromContext: 'templateInfo.entityRef' },\n },\n };\n },\n );\n};\n"],"names":["createAnnotatorAction"],"mappings":";;;;AAiBO,MAAM,6BAA6B,MAAM;AAC9C,EAAO,OAAAA,+BAAA;AAAA,IACL,yBAAA;AAAA,IACA,6IAAA;AAAA,IACA,sDAAA;AAAA,IACA,MAAM;AACJ,MAAO,OAAA;AAAA,QACL,IAAM,EAAA;AAAA,UACJ,cAAA,EAAgB,EAAE,eAAA,EAAiB,wBAAyB;AAAA;AAC9D,OACF;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"createScaffoldedFromAction.cjs.js","sources":["../../../src/actions/customActions/createScaffoldedFromAction.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { createAnnotatorAction } from '../annotator/annotator';\nimport { examples } from './createScaffoldedFromAction.examples';\n\nexport const createScaffoldedFromAction = () => {\n return createAnnotatorAction(\n 'catalog:scaffolded-from',\n 'Creates a new `catalog:scaffolded-from` scaffolder action to update a catalog-info.yaml with the entityRef of the template that created it.',\n 'Annotating catalog-info.yaml with template entityRef',\n () => {\n return {\n spec: {\n scaffoldedFrom: { readFromContext: 'templateInfo.entityRef' },\n },\n };\n },\n examples,\n );\n};\n"],"names":["createAnnotatorAction","examples"],"mappings":";;;;;AAkBO,MAAM,6BAA6B,MAAM;AAC9C,EAAO,OAAAA,+BAAA;AAAA,IACL,yBAAA;AAAA,IACA,6IAAA;AAAA,IACA,sDAAA;AAAA,IACA,MAAM;AACJ,MAAO,OAAA;AAAA,QACL,IAAM,EAAA;AAAA,UACJ,cAAA,EAAgB,EAAE,eAAA,EAAiB,wBAAyB;AAAA;AAC9D,OACF;AAAA,KACF;AAAA,IACAC;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Template Example for annotating a catalog entity with the template entity reference",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "catalog:scaffolded-from",
16
+ name: "Annotate catalog-info.yaml with template entityRef."
17
+ }
18
+ ]
19
+ })
20
+ }
21
+ ];
22
+
23
+ exports.examples = examples;
24
+ //# sourceMappingURL=createScaffoldedFromAction.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createScaffoldedFromAction.examples.cjs.js","sources":["../../../src/actions/customActions/createScaffoldedFromAction.examples.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Template Example for annotating a catalog entity with the template entity reference',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:scaffolded-from',\n name: 'Annotate catalog-info.yaml with template entityRef.',\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,qFAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,yBAAA;AAAA,UACR,IAAM,EAAA;AAAA;AACR;AACF,KACD;AAAA;AAEL;;;;"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  var getCurrentTimestamp = require('../../utils/getCurrentTimestamp.cjs.js');
4
4
  var annotator = require('../annotator/annotator.cjs.js');
5
+ var createTimestampAction_examples = require('./createTimestampAction.examples.cjs.js');
5
6
 
6
7
  const createTimestampAction = () => {
7
8
  return annotator.createAnnotatorAction(
@@ -12,7 +13,8 @@ const createTimestampAction = () => {
12
13
  return {
13
14
  annotations: { "backstage.io/createdAt": getCurrentTimestamp.getCurrentTimestamp() }
14
15
  };
15
- }
16
+ },
17
+ createTimestampAction_examples.examples
16
18
  );
17
19
  };
18
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"createTimestampAction.cjs.js","sources":["../../../src/actions/customActions/createTimestampAction.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { getCurrentTimestamp } from '../../utils/getCurrentTimestamp';\nimport { createAnnotatorAction } from '../annotator/annotator';\n\nexport const createTimestampAction = () => {\n return createAnnotatorAction(\n 'catalog:timestamping',\n 'Creates a new `catalog:timestamping` Scaffolder action to annotate scaffolded entities with creation timestamp.',\n 'Annotating catalog-info.yaml with current timestamp',\n () => {\n return {\n annotations: { 'backstage.io/createdAt': getCurrentTimestamp() },\n };\n },\n );\n};\n"],"names":["createAnnotatorAction","getCurrentTimestamp"],"mappings":";;;;;AAkBO,MAAM,wBAAwB,MAAM;AACzC,EAAO,OAAAA,+BAAA;AAAA,IACL,sBAAA;AAAA,IACA,iHAAA;AAAA,IACA,qDAAA;AAAA,IACA,MAAM;AACJ,MAAO,OAAA;AAAA,QACL,WAAa,EAAA,EAAE,wBAA0B,EAAAC,uCAAA,EAAsB;AAAA,OACjE;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"createTimestampAction.cjs.js","sources":["../../../src/actions/customActions/createTimestampAction.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { getCurrentTimestamp } from '../../utils/getCurrentTimestamp';\nimport { createAnnotatorAction } from '../annotator/annotator';\nimport { examples } from './createTimestampAction.examples';\n\nexport const createTimestampAction = () => {\n return createAnnotatorAction(\n 'catalog:timestamping',\n 'Creates a new `catalog:timestamping` Scaffolder action to annotate scaffolded entities with creation timestamp.',\n 'Annotating catalog-info.yaml with current timestamp',\n () => {\n return {\n annotations: { 'backstage.io/createdAt': getCurrentTimestamp() },\n };\n },\n examples,\n );\n};\n"],"names":["createAnnotatorAction","getCurrentTimestamp","examples"],"mappings":";;;;;;AAmBO,MAAM,wBAAwB,MAAM;AACzC,EAAO,OAAAA,+BAAA;AAAA,IACL,sBAAA;AAAA,IACA,iHAAA;AAAA,IACA,qDAAA;AAAA,IACA,MAAM;AACJ,MAAO,OAAA;AAAA,QACL,WAAa,EAAA,EAAE,wBAA0B,EAAAC,uCAAA,EAAsB;AAAA,OACjE;AAAA,KACF;AAAA,IACAC;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Template Example for annotating a catalog entity with the current timestamp",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "catalog:timestamping",
16
+ name: "Annotate catalog-info.yaml with the current timestamp."
17
+ }
18
+ ]
19
+ })
20
+ }
21
+ ];
22
+
23
+ exports.examples = examples;
24
+ //# sourceMappingURL=createTimestampAction.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTimestampAction.examples.cjs.js","sources":["../../../src/actions/customActions/createTimestampAction.examples.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Template Example for annotating a catalog entity with the current timestamp',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:timestamping',\n name: 'Annotate catalog-info.yaml with the current timestamp.',\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,6EAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,sBAAA;AAAA,UACR,IAAM,EAAA;AAAA;AACR;AACF,KACD;AAAA;AAEL;;;;"}
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var annotator = require('../annotator/annotator.cjs.js');
4
+ var createVersionAction_examples = require('./createVersionAction.examples.cjs.js');
5
+
6
+ const createVersionAction = () => {
7
+ return annotator.createAnnotatorAction(
8
+ "catalog:template:version",
9
+ "Creates a new `catalog:template:version` scaffolder action to update a catalog-info.yaml with the versioning information from the scaffolder template",
10
+ "Annotating catalog-info.yaml with the version of the scaffolder template",
11
+ () => {
12
+ return {
13
+ annotations: {
14
+ "backstage.io/template-version": {
15
+ readFromContext: "templateInfo.entity.metadata.annotations"
16
+ }
17
+ }
18
+ };
19
+ },
20
+ createVersionAction_examples.examples
21
+ );
22
+ };
23
+
24
+ exports.createVersionAction = createVersionAction;
25
+ //# sourceMappingURL=createVersionAction.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVersionAction.cjs.js","sources":["../../../src/actions/customActions/createVersionAction.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { createAnnotatorAction } from '../annotator/annotator';\nimport { examples } from './createVersionAction.examples';\n\nexport const createVersionAction = () => {\n return createAnnotatorAction(\n 'catalog:template:version',\n 'Creates a new `catalog:template:version` scaffolder action to update a catalog-info.yaml with the versioning information from the scaffolder template',\n 'Annotating catalog-info.yaml with the version of the scaffolder template',\n () => {\n return {\n annotations: {\n 'backstage.io/template-version': {\n readFromContext: 'templateInfo.entity.metadata.annotations',\n },\n },\n };\n },\n examples,\n );\n};\n"],"names":["createAnnotatorAction","examples"],"mappings":";;;;;AAkBO,MAAM,sBAAsB,MAAM;AACvC,EAAO,OAAAA,+BAAA;AAAA,IACL,0BAAA;AAAA,IACA,uJAAA;AAAA,IACA,0EAAA;AAAA,IACA,MAAM;AACJ,MAAO,OAAA;AAAA,QACL,WAAa,EAAA;AAAA,UACX,+BAAiC,EAAA;AAAA,YAC/B,eAAiB,EAAA;AAAA;AACnB;AACF,OACF;AAAA,KACF;AAAA,IACAC;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Template Example for annotating a catalog entity with the version of the scaffolder template",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ action: "catalog:template:version",
16
+ name: "Annotate catalog-info.yaml with the version of the scaffolder template."
17
+ }
18
+ ]
19
+ })
20
+ },
21
+ {
22
+ description: "Template Example for annotating a catalog entity with the version of the scaffolder template as input",
23
+ example: yaml__default.default.stringify({
24
+ steps: [
25
+ {
26
+ action: "catalog:template:version",
27
+ name: "Annotate catalog-info.yaml with the version of the scaffolder template.",
28
+ input: {
29
+ annotations: {
30
+ "backstage.io/template-version": "templateVersionParameterValue"
31
+ }
32
+ }
33
+ }
34
+ ]
35
+ })
36
+ }
37
+ ];
38
+
39
+ exports.examples = examples;
40
+ //# sourceMappingURL=createVersionAction.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVersionAction.examples.cjs.js","sources":["../../../src/actions/customActions/createVersionAction.examples.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Template Example for annotating a catalog entity with the version of the scaffolder template',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:template:version',\n name: 'Annotate catalog-info.yaml with the version of the scaffolder template.',\n },\n ],\n }),\n },\n {\n description:\n 'Template Example for annotating a catalog entity with the version of the scaffolder template as input',\n example: yaml.stringify({\n steps: [\n {\n action: 'catalog:template:version',\n name: 'Annotate catalog-info.yaml with the version of the scaffolder template.',\n input: {\n annotations: {\n 'backstage.io/template-version': 'templateVersionParameterValue',\n },\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,8FAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,0BAAA;AAAA,UACR,IAAM,EAAA;AAAA;AACR;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,uGAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,0BAAA;AAAA,UACR,IAAM,EAAA,yEAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,WAAa,EAAA;AAAA,cACX,+BAAiC,EAAA;AAAA;AACnC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
package/dist/index.cjs.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var annotator = require('./actions/annotator/annotator.cjs.js');
6
6
  var createTimestampAction = require('./actions/customActions/createTimestampAction.cjs.js');
7
7
  var createScaffoldedFromAction = require('./actions/customActions/createScaffoldedFromAction.cjs.js');
8
+ var createVersionAction = require('./actions/customActions/createVersionAction.cjs.js');
8
9
  var module$1 = require('./module.cjs.js');
9
10
 
10
11
 
@@ -12,5 +13,6 @@ var module$1 = require('./module.cjs.js');
12
13
  exports.createAnnotatorAction = annotator.createAnnotatorAction;
13
14
  exports.createTimestampAction = createTimestampAction.createTimestampAction;
14
15
  exports.createScaffoldedFromAction = createScaffoldedFromAction.createScaffoldedFromAction;
16
+ exports.createVersionAction = createVersionAction.createVersionAction;
15
17
  exports.default = module$1.scaffolderCustomActionsScaffolderModule;
16
18
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
2
+ import { TemplateExample } from '@backstage/plugin-scaffolder-node';
2
3
  import * as _backstage_types_index from '@backstage/types/index';
3
4
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
4
5
 
@@ -12,7 +13,7 @@ type Value = string | {
12
13
  */
13
14
  declare const createAnnotatorAction: (actionId?: string, actionDescription?: string, loggerInfoMsg?: string, annotateEntityObjectProvider?: (() => {
14
15
  annotations?: {
15
- [key: string]: string;
16
+ [key: string]: Value;
16
17
  } | undefined;
17
18
  labels?: {
18
19
  [key: string]: string;
@@ -20,7 +21,7 @@ declare const createAnnotatorAction: (actionId?: string, actionDescription?: str
20
21
  spec?: {
21
22
  [key: string]: Value;
22
23
  } | undefined;
23
- }) | undefined) => _backstage_plugin_scaffolder_node.TemplateAction<{
24
+ }) | undefined, examples?: TemplateExample[]) => _backstage_plugin_scaffolder_node.TemplateAction<{
24
25
  labels?: {
25
26
  [key: string]: string;
26
27
  } | undefined;
@@ -71,6 +72,23 @@ declare const createScaffoldedFromAction: () => _backstage_plugin_scaffolder_nod
71
72
  writeToFile?: string | undefined;
72
73
  }, _backstage_types_index.JsonObject, "v1">;
73
74
 
75
+ declare const createVersionAction: () => _backstage_plugin_scaffolder_node.TemplateAction<{
76
+ labels?: {
77
+ [key: string]: string;
78
+ } | undefined;
79
+ annotations?: {
80
+ [key: string]: string;
81
+ } | undefined;
82
+ spec?: {
83
+ [key: string]: string;
84
+ } | undefined;
85
+ entityFilePath?: string | undefined;
86
+ objectYaml?: {
87
+ [key: string]: string;
88
+ } | undefined;
89
+ writeToFile?: string | undefined;
90
+ }, _backstage_types_index.JsonObject, "v1">;
91
+
74
92
  /***/
75
93
  /**
76
94
  * The annotator module for @backstage/plugin-scaffolder-backend.
@@ -79,4 +97,4 @@ declare const createScaffoldedFromAction: () => _backstage_plugin_scaffolder_nod
79
97
  */
80
98
  declare const scaffolderCustomActionsScaffolderModule: _backstage_backend_plugin_api.BackendFeature;
81
99
 
82
- export { createAnnotatorAction, createScaffoldedFromAction, createTimestampAction, scaffolderCustomActionsScaffolderModule as default };
100
+ export { createAnnotatorAction, createScaffoldedFromAction, createTimestampAction, createVersionAction, scaffolderCustomActionsScaffolderModule as default };
@@ -5,6 +5,7 @@ var alpha = require('@backstage/plugin-scaffolder-node/alpha');
5
5
  var annotator = require('./actions/annotator/annotator.cjs.js');
6
6
  var createTimestampAction = require('./actions/customActions/createTimestampAction.cjs.js');
7
7
  var createScaffoldedFromAction = require('./actions/customActions/createScaffoldedFromAction.cjs.js');
8
+ var createVersionAction = require('./actions/customActions/createVersionAction.cjs.js');
8
9
 
9
10
  const scaffolderCustomActionsScaffolderModule = backendPluginApi.createBackendModule({
10
11
  moduleId: "scaffolder-backend-scaffolder-annotator",
@@ -18,6 +19,7 @@ const scaffolderCustomActionsScaffolderModule = backendPluginApi.createBackendMo
18
19
  scaffolder.addActions(createScaffoldedFromAction.createScaffoldedFromAction());
19
20
  scaffolder.addActions(createTimestampAction.createTimestampAction());
20
21
  scaffolder.addActions(annotator.createAnnotatorAction());
22
+ scaffolder.addActions(createVersionAction.createVersionAction());
21
23
  }
22
24
  });
23
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\n\nimport {\n createAnnotatorAction,\n createScaffoldedFromAction,\n createTimestampAction,\n} from './actions';\n\n/***/\n/**\n * The annotator module for @backstage/plugin-scaffolder-backend.\n *\n * @alpha\n */\nexport const scaffolderCustomActionsScaffolderModule = createBackendModule({\n moduleId: 'scaffolder-backend-scaffolder-annotator',\n pluginId: 'scaffolder',\n register(env) {\n env.registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n },\n async init({ scaffolder }) {\n scaffolder.addActions(createScaffoldedFromAction());\n scaffolder.addActions(createTimestampAction());\n scaffolder.addActions(createAnnotatorAction());\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","createScaffoldedFromAction","createTimestampAction","createAnnotatorAction"],"mappings":";;;;;;;;AA8BO,MAAM,0CAA0CA,oCAAoB,CAAA;AAAA,EACzE,QAAU,EAAA,yCAAA;AAAA,EACV,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC;AAAA,OACd;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,UAAA,EAAc,EAAA;AACzB,QAAW,UAAA,CAAA,UAAA,CAAWC,uDAA4B,CAAA;AAClD,QAAW,UAAA,CAAA,UAAA,CAAWC,6CAAuB,CAAA;AAC7C,QAAW,UAAA,CAAA,UAAA,CAAWC,iCAAuB,CAAA;AAAA;AAC/C,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { createBackendModule } from '@backstage/backend-plugin-api';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\n\nimport {\n createAnnotatorAction,\n createScaffoldedFromAction,\n createTimestampAction,\n createVersionAction,\n} from './actions';\n\n/***/\n/**\n * The annotator module for @backstage/plugin-scaffolder-backend.\n *\n * @alpha\n */\nexport const scaffolderCustomActionsScaffolderModule = createBackendModule({\n moduleId: 'scaffolder-backend-scaffolder-annotator',\n pluginId: 'scaffolder',\n register(env) {\n env.registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n },\n async init({ scaffolder }) {\n scaffolder.addActions(createScaffoldedFromAction());\n scaffolder.addActions(createTimestampAction());\n scaffolder.addActions(createAnnotatorAction());\n scaffolder.addActions(createVersionAction());\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","createScaffoldedFromAction","createTimestampAction","createAnnotatorAction","createVersionAction"],"mappings":";;;;;;;;;AA+BO,MAAM,0CAA0CA,oCAAoB,CAAA;AAAA,EACzE,QAAU,EAAA,yCAAA;AAAA,EACV,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC;AAAA,OACd;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,UAAA,EAAc,EAAA;AACzB,QAAW,UAAA,CAAA,UAAA,CAAWC,uDAA4B,CAAA;AAClD,QAAW,UAAA,CAAA,UAAA,CAAWC,6CAAuB,CAAA;AAC7C,QAAW,UAAA,CAAA,UAAA,CAAWC,iCAAuB,CAAA;AAC7C,QAAW,UAAA,CAAA,UAAA,CAAWC,yCAAqB,CAAA;AAAA;AAC7C,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var lodash = require('lodash');
4
+
5
+ const resolveAnnotation = (annotation, ctx) => {
6
+ if (!annotation || Object.keys(annotation).length === 0) {
7
+ return {};
8
+ }
9
+ return Object.keys(annotation).reduce((acc, s) => {
10
+ const val = annotation[s];
11
+ return {
12
+ ...acc,
13
+ ...{
14
+ [`${s}`]: typeof val === "string" ? annotation[s] : lodash.get(ctx, val.readFromContext)["backstage.io/template-version"]
15
+ }
16
+ };
17
+ }, {});
18
+ };
19
+
20
+ exports.resolveAnnotation = resolveAnnotation;
21
+ //# sourceMappingURL=resolveAnnotation.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAnnotation.cjs.js","sources":["../../src/utils/resolveAnnotation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport type { ActionContext } from '@backstage/plugin-scaffolder-node';\n\nimport { get } from 'lodash';\nimport { Value } from './resolveSpec';\n\nexport const resolveAnnotation = (\n annotation: { [key: string]: Value } | undefined,\n ctx: ActionContext<any>,\n) => {\n if (!annotation || Object.keys(annotation).length === 0) {\n return {};\n }\n return Object.keys(annotation).reduce((acc, s) => {\n const val = annotation[s];\n return {\n ...acc,\n ...{\n [`${s}`]:\n typeof val === 'string'\n ? annotation[s]\n : get(ctx, val.readFromContext)!['backstage.io/template-version'],\n },\n };\n }, {});\n};\n"],"names":["get"],"mappings":";;;;AAoBa,MAAA,iBAAA,GAAoB,CAC/B,UAAA,EACA,GACG,KAAA;AACH,EAAA,IAAI,CAAC,UAAc,IAAA,MAAA,CAAO,KAAK,UAAU,CAAA,CAAE,WAAW,CAAG,EAAA;AACvD,IAAA,OAAO,EAAC;AAAA;AAEV,EAAA,OAAO,OAAO,IAAK,CAAA,UAAU,EAAE,MAAO,CAAA,CAAC,KAAK,CAAM,KAAA;AAChD,IAAM,MAAA,GAAA,GAAM,WAAW,CAAC,CAAA;AACxB,IAAO,OAAA;AAAA,MACL,GAAG,GAAA;AAAA,MACH,GAAG;AAAA,QACD,CAAC,CAAG,EAAA,CAAC,CAAE,CAAA,GACL,OAAO,GAAQ,KAAA,QAAA,GACX,UAAW,CAAA,CAAC,IACZA,UAAI,CAAA,GAAA,EAAK,GAAI,CAAA,eAAe,EAAG,+BAA+B;AAAA;AACtE,KACF;AAAA,GACF,EAAG,EAAE,CAAA;AACP;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-scaffolder-backend-module-annotator",
3
3
  "description": "The annotator module for @backstage/plugin-scaffolder-backend",
4
- "version": "2.7.0",
4
+ "version": "2.8.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -10,7 +10,6 @@
10
10
  },
11
11
  "backstage": {
12
12
  "role": "backend-plugin-module",
13
- "supported-versions": "1.32.5",
14
13
  "pluginId": "scaffolder",
15
14
  "pluginPackage": "@backstage/plugin-scaffolder-backend",
16
15
  "features": {
@@ -57,6 +56,7 @@
57
56
  "devDependencies": {
58
57
  "@backstage/backend-test-utils": "^1.5.0",
59
58
  "@backstage/cli": "^0.32.1",
59
+ "@backstage/plugin-scaffolder-node-test-utils": "^0.2.2",
60
60
  "@types/fs-extra": "^11.0.4",
61
61
  "@types/lodash": "^4.17.13"
62
62
  },
@@ -70,8 +70,6 @@
70
70
  "directory": "workspaces/scaffolder-backend-module-annotator/plugins/scaffolder-backend-module-annotator"
71
71
  },
72
72
  "keywords": [
73
- "support:tech-preview",
74
- "lifecycle:active",
75
73
  "backstage",
76
74
  "plugin"
77
75
  ],