@backstage/cli 0.36.0-next.2 → 0.36.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.
Files changed (276) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/config/eslint-factory.js +1 -0
  3. package/config/getJestEnvironment.js +7 -29
  4. package/config/jest-environment-jsdom/index.js +9 -43
  5. package/config/jest.js +7 -401
  6. package/config/jestCacheResultProcessor.cjs +10 -6
  7. package/config/jestCachingModuleLoader.js +11 -19
  8. package/config/jestFileTransform.js +11 -28
  9. package/config/jestRejectNetworkRequests.js +10 -53
  10. package/config/jestSucraseTransform.js +10 -70
  11. package/config/jestSwcTransform.js +10 -27
  12. package/config/jestYamlTransform.js +11 -24
  13. package/config/nodeTransform.cjs +10 -70
  14. package/config/nodeTransformHooks.mjs +4 -278
  15. package/config/webpack-public-path.js +10 -14
  16. package/dist/cli-internal/src/InternalCliModule.cjs.js +11 -0
  17. package/dist/cli-internal/src/InternalCommandNode.cjs.js +25 -0
  18. package/dist/cli-internal/src/knownPluginPackages.cjs.js +40 -0
  19. package/dist/index.cjs.js +21 -11
  20. package/dist/wiring/CliInitializer.cjs.js +61 -30
  21. package/dist/wiring/CommandGraph.cjs.js +81 -23
  22. package/dist/wiring/discoverCliModules.cjs.js +44 -0
  23. package/package.json +27 -160
  24. package/dist/modules/auth/commands/list.cjs.js +0 -23
  25. package/dist/modules/auth/commands/login.cjs.js +0 -316
  26. package/dist/modules/auth/commands/logout.cjs.js +0 -55
  27. package/dist/modules/auth/commands/printToken.cjs.js +0 -41
  28. package/dist/modules/auth/commands/select.cjs.js +0 -32
  29. package/dist/modules/auth/commands/show.cjs.js +0 -59
  30. package/dist/modules/auth/index.cjs.js +0 -44
  31. package/dist/modules/auth/lib/auth.cjs.js +0 -60
  32. package/dist/modules/auth/lib/http.cjs.js +0 -26
  33. package/dist/modules/auth/lib/localServer.cjs.js +0 -80
  34. package/dist/modules/auth/lib/pkce.cjs.js +0 -23
  35. package/dist/modules/auth/lib/prompt.cjs.js +0 -44
  36. package/dist/modules/auth/lib/secretStore.cjs.js +0 -81
  37. package/dist/modules/auth/lib/storage.cjs.js +0 -152
  38. package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -53
  39. package/dist/modules/build/commands/package/build/command.cjs.js +0 -136
  40. package/dist/modules/build/commands/package/build/index.cjs.js +0 -10
  41. package/dist/modules/build/commands/package/clean.cjs.js +0 -21
  42. package/dist/modules/build/commands/package/postpack.cjs.js +0 -15
  43. package/dist/modules/build/commands/package/prepack.cjs.js +0 -29
  44. package/dist/modules/build/commands/package/start/command.cjs.js +0 -80
  45. package/dist/modules/build/commands/package/start/index.cjs.js +0 -10
  46. package/dist/modules/build/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -34
  47. package/dist/modules/build/commands/package/start/startBackend.cjs.js +0 -46
  48. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +0 -50
  49. package/dist/modules/build/commands/package/start/startPackage.cjs.js +0 -53
  50. package/dist/modules/build/commands/repo/build.cjs.js +0 -149
  51. package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
  52. package/dist/modules/build/commands/repo/start.cjs.js +0 -199
  53. package/dist/modules/build/index.cjs.js +0 -68
  54. package/dist/modules/build/lib/buildBackend.cjs.js +0 -81
  55. package/dist/modules/build/lib/buildFrontend.cjs.js +0 -50
  56. package/dist/modules/build/lib/builder/config.cjs.js +0 -257
  57. package/dist/modules/build/lib/builder/packager.cjs.js +0 -131
  58. package/dist/modules/build/lib/builder/plugins.cjs.js +0 -125
  59. package/dist/modules/build/lib/builder/types.cjs.js +0 -10
  60. package/dist/modules/build/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +0 -43
  61. package/dist/modules/build/lib/bundler/bundle.cjs.js +0 -189
  62. package/dist/modules/build/lib/bundler/config.cjs.js +0 -308
  63. package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +0 -17
  64. package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +0 -34
  65. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +0 -135
  66. package/dist/modules/build/lib/bundler/optimization.cjs.js +0 -68
  67. package/dist/modules/build/lib/bundler/packageDetection.cjs.js +0 -124
  68. package/dist/modules/build/lib/bundler/paths.cjs.js +0 -62
  69. package/dist/modules/build/lib/bundler/server.cjs.js +0 -231
  70. package/dist/modules/build/lib/bundler/transforms.cjs.js +0 -145
  71. package/dist/modules/build/lib/config.cjs.js +0 -94
  72. package/dist/modules/build/lib/entryPoints.cjs.js +0 -49
  73. package/dist/modules/build/lib/ipc/IpcServer.cjs.js +0 -60
  74. package/dist/modules/build/lib/ipc/ServerDataStore.cjs.js +0 -36
  75. package/dist/modules/build/lib/optionsParser.cjs.js +0 -22
  76. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +0 -235
  77. package/dist/modules/build/lib/packager/productionPack.cjs.js +0 -160
  78. package/dist/modules/build/lib/publishing.cjs.js +0 -40
  79. package/dist/modules/build/lib/role.cjs.js +0 -24
  80. package/dist/modules/build/lib/runner/runBackend.cjs.js +0 -136
  81. package/dist/modules/build/lib/typeDistProject.cjs.js +0 -89
  82. package/dist/modules/build/lib/urls.cjs.js +0 -13
  83. package/dist/modules/config/commands/docs.cjs.js +0 -63
  84. package/dist/modules/config/commands/print.cjs.js +0 -81
  85. package/dist/modules/config/commands/schema.cjs.js +0 -56
  86. package/dist/modules/config/commands/validate.cjs.js +0 -50
  87. package/dist/modules/config/index.cjs.js +0 -51
  88. package/dist/modules/config/lib/config.cjs.js +0 -94
  89. package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js +0 -127
  90. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +0 -126
  91. package/dist/modules/create-github-app/index.cjs.js +0 -19
  92. package/dist/modules/info/commands/info.cjs.js +0 -182
  93. package/dist/modules/info/index.cjs.js +0 -19
  94. package/dist/modules/lint/commands/package/lint.cjs.js +0 -78
  95. package/dist/modules/lint/commands/repo/lint.cjs.js +0 -282
  96. package/dist/modules/lint/index.cjs.js +0 -24
  97. package/dist/modules/lint/lib/optionsParser.cjs.js +0 -22
  98. package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -426
  99. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -90
  100. package/dist/modules/maintenance/index.cjs.js +0 -24
  101. package/dist/modules/migrate/commands/packageExports.cjs.js +0 -15
  102. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +0 -77
  103. package/dist/modules/migrate/commands/packageRole.cjs.js +0 -57
  104. package/dist/modules/migrate/commands/packageScripts.cjs.js +0 -87
  105. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +0 -51
  106. package/dist/modules/migrate/commands/versions/bump.cjs.js +0 -403
  107. package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -133
  108. package/dist/modules/migrate/index.cjs.js +0 -59
  109. package/dist/modules/migrate/lib/utils.cjs.js +0 -44
  110. package/dist/modules/migrate/lib/versioning/packages.cjs.js +0 -71
  111. package/dist/modules/migrate/lib/versioning/yarn.cjs.js +0 -28
  112. package/dist/modules/new/commands/new.cjs.js +0 -115
  113. package/dist/modules/new/index.cjs.js +0 -40
  114. package/dist/modules/new/lib/codeowners/codeowners.cjs.js +0 -92
  115. package/dist/modules/new/lib/createNewPackage.cjs.js +0 -32
  116. package/dist/modules/new/lib/defaultTemplates.cjs.js +0 -17
  117. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +0 -89
  118. package/dist/modules/new/lib/execution/executePortableTemplate.cjs.js +0 -66
  119. package/dist/modules/new/lib/execution/installNewPackage.cjs.js +0 -127
  120. package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +0 -116
  121. package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +0 -157
  122. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +0 -81
  123. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +0 -132
  124. package/dist/modules/new/lib/preparation/resolvePackageParams.cjs.js +0 -40
  125. package/dist/modules/new/lib/preparation/selectTemplateInteractively.cjs.js +0 -38
  126. package/dist/modules/new/lib/tasks.cjs.js +0 -51
  127. package/dist/modules/new/lib/types.cjs.js +0 -19
  128. package/dist/modules/new/lib/version.cjs.js +0 -91
  129. package/dist/modules/test/commands/package/test.cjs.js +0 -59
  130. package/dist/modules/test/commands/repo/test.cjs.js +0 -299
  131. package/dist/modules/test/index.cjs.js +0 -24
  132. package/dist/modules/translations/commands/export.cjs.js +0 -128
  133. package/dist/modules/translations/commands/import.cjs.js +0 -165
  134. package/dist/modules/translations/index.cjs.js +0 -24
  135. package/dist/modules/translations/lib/discoverPackages.cjs.js +0 -121
  136. package/dist/modules/translations/lib/extractTranslations.cjs.js +0 -71
  137. package/dist/modules/translations/lib/messageFilePath.cjs.js +0 -43
  138. package/dist/packages/backend-defaults/package.json.cjs.js +0 -6
  139. package/dist/packages/backend-plugin-api/package.json.cjs.js +0 -6
  140. package/dist/packages/backend-test-utils/package.json.cjs.js +0 -6
  141. package/dist/packages/catalog-client/package.json.cjs.js +0 -6
  142. package/dist/packages/cli/package.json.cjs.js +0 -159
  143. package/dist/packages/config/package.json.cjs.js +0 -6
  144. package/dist/packages/core-app-api/package.json.cjs.js +0 -6
  145. package/dist/packages/core-components/package.json.cjs.js +0 -6
  146. package/dist/packages/core-plugin-api/package.json.cjs.js +0 -6
  147. package/dist/packages/dev-utils/package.json.cjs.js +0 -6
  148. package/dist/packages/errors/package.json.cjs.js +0 -6
  149. package/dist/packages/frontend-defaults/package.json.cjs.js +0 -6
  150. package/dist/packages/frontend-plugin-api/package.json.cjs.js +0 -6
  151. package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +0 -26
  152. package/dist/packages/frontend-test-utils/package.json.cjs.js +0 -6
  153. package/dist/packages/test-utils/package.json.cjs.js +0 -6
  154. package/dist/packages/theme/package.json.cjs.js +0 -6
  155. package/dist/packages/types/package.json.cjs.js +0 -6
  156. package/dist/plugins/auth-backend/package.json.cjs.js +0 -6
  157. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +0 -6
  158. package/dist/plugins/catalog-node/package.json.cjs.js +0 -6
  159. package/dist/plugins/scaffolder-node/package.json.cjs.js +0 -6
  160. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +0 -6
  161. package/dist/wiring/CommandRegistry.cjs.js +0 -14
  162. package/dist/wiring/factory.cjs.js +0 -15
  163. package/dist/wiring/types.cjs.js +0 -11
  164. package/templates/backend-plugin/.eslintrc.js.hbs +0 -1
  165. package/templates/backend-plugin/README.md.hbs +0 -28
  166. package/templates/backend-plugin/dev/index.ts.hbs +0 -60
  167. package/templates/backend-plugin/package.json.hbs +0 -44
  168. package/templates/backend-plugin/portable-template.yaml +0 -5
  169. package/templates/backend-plugin/src/index.ts.hbs +0 -1
  170. package/templates/backend-plugin/src/plugin.test.ts.hbs +0 -129
  171. package/templates/backend-plugin/src/plugin.ts.hbs +0 -32
  172. package/templates/backend-plugin/src/router.test.ts +0 -67
  173. package/templates/backend-plugin/src/router.ts +0 -51
  174. package/templates/backend-plugin/src/services/TodoListService.ts +0 -155
  175. package/templates/backend-plugin/src/setupTests.ts +0 -1
  176. package/templates/backend-plugin-module/.eslintrc.js.hbs +0 -1
  177. package/templates/backend-plugin-module/README.md.hbs +0 -5
  178. package/templates/backend-plugin-module/package.json.hbs +0 -34
  179. package/templates/backend-plugin-module/portable-template.yaml +0 -5
  180. package/templates/backend-plugin-module/src/index.ts.hbs +0 -8
  181. package/templates/backend-plugin-module/src/module.ts.hbs +0 -17
  182. package/templates/catalog-provider-module/.eslintrc.js.hbs +0 -1
  183. package/templates/catalog-provider-module/README.md.hbs +0 -5
  184. package/templates/catalog-provider-module/config.d.ts.hbs +0 -34
  185. package/templates/catalog-provider-module/package.json.hbs +0 -36
  186. package/templates/catalog-provider-module/portable-template.yaml +0 -9
  187. package/templates/catalog-provider-module/src/index.ts.hbs +0 -8
  188. package/templates/catalog-provider-module/src/module.ts.hbs +0 -29
  189. package/templates/catalog-provider-module/src/provider/readProviderConfigs.ts.hbs +0 -78
  190. package/templates/catalog-provider-module/src/provider/{{providerClass}}.test.ts.hbs +0 -18
  191. package/templates/catalog-provider-module/src/provider/{{providerClass}}.ts.hbs +0 -109
  192. package/templates/frontend-plugin/.eslintrc.js.hbs +0 -1
  193. package/templates/frontend-plugin/README.md.hbs +0 -13
  194. package/templates/frontend-plugin/dev/index.tsx.hbs +0 -11
  195. package/templates/frontend-plugin/package.json.hbs +0 -54
  196. package/templates/frontend-plugin/portable-template.yaml +0 -6
  197. package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
  198. package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
  199. package/templates/frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
  200. package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
  201. package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
  202. package/templates/frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
  203. package/templates/frontend-plugin/src/index.ts.hbs +0 -1
  204. package/templates/frontend-plugin/src/plugin.test.ts.hbs +0 -7
  205. package/templates/frontend-plugin/src/plugin.ts.hbs +0 -22
  206. package/templates/frontend-plugin/src/routes.ts.hbs +0 -5
  207. package/templates/frontend-plugin/src/setupTests.ts +0 -1
  208. package/templates/new-frontend-plugin/.eslintrc.js.hbs +0 -1
  209. package/templates/new-frontend-plugin/README.md.hbs +0 -20
  210. package/templates/new-frontend-plugin/dev/index.tsx +0 -10
  211. package/templates/new-frontend-plugin/package.json.hbs +0 -49
  212. package/templates/new-frontend-plugin/portable-template.yaml +0 -5
  213. package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
  214. package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
  215. package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
  216. package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
  217. package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
  218. package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
  219. package/templates/new-frontend-plugin/src/index.ts.hbs +0 -1
  220. package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +0 -7
  221. package/templates/new-frontend-plugin/src/plugin.tsx.hbs +0 -25
  222. package/templates/new-frontend-plugin/src/routes.ts +0 -3
  223. package/templates/new-frontend-plugin/src/setupTests.ts +0 -1
  224. package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +0 -1
  225. package/templates/new-frontend-plugin-module/README.md.hbs +0 -5
  226. package/templates/new-frontend-plugin-module/package.json.hbs +0 -35
  227. package/templates/new-frontend-plugin-module/portable-template.yaml +0 -5
  228. package/templates/new-frontend-plugin-module/src/index.ts.hbs +0 -1
  229. package/templates/new-frontend-plugin-module/src/module.tsx.hbs +0 -8
  230. package/templates/new-frontend-plugin-module/src/setupTests.ts +0 -1
  231. package/templates/node-library/.eslintrc.js.hbs +0 -1
  232. package/templates/node-library/README.md.hbs +0 -12
  233. package/templates/node-library/package.json.hbs +0 -29
  234. package/templates/node-library/portable-template.yaml +0 -3
  235. package/templates/node-library/src/index.ts.hbs +0 -1
  236. package/templates/node-library/src/setupTests.ts +0 -1
  237. package/templates/plugin-common-library/.eslintrc.js.hbs +0 -1
  238. package/templates/plugin-common-library/README.md.hbs +0 -5
  239. package/templates/plugin-common-library/package.json.hbs +0 -31
  240. package/templates/plugin-common-library/portable-template.yaml +0 -3
  241. package/templates/plugin-common-library/src/index.ts.hbs +0 -19
  242. package/templates/plugin-common-library/src/setupTests.ts +0 -1
  243. package/templates/plugin-node-library/.eslintrc.js.hbs +0 -1
  244. package/templates/plugin-node-library/README.md.hbs +0 -5
  245. package/templates/plugin-node-library/package.json.hbs +0 -30
  246. package/templates/plugin-node-library/portable-template.yaml +0 -3
  247. package/templates/plugin-node-library/src/index.ts.hbs +0 -18
  248. package/templates/plugin-node-library/src/setupTests.ts +0 -1
  249. package/templates/plugin-web-library/.eslintrc.js.hbs +0 -1
  250. package/templates/plugin-web-library/README.md.hbs +0 -5
  251. package/templates/plugin-web-library/package.json.hbs +0 -42
  252. package/templates/plugin-web-library/portable-template.yaml +0 -3
  253. package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -17
  254. package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +0 -28
  255. package/templates/plugin-web-library/src/components/ExampleComponent/index.ts +0 -2
  256. package/templates/plugin-web-library/src/components/index.ts +0 -5
  257. package/templates/plugin-web-library/src/hooks/index.ts +0 -5
  258. package/templates/plugin-web-library/src/hooks/useExample/index.ts +0 -1
  259. package/templates/plugin-web-library/src/hooks/useExample/useExample.ts +0 -15
  260. package/templates/plugin-web-library/src/index.ts.hbs +0 -12
  261. package/templates/plugin-web-library/src/setupTests.ts +0 -1
  262. package/templates/scaffolder-backend-module/.eslintrc.js.hbs +0 -1
  263. package/templates/scaffolder-backend-module/README.md.hbs +0 -5
  264. package/templates/scaffolder-backend-module/package.json.hbs +0 -36
  265. package/templates/scaffolder-backend-module/portable-template.yaml +0 -6
  266. package/templates/scaffolder-backend-module/src/actions/example.test.ts +0 -24
  267. package/templates/scaffolder-backend-module/src/actions/example.ts +0 -39
  268. package/templates/scaffolder-backend-module/src/index.ts.hbs +0 -8
  269. package/templates/scaffolder-backend-module/src/module.ts +0 -21
  270. package/templates/web-library/.eslintrc.js.hbs +0 -1
  271. package/templates/web-library/README.md.hbs +0 -12
  272. package/templates/web-library/package.json.hbs +0 -30
  273. package/templates/web-library/portable-template.yaml +0 -3
  274. package/templates/web-library/src/index.ts.hbs +0 -1
  275. package/templates/web-library/src/setupTests.ts +0 -1
  276. /package/dist/{packages/opaque-internal → opaque-internal}/src/OpaqueType.cjs.js +0 -0
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- const MESSAGE_MARKER = "eHgtF5hmbrXyiEvo";
4
- function describeParentCallSite(ErrorConstructor = Error) {
5
- const { stack } = new ErrorConstructor(MESSAGE_MARKER);
6
- if (!stack) {
7
- return "<unknown>";
8
- }
9
- const startIndex = stack.includes(MESSAGE_MARKER) ? stack.indexOf("\n") + 1 : 0;
10
- const secondEntryStart = stack.indexOf("\n", stack.indexOf("\n", startIndex) + 1) + 1;
11
- const secondEntryEnd = stack.indexOf("\n", secondEntryStart);
12
- const line = stack.substring(secondEntryStart, secondEntryEnd).trim();
13
- if (!line) {
14
- return "unknown";
15
- }
16
- if (line.includes("(")) {
17
- return line.substring(line.indexOf("(") + 1, line.indexOf(")"));
18
- }
19
- if (line.includes("@")) {
20
- return line.substring(line.indexOf("@") + 1);
21
- }
22
- return line;
23
- }
24
-
25
- exports.describeParentCallSite = describeParentCallSite;
26
- //# sourceMappingURL=describeParentCallSite.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.5.1-next.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "1.7.16-next.0";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.7.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "1.2.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.27.1-next.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.2.17-next.1";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "2.1.0-next.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.13.0-next.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var version = "0.3.9-next.2";
4
-
5
- exports.version = version;
6
- //# sourceMappingURL=package.json.cjs.js.map
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- class CommandRegistry {
4
- graph;
5
- constructor(graph) {
6
- this.graph = graph;
7
- }
8
- addCommand(command) {
9
- this.graph.add(command);
10
- }
11
- }
12
-
13
- exports.CommandRegistry = CommandRegistry;
14
- //# sourceMappingURL=CommandRegistry.cjs.js.map
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- var describeParentCallSite = require('../packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js');
4
- var types = require('./types.cjs.js');
5
-
6
- function createCliPlugin(options) {
7
- return types.OpaqueCliPlugin.createInstance("v1", {
8
- pluginId: options.pluginId,
9
- init: options.init,
10
- description: `created at '${describeParentCallSite.describeParentCallSite()}'`
11
- });
12
- }
13
-
14
- exports.createCliPlugin = createCliPlugin;
15
- //# sourceMappingURL=factory.cjs.js.map
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var OpaqueType = require('../packages/opaque-internal/src/OpaqueType.cjs.js');
4
-
5
- const OpaqueCliPlugin = OpaqueType.OpaqueType.create({
6
- type: "@backstage/CliPlugin",
7
- versions: ["v1"]
8
- });
9
-
10
- exports.OpaqueCliPlugin = OpaqueCliPlugin;
11
- //# sourceMappingURL=types.cjs.js.map
@@ -1 +0,0 @@
1
- module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
@@ -1,28 +0,0 @@
1
- # {{pluginId}}
2
-
3
- This plugin backend was templated using the Backstage CLI. You should replace this text with a description of your plugin backend.
4
-
5
- ## Installation
6
-
7
- This plugin is installed via the `{{packageName}}` package. To install it to your backend package, run the following command:
8
-
9
- ```bash
10
- # From your root directory
11
- yarn --cwd packages/backend add {{packageName}}
12
- ```
13
-
14
- Then add the plugin to your backend in `packages/backend/src/index.ts`:
15
-
16
- ```ts
17
- const backend = createBackend();
18
- // ...
19
- backend.add(import('{{packageName}}'));
20
- ```
21
-
22
- ## Development
23
-
24
- This plugin backend can be started in a standalone mode from directly in this
25
- package with `yarn start`. It is a limited setup that is most convenient when
26
- developing the plugin backend itself.
27
-
28
- If you want to run the entire project, including the frontend, run `yarn start` from the root directory.
@@ -1,60 +0,0 @@
1
- import { createBackend } from '@backstage/backend-defaults';
2
- import { mockServices } from '@backstage/backend-test-utils';
3
- import { catalogServiceMock } from '@backstage/plugin-catalog-node/testUtils';
4
-
5
- // TEMPLATE NOTE:
6
- // This is the development setup for your plugin that wires up a
7
- // minimal backend that can use both real and mocked plugins and services.
8
- //
9
- // Start up the backend by running `yarn start` in the package directory.
10
- // Once it's up and running, try out the following requests:
11
- //
12
- // Create a new todo item, standalone or for the sample component:
13
- //
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
- //
17
- // List TODOs:
18
- //
19
- // curl http://localhost:7007/api/{{pluginId}}/todos
20
- //
21
- // Explicitly make an unauthenticated request, or with service auth:
22
- //
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
-
26
- const backend = createBackend();
27
-
28
- // TEMPLATE NOTE:
29
- // Mocking the auth and httpAuth service allows you to call your plugin API without
30
- // having to authenticate.
31
- //
32
- // If you want to use real auth, you can install the following instead:
33
- // backend.add(import('@backstage/plugin-auth-backend'));
34
- // backend.add(import('@backstage/plugin-auth-backend-module-guest-provider'));
35
- backend.add(mockServices.auth.factory());
36
- backend.add(mockServices.httpAuth.factory());
37
-
38
- // TEMPLATE NOTE:
39
- // Rather than using a real catalog you can use a mock with a fixed set of entities.
40
- backend.add(
41
- catalogServiceMock.factory({
42
- entities: [
43
- {
44
- apiVersion: 'backstage.io/v1alpha1',
45
- kind: 'Component',
46
- metadata: {
47
- name: 'sample',
48
- title: 'Sample Component',
49
- },
50
- spec: {
51
- type: 'service',
52
- },
53
- },
54
- ],
55
- }),
56
- );
57
-
58
- backend.add(import('../src'));
59
-
60
- backend.start();
@@ -1,44 +0,0 @@
1
- {
2
- "name": "{{packageName}}",
3
- "main": "src/index.ts",
4
- "types": "src/index.ts",
5
- "publishConfig": {
6
- "access": "public",
7
- "main": "dist/index.cjs.js",
8
- "types": "dist/index.d.ts"
9
- },
10
- "backstage": {
11
- "role": "backend-plugin",
12
- "pluginId": "{{pluginId}}"
13
- },
14
- "scripts": {
15
- "start": "backstage-cli package start",
16
- "build": "backstage-cli package build",
17
- "lint": "backstage-cli package lint",
18
- "test": "backstage-cli package test",
19
- "clean": "backstage-cli package clean",
20
- "prepack": "backstage-cli package prepack",
21
- "postpack": "backstage-cli package postpack"
22
- },
23
- "dependencies": {
24
- "@backstage/backend-defaults": "{{versionQuery '@backstage/backend-defaults'}}",
25
- "@backstage/backend-plugin-api": "{{versionQuery '@backstage/backend-plugin-api'}}",
26
- "@backstage/catalog-client": "{{versionQuery '@backstage/catalog-client'}}",
27
- "@backstage/errors": "{{versionQuery '@backstage/errors'}}",
28
- "@backstage/types": "{{versionQuery '@backstage/types'}}",
29
- "@backstage/plugin-catalog-node": "{{versionQuery '@backstage/plugin-catalog-node'}}",
30
- "express": "{{versionQuery 'express' '4.17.1'}}",
31
- "express-promise-router": "{{versionQuery 'express-promise-router' '4.1.0'}}",
32
- "zod": "{{versionQuery 'zod' '3.25.76'}}"
33
- },
34
- "devDependencies": {
35
- "@backstage/backend-test-utils": "{{versionQuery '@backstage/backend-test-utils'}}",
36
- "@backstage/cli": "{{versionQuery '@backstage/cli'}}",
37
- "@types/express": "{{versionQuery '@types/express' '4.17.6'}}",
38
- "@types/supertest": "{{versionQuery '@types/supertest' '2.0.12'}}",
39
- "supertest": "{{versionQuery 'supertest' '6.2.4'}}"
40
- },
41
- "files": [
42
- "dist"
43
- ]
44
- }
@@ -1,5 +0,0 @@
1
- name: backend-plugin
2
- role: backend-plugin
3
- description: A new backend plugin
4
- values:
5
- pluginVar: '{{ camelCase pluginId }}Plugin'
@@ -1 +0,0 @@
1
- export { {{pluginVar}} as default } from './plugin';
@@ -1,129 +0,0 @@
1
- import {
2
- mockCredentials,
3
- startTestBackend,
4
- } from '@backstage/backend-test-utils';
5
- import { createServiceFactory } from '@backstage/backend-plugin-api';
6
- import { todoListServiceRef } from './services/TodoListService';
7
- import { {{pluginVar}} } from './plugin';
8
- import request from 'supertest';
9
- import { catalogServiceMock } from '@backstage/plugin-catalog-node/testUtils';
10
- import {
11
- ConflictError,
12
- AuthenticationError,
13
- NotAllowedError,
14
- } from '@backstage/errors';
15
-
16
- // TEMPLATE NOTE:
17
- // Plugin tests are integration tests for your plugin, ensuring that all pieces
18
- // work together end-to-end. You can still mock injected backend services
19
- // however, just like anyone who installs your plugin might replace the
20
- // services with their own implementations.
21
- describe('plugin', () => {
22
- it('should create and read TODO items', async () => {
23
- const { server } = await startTestBackend({
24
- features: [{{pluginVar}}],
25
- });
26
-
27
- await request(server).get('/api/{{pluginId}}/todos').expect(200, {
28
- items: [],
29
- });
30
-
31
- const createRes = await request(server)
32
- .post('/api/{{pluginId}}/todos')
33
- .send({ title: 'My Todo' });
34
-
35
- expect(createRes.status).toBe(201);
36
- expect(createRes.body).toEqual({
37
- id: expect.any(String),
38
- title: 'My Todo',
39
- createdBy: mockCredentials.user().principal.userEntityRef,
40
- createdAt: expect.any(String),
41
- });
42
-
43
- const createdTodoItem = createRes.body;
44
-
45
- await request(server)
46
- .get('/api/{{pluginId}}/todos')
47
- .expect(200, {
48
- items: [createdTodoItem],
49
- });
50
-
51
- await request(server)
52
- .get(`/api/{{pluginId}}/todos/${createdTodoItem.id}`)
53
- .expect(200, createdTodoItem);
54
- });
55
-
56
- it('should create TODO item with catalog information', async () => {
57
- const { server } = await startTestBackend({
58
- features: [
59
- {{pluginVar}},
60
- catalogServiceMock.factory({
61
- entities: [
62
- {
63
- apiVersion: 'backstage.io/v1alpha1',
64
- kind: 'Component',
65
- metadata: {
66
- name: 'my-component',
67
- namespace: 'default',
68
- title: 'My Component',
69
- },
70
- spec: {
71
- type: 'service',
72
- owner: 'me',
73
- },
74
- },
75
- ],
76
- }),
77
- ],
78
- });
79
-
80
- const createRes = await request(server)
81
- .post('/api/{{pluginId}}/todos')
82
- .send({ title: 'My Todo', entityRef: 'component:default/my-component' });
83
-
84
- expect(createRes.status).toBe(201);
85
- expect(createRes.body).toEqual({
86
- id: expect.any(String),
87
- title: '[My Component] My Todo',
88
- createdBy: mockCredentials.user().principal.userEntityRef,
89
- createdAt: expect.any(String),
90
- });
91
- });
92
-
93
- it('should forward errors from the TodoListService', async () => {
94
- const { server } = await startTestBackend({
95
- features: [
96
- {{pluginVar}},
97
- createServiceFactory({
98
- service: todoListServiceRef,
99
- deps: {},
100
- factory: () => ({
101
- createTodo: jest.fn().mockRejectedValue(new ConflictError()),
102
- listTodos: jest.fn().mockRejectedValue(new AuthenticationError()),
103
- getTodo: jest.fn().mockRejectedValue(new NotAllowedError()),
104
- }),
105
- })
106
- ],
107
- });
108
-
109
- const createRes = await request(server)
110
- .post('/api/{{pluginId}}/todos')
111
- .send({ title: 'My Todo', entityRef: 'component:default/my-component' });
112
- expect(createRes.status).toBe(409);
113
- expect(createRes.body).toMatchObject({
114
- error: { name: 'ConflictError' },
115
- });
116
-
117
- const listRes = await request(server).get('/api/{{pluginId}}/todos');
118
- expect(listRes.status).toBe(401);
119
- expect(listRes.body).toMatchObject({
120
- error: { name: 'AuthenticationError' },
121
- });
122
-
123
- const getRes = await request(server).get('/api/{{pluginId}}/todos/123');
124
- expect(getRes.status).toBe(403);
125
- expect(getRes.body).toMatchObject({
126
- error: { name: 'NotAllowedError' },
127
- });
128
- });
129
- });
@@ -1,32 +0,0 @@
1
- import {
2
- coreServices,
3
- createBackendPlugin,
4
- } from '@backstage/backend-plugin-api';
5
- import { createRouter } from './router';
6
- import { todoListServiceRef } from './services/TodoListService';
7
-
8
- /**
9
- * {{pluginVar}} backend plugin
10
- *
11
- * @public
12
- */
13
- export const {{pluginVar}} = createBackendPlugin({
14
- pluginId: '{{pluginId}}',
15
- register(env) {
16
- env.registerInit({
17
- deps: {
18
- httpAuth: coreServices.httpAuth,
19
- httpRouter: coreServices.httpRouter,
20
- todoList: todoListServiceRef,
21
- },
22
- async init({ httpAuth, httpRouter, todoList }) {
23
- httpRouter.use(
24
- await createRouter({
25
- httpAuth,
26
- todoList,
27
- }),
28
- );
29
- },
30
- });
31
- },
32
- });
@@ -1,67 +0,0 @@
1
- import {
2
- mockCredentials,
3
- mockErrorHandler,
4
- mockServices,
5
- } from '@backstage/backend-test-utils';
6
- import express from 'express';
7
- import request from 'supertest';
8
-
9
- import { createRouter } from './router';
10
- import { todoListServiceRef } from './services/TodoListService';
11
-
12
- const mockTodoItem = {
13
- title: 'Do the thing',
14
- id: '123',
15
- createdBy: mockCredentials.user().principal.userEntityRef,
16
- createdAt: new Date().toISOString(),
17
- };
18
-
19
- // TEMPLATE NOTE:
20
- // Testing the router directly allows you to write a unit test that mocks the provided options.
21
- describe('createRouter', () => {
22
- let app: express.Express;
23
- let todoList: jest.Mocked<typeof todoListServiceRef.T>;
24
-
25
- beforeEach(async () => {
26
- todoList = {
27
- createTodo: jest.fn(),
28
- listTodos: jest.fn(),
29
- getTodo: jest.fn(),
30
- };
31
- const router = await createRouter({
32
- httpAuth: mockServices.httpAuth(),
33
- todoList,
34
- });
35
- app = express();
36
- app.use(router);
37
- app.use(mockErrorHandler());
38
- });
39
-
40
- it('should create a TODO', async () => {
41
- todoList.createTodo.mockResolvedValue(mockTodoItem);
42
-
43
- const response = await request(app).post('/todos').send({
44
- title: 'Do the thing',
45
- });
46
-
47
- expect(response.status).toBe(201);
48
- expect(response.body).toEqual(mockTodoItem);
49
- });
50
-
51
- it('should not allow unauthenticated requests to create a TODO', async () => {
52
- todoList.createTodo.mockResolvedValue(mockTodoItem);
53
-
54
- // TEMPLATE NOTE:
55
- // The HttpAuth mock service considers all requests to be authenticated as a
56
- // mock user by default. In order to test other cases we need to explicitly
57
- // pass an authorization header with mock credentials.
58
- const response = await request(app)
59
- .post('/todos')
60
- .set('Authorization', mockCredentials.none.header())
61
- .send({
62
- title: 'Do the thing',
63
- });
64
-
65
- expect(response.status).toBe(401);
66
- });
67
- });
@@ -1,51 +0,0 @@
1
- import { HttpAuthService } from '@backstage/backend-plugin-api';
2
- import { InputError } from '@backstage/errors';
3
- import { z } from 'zod';
4
- import express from 'express';
5
- import Router from 'express-promise-router';
6
- import { todoListServiceRef } from './services/TodoListService';
7
-
8
- export async function createRouter({
9
- httpAuth,
10
- todoList,
11
- }: {
12
- httpAuth: HttpAuthService;
13
- todoList: typeof todoListServiceRef.T;
14
- }): Promise<express.Router> {
15
- const router = Router();
16
- router.use(express.json());
17
-
18
- // TEMPLATE NOTE:
19
- // Zod is a powerful library for data validation and recommended in particular
20
- // for user-defined schemas. In this case we use it for input validation too.
21
- //
22
- // If you want to define a schema for your API we recommend using Backstage's
23
- // OpenAPI tooling: https://backstage.io/docs/next/openapi/01-getting-started
24
- const todoSchema = z.object({
25
- title: z.string(),
26
- entityRef: z.string().optional(),
27
- });
28
-
29
- router.post('/todos', async (req, res) => {
30
- const parsed = todoSchema.safeParse(req.body);
31
- if (!parsed.success) {
32
- throw new InputError(parsed.error.toString());
33
- }
34
-
35
- const result = await todoList.createTodo(parsed.data, {
36
- credentials: await httpAuth.credentials(req, { allow: ['user'] }),
37
- });
38
-
39
- res.status(201).json(result);
40
- });
41
-
42
- router.get('/todos', async (_req, res) => {
43
- res.json(await todoList.listTodos());
44
- });
45
-
46
- router.get('/todos/:id', async (req, res) => {
47
- res.json(await todoList.getTodo({ id: req.params.id }));
48
- });
49
-
50
- return router;
51
- }