@backstage/cli 0.30.0-next.1 → 0.30.0-next.3

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.
Files changed (142) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/config/jestSwcTransform.js +1 -1
  3. package/dist/commands/index.cjs.js +3 -0
  4. package/dist/commands/new/new.cjs.js +39 -80
  5. package/dist/commands/versions/bump.cjs.js +2 -0
  6. package/dist/lib/builder/plugins.cjs.js +20 -1
  7. package/dist/lib/new/createNewPackage.cjs.js +32 -0
  8. package/dist/lib/new/defaultTemplates.cjs.js +16 -0
  9. package/dist/lib/new/execution/PortableTemplater.cjs.js +91 -0
  10. package/dist/lib/new/execution/executePortableTemplate.cjs.js +54 -0
  11. package/dist/lib/new/execution/installNewPackage.cjs.js +127 -0
  12. package/dist/lib/new/execution/writeTemplateContents.cjs.js +111 -0
  13. package/dist/lib/new/preparation/collectPortableTemplateInput.cjs.js +157 -0
  14. package/dist/lib/new/preparation/loadPortableTemplate.cjs.js +82 -0
  15. package/dist/lib/new/preparation/loadPortableTemplateConfig.cjs.js +121 -0
  16. package/dist/lib/new/preparation/resolvePackageParams.cjs.js +40 -0
  17. package/dist/lib/new/preparation/selectTemplateInteractively.cjs.js +38 -0
  18. package/dist/lib/new/types.cjs.js +15 -4
  19. package/dist/lib/packager/createDistWorkspace.cjs.js +6 -8
  20. package/dist/lib/packager/productionPack.cjs.js +3 -0
  21. package/dist/lib/tasks.cjs.js +0 -111
  22. package/dist/lib/typeDistProject.cjs.js +2 -7
  23. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  24. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  25. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  26. package/dist/packages/cli/package.json.cjs.js +3 -3
  27. package/dist/packages/core-components/package.json.cjs.js +1 -1
  28. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  29. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  30. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  31. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  32. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  33. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  34. package/package.json +13 -13
  35. package/templates/{default-backend-plugin → backend-plugin}/README.md.hbs +4 -4
  36. package/templates/{default-backend-plugin → backend-plugin}/dev/index.ts.hbs +5 -5
  37. package/templates/{default-backend-plugin → backend-plugin}/package.json.hbs +1 -9
  38. package/templates/backend-plugin/portable-template.yaml +5 -0
  39. package/templates/{default-backend-plugin → backend-plugin}/src/plugin.test.ts.hbs +5 -5
  40. package/templates/{default-backend-plugin → backend-plugin}/src/plugin.ts.hbs +1 -1
  41. package/templates/{default-backend-module → backend-plugin-module}/README.md.hbs +1 -1
  42. package/templates/{default-backend-module → backend-plugin-module}/package.json.hbs +1 -9
  43. package/templates/backend-plugin-module/portable-template.yaml +5 -0
  44. package/templates/{default-plugin → frontend-plugin}/README.md.hbs +3 -3
  45. package/templates/{default-plugin → frontend-plugin}/dev/index.tsx.hbs +1 -1
  46. package/templates/{default-plugin → frontend-plugin}/package.json.hbs +1 -9
  47. package/templates/frontend-plugin/portable-template.yaml +6 -0
  48. package/templates/{default-plugin → frontend-plugin}/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +1 -1
  49. package/templates/{default-plugin → frontend-plugin}/src/components/ExampleComponent/ExampleComponent.tsx.hbs +1 -1
  50. package/templates/{default-plugin → frontend-plugin}/src/plugin.test.ts.hbs +1 -1
  51. package/templates/{default-plugin → frontend-plugin}/src/plugin.ts.hbs +1 -1
  52. package/templates/{default-plugin → frontend-plugin}/src/routes.ts.hbs +1 -1
  53. package/templates/{node-library-package → node-library}/README.md.hbs +2 -2
  54. package/templates/{node-library-package → node-library}/package.json.hbs +1 -9
  55. package/templates/node-library/portable-template.yaml +3 -0
  56. package/templates/plugin-common-library/README.md.hbs +5 -0
  57. package/templates/{default-common-plugin-package → plugin-common-library}/package.json.hbs +2 -10
  58. package/templates/plugin-common-library/portable-template.yaml +3 -0
  59. package/templates/{default-common-plugin-package → plugin-common-library}/src/index.ts.hbs +1 -1
  60. package/templates/plugin-node-library/README.md.hbs +5 -0
  61. package/templates/{default-node-plugin-package → plugin-node-library}/package.json.hbs +2 -10
  62. package/templates/plugin-node-library/portable-template.yaml +3 -0
  63. package/templates/{default-node-plugin-package → plugin-node-library}/src/index.ts.hbs +1 -1
  64. package/templates/plugin-web-library/README.md.hbs +5 -0
  65. package/templates/{default-react-plugin-package → plugin-web-library}/package.json.hbs +2 -10
  66. package/templates/plugin-web-library/portable-template.yaml +3 -0
  67. package/templates/{default-react-plugin-package → plugin-web-library}/src/index.ts.hbs +1 -1
  68. package/templates/scaffolder-backend-module/README.md.hbs +5 -0
  69. package/templates/{scaffolder-module → scaffolder-backend-module}/package.json.hbs +2 -10
  70. package/templates/scaffolder-backend-module/portable-template.yaml +6 -0
  71. package/templates/{scaffolder-module → scaffolder-backend-module}/src/index.ts.hbs +1 -1
  72. package/templates/{web-library-package → web-library}/README.md.hbs +2 -2
  73. package/templates/{web-library-package → web-library}/package.json.hbs +1 -9
  74. package/templates/web-library/portable-template.yaml +3 -0
  75. package/dist/lib/new/FactoryRegistry.cjs.js +0 -96
  76. package/dist/lib/new/factories/backendModule.cjs.js +0 -82
  77. package/dist/lib/new/factories/backendPlugin.cjs.js +0 -78
  78. package/dist/lib/new/factories/common/prompts.cjs.js +0 -57
  79. package/dist/lib/new/factories/common/tasks.cjs.js +0 -66
  80. package/dist/lib/new/factories/common/util.cjs.js +0 -16
  81. package/dist/lib/new/factories/frontendPlugin.cjs.js +0 -107
  82. package/dist/lib/new/factories/index.cjs.js +0 -24
  83. package/dist/lib/new/factories/nodeLibraryPackage.cjs.js +0 -57
  84. package/dist/lib/new/factories/pluginCommon.cjs.js +0 -58
  85. package/dist/lib/new/factories/pluginNode.cjs.js +0 -58
  86. package/dist/lib/new/factories/pluginWeb.cjs.js +0 -58
  87. package/dist/lib/new/factories/scaffolderModule.cjs.js +0 -90
  88. package/dist/lib/new/factories/webLibraryPackage.cjs.js +0 -57
  89. package/templates/default-backend-module/tsconfig.json +0 -9
  90. package/templates/default-backend-plugin/tsconfig.json +0 -13
  91. package/templates/default-common-plugin-package/README.md.hbs +0 -5
  92. package/templates/default-common-plugin-package/tsconfig.json +0 -9
  93. package/templates/default-node-plugin-package/README.md.hbs +0 -5
  94. package/templates/default-node-plugin-package/tsconfig.json +0 -9
  95. package/templates/default-plugin/tsconfig.json +0 -12
  96. package/templates/default-react-plugin-package/README.md.hbs +0 -5
  97. package/templates/default-react-plugin-package/tsconfig.json +0 -11
  98. package/templates/node-library-package/tsconfig.json +0 -11
  99. package/templates/scaffolder-module/README.md.hbs +0 -5
  100. package/templates/scaffolder-module/tsconfig.json +0 -9
  101. package/templates/web-library-package/tsconfig.json +0 -11
  102. /package/templates/{default-backend-plugin → backend-plugin}/.eslintrc.js.hbs +0 -0
  103. /package/templates/{default-backend-plugin → backend-plugin}/src/index.ts.hbs +0 -0
  104. /package/templates/{default-backend-plugin → backend-plugin}/src/router.test.ts +0 -0
  105. /package/templates/{default-backend-plugin → backend-plugin}/src/router.ts +0 -0
  106. /package/templates/{default-backend-plugin → backend-plugin}/src/services/TodoListService/createTodoListService.ts +0 -0
  107. /package/templates/{default-backend-plugin → backend-plugin}/src/services/TodoListService/index.ts +0 -0
  108. /package/templates/{default-backend-plugin → backend-plugin}/src/services/TodoListService/types.ts +0 -0
  109. /package/templates/{default-backend-plugin → backend-plugin}/src/setupTests.ts +0 -0
  110. /package/templates/{default-backend-module → backend-plugin-module}/.eslintrc.js.hbs +0 -0
  111. /package/templates/{default-backend-module → backend-plugin-module}/src/index.ts.hbs +0 -0
  112. /package/templates/{default-backend-module → backend-plugin-module}/src/module.ts.hbs +0 -0
  113. /package/templates/{default-common-plugin-package → frontend-plugin}/.eslintrc.js.hbs +0 -0
  114. /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleComponent/index.ts +0 -0
  115. /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -0
  116. /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -0
  117. /package/templates/{default-plugin → frontend-plugin}/src/components/ExampleFetchComponent/index.ts +0 -0
  118. /package/templates/{default-plugin → frontend-plugin}/src/index.ts.hbs +0 -0
  119. /package/templates/{default-plugin → frontend-plugin}/src/setupTests.ts +0 -0
  120. /package/templates/{default-node-plugin-package → node-library}/.eslintrc.js.hbs +0 -0
  121. /package/templates/{node-library-package → node-library}/src/index.ts.hbs +0 -0
  122. /package/templates/{default-common-plugin-package → node-library}/src/setupTests.ts +0 -0
  123. /package/templates/{default-plugin → plugin-common-library}/.eslintrc.js.hbs +0 -0
  124. /package/templates/{default-node-plugin-package → plugin-common-library}/src/setupTests.ts +0 -0
  125. /package/templates/{default-react-plugin-package → plugin-node-library}/.eslintrc.js.hbs +0 -0
  126. /package/templates/{node-library-package → plugin-node-library}/src/setupTests.ts +0 -0
  127. /package/templates/{node-library-package → plugin-web-library}/.eslintrc.js.hbs +0 -0
  128. /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -0
  129. /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/ExampleComponent/ExampleComponent.tsx +0 -0
  130. /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/ExampleComponent/index.ts +0 -0
  131. /package/templates/{default-react-plugin-package → plugin-web-library}/src/components/index.ts +0 -0
  132. /package/templates/{default-react-plugin-package → plugin-web-library}/src/hooks/index.ts +0 -0
  133. /package/templates/{default-react-plugin-package → plugin-web-library}/src/hooks/useExample/index.ts +0 -0
  134. /package/templates/{default-react-plugin-package → plugin-web-library}/src/hooks/useExample/useExample.ts +0 -0
  135. /package/templates/{default-react-plugin-package → plugin-web-library}/src/setupTests.ts +0 -0
  136. /package/templates/{scaffolder-module → scaffolder-backend-module}/.eslintrc.js.hbs +0 -0
  137. /package/templates/{scaffolder-module → scaffolder-backend-module}/src/actions/example.test.ts +0 -0
  138. /package/templates/{scaffolder-module → scaffolder-backend-module}/src/actions/example.ts +0 -0
  139. /package/templates/{scaffolder-module → scaffolder-backend-module}/src/module.ts +0 -0
  140. /package/templates/{web-library-package → web-library}/.eslintrc.js.hbs +0 -0
  141. /package/templates/{web-library-package → web-library}/src/index.ts.hbs +0 -0
  142. /package/templates/{web-library-package → web-library}/src/setupTests.ts +0 -0
