@backstage/cli 0.36.0-next.1 → 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 (263) hide show
  1. package/CHANGELOG.md +110 -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 -10
  20. package/dist/wiring/CliInitializer.cjs.js +61 -20
  21. package/dist/wiring/CommandGraph.cjs.js +81 -23
  22. package/dist/wiring/discoverCliModules.cjs.js +44 -0
  23. package/package.json +27 -154
  24. package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -24
  25. package/dist/modules/build/commands/package/build/command.cjs.js +0 -89
  26. package/dist/modules/build/commands/package/build/index.cjs.js +0 -8
  27. package/dist/modules/build/commands/package/clean.cjs.js +0 -21
  28. package/dist/modules/build/commands/package/postpack.cjs.js +0 -15
  29. package/dist/modules/build/commands/package/prepack.cjs.js +0 -29
  30. package/dist/modules/build/commands/package/start/command.cjs.js +0 -23
  31. package/dist/modules/build/commands/package/start/index.cjs.js +0 -8
  32. package/dist/modules/build/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -34
  33. package/dist/modules/build/commands/package/start/startBackend.cjs.js +0 -46
  34. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +0 -50
  35. package/dist/modules/build/commands/package/start/startPackage.cjs.js +0 -53
  36. package/dist/modules/build/commands/repo/build.cjs.js +0 -114
  37. package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
  38. package/dist/modules/build/commands/repo/start.cjs.js +0 -150
  39. package/dist/modules/build/index.cjs.js +0 -192
  40. package/dist/modules/build/lib/buildBackend.cjs.js +0 -81
  41. package/dist/modules/build/lib/buildFrontend.cjs.js +0 -50
  42. package/dist/modules/build/lib/builder/config.cjs.js +0 -257
  43. package/dist/modules/build/lib/builder/packager.cjs.js +0 -131
  44. package/dist/modules/build/lib/builder/plugins.cjs.js +0 -125
  45. package/dist/modules/build/lib/builder/types.cjs.js +0 -10
  46. package/dist/modules/build/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +0 -43
  47. package/dist/modules/build/lib/bundler/bundle.cjs.js +0 -189
  48. package/dist/modules/build/lib/bundler/config.cjs.js +0 -308
  49. package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +0 -17
  50. package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +0 -34
  51. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +0 -135
  52. package/dist/modules/build/lib/bundler/optimization.cjs.js +0 -68
  53. package/dist/modules/build/lib/bundler/packageDetection.cjs.js +0 -124
  54. package/dist/modules/build/lib/bundler/paths.cjs.js +0 -62
  55. package/dist/modules/build/lib/bundler/server.cjs.js +0 -231
  56. package/dist/modules/build/lib/bundler/transforms.cjs.js +0 -145
  57. package/dist/modules/build/lib/config.cjs.js +0 -94
  58. package/dist/modules/build/lib/entryPoints.cjs.js +0 -49
  59. package/dist/modules/build/lib/ipc/IpcServer.cjs.js +0 -60
  60. package/dist/modules/build/lib/ipc/ServerDataStore.cjs.js +0 -36
  61. package/dist/modules/build/lib/optionsParser.cjs.js +0 -37
  62. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +0 -235
  63. package/dist/modules/build/lib/packager/productionPack.cjs.js +0 -160
  64. package/dist/modules/build/lib/publishing.cjs.js +0 -40
  65. package/dist/modules/build/lib/role.cjs.js +0 -24
  66. package/dist/modules/build/lib/runner/runBackend.cjs.js +0 -136
  67. package/dist/modules/build/lib/typeDistProject.cjs.js +0 -89
  68. package/dist/modules/build/lib/urls.cjs.js +0 -13
  69. package/dist/modules/config/commands/docs.cjs.js +0 -62
  70. package/dist/modules/config/commands/print.cjs.js +0 -80
  71. package/dist/modules/config/commands/schema.cjs.js +0 -55
  72. package/dist/modules/config/commands/validate.cjs.js +0 -49
  73. package/dist/modules/config/index.cjs.js +0 -51
  74. package/dist/modules/config/lib/config.cjs.js +0 -94
  75. package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js +0 -127
  76. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +0 -115
  77. package/dist/modules/create-github-app/index.cjs.js +0 -27
  78. package/dist/modules/info/commands/info.cjs.js +0 -181
  79. package/dist/modules/info/index.cjs.js +0 -19
  80. package/dist/modules/lint/commands/package/lint.cjs.js +0 -46
  81. package/dist/modules/lint/commands/repo/lint.cjs.js +0 -212
  82. package/dist/modules/lint/index.cjs.js +0 -82
  83. package/dist/modules/lint/lib/optionsParser.cjs.js +0 -37
  84. package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -400
  85. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -74
  86. package/dist/modules/maintenance/index.cjs.js +0 -42
  87. package/dist/modules/migrate/commands/packageExports.cjs.js +0 -15
  88. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +0 -77
  89. package/dist/modules/migrate/commands/packageRole.cjs.js +0 -57
  90. package/dist/modules/migrate/commands/packageScripts.cjs.js +0 -87
  91. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +0 -51
  92. package/dist/modules/migrate/commands/versions/bump.cjs.js +0 -373
  93. package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -112
  94. package/dist/modules/migrate/index.cjs.js +0 -82
  95. package/dist/modules/migrate/lib/utils.cjs.js +0 -44
  96. package/dist/modules/migrate/lib/versioning/packages.cjs.js +0 -71
  97. package/dist/modules/migrate/lib/versioning/yarn.cjs.js +0 -28
  98. package/dist/modules/new/commands/new.cjs.js +0 -60
  99. package/dist/modules/new/index.cjs.js +0 -68
  100. package/dist/modules/new/lib/codeowners/codeowners.cjs.js +0 -92
  101. package/dist/modules/new/lib/createNewPackage.cjs.js +0 -32
  102. package/dist/modules/new/lib/defaultTemplates.cjs.js +0 -17
  103. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +0 -89
  104. package/dist/modules/new/lib/execution/executePortableTemplate.cjs.js +0 -66
  105. package/dist/modules/new/lib/execution/installNewPackage.cjs.js +0 -127
  106. package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +0 -116
  107. package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +0 -157
  108. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +0 -81
  109. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +0 -132
  110. package/dist/modules/new/lib/preparation/resolvePackageParams.cjs.js +0 -40
  111. package/dist/modules/new/lib/preparation/selectTemplateInteractively.cjs.js +0 -38
  112. package/dist/modules/new/lib/tasks.cjs.js +0 -51
  113. package/dist/modules/new/lib/types.cjs.js +0 -19
  114. package/dist/modules/new/lib/version.cjs.js +0 -91
  115. package/dist/modules/test/commands/package/test.cjs.js +0 -65
  116. package/dist/modules/test/commands/repo/test.cjs.js +0 -288
  117. package/dist/modules/test/index.cjs.js +0 -54
  118. package/dist/modules/translations/commands/export.cjs.js +0 -127
  119. package/dist/modules/translations/commands/import.cjs.js +0 -164
  120. package/dist/modules/translations/index.cjs.js +0 -24
  121. package/dist/modules/translations/lib/discoverPackages.cjs.js +0 -121
  122. package/dist/modules/translations/lib/extractTranslations.cjs.js +0 -71
  123. package/dist/modules/translations/lib/messageFilePath.cjs.js +0 -43
  124. package/dist/packages/backend-defaults/package.json.cjs.js +0 -6
  125. package/dist/packages/backend-plugin-api/package.json.cjs.js +0 -6
  126. package/dist/packages/backend-test-utils/package.json.cjs.js +0 -6
  127. package/dist/packages/catalog-client/package.json.cjs.js +0 -6
  128. package/dist/packages/cli/package.json.cjs.js +0 -156
  129. package/dist/packages/config/package.json.cjs.js +0 -6
  130. package/dist/packages/core-app-api/package.json.cjs.js +0 -6
  131. package/dist/packages/core-components/package.json.cjs.js +0 -6
  132. package/dist/packages/core-plugin-api/package.json.cjs.js +0 -6
  133. package/dist/packages/dev-utils/package.json.cjs.js +0 -6
  134. package/dist/packages/errors/package.json.cjs.js +0 -6
  135. package/dist/packages/frontend-defaults/package.json.cjs.js +0 -6
  136. package/dist/packages/frontend-plugin-api/package.json.cjs.js +0 -6
  137. package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +0 -26
  138. package/dist/packages/frontend-test-utils/package.json.cjs.js +0 -6
  139. package/dist/packages/test-utils/package.json.cjs.js +0 -6
  140. package/dist/packages/theme/package.json.cjs.js +0 -6
  141. package/dist/packages/types/package.json.cjs.js +0 -6
  142. package/dist/plugins/auth-backend/package.json.cjs.js +0 -6
  143. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +0 -6
  144. package/dist/plugins/catalog-node/package.json.cjs.js +0 -6
  145. package/dist/plugins/scaffolder-node/package.json.cjs.js +0 -6
  146. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +0 -6
  147. package/dist/wiring/CommandRegistry.cjs.js +0 -14
  148. package/dist/wiring/factory.cjs.js +0 -15
  149. package/dist/wiring/lazy.cjs.js +0 -22
  150. package/dist/wiring/types.cjs.js +0 -11
  151. package/templates/backend-plugin/.eslintrc.js.hbs +0 -1
  152. package/templates/backend-plugin/README.md.hbs +0 -28
  153. package/templates/backend-plugin/dev/index.ts.hbs +0 -60
  154. package/templates/backend-plugin/package.json.hbs +0 -44
  155. package/templates/backend-plugin/portable-template.yaml +0 -5
  156. package/templates/backend-plugin/src/index.ts.hbs +0 -1
  157. package/templates/backend-plugin/src/plugin.test.ts.hbs +0 -129
  158. package/templates/backend-plugin/src/plugin.ts.hbs +0 -32
  159. package/templates/backend-plugin/src/router.test.ts +0 -67
  160. package/templates/backend-plugin/src/router.ts +0 -51
  161. package/templates/backend-plugin/src/services/TodoListService.ts +0 -155
  162. package/templates/backend-plugin/src/setupTests.ts +0 -1
  163. package/templates/backend-plugin-module/.eslintrc.js.hbs +0 -1
  164. package/templates/backend-plugin-module/README.md.hbs +0 -5
  165. package/templates/backend-plugin-module/package.json.hbs +0 -34
  166. package/templates/backend-plugin-module/portable-template.yaml +0 -5
  167. package/templates/backend-plugin-module/src/index.ts.hbs +0 -8
  168. package/templates/backend-plugin-module/src/module.ts.hbs +0 -17
  169. package/templates/catalog-provider-module/.eslintrc.js.hbs +0 -1
  170. package/templates/catalog-provider-module/README.md.hbs +0 -5
  171. package/templates/catalog-provider-module/config.d.ts.hbs +0 -34
  172. package/templates/catalog-provider-module/package.json.hbs +0 -36
  173. package/templates/catalog-provider-module/portable-template.yaml +0 -9
  174. package/templates/catalog-provider-module/src/index.ts.hbs +0 -8
  175. package/templates/catalog-provider-module/src/module.ts.hbs +0 -29
  176. package/templates/catalog-provider-module/src/provider/readProviderConfigs.ts.hbs +0 -78
  177. package/templates/catalog-provider-module/src/provider/{{providerClass}}.test.ts.hbs +0 -18
  178. package/templates/catalog-provider-module/src/provider/{{providerClass}}.ts.hbs +0 -109
  179. package/templates/frontend-plugin/.eslintrc.js.hbs +0 -1
  180. package/templates/frontend-plugin/README.md.hbs +0 -13
  181. package/templates/frontend-plugin/dev/index.tsx.hbs +0 -11
  182. package/templates/frontend-plugin/package.json.hbs +0 -54
  183. package/templates/frontend-plugin/portable-template.yaml +0 -6
  184. package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
  185. package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
  186. package/templates/frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
  187. package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
  188. package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
  189. package/templates/frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
  190. package/templates/frontend-plugin/src/index.ts.hbs +0 -1
  191. package/templates/frontend-plugin/src/plugin.test.ts.hbs +0 -7
  192. package/templates/frontend-plugin/src/plugin.ts.hbs +0 -22
  193. package/templates/frontend-plugin/src/routes.ts.hbs +0 -5
  194. package/templates/frontend-plugin/src/setupTests.ts +0 -1
  195. package/templates/new-frontend-plugin/.eslintrc.js.hbs +0 -1
  196. package/templates/new-frontend-plugin/README.md.hbs +0 -20
  197. package/templates/new-frontend-plugin/dev/index.tsx +0 -10
  198. package/templates/new-frontend-plugin/package.json.hbs +0 -49
  199. package/templates/new-frontend-plugin/portable-template.yaml +0 -5
  200. package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
  201. package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
  202. package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
  203. package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
  204. package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
  205. package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
  206. package/templates/new-frontend-plugin/src/index.ts.hbs +0 -1
  207. package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +0 -7
  208. package/templates/new-frontend-plugin/src/plugin.tsx.hbs +0 -25
  209. package/templates/new-frontend-plugin/src/routes.ts +0 -3
  210. package/templates/new-frontend-plugin/src/setupTests.ts +0 -1
  211. package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +0 -1
  212. package/templates/new-frontend-plugin-module/README.md.hbs +0 -5
  213. package/templates/new-frontend-plugin-module/package.json.hbs +0 -35
  214. package/templates/new-frontend-plugin-module/portable-template.yaml +0 -5
  215. package/templates/new-frontend-plugin-module/src/index.ts.hbs +0 -1
  216. package/templates/new-frontend-plugin-module/src/module.tsx.hbs +0 -8
  217. package/templates/new-frontend-plugin-module/src/setupTests.ts +0 -1
  218. package/templates/node-library/.eslintrc.js.hbs +0 -1
  219. package/templates/node-library/README.md.hbs +0 -12
  220. package/templates/node-library/package.json.hbs +0 -29
  221. package/templates/node-library/portable-template.yaml +0 -3
  222. package/templates/node-library/src/index.ts.hbs +0 -1
  223. package/templates/node-library/src/setupTests.ts +0 -1
  224. package/templates/plugin-common-library/.eslintrc.js.hbs +0 -1
  225. package/templates/plugin-common-library/README.md.hbs +0 -5
  226. package/templates/plugin-common-library/package.json.hbs +0 -31
  227. package/templates/plugin-common-library/portable-template.yaml +0 -3
  228. package/templates/plugin-common-library/src/index.ts.hbs +0 -19
  229. package/templates/plugin-common-library/src/setupTests.ts +0 -1
  230. package/templates/plugin-node-library/.eslintrc.js.hbs +0 -1
  231. package/templates/plugin-node-library/README.md.hbs +0 -5
  232. package/templates/plugin-node-library/package.json.hbs +0 -30
  233. package/templates/plugin-node-library/portable-template.yaml +0 -3
  234. package/templates/plugin-node-library/src/index.ts.hbs +0 -18
  235. package/templates/plugin-node-library/src/setupTests.ts +0 -1
  236. package/templates/plugin-web-library/.eslintrc.js.hbs +0 -1
  237. package/templates/plugin-web-library/README.md.hbs +0 -5
  238. package/templates/plugin-web-library/package.json.hbs +0 -42
  239. package/templates/plugin-web-library/portable-template.yaml +0 -3
  240. package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -17
  241. package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +0 -28
  242. package/templates/plugin-web-library/src/components/ExampleComponent/index.ts +0 -2
  243. package/templates/plugin-web-library/src/components/index.ts +0 -5
  244. package/templates/plugin-web-library/src/hooks/index.ts +0 -5
  245. package/templates/plugin-web-library/src/hooks/useExample/index.ts +0 -1
  246. package/templates/plugin-web-library/src/hooks/useExample/useExample.ts +0 -15
  247. package/templates/plugin-web-library/src/index.ts.hbs +0 -12
  248. package/templates/plugin-web-library/src/setupTests.ts +0 -1
  249. package/templates/scaffolder-backend-module/.eslintrc.js.hbs +0 -1
  250. package/templates/scaffolder-backend-module/README.md.hbs +0 -5
  251. package/templates/scaffolder-backend-module/package.json.hbs +0 -36
  252. package/templates/scaffolder-backend-module/portable-template.yaml +0 -6
  253. package/templates/scaffolder-backend-module/src/actions/example.test.ts +0 -24
  254. package/templates/scaffolder-backend-module/src/actions/example.ts +0 -39
  255. package/templates/scaffolder-backend-module/src/index.ts.hbs +0 -8
  256. package/templates/scaffolder-backend-module/src/module.ts +0 -21
  257. package/templates/web-library/.eslintrc.js.hbs +0 -1
  258. package/templates/web-library/README.md.hbs +0 -12
  259. package/templates/web-library/package.json.hbs +0 -30
  260. package/templates/web-library/portable-template.yaml +0 -3
  261. package/templates/web-library/src/index.ts.hbs +0 -1
  262. package/templates/web-library/src/setupTests.ts +0 -1
  263. /package/dist/{packages/opaque-internal → opaque-internal}/src/OpaqueType.cjs.js +0 -0