@@ -1,23 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var fs = require('fs-extra');
5
- var handlebars = require('handlebars');
6
4
  var ora = require('ora');
7
5
  var util = require('util');
8
- var path = require('path');
9
- var recursive = require('recursive-readdir');
10
6
  var child_process = require('child_process');
11
7
  var errors = require('@backstage/errors');
12
- var paths = require('./paths.cjs.js');
13
8
 
14
9
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
15
10
 
16
11
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
17
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
18
- var handlebars__default = /*#__PURE__*/_interopDefaultCompat(handlebars);
19
12
  var ora__default = /*#__PURE__*/_interopDefaultCompat(ora);
20
- var recursive__default = /*#__PURE__*/_interopDefaultCompat(recursive);
21
13
 
22
14
  const exec = util.promisify(child_process.exec);
23
15
  const TASK_NAME_MAX_LENGTH = 14;
@@ -80,109 +72,6 @@ ${chalk__default.default.red(message)}
80
72
  }
81
73
  }
82
74
  }
83
- async function templatingTask(templateDir, destinationDir, context, versionProvider, isMonoRepo) {
84
- const files = await recursive__default.default(templateDir).catch((error) => {
85
- throw new Error(`Failed to read template directory: ${error.message}`);
86
- });
87
- for (const file of files) {
88
- const destinationFile = file.replace(templateDir, destinationDir);
89
- await fs__default.default.ensureDir(path.dirname(destinationFile));
90
- if (file.endsWith(".hbs")) {
91
- await Task.forItem("templating", path.basename(file), async () => {
92
- const destination = destinationFile.replace(/\.hbs$/, "");
93
- const template = await fs__default.default.readFile(file);
94
- const compiled = handlebars__default.default.compile(template.toString(), {
95
- strict: true
96
- });
97
- const contents = compiled(
98
- { name: path.basename(destination), ...context },
99
- {
100
- helpers: {
101
- versionQuery(name, versionHint) {
102
- return versionProvider(
103
- name,
104
- typeof versionHint === "string" ? versionHint : void 0
105
- );
106
- }
107
- }
108
- }
109
- );
110
- await fs__default.default.writeFile(destination, contents).catch((error) => {
111
- throw new Error(
112
- `Failed to create file: ${destination}: ${error.message}`
113
- );
114
- });
115
- });
116
- } else {
117
- if (isMonoRepo && file.match("tsconfig.json")) {
118
- continue;
119
- }
120
- await Task.forItem("copying", path.basename(file), async () => {
121
- await fs__default.default.copyFile(file, destinationFile).catch((error) => {
122
- const destination = destinationFile;
123
- throw new Error(
124
- `Failed to copy file to ${destination} : ${error.message}`
125
- );
126
- });
127
- });
128
- }
129
- }
130
- }
131
- async function addPackageDependency(path, options) {
132
- try {
133
- const pkgJson = await fs__default.default.readJson(path);
134
- const normalize = (obj) => {
135
- if (Object.keys(obj).length === 0) {
136
- return void 0;
137
- }
138
- return Object.fromEntries(
139
- Object.keys(obj).sort().map((key) => [key, obj[key]])
140
- );
141
- };
142
- pkgJson.dependencies = normalize({
143
- ...pkgJson.dependencies,
144
- ...options.dependencies
145
- });
146
- pkgJson.devDependencies = normalize({
147
- ...pkgJson.devDependencies,
148
- ...options.devDependencies
149
- });
150
- pkgJson.peerDependencies = normalize({
151
- ...pkgJson.peerDependencies,
152
- ...options.peerDependencies
153
- });
154
- await fs__default.default.writeJson(path, pkgJson, { spaces: 2 });
155
- } catch (error) {
156
- throw new Error(`Failed to add package dependencies, ${error}`);
157
- }
158
- }
159
- async function addToBackend(name, options) {
160
- if (await fs__default.default.pathExists(paths.paths.resolveTargetRoot("packages/backend"))) {
161
- await Task.forItem("backend", `adding ${options.type}`, async () => {
162
- const backendFilePath = paths.paths.resolveTargetRoot(
163
- "packages/backend/src/index.ts"
164
- );
165
- if (!await fs__default.default.pathExists(backendFilePath)) {
166
- return;
167
- }
168
- const content = await fs__default.default.readFile(backendFilePath, "utf8");
169
- const lines = content.split("\n");
170
- const backendAddLine = `backend.add(import('${name}'));`;
171
- const backendStartIndex = lines.findIndex(
172
- (line) => line.match(/backend.start/)
173
- );
174
- if (backendStartIndex !== -1) {
175
- const [indentation] = lines[backendStartIndex].match(/^\s*/);
176
- lines.splice(backendStartIndex, 0, `${indentation}${backendAddLine}`);
177
- const newContent = lines.join("\n");
178
- await fs__default.default.writeFile(backendFilePath, newContent, "utf8");
179
- }
180
- });
181
- }
182
- }
183
75
 
184
76
  exports.Task = Task;
185
- exports.addPackageDependency = addPackageDependency;
186
- exports.addToBackend = addToBackend;
187
- exports.templatingTask = templatingTask;
188
77
  //# sourceMappingURL=tasks.cjs.js.map
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var cliNode = require('@backstage/cli-node');
3
4
  var path = require('path');
4
5
  var tsMorph = require('ts-morph');
5
6
  var paths = require('./paths.cjs.js');
@@ -18,12 +19,6 @@ const targetPackageRoles = [
18
19
  "web-library",
19
20
  "node-library"
20
21
  ];
21
- const targetFeatureTypes = [
22
- "@backstage/BackendFeature",
23
- "@backstage/BackstagePlugin",
24
- "@backstage/FrontendPlugin",
25
- "@backstage/FrontendModule"
26
- ];
27
22
  const getEntryPointDefaultFeatureType = (role, packageDir, project, entryPoint) => {
28
23
  if (isTargetPackageRole(role)) {
29
24
  const distPath = path.resolve(packageDir, entryPoint);
@@ -86,7 +81,7 @@ function isTargetPackageRole(role) {
86
81
  return !!role && targetPackageRoles.includes(role);
87
82
  }
88
83
  function isTargetFeatureType(type) {
89
- return !!type && targetFeatureTypes.includes(type);
84
+ return !!type && cliNode.packageFeatureType.includes(type);
90
85
  }
91
86
 
92
87
  exports.createTypeDistProject = createTypeDistProject;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.8.0-next.1";
3
+ var version = "0.8.0-next.3";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.2.0-next.0";
3
+ var version = "1.2.0-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.3.0-next.1";
3
+ var version = "1.3.0-next.3";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.30.0-next.1";
3
+ var version = "0.30.0-next.3";
4
4
  var dependencies = {
5
5
  "@backstage/catalog-model": "workspace:^",
6
6
  "@backstage/cli-common": "workspace:^",
@@ -85,7 +85,6 @@ var dependencies = {
85
85
  "node-libs-browser": "^2.2.1",
86
86
  "npm-packlist": "^5.0.0",
87
87
  ora: "^5.3.0",
88
- "p-limit": "^3.1.0",
89
88
  "p-queue": "^6.6.2",
90
89
  pirates: "^4.0.6",
91
90
  postcss: "^8.1.0",
@@ -115,7 +114,8 @@ var dependencies = {
115
114
  yargs: "^16.2.0",
116
115
  "yml-loader": "^2.1.0",
117
116
  yn: "^4.0.0",
118
- zod: "^3.22.4"
117
+ zod: "^3.22.4",
118
+ "zod-validation-error": "^3.4.0"
119
119
  };
120
120
  var devDependencies = {
121
121
  "@backstage/backend-plugin-api": "workspace:^",
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.16.4-next.0";
3
+ var version = "0.16.4-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.1.7-next.1";
3
+ var version = "1.1.7-next.3";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.24.3-next.1";
3
+ var version = "0.24.3-next.3";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.2.5-next.0";
3
+ var version = "0.2.5-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.16.0-next.1";
3
+ var version = "1.16.0-next.3";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.7.0-next.0";
3
+ var version = "0.7.0-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.1.19-next.1";
3
+ var version = "0.1.19-next.3";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/cli",
3
- "version": "0.30.0-next.1",
3
+ "version": "0.30.0-next.3",
4
4
  "description": "CLI for developing Backstage plugins and apps",
5
5
  "backstage": {
6
6
  "role": "cli"
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "@backstage/catalog-model": "1.7.3",
51
51
  "@backstage/cli-common": "0.1.15",
52
- "@backstage/cli-node": "0.2.13-next.0",
52
+ "@backstage/cli-node": "0.2.13-next.1",
53
53
  "@backstage/config": "1.3.2",
54
54
  "@backstage/config-loader": "1.9.6-next.0",
55
55
  "@backstage/errors": "1.2.7",
@@ -130,7 +130,6 @@
130
130
  "node-libs-browser": "^2.2.1",
131
131
  "npm-packlist": "^5.0.0",
132
132
  "ora": "^5.3.0",
133
- "p-limit": "^3.1.0",
134
133
  "p-queue": "^6.6.2",
135
134
  "pirates": "^4.0.6",
136
135
  "postcss": "^8.1.0",
@@ -160,23 +159,24 @@
160
159
  "yargs": "^16.2.0",
161
160
  "yml-loader": "^2.1.0",
162
161
  "yn": "^4.0.0",
163
- "zod": "^3.22.4"
162
+ "zod": "^3.22.4",
163
+ "zod-validation-error": "^3.4.0"
164
164
  },
165
165
  "devDependencies": {
166
- "@backstage/backend-plugin-api": "1.2.0-next.0",
167
- "@backstage/backend-test-utils": "1.3.0-next.1",
166
+ "@backstage/backend-plugin-api": "1.2.0-next.2",
167
+ "@backstage/backend-test-utils": "1.3.0-next.3",
168
168
  "@backstage/catalog-client": "1.9.1",
169
169
  "@backstage/config": "1.3.2",
170
170
  "@backstage/core-app-api": "1.15.5-next.0",
171
- "@backstage/core-components": "0.16.4-next.0",
171
+ "@backstage/core-components": "0.16.4-next.1",
172
172
  "@backstage/core-plugin-api": "1.10.4-next.0",
173
- "@backstage/dev-utils": "1.1.7-next.1",
173
+ "@backstage/dev-utils": "1.1.7-next.3",
174
174
  "@backstage/errors": "1.2.7",
175
- "@backstage/plugin-auth-backend": "0.24.3-next.1",
176
- "@backstage/plugin-auth-backend-module-guest-provider": "0.2.5-next.0",
177
- "@backstage/plugin-catalog-node": "1.16.0-next.1",
178
- "@backstage/plugin-scaffolder-node": "0.7.0-next.0",
179
- "@backstage/plugin-scaffolder-node-test-utils": "0.1.19-next.1",
175
+ "@backstage/plugin-auth-backend": "0.24.3-next.3",
176
+ "@backstage/plugin-auth-backend-module-guest-provider": "0.2.5-next.2",
177
+ "@backstage/plugin-catalog-node": "1.16.0-next.3",
178
+ "@backstage/plugin-scaffolder-node": "0.7.0-next.2",
179
+ "@backstage/plugin-scaffolder-node-test-utils": "0.1.19-next.3",
180
180
  "@backstage/test-utils": "1.7.5-next.0",
181
181
  "@backstage/theme": "0.6.4-next.0",
182
182
  "@rspack/core": "^1.0.10",
@@ -1,14 +1,14 @@
1
- # {{id}}
1
+ # {{pluginId}}
2
2
 
3
3
  This plugin backend was templated using the Backstage CLI. You should replace this text with a description of your plugin backend.
4
4
 
5
5
  ## Installation
6
6
 
7
- This plugin is installed via the `{{name}}` package. To install it to your backend package, run the following command:
7
+ This plugin is installed via the `{{packageName}}` package. To install it to your backend package, run the following command:
8
8
 
9
9
  ```bash
10
10
  # From your root directory
11
- yarn --cwd packages/backend add {{name}}
11
+ yarn --cwd packages/backend add {{packageName}}
12
12
  ```
13
13
 
14
14
  Then add the plugin to your backend in `packages/backend/src/index.ts`:
@@ -16,7 +16,7 @@ Then add the plugin to your backend in `packages/backend/src/index.ts`:
16
16
  ```ts
17
17
  const backend = createBackend();
18
18
  // ...
19
- backend.add(import('{{name}}'));
19
+ backend.add(import('{{packageName}}'));
20
20
  ```
21
21
 
22
22
  ## Development
@@ -11,17 +11,17 @@ import { catalogServiceMock } from '@backstage/plugin-catalog-node/testUtils';
11
11
  //
12
12
  // Create a new todo item, standalone or for the sample component:
13
13
  //
14
- // curl http://localhost:7007/api/{{id}}/todos -H 'Content-Type: application/json' -d '{"title": "My Todo"}'
15
- // curl http://localhost:7007/api/{{id}}/todos -H 'Content-Type: application/json' -d '{"title": "My Todo", "entityRef": "component:default/sample"}'
14
+ // curl http://localhost:7007/api/{{pluginId}}/todos -H 'Content-Type: application/json' -d '{"title": "My Todo"}'
15
+ // curl http://localhost:7007/api/{{pluginId}}/todos -H 'Content-Type: application/json' -d '{"title": "My Todo", "entityRef": "component:default/sample"}'
16
16
  //
17
17
  // List TODOs:
18
18
  //
19
- // curl http://localhost:7007/api/{{id}}/todos
19
+ // curl http://localhost:7007/api/{{pluginId}}/todos
20
20
  //
21
21
  // Explicitly make an unauthenticated request, or with service auth:
22
22
  //
23
- // curl http://localhost:7007/api/{{id}}/todos -H 'Authorization: Bearer mock-none-token'
24
- // curl http://localhost:7007/api/{{id}}/todos -H 'Authorization: Bearer mock-service-token'
23
+ // curl http://localhost:7007/api/{{pluginId}}/todos -H 'Authorization: Bearer mock-none-token'
24
+ // curl http://localhost:7007/api/{{pluginId}}/todos -H 'Authorization: Bearer mock-service-token'
25
25
 
26
26
  const backend = createBackend();
27
27
 
@@ -1,16 +1,8 @@
1
1
  {
2
- "name": "{{name}}",
3
- "version": "{{pluginVersion}}",
2
+ "name": "{{packageName}}",
4
3
  "main": "src/index.ts",
5
4
  "types": "src/index.ts",
6
- "license": "{{license}}",
7
- {{#if privatePackage}}
8
- "private": {{privatePackage}},
9
- {{/if}}
10
5
  "publishConfig": {
11
- {{#if npmRegistry}}
12
- "registry": "{{npmRegistry}}",
13
- {{/if}}
14
6
  "access": "public",
15
7
  "main": "dist/index.cjs.js",
16
8
  "types": "dist/index.d.ts"
@@ -0,0 +1,5 @@
1
+ name: backend-plugin
2
+ role: backend-plugin
3
+ description: A new backend plugin
4
+ values:
5
+ pluginVar: '{{ camelCase pluginId }}Plugin'
@@ -17,12 +17,12 @@ describe('plugin', () => {
17
17
  features: [{{pluginVar}}],
18
18
  });
19
19
 
20
- await request(server).get('/api/{{id}}/todos').expect(200, {
20
+ await request(server).get('/api/{{pluginId}}/todos').expect(200, {
21
21
  items: [],
22
22
  });
23
23
 
24
24
  const createRes = await request(server)
25
- .post('/api/{{id}}/todos')
25
+ .post('/api/{{pluginId}}/todos')
26
26
  .send({ title: 'My Todo' });
27
27
 
28
28
  expect(createRes.status).toBe(201);
@@ -36,13 +36,13 @@ describe('plugin', () => {
36
36
  const createdTodoItem = createRes.body;
37
37
 
38
38
  await request(server)
39
- .get('/api/{{id}}/todos')
39
+ .get('/api/{{pluginId}}/todos')
40
40
  .expect(200, {
41
41
  items: [createdTodoItem],
42
42
  });
43
43
 
44
44
  await request(server)
45
- .get(`/api/{{id}}/todos/${createdTodoItem.id}`)
45
+ .get(`/api/{{pluginId}}/todos/${createdTodoItem.id}`)
46
46
  .expect(200, createdTodoItem);
47
47
  });
48
48
 
@@ -71,7 +71,7 @@ describe('plugin', () => {
71
71
  });
72
72
 
73
73
  const createRes = await request(server)
74
- .post('/api/{{id}}/todos')
74
+ .post('/api/{{pluginId}}/todos')
75
75
  .send({ title: 'My Todo', entityRef: 'component:default/my-component' });
76
76
 
77
77
  expect(createRes.status).toBe(201);
@@ -12,7 +12,7 @@ import { createTodoListService } from './services/TodoListService';
12
12
  * @public
13
13
  */
14
14
  export const {{pluginVar}} = createBackendPlugin({
15
- pluginId: '{{id}}',
15
+ pluginId: '{{pluginId}}',
16
16
  register(env) {
17
17
  env.registerInit({
18
18
  deps: {
@@ -1,4 +1,4 @@
1
- # {{name}}
1
+ # {{packageName}}
2
2
 
3
3
  The {{moduleId}} backend module for the {{pluginId}} plugin.
4
4
 
@@ -1,17 +1,9 @@
1
1
  {
2
- "name": "{{name}}",
2
+ "name": "{{packageName}}",
3
3
  "description": "The {{moduleId}} backend module for the {{pluginId}} plugin.",
4
- "version": "{{packageVersion}}",
5
4
  "main": "src/index.ts",
6
5
  "types": "src/index.ts",
7
- "license": "{{license}}",
8
- {{#if privatePackage}}
9
- "private": {{privatePackage}},
10
- {{/if}}
11
6
  "publishConfig": {
12
- {{#if npmRegistry}}
13
- "registry": "{{npmRegistry}}",
14
- {{/if}}
15
7
  "access": "public",
16
8
  "main": "dist/index.cjs.js",
17
9
  "types": "dist/index.d.ts"
@@ -0,0 +1,5 @@
1
+ name: backend-plugin-module
2
+ role: backend-plugin-module
3
+ description: A new backend module that extends an existing backend plugin
4
+ values:
5
+ moduleVar: '{{ camelCase pluginId }}Module{{ upperFirst ( camelCase moduleId ) }}'
@@ -1,12 +1,12 @@
1
- # {{id}}
1
+ # {{pluginId}}
2
2
 
3
- Welcome to the {{id}} plugin!
3
+ Welcome to the {{pluginId}} plugin!
4
4
 
5
5
  _This plugin was created through the Backstage CLI_
6
6
 
7
7
  ## Getting started
8
8
 
9
- Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/{{id}}](http://localhost:3000/{{id}}).
9
+ Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/{{pluginId}}](http://localhost:3000/{{pluginId}}).
10
10
 
11
11
  You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
12
12
  This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
@@ -7,6 +7,6 @@ createDevApp()
7
7
  .addPage({
8
8
  element: <{{ extensionName }} />,
9
9
  title: 'Root Page',
10
- path: '/{{ id }}',
10
+ path: '/{{pluginId}}',
11
11
  })
12
12
  .render();
@@ -1,16 +1,8 @@
1
1
  {
2
- "name": "{{name}}",
3
- "version": "{{pluginVersion}}",
2
+ "name": "{{packageName}}",
4
3
  "main": "src/index.ts",
5
4
  "types": "src/index.ts",
6
- "license": "{{license}}",
7
- {{#if privatePackage}}
8
- "private": {{privatePackage}},
9
- {{/if}}
10
5
  "publishConfig": {
11
- {{#if npmRegistry}}
12
- "registry": "{{npmRegistry}}",
13
- {{/if}}
14
6
  "access": "public",
15
7
  "main": "dist/index.esm.js",
16
8
  "types": "dist/index.d.ts"
@@ -0,0 +1,6 @@
1
+ name: frontend-plugin
2
+ role: frontend-plugin
3
+ description: A new frontend plugin
4
+ values:
5
+ pluginVar: '{{ camelCase pluginId }}Plugin'
6
+ extensionName: '{{ upperFirst ( camelCase pluginId ) }}Page'
@@ -23,7 +23,7 @@ describe('ExampleComponent', () => {
23
23
  it('should render', async () => {
24
24
  await renderInTestApp(<ExampleComponent />);
25
25
  expect(
26
- screen.getByText('Welcome to {{ id }}!'),
26
+ screen.getByText('Welcome to {{pluginId}}!'),
27
27
  ).toBeInTheDocument();
28
28
  });
29
29
  });
@@ -13,7 +13,7 @@ import { ExampleFetchComponent } from '../ExampleFetchComponent';
13
13
 
14
14
  export const ExampleComponent = () => (
15
15
  <Page themeId="tool">
16
- <Header title="Welcome to {{ id }}!" subtitle="Optional subtitle">
16
+ <Header title="Welcome to {{pluginId}}!" subtitle="Optional subtitle">
17
17
  <HeaderLabel label="Owner" value="Team X" />
18
18
  <HeaderLabel label="Lifecycle" value="Alpha" />
19
19
  </Header>
@@ -1,6 +1,6 @@
1
1
  import { {{ pluginVar }} } from './plugin';
2
2
 
3
- describe('{{ id }}', () => {
3
+ describe('{{pluginId}}', () => {
4
4
  it('should export plugin', () => {
5
5
  expect({{ pluginVar }}).toBeDefined();
6
6
  });
@@ -6,7 +6,7 @@ import {
6
6
  import { rootRouteRef } from './routes';
7
7
 
8
8
  export const {{ pluginVar }} = createPlugin({
9
- id: '{{ id }}',
9
+ id: '{{pluginId}}',
10
10
  routes: {
11
11
  root: rootRouteRef,
12
12
  },
@@ -1,5 +1,5 @@
1
1
  import { createRouteRef } from '@backstage/core-plugin-api';
2
2
 
3
3
  export const rootRouteRef = createRouteRef({
4
- id: '{{ id }}',
4
+ id: '{{pluginId}}',
5
5
  });
@@ -1,4 +1,4 @@
1
- # {{name}}
1
+ # {{packageName}}
2
2
 
3
3
  _This package was created through the Backstage CLI_.
4
4
 
@@ -8,5 +8,5 @@ Install the package via Yarn:
8
8
 
9
9
  ```sh
10
10
  cd <package-dir> # if within a monorepo
11
- yarn add {{name}}
11
+ yarn add {{packageName}}
12
12
  ```
@@ -1,16 +1,8 @@
1
1
  {
2
- "name": "{{name}}",
3
- "version": "{{pluginVersion}}",
2
+ "name": "{{packageName}}",
4
3
  "main": "src/index.ts",
5
4
  "types": "src/index.ts",
6
- "license": "{{license}}",
7
- {{#if privatePackage}}
8
- "private": {{privatePackage}},
9
- {{/if}}
10
5
  "publishConfig": {
11
- {{#if npmRegistry}}
12
- "registry": "{{npmRegistry}}",
13
- {{/if}}
14
6
  "access": "public",
15
7
  "main": "dist/index.cjs.js",
16
8
  "types": "dist/index.d.ts"
@@ -0,0 +1,3 @@
1
+ name: node-library
2
+ role: node-library
3
+ description: A library package, exporting shared functionality for Node.js environments
@@ -0,0 +1,5 @@
1
+ # {{packageName}}
2
+
3
+ Welcome to the common package for the {{pluginId}} plugin!
4
+
5
+ _This plugin was created through the Backstage CLI_