@@ -1,109 +0,0 @@
1
- import { Config } from '@backstage/config';
2
- import {
3
- DeferredEntity,
4
- EntityProvider,
5
- EntityProviderConnection,
6
- } from '@backstage/plugin-catalog-node';
7
- import * as uuid from 'uuid';
8
- import { readProviderConfigs } from './readProviderConfigs';
9
- import {
10
- LoggerService,
11
- SchedulerService,
12
- SchedulerServiceTaskRunner,
13
- } from '@backstage/backend-plugin-api';
14
-
15
- export type {{providerClass}}Options = {
16
- /**
17
- * The logger to use.
18
- */
19
- logger: LoggerService;
20
-
21
- /**
22
- * Scheduler used to schedule refreshes based on
23
- * the schedule config.
24
- */
25
- scheduler: SchedulerService;
26
- };
27
-
28
- export class {{providerClass}} implements EntityProvider {
29
- static fromConfig(
30
- configRoot: Config,
31
- options: {{providerClass}}Options,
32
- ): {{providerClass}}[] {
33
- return readProviderConfigs(configRoot).map(providerConfig => {
34
- return new {{providerClass}}({
35
- id: providerConfig.id,
36
- target: providerConfig.target,
37
- logger: options.logger,
38
- taskRunner: options.scheduler.createScheduledTaskRunner(
39
- providerConfig.schedule,
40
- ),
41
- });
42
- });
43
- }
44
-
45
- readonly #id: string;
46
- readonly #target: string;
47
- readonly #logger: LoggerService;
48
- readonly #taskRunner: SchedulerServiceTaskRunner;
49
-
50
- constructor(options: {
51
- id: string;
52
- target: string;
53
- logger: LoggerService;
54
- taskRunner: SchedulerServiceTaskRunner;
55
- }) {
56
- this.#id = options.id;
57
- this.#target = options.target;
58
- this.#logger = options.logger;
59
- this.#taskRunner = options.taskRunner;
60
- }
61
-
62
- /** {@inheritdoc @backstage/plugin-catalog-node#EntityProvider.getProviderName} */
63
- getProviderName() {
64
- return `{{providerClass}}:${this.#id}`;
65
- }
66
-
67
- /** {@inheritdoc @backstage/plugin-catalog-node#EntityProvider.connect} */
68
- async connect(connection: EntityProviderConnection) {
69
- const id = `${this.getProviderName()}:refresh`;
70
-
71
- // Schedule a refresh task to be run periodically
72
- await this.#taskRunner.run({
73
- id,
74
- fn: async () => {
75
- const logger = this.#logger.child({
76
- taskId: id,
77
- taskInstanceId: uuid.v4(),
78
- });
79
-
80
- try {
81
- const entities = await this.read({ logger });
82
-
83
- logger.info(`Read ${entities.length} entities`);
84
-
85
- await connection.applyMutation({
86
- type: 'full',
87
- entities,
88
- });
89
- } catch (error) {
90
- logger.error(`Refresh failed`, error);
91
- }
92
- },
93
- });
94
- }
95
-
96
- /**
97
- * Reads entities to be added to the catalog.
98
- */
99
- async read(options: { logger: LoggerService }): Promise<DeferredEntity[]> {
100
- const { logger } = options;
101
-
102
- logger.info(`Reading entities from ${this.#target}`);
103
-
104
- // TODO: Implement entity reading logic from the target
105
- const entities: DeferredEntity[] = [];
106
-
107
- return entities;
108
- }
109
- }
@@ -1 +0,0 @@
1
- module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
@@ -1,13 +0,0 @@
1
- # {{pluginId}}
2
-
3
- Welcome to the {{pluginId}} plugin!
4
-
5
- _This plugin was created through the Backstage CLI_
6
-
7
- ## Getting started
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 [/{{pluginId}}](http://localhost:3000/{{pluginId}}).
10
-
11
- You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
12
- This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
13
- It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
@@ -1,11 +0,0 @@
1
- import { createDevApp } from '@backstage/dev-utils';
2
- import { {{ pluginVar }}, {{ extensionName }} } from '../src/plugin';
3
-
4
- createDevApp()
5
- .registerPlugin({{ pluginVar }})
6
- .addPage({
7
- element: <{{ extensionName }} />,
8
- title: 'Root Page',
9
- path: '/{{pluginId}}',
10
- })
11
- .render();
@@ -1,54 +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.esm.js",
8
- "types": "dist/index.d.ts"
9
- },
10
- "backstage": {
11
- "role": "frontend-plugin",
12
- "pluginId": "{{pluginId}}"
13
- },
14
- "sideEffects": false,
15
- "scripts": {
16
- "start": "backstage-cli package start",
17
- "build": "backstage-cli package build",
18
- "lint": "backstage-cli package lint",
19
- "test": "backstage-cli package test",
20
- "clean": "backstage-cli package clean",
21
- "prepack": "backstage-cli package prepack",
22
- "postpack": "backstage-cli package postpack"
23
- },
24
- "dependencies": {
25
- "@backstage/core-components": "{{versionQuery '@backstage/core-components'}}",
26
- "@backstage/core-plugin-api": "{{versionQuery '@backstage/core-plugin-api'}}",
27
- "@backstage/theme": "{{versionQuery '@backstage/theme'}}",
28
- "@material-ui/core": "{{versionQuery '@material-ui/core' '4.12.2'}}",
29
- "@material-ui/icons": "{{versionQuery '@material-ui/icons' '4.9.1'}}",
30
- "@material-ui/lab": "{{versionQuery '@material-ui/lab' '4.0.0-alpha.61'}}",
31
- "react-use": "{{versionQuery 'react-use' '17.2.4'}}"
32
- },
33
- "peerDependencies": {
34
- "react": "{{versionQuery 'react' '^16.13.1 || ^17.0.0 || ^18.0.0'}}",
35
- "react-dom": "{{versionQuery 'react-dom' '^16.13.1 || ^17.0.0 || ^18.0.0'}}",
36
- "react-router-dom": "{{versionQuery 'react-router-dom' '^6.0.0'}}"
37
- },
38
- "devDependencies": {
39
- "@backstage/cli": "{{versionQuery '@backstage/cli'}}",
40
- "@backstage/core-app-api": "{{versionQuery '@backstage/core-app-api'}}",
41
- "@backstage/dev-utils": "{{versionQuery '@backstage/dev-utils'}}",
42
- "@backstage/test-utils": "{{versionQuery '@backstage/test-utils'}}",
43
- "@testing-library/jest-dom": "{{versionQuery '@testing-library/jest-dom' '6.0.0'}}",
44
- "@testing-library/react": "{{versionQuery '@testing-library/react' '14.0.0'}}",
45
- "@testing-library/user-event": "{{versionQuery '@testing-library/user-event' '14.0.0'}}",
46
- "msw": "{{versionQuery 'msw' '1.0.0'}}",
47
- "react": "{{versionQuery 'react' '^16.13.1 || ^17.0.0 || ^18.0.0'}}",
48
- "react-dom": "{{versionQuery 'react-dom' '^16.13.1 || ^17.0.0 || ^18.0.0'}}",
49
- "react-router-dom": "{{versionQuery 'react-router-dom' '^6.0.0'}}"
50
- },
51
- "files": [
52
- "dist"
53
- ]
54
- }
@@ -1,6 +0,0 @@
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'
@@ -1,28 +0,0 @@
1
- import { ExampleComponent } from './ExampleComponent';
2
- import { rest } from 'msw';
3
- import { setupServer } from 'msw/node';
4
- import { screen } from '@testing-library/react';
5
- import {
6
- registerMswTestHooks,
7
- renderInTestApp,
8
- } from '@backstage/test-utils';
9
-
10
- describe('ExampleComponent', () => {
11
- const server = setupServer();
12
- // Enable sane handlers for network requests
13
- registerMswTestHooks(server);
14
-
15
- // setup mock response
16
- beforeEach(() => {
17
- server.use(
18
- rest.get('/*', (_, res, ctx) => res(ctx.status(200), ctx.json({}))),
19
- );
20
- });
21
-
22
- it('should render', async () => {
23
- await renderInTestApp(<ExampleComponent />);
24
- expect(
25
- screen.getByText('Welcome to {{pluginId}}!'),
26
- ).toBeInTheDocument();
27
- });
28
- });
@@ -1,37 +0,0 @@
1
- import { Typography, Grid } from '@material-ui/core';
2
- import {
3
- InfoCard,
4
- Header,
5
- Page,
6
- Content,
7
- ContentHeader,
8
- HeaderLabel,
9
- SupportButton,
10
- } from '@backstage/core-components';
11
- import { ExampleFetchComponent } from '../ExampleFetchComponent';
12
-
13
- export const ExampleComponent = () => (
14
- <Page themeId="tool">
15
- <Header title="Welcome to {{pluginId}}!" subtitle="Optional subtitle">
16
- <HeaderLabel label="Owner" value="Team X" />
17
- <HeaderLabel label="Lifecycle" value="Alpha" />
18
- </Header>
19
- <Content>
20
- <ContentHeader title="Plugin title">
21
- <SupportButton>A description of your plugin goes here.</SupportButton>
22
- </ContentHeader>
23
- <Grid container spacing={3} direction="column">
24
- <Grid item>
25
- <InfoCard title="Information card">
26
- <Typography variant="body1">
27
- All content should be wrapped in a card like this.
28
- </Typography>
29
- </InfoCard>
30
- </Grid>
31
- <Grid item>
32
- <ExampleFetchComponent />
33
- </Grid>
34
- </Grid>
35
- </Content>
36
- </Page>
37
- );
@@ -1 +0,0 @@
1
- export { ExampleComponent } from './ExampleComponent';
@@ -1,19 +0,0 @@
1
- import { renderInTestApp } from '@backstage/test-utils';
2
- import { ExampleFetchComponent } from './ExampleFetchComponent';
3
-
4
- describe('ExampleFetchComponent', () => {
5
- it('renders the user table', async () => {
6
- const { getAllByText, getByAltText, getByText, findByRole } =
7
- await renderInTestApp(<ExampleFetchComponent />);
8
-
9
- // Wait for the table to render
10
- const table = await findByRole('table');
11
- const nationality = getAllByText('GB');
12
- // Assert that the table contains the expected user data
13
- expect(table).toBeInTheDocument();
14
- expect(getByAltText('Carolyn')).toBeInTheDocument();
15
- expect(getByText('Carolyn Moore')).toBeInTheDocument();
16
- expect(getByText('carolyn.moore@example.com')).toBeInTheDocument();
17
- expect(nationality[0]).toBeInTheDocument();
18
- });
19
- });
@@ -1,308 +0,0 @@
1
- import { makeStyles } from '@material-ui/core/styles';
2
- import {
3
- Table,
4
- TableColumn,
5
- Progress,
6
- ResponseErrorPanel,
7
- } from '@backstage/core-components';
8
- import useAsync from 'react-use/lib/useAsync';
9
-
10
- export const exampleUsers = {
11
- results: [
12
- {
13
- gender: 'female',
14
- name: {
15
- title: 'Miss',
16
- first: 'Carolyn',
17
- last: 'Moore',
18
- },
19
- email: 'carolyn.moore@example.com',
20
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Carolyn',
21
- nat: 'GB',
22
- },
23
- {
24
- gender: 'female',
25
- name: {
26
- title: 'Ms',
27
- first: 'Esma',
28
- last: 'Berberoğlu',
29
- },
30
- email: 'esma.berberoglu@example.com',
31
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Esma',
32
- nat: 'TR',
33
- },
34
- {
35
- gender: 'female',
36
- name: {
37
- title: 'Ms',
38
- first: 'Isabella',
39
- last: 'Rhodes',
40
- },
41
- email: 'isabella.rhodes@example.com',
42
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella',
43
- nat: 'GB',
44
- },
45
- {
46
- gender: 'male',
47
- name: {
48
- title: 'Mr',
49
- first: 'Derrick',
50
- last: 'Carter',
51
- },
52
- email: 'derrick.carter@example.com',
53
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Derrick',
54
- nat: 'IE',
55
- },
56
- {
57
- gender: 'female',
58
- name: {
59
- title: 'Miss',
60
- first: 'Mattie',
61
- last: 'Lambert',
62
- },
63
- email: 'mattie.lambert@example.com',
64
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mattie',
65
- nat: 'AU',
66
- },
67
- {
68
- gender: 'male',
69
- name: {
70
- title: 'Mr',
71
- first: 'Mijat',
72
- last: 'Rakić',
73
- },
74
- email: 'mijat.rakic@example.com',
75
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mijat',
76
- nat: 'RS',
77
- },
78
- {
79
- gender: 'male',
80
- name: {
81
- title: 'Mr',
82
- first: 'Javier',
83
- last: 'Reid',
84
- },
85
- email: 'javier.reid@example.com',
86
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Javier',
87
- nat: 'US',
88
- },
89
- {
90
- gender: 'female',
91
- name: {
92
- title: 'Ms',
93
- first: 'Isabella',
94
- last: 'Li',
95
- },
96
- email: 'isabella.li@example.com',
97
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella',
98
- nat: 'CA',
99
- },
100
- {
101
- gender: 'female',
102
- name: {
103
- title: 'Mrs',
104
- first: 'Stephanie',
105
- last: 'Garrett',
106
- },
107
- email: 'stephanie.garrett@example.com',
108
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Stephanie',
109
- nat: 'AU',
110
- },
111
- {
112
- gender: 'female',
113
- name: {
114
- title: 'Ms',
115
- first: 'Antonia',
116
- last: 'Núñez',
117
- },
118
- email: 'antonia.nunez@example.com',
119
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Antonia',
120
- nat: 'ES',
121
- },
122
- {
123
- gender: 'male',
124
- name: {
125
- title: 'Mr',
126
- first: 'Donald',
127
- last: 'Young',
128
- },
129
- email: 'donald.young@example.com',
130
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Donald',
131
- nat: 'US',
132
- },
133
- {
134
- gender: 'male',
135
- name: {
136
- title: 'Mr',
137
- first: 'Iegor',
138
- last: 'Holodovskiy',
139
- },
140
- email: 'iegor.holodovskiy@example.com',
141
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Iegor',
142
- nat: 'UA',
143
- },
144
- {
145
- gender: 'female',
146
- name: {
147
- title: 'Madame',
148
- first: 'Jessica',
149
- last: 'David',
150
- },
151
- email: 'jessica.david@example.com',
152
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Jessica',
153
- nat: 'CH',
154
- },
155
- {
156
- gender: 'female',
157
- name: {
158
- title: 'Ms',
159
- first: 'Eve',
160
- last: 'Martinez',
161
- },
162
- email: 'eve.martinez@example.com',
163
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Eve',
164
- nat: 'FR',
165
- },
166
- {
167
- gender: 'male',
168
- name: {
169
- title: 'Mr',
170
- first: 'Caleb',
171
- last: 'Silva',
172
- },
173
- email: 'caleb.silva@example.com',
174
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Caleb',
175
- nat: 'US',
176
- },
177
- {
178
- gender: 'female',
179
- name: {
180
- title: 'Miss',
181
- first: 'Marcia',
182
- last: 'Jenkins',
183
- },
184
- email: 'marcia.jenkins@example.com',
185
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Marcia',
186
- nat: 'US',
187
- },
188
- {
189
- gender: 'female',
190
- name: {
191
- title: 'Mrs',
192
- first: 'Mackenzie',
193
- last: 'Jones',
194
- },
195
- email: 'mackenzie.jones@example.com',
196
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mackenzie',
197
- nat: 'NZ',
198
- },
199
- {
200
- gender: 'male',
201
- name: {
202
- title: 'Mr',
203
- first: 'Jeremiah',
204
- last: 'Gutierrez',
205
- },
206
- email: 'jeremiah.gutierrez@example.com',
207
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Jeremiah',
208
- nat: 'AU',
209
- },
210
- {
211
- gender: 'female',
212
- name: {
213
- title: 'Ms',
214
- first: 'Luciara',
215
- last: 'Souza',
216
- },
217
- email: 'luciara.souza@example.com',
218
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Luciara',
219
- nat: 'BR',
220
- },
221
- {
222
- gender: 'male',
223
- name: {
224
- title: 'Mr',
225
- first: 'Valgi',
226
- last: 'da Cunha',
227
- },
228
- email: 'valgi.dacunha@example.com',
229
- picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Valgi',
230
- nat: 'BR',
231
- },
232
- ],
233
- };
234
-
235
- const useStyles = makeStyles({
236
- avatar: {
237
- height: 32,
238
- width: 32,
239
- borderRadius: '50%',
240
- },
241
- });
242
-
243
- type User = {
244
- gender: string; // "male"
245
- name: {
246
- title: string; // "Mr",
247
- first: string; // "Duane",
248
- last: string; // "Reed"
249
- };
250
- email: string; // "duane.reed@example.com"
251
- picture: string; // "https://api.dicebear.com/6.x/open-peeps/svg?seed=Duane"
252
- nat: string; // "AU"
253
- };
254
-
255
- type DenseTableProps = {
256
- users: User[];
257
- };
258
-
259
- export const DenseTable = ({ users }: DenseTableProps) => {
260
- const classes = useStyles();
261
-
262
- const columns: TableColumn[] = [
263
- { title: 'Avatar', field: 'avatar' },
264
- { title: 'Name', field: 'name' },
265
- { title: 'Email', field: 'email' },
266
- { title: 'Nationality', field: 'nationality' },
267
- ];
268
-
269
- const data = users.map(user => {
270
- return {
271
- avatar: (
272
- <img
273
- src={user.picture}
274
- className={classes.avatar}
275
- alt={user.name.first}
276
- />
277
- ),
278
- name: `${user.name.first} ${user.name.last}`,
279
- email: user.email,
280
- nationality: user.nat,
281
- };
282
- });
283
-
284
- return (
285
- <Table
286
- title="Example User List"
287
- options=\{{ search: false, paging: false }}
288
- columns={columns}
289
- data={data}
290
- />
291
- );
292
- };
293
-
294
- export const ExampleFetchComponent = () => {
295
-
296
- const { value, loading, error } = useAsync(async (): Promise<User[]> => {
297
- // Would use fetch in a real world example
298
- return exampleUsers.results;
299
- }, []);
300
-
301
- if (loading) {
302
- return <Progress />;
303
- } else if (error) {
304
- return <ResponseErrorPanel error={error} />;
305
- }
306
-
307
- return <DenseTable users={value || []} />;
308
- };
@@ -1 +0,0 @@
1
- export { ExampleFetchComponent } from './ExampleFetchComponent';
@@ -1 +0,0 @@
1
- export { {{ pluginVar }}, {{ extensionName }} } from './plugin';
@@ -1,7 +0,0 @@
1
- import { {{ pluginVar }} } from './plugin';
2
-
3
- describe('{{pluginId}}', () => {
4
- it('should export plugin', () => {
5
- expect({{ pluginVar }}).toBeDefined();
6
- });
7
- });
@@ -1,22 +0,0 @@
1
- import {
2
- createPlugin,
3
- createRoutableExtension,
4
- } from '@backstage/core-plugin-api';
5
-
6
- import { rootRouteRef } from './routes';
7
-
8
- export const {{ pluginVar }} = createPlugin({
9
- id: '{{pluginId}}',
10
- routes: {
11
- root: rootRouteRef,
12
- },
13
- });
14
-
15
- export const {{ extensionName }} = {{ pluginVar }}.provide(
16
- createRoutableExtension({
17
- name: '{{ extensionName }}',
18
- component: () =>
19
- import('./components/ExampleComponent').then(m => m.ExampleComponent),
20
- mountPoint: rootRouteRef,
21
- }),
22
- );
@@ -1,5 +0,0 @@
1
- import { createRouteRef } from '@backstage/core-plugin-api';
2
-
3
- export const rootRouteRef = createRouteRef({
4
- id: '{{pluginId}}',
5
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1 +0,0 @@
1
- module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
@@ -1,20 +0,0 @@
1
- # {{pluginId}}
2
-
3
- Welcome to the {{pluginId}} plugin!
4
-
5
- _This plugin was created through the Backstage CLI_
6
-
7
- ## Getting started
8
-
9
- Your plugin has been added to the app in this repository, meaning you'll be able
10
- to access it by running `yarn start` in the root directory, and then navigating
11
- to [/{{pluginId}}](http://localhost:3000/{{pluginId}}).
12
-
13
- This plugin is built with Backstage's [new frontend
14
- system](https://backstage.io/docs/frontend-system/architecture/index), and you
15
- can find more information about building plugins in the [plugin builder
16
- documentation](https://backstage.io/docs/frontend-system/building-plugins/index).
17
-
18
- You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
19
- This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
20
- It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
@@ -1,10 +0,0 @@
1
- import { createApp } from '@backstage/frontend-defaults';
2
- import ReactDOM from 'react-dom';
3
-
4
- import plugin from '../src';
5
-
6
- const app = createApp({
7
- features: [plugin],
8
- });
9
-
10
- ReactDOM.render(app.createRoot(), document.getElementById('root'));