@backstage/create-app 0.4.14 → 0.4.18-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,287 @@
1
1
  # @backstage/create-app
2
2
 
3
+ ## 0.4.18-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5bd0ce9e62: chore(deps): bump `inquirer` from 7.3.3 to 8.2.0
8
+ - ba59832aed: Permission the `catalog-import` route
9
+
10
+ The following changes are **required** if you intend to add permissions to your existing app.
11
+
12
+ Use the `PermissionedRoute` for `CatalogImportPage` instead of the normal `Route`:
13
+
14
+ ```diff
15
+ // packages/app/src/App.tsx
16
+ ...
17
+ + import { PermissionedRoute } from '@backstage/plugin-permission-react';
18
+ + import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';
19
+
20
+ ...
21
+
22
+ - <Route path="/catalog-import" element={<CatalogImportPage />} />
23
+ + <PermissionedRoute
24
+ + path="/catalog-import"
25
+ + permission={catalogEntityCreatePermission}
26
+ + element={<CatalogImportPage />}
27
+ + />
28
+ ```
29
+
30
+ ## 0.4.18-next.0
31
+
32
+ ### Patch Changes
33
+
34
+ - f27f5197e2: Apply the fix from `0.4.16`, which is part of the `v0.65.1` release of Backstage.
35
+ - 2687029a67: Update backend-to-backend auth link in configuration file comment
36
+ - 24ef62048c: Adds missing `/catalog-graph` route to `<CatalogGraphPage/>`.
37
+
38
+ To fix this problem for a recently created app please update your `app/src/App.tsx`
39
+
40
+ ```diff
41
+ + import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
42
+
43
+ ... omitted ...
44
+
45
+ </Route>
46
+ <Route path="/settings" element={<UserSettingsPage />} />
47
+ + <Route path="/catalog-graph" element={<CatalogGraphPage />} />
48
+ </FlatRoutes>
49
+ ```
50
+
51
+ - cef64b1561: Added `tokenManager` as a required property for the auth-backend `createRouter` function. This dependency is used to issue server tokens that are used by the `CatalogIdentityClient` when looking up users and their group membership during authentication.
52
+
53
+ These changes are **required** to `packages/backend/src/plugins/auth.ts`:
54
+
55
+ ```diff
56
+ export default async function createPlugin({
57
+ logger,
58
+ database,
59
+ config,
60
+ discovery,
61
+ + tokenManager,
62
+ }: PluginEnvironment): Promise<Router> {
63
+ return await createRouter({
64
+ logger,
65
+ config,
66
+ database,
67
+ discovery,
68
+ + tokenManager,
69
+ });
70
+ }
71
+ ```
72
+
73
+ - e39d88bd84: Switched the `app` dependency in the backend to use a file target rather than version.
74
+
75
+ To apply this change to an existing app, make the following change to `packages/backend/package.json`:
76
+
77
+ ```diff
78
+ "dependencies": {
79
+ - "app": "0.0.0",
80
+ + "app": "file:../app",
81
+ ```
82
+
83
+ ## 0.4.16
84
+
85
+ ### Patch Changes
86
+
87
+ - c945cd9f7e: Adds missing `/catalog-graph` route to `<CatalogGraphPage/>`.
88
+
89
+ To fix this problem for a recently created app please update your `app/src/App.tsx`
90
+
91
+ ```diff
92
+ + import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
93
+
94
+ ... omitted ...
95
+
96
+ </Route>
97
+ <Route path="/settings" element={<UserSettingsPage />} />
98
+ + <Route path="/catalog-graph" element={<CatalogGraphPage />} />
99
+ </FlatRoutes>
100
+ ```
101
+
102
+ ## 0.4.15
103
+
104
+ ### Patch Changes
105
+
106
+ - 01b27d547c: Added three additional required properties to the search-backend `createRouter` function to support filtering search results based on permissions. To make this change to an existing app, add the required parameters to the `createRouter` call in `packages/backend/src/plugins/search.ts`:
107
+
108
+ ```diff
109
+ export default async function createPlugin({
110
+ logger,
111
+ + permissions,
112
+ discovery,
113
+ config,
114
+ tokenManager,
115
+ }: PluginEnvironment) {
116
+ /* ... */
117
+
118
+ return await createRouter({
119
+ engine: indexBuilder.getSearchEngine(),
120
+ + types: indexBuilder.getDocumentTypes(),
121
+ + permissions,
122
+ + config,
123
+ logger,
124
+ });
125
+ }
126
+ ```
127
+
128
+ - a0d446c8ec: Replaced EntitySystemDiagramCard with EntityCatalogGraphCard
129
+
130
+ To make this change to an existing app:
131
+
132
+ Add `@backstage/plugin-catalog-graph` as a `dependency` in `packages/app/package.json`
133
+
134
+ Apply the following changes to the `packages/app/src/components/catalog/EntityPage.tsx` file:
135
+
136
+ ```diff
137
+ + import {
138
+ + Direction,
139
+ + EntityCatalogGraphCard,
140
+ + } from '@backstage/plugin-catalog-graph';
141
+ + import {
142
+ + RELATION_API_CONSUMED_BY,
143
+ + RELATION_API_PROVIDED_BY,
144
+ + RELATION_CONSUMES_API,
145
+ + RELATION_DEPENDENCY_OF,
146
+ + RELATION_DEPENDS_ON,
147
+ + RELATION_HAS_PART,
148
+ + RELATION_PART_OF,
149
+ + RELATION_PROVIDES_API,
150
+ + } from '@backstage/catalog-model';
151
+ ```
152
+
153
+ ```diff
154
+ <EntityLayout.Route path="/diagram" title="Diagram">
155
+ - <EntitySystemDiagramCard />
156
+ + <EntityCatalogGraphCard
157
+ + variant="gridItem"
158
+ + direction={Direction.TOP_BOTTOM}
159
+ + title="System Diagram"
160
+ + height={700}
161
+ + relations={[
162
+ + RELATION_PART_OF,
163
+ + RELATION_HAS_PART,
164
+ + RELATION_API_CONSUMED_BY,
165
+ + RELATION_API_PROVIDED_BY,
166
+ + RELATION_CONSUMES_API,
167
+ + RELATION_PROVIDES_API,
168
+ + RELATION_DEPENDENCY_OF,
169
+ + RELATION_DEPENDS_ON,
170
+ + ]}
171
+ + unidirectional={false}
172
+ + />
173
+ </EntityLayout.Route>
174
+ ```
175
+
176
+ ```diff
177
+ const cicdContent = (
178
+ <Grid item md={6}>
179
+ <EntityAboutCard variant="gridItem" />
180
+ </Grid>
181
+ + <Grid item md={6} xs={12}>
182
+ + <EntityCatalogGraphCard variant="gridItem" height={400} />
183
+ + </Grid>
184
+ ```
185
+
186
+ Add the above component in `overviewContent`, `apiPage` , `systemPage` and domainPage` as well.
187
+
188
+ - 4aca2a5307: An example instance of a `<SearchFilter.Select />` with asynchronously loaded values was added to the composed `SearchPage.tsx`, allowing searches bound to the `techdocs` type to be filtered by entity name.
189
+
190
+ This is an entirely optional change; if you wish to adopt it, you can make the following (or similar) changes to your search page layout:
191
+
192
+ ```diff
193
+ --- a/packages/app/src/components/search/SearchPage.tsx
194
+ +++ b/packages/app/src/components/search/SearchPage.tsx
195
+ @@ -2,6 +2,10 @@ import React from 'react';
196
+ import { makeStyles, Theme, Grid, List, Paper } from '@material-ui/core';
197
+
198
+ import { CatalogResultListItem } from '@backstage/plugin-catalog';
199
+ +import {
200
+ + catalogApiRef,
201
+ + CATALOG_FILTER_EXISTS,
202
+ +} from '@backstage/plugin-catalog-react';
203
+ import { DocsResultListItem } from '@backstage/plugin-techdocs';
204
+
205
+ import {
206
+ @@ -10,6 +14,7 @@ import {
207
+ SearchResult,
208
+ SearchType,
209
+ DefaultResultListItem,
210
+ + useSearch,
211
+ } from '@backstage/plugin-search';
212
+ import {
213
+ CatalogIcon,
214
+ @@ -18,6 +23,7 @@ import {
215
+ Header,
216
+ Page,
217
+ } from '@backstage/core-components';
218
+ +import { useApi } from '@backstage/core-plugin-api';
219
+
220
+ const useStyles = makeStyles((theme: Theme) => ({
221
+ bar: {
222
+ @@ -36,6 +42,8 @@ const useStyles = makeStyles((theme: Theme) => ({
223
+
224
+ const SearchPage = () => {
225
+ const classes = useStyles();
226
+ + const { types } = useSearch();
227
+ + const catalogApi = useApi(catalogApiRef);
228
+
229
+ return (
230
+ <Page themeId="home">
231
+ @@ -65,6 +73,27 @@ const SearchPage = () => {
232
+ ]}
233
+ />
234
+ <Paper className={classes.filters}>
235
+ + {types.includes('techdocs') && (
236
+ + <SearchFilter.Select
237
+ + className={classes.filter}
238
+ + label="Entity"
239
+ + name="name"
240
+ + values={async () => {
241
+ + // Return a list of entities which are documented.
242
+ + const { items } = await catalogApi.getEntities({
243
+ + fields: ['metadata.name'],
244
+ + filter: {
245
+ + 'metadata.annotations.backstage.io/techdocs-ref':
246
+ + CATALOG_FILTER_EXISTS,
247
+ + },
248
+ + });
249
+ +
250
+ + const names = items.map(entity => entity.metadata.name);
251
+ + names.sort();
252
+ + return names;
253
+ + }}
254
+ + />
255
+ + )}
256
+ <SearchFilter.Select
257
+ className={classes.filter}
258
+ name="kind"
259
+ ```
260
+
261
+ - 1dbe63ec39: A `label` prop was added to `<SearchFilter.* />` components in order to allow
262
+ user-friendly label strings (as well as the option to omit a label). In order
263
+ to maintain labels on your existing filters, add a `label` prop to them in your
264
+ `SearchPage.tsx`.
265
+
266
+ ```diff
267
+ --- a/packages/app/src/components/search/SearchPage.tsx
268
+ +++ b/packages/app/src/components/search/SearchPage.tsx
269
+ @@ -96,11 +96,13 @@ const SearchPage = () => {
270
+ )}
271
+ <SearchFilter.Select
272
+ className={classes.filter}
273
+ + label="Kind"
274
+ name="kind"
275
+ values={['Component', 'Template']}
276
+ />
277
+ <SearchFilter.Checkbox
278
+ className={classes.filter}
279
+ + label="Lifecycle"
280
+ name="lifecycle"
281
+ values={['experimental', 'production']}
282
+ />
283
+ ```
284
+
3
285
  ## 0.4.14
4
286
 
5
287
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -55,113 +55,122 @@ ${chalk__default["default"].red(`${error}`)}
55
55
  }
56
56
  }
57
57
 
58
- var version$D = "0.4.14";
58
+ var version$G = "0.4.18-next.1";
59
59
 
60
- var version$C = "0.1.5";
60
+ var version$F = "0.1.6-next.1";
61
61
 
62
- var version$B = "0.10.4";
62
+ var version$E = "0.10.6-next.0";
63
63
 
64
- var version$A = "0.1.4";
64
+ var version$D = "0.1.5-next.0";
65
65
 
66
- var version$z = "0.5.5";
66
+ var version$C = "0.5.5";
67
67
 
68
- var version$y = "0.9.10";
68
+ var version$B = "0.9.10";
69
69
 
70
- var version$x = "0.12.0";
70
+ var version$A = "0.13.1-next.1";
71
71
 
72
- var version$w = "0.1.13";
72
+ var version$z = "0.1.13";
73
73
 
74
- var version$v = "0.5.0";
74
+ var version$y = "0.5.2-next.0";
75
75
 
76
- var version$u = "0.8.5";
76
+ var version$x = "0.8.7-next.1";
77
77
 
78
- var version$t = "0.6.0";
78
+ var version$w = "0.6.0";
79
79
 
80
- var version$s = "0.2.0";
80
+ var version$v = "0.2.0";
81
81
 
82
- var version$r = "0.1.19";
82
+ var version$u = "0.1.20-next.0";
83
83
 
84
- var version$q = "0.2.3";
84
+ var version$t = "0.2.4-next.0";
85
85
 
86
- var version$p = "0.2.14";
86
+ var version$s = "0.2.14";
87
87
 
88
- var version$o = "0.7.0";
88
+ var version$r = "0.7.1-next.0";
89
89
 
90
- var version$n = "0.3.22";
90
+ var version$q = "0.3.23-next.0";
91
91
 
92
- var version$m = "0.7.0";
92
+ var version$p = "0.9.0-next.1";
93
93
 
94
- var version$l = "0.7.9";
94
+ var version$o = "0.7.11-next.1";
95
95
 
96
- var version$k = "0.6.12";
96
+ var version$n = "0.1.2-next.0";
97
97
 
98
- var version$j = "0.21.0";
98
+ var version$m = "0.6.13-next.1";
99
99
 
100
- var version$i = "0.7.10";
100
+ var version$l = "0.21.2-next.1";
101
101
 
102
- var version$h = "0.2.35";
102
+ var version$k = "0.2.9-next.0";
103
103
 
104
- var version$g = "0.3.26";
104
+ var version$j = "0.8.0-next.0";
105
105
 
106
- var version$f = "0.4.32";
106
+ var version$i = "0.2.36-next.0";
107
107
 
108
- var version$e = "0.2.35";
108
+ var version$h = "0.3.28-next.0";
109
+
110
+ var version$g = "0.4.34-next.0";
111
+
112
+ var version$f = "0.2.36-next.0";
113
+
114
+ var version$e = "0.4.1-next.0";
109
115
 
110
116
  var version$d = "0.4.0";
111
117
 
112
- var version$c = "0.4.0";
118
+ var version$c = "0.3.0";
113
119
 
114
- var version$b = "0.4.0";
120
+ var version$b = "0.4.2-next.1";
115
121
 
116
- var version$a = "0.2.16";
122
+ var version$a = "0.2.17-next.1";
117
123
 
118
- var version$9 = "0.1.19";
124
+ var version$9 = "0.1.20-next.1";
119
125
 
120
- var version$8 = "0.12.0";
126
+ var version$8 = "0.12.1-next.1";
121
127
 
122
- var version$7 = "0.15.21";
128
+ var version$7 = "0.15.23-next.1";
123
129
 
124
- var version$6 = "0.5.6";
130
+ var version$6 = "0.6.1-next.0";
125
131
 
126
- var version$5 = "0.3.1";
132
+ var version$5 = "0.4.1-next.1";
127
133
 
128
- var version$4 = "0.4.4";
134
+ var version$4 = "0.4.5";
129
135
 
130
- var version$3 = "0.5.3";
136
+ var version$3 = "0.5.4-next.0";
131
137
 
132
- var version$2 = "0.13.0";
138
+ var version$2 = "0.13.2-next.1";
133
139
 
134
- var version$1 = "0.13.0";
140
+ var version$1 = "0.13.2-next.0";
135
141
 
136
- var version = "0.3.17";
142
+ var version = "0.3.18-next.0";
137
143
 
138
144
  const packageVersions = {
139
- "@backstage/app-defaults": version$C,
140
- "@backstage/backend-common": version$B,
141
- "@backstage/backend-tasks": version$A,
142
- "@backstage/catalog-client": version$z,
143
- "@backstage/catalog-model": version$y,
144
- "@backstage/cli": version$x,
145
- "@backstage/config": version$w,
146
- "@backstage/core-app-api": version$v,
147
- "@backstage/core-components": version$u,
148
- "@backstage/core-plugin-api": version$t,
149
- "@backstage/errors": version$s,
150
- "@backstage/integration-react": version$r,
151
- "@backstage/plugin-api-docs": version$o,
152
- "@backstage/plugin-app-backend": version$n,
153
- "@backstage/plugin-auth-backend": version$m,
154
- "@backstage/plugin-catalog": version$l,
155
- "@backstage/plugin-catalog-react": version$k,
156
- "@backstage/plugin-catalog-backend": version$j,
157
- "@backstage/plugin-catalog-import": version$i,
158
- "@backstage/plugin-circleci": version$h,
159
- "@backstage/plugin-explore": version$g,
160
- "@backstage/plugin-github-actions": version$f,
161
- "@backstage/plugin-lighthouse": version$e,
162
- "@backstage/plugin-org": version$d,
163
- "@backstage/plugin-permission-common": version$c,
145
+ "@backstage/app-defaults": version$F,
146
+ "@backstage/backend-common": version$E,
147
+ "@backstage/backend-tasks": version$D,
148
+ "@backstage/catalog-client": version$C,
149
+ "@backstage/catalog-model": version$B,
150
+ "@backstage/cli": version$A,
151
+ "@backstage/config": version$z,
152
+ "@backstage/core-app-api": version$y,
153
+ "@backstage/core-components": version$x,
154
+ "@backstage/core-plugin-api": version$w,
155
+ "@backstage/errors": version$v,
156
+ "@backstage/integration-react": version$u,
157
+ "@backstage/plugin-api-docs": version$r,
158
+ "@backstage/plugin-app-backend": version$q,
159
+ "@backstage/plugin-auth-backend": version$p,
160
+ "@backstage/plugin-catalog": version$o,
161
+ "@backstage/plugin-catalog-common": version$n,
162
+ "@backstage/plugin-catalog-react": version$m,
163
+ "@backstage/plugin-catalog-backend": version$l,
164
+ "@backstage/plugin-catalog-graph": version$k,
165
+ "@backstage/plugin-catalog-import": version$j,
166
+ "@backstage/plugin-circleci": version$i,
167
+ "@backstage/plugin-explore": version$h,
168
+ "@backstage/plugin-github-actions": version$g,
169
+ "@backstage/plugin-lighthouse": version$f,
170
+ "@backstage/plugin-org": version$e,
171
+ "@backstage/plugin-permission-common": version$d,
164
172
  "@backstage/plugin-permission-node": version$b,
173
+ "@backstage/plugin-permission-react": version$c,
165
174
  "@backstage/plugin-proxy-backend": version$a,
166
175
  "@backstage/plugin-rollbar-backend": version$9,
167
176
  "@backstage/plugin-scaffolder": version$8,
@@ -173,8 +182,8 @@ const packageVersions = {
173
182
  "@backstage/plugin-techdocs": version$2,
174
183
  "@backstage/plugin-techdocs-backend": version$1,
175
184
  "@backstage/plugin-user-settings": version,
176
- "@backstage/test-utils": version$q,
177
- "@backstage/theme": version$p
185
+ "@backstage/test-utils": version$t,
186
+ "@backstage/theme": version$s
178
187
  };
179
188
 
180
189
  const TASK_NAME_MAX_LENGTH = 14;
@@ -375,7 +384,7 @@ var createApp = async (cmd, version) => {
375
384
  };
376
385
 
377
386
  const main = (argv) => {
378
- program__default["default"].name("backstage-create-app").version(version$D).description("Creates a new app in a new directory or specified path").option("--path [directory]", "Location to store the app defaulting to a new folder with the app name").option("--skip-install", "Skip the install and builds steps after creating the app").action((cmd) => createApp(cmd, version$D));
387
+ program__default["default"].name("backstage-create-app").version(version$G).description("Creates a new app in a new directory or specified path").option("--path [directory]", "Location to store the app defaulting to a new folder with the app name").option("--skip-install", "Skip the install and builds steps after creating the app").action((cmd) => createApp(cmd, version$G));
379
388
  program__default["default"].parse(argv);
380
389
  };
381
390
  process.on("unhandledRejection", (rejection) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/lib/errors.ts","../src/lib/versions.ts","../src/lib/tasks.ts","../src/createApp.ts","../src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\n\nexport class CustomError extends Error {\n get name(): string {\n return this.constructor.name;\n }\n}\n\nexport class ExitCodeError extends CustomError {\n readonly code: number;\n\n constructor(code: number, command?: string) {\n if (command) {\n super(`Command '${command}' exited with code ${code}`);\n } else {\n super(`Child exited with code ${code}`);\n }\n this.code = code;\n }\n}\n\nexport function exitWithError(error: Error): never {\n if (error instanceof ExitCodeError) {\n process.stderr.write(`\\n${chalk.red(error.message)}\\n\\n`);\n process.exit(error.code);\n } else {\n process.stderr.write(`\\n${chalk.red(`${error}`)}\\n\\n`);\n process.exit(1);\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable monorepo/no-relative-import */\n\n/*\nThis is a list of all packages used by the template. If dependencies are added or removed,\nthis list should be updated as well.\n\nThe list, and the accompanying peerDependencies entries, are here to ensure correct versioning\nand bumping of this package. Without this list the version would not be bumped unless we\nmanually trigger a release.\n\nThis does not create an actual dependency on these packages and does not bring in any code.\nRelative imports are used rather than package imports to make sure the packages aren't externalized.\nRollup will extract the value of the version field in each package at build time without\nleaving any imports in place.\n*/\n\nimport { version as appDefaults } from '../../../app-defaults/package.json';\nimport { version as backendCommon } from '../../../backend-common/package.json';\nimport { version as backendTasks } from '../../../backend-tasks/package.json';\nimport { version as catalogClient } from '../../../catalog-client/package.json';\nimport { version as catalogModel } from '../../../catalog-model/package.json';\nimport { version as cli } from '../../../cli/package.json';\nimport { version as config } from '../../../config/package.json';\nimport { version as coreAppApi } from '../../../core-app-api/package.json';\nimport { version as coreComponents } from '../../../core-components/package.json';\nimport { version as corePluginApi } from '../../../core-plugin-api/package.json';\nimport { version as errors } from '../../../errors/package.json';\nimport { version as integrationReact } from '../../../integration-react/package.json';\nimport { version as testUtils } from '../../../test-utils/package.json';\nimport { version as theme } from '../../../theme/package.json';\n\nimport { version as pluginApiDocs } from '../../../../plugins/api-docs/package.json';\nimport { version as pluginAppBackend } from '../../../../plugins/app-backend/package.json';\nimport { version as pluginAuthBackend } from '../../../../plugins/auth-backend/package.json';\nimport { version as pluginCatalog } from '../../../../plugins/catalog/package.json';\nimport { version as pluginCatalogReact } from '../../../../plugins/catalog-react/package.json';\nimport { version as pluginCatalogBackend } from '../../../../plugins/catalog-backend/package.json';\nimport { version as pluginCatalogImport } from '../../../../plugins/catalog-import/package.json';\nimport { version as pluginCircleci } from '../../../../plugins/circleci/package.json';\nimport { version as pluginExplore } from '../../../../plugins/explore/package.json';\nimport { version as pluginGithubActions } from '../../../../plugins/github-actions/package.json';\nimport { version as pluginLighthouse } from '../../../../plugins/lighthouse/package.json';\nimport { version as pluginOrg } from '../../../../plugins/org/package.json';\nimport { version as pluginPermissionCommon } from '../../../../plugins/permission-common/package.json';\nimport { version as pluginPermissionNode } from '../../../../plugins/permission-node/package.json';\nimport { version as pluginProxyBackend } from '../../../../plugins/proxy-backend/package.json';\nimport { version as pluginRollbarBackend } from '../../../../plugins/rollbar-backend/package.json';\nimport { version as pluginScaffolder } from '../../../../plugins/scaffolder/package.json';\nimport { version as pluginScaffolderBackend } from '../../../../plugins/scaffolder-backend/package.json';\nimport { version as pluginSearch } from '../../../../plugins/search/package.json';\nimport { version as pluginSearchBackend } from '../../../../plugins/search-backend/package.json';\nimport { version as pluginSearchBackendNode } from '../../../../plugins/search-backend-node/package.json';\nimport { version as pluginTechRadar } from '../../../../plugins/tech-radar/package.json';\nimport { version as pluginTechdocs } from '../../../../plugins/techdocs/package.json';\nimport { version as pluginTechdocsBackend } from '../../../../plugins/techdocs-backend/package.json';\nimport { version as pluginUserSettings } from '../../../../plugins/user-settings/package.json';\n\nexport const packageVersions = {\n '@backstage/app-defaults': appDefaults,\n '@backstage/backend-common': backendCommon,\n '@backstage/backend-tasks': backendTasks,\n '@backstage/catalog-client': catalogClient,\n '@backstage/catalog-model': catalogModel,\n '@backstage/cli': cli,\n '@backstage/config': config,\n '@backstage/core-app-api': coreAppApi,\n '@backstage/core-components': coreComponents,\n '@backstage/core-plugin-api': corePluginApi,\n '@backstage/errors': errors,\n '@backstage/integration-react': integrationReact,\n '@backstage/plugin-api-docs': pluginApiDocs,\n '@backstage/plugin-app-backend': pluginAppBackend,\n '@backstage/plugin-auth-backend': pluginAuthBackend,\n '@backstage/plugin-catalog': pluginCatalog,\n '@backstage/plugin-catalog-react': pluginCatalogReact,\n '@backstage/plugin-catalog-backend': pluginCatalogBackend,\n '@backstage/plugin-catalog-import': pluginCatalogImport,\n '@backstage/plugin-circleci': pluginCircleci,\n '@backstage/plugin-explore': pluginExplore,\n '@backstage/plugin-github-actions': pluginGithubActions,\n '@backstage/plugin-lighthouse': pluginLighthouse,\n '@backstage/plugin-org': pluginOrg,\n '@backstage/plugin-permission-common': pluginPermissionCommon,\n '@backstage/plugin-permission-node': pluginPermissionNode,\n '@backstage/plugin-proxy-backend': pluginProxyBackend,\n '@backstage/plugin-rollbar-backend': pluginRollbarBackend,\n '@backstage/plugin-scaffolder': pluginScaffolder,\n '@backstage/plugin-scaffolder-backend': pluginScaffolderBackend,\n '@backstage/plugin-search': pluginSearch,\n '@backstage/plugin-search-backend': pluginSearchBackend,\n '@backstage/plugin-search-backend-node': pluginSearchBackendNode,\n '@backstage/plugin-tech-radar': pluginTechRadar,\n '@backstage/plugin-techdocs': pluginTechdocs,\n '@backstage/plugin-techdocs-backend': pluginTechdocsBackend,\n '@backstage/plugin-user-settings': pluginUserSettings,\n '@backstage/test-utils': testUtils,\n '@backstage/theme': theme,\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BACKSTAGE_JSON } from '@backstage/cli-common';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport handlebars from 'handlebars';\nimport ora from 'ora';\nimport recursive from 'recursive-readdir';\nimport {\n basename,\n dirname,\n join,\n resolve as resolvePath,\n relative as relativePath,\n} from 'path';\nimport { exec as execCb } from 'child_process';\nimport { packageVersions } from './versions';\nimport { promisify } from 'util';\n\nconst TASK_NAME_MAX_LENGTH = 14;\nconst exec = promisify(execCb);\n\nexport class Task {\n static log(name: string = '') {\n process.stdout.write(`${chalk.green(name)}\\n`);\n }\n\n static error(message: string = '') {\n process.stdout.write(`\\n${chalk.red(message)}\\n\\n`);\n }\n\n static section(name: string) {\n const title = chalk.green(`${name}:`);\n process.stdout.write(`\\n ${title}\\n`);\n }\n\n static exit(code: number = 0) {\n process.exit(code);\n }\n\n static async forItem(\n task: string,\n item: string,\n taskFunc: () => Promise<void>,\n ): Promise<void> {\n const paddedTask = chalk.green(task.padEnd(TASK_NAME_MAX_LENGTH));\n\n const spinner = ora({\n prefixText: chalk.green(` ${paddedTask}${chalk.cyan(item)}`),\n spinner: 'arc',\n color: 'green',\n }).start();\n\n try {\n await taskFunc();\n spinner.succeed();\n } catch (error) {\n spinner.fail();\n throw error;\n }\n }\n}\n\n/**\n * Generate a templated backstage project\n *\n * @param templateDir - location containing template files\n * @param destinationDir - location to save templated project\n * @param context - template parameters\n */\nexport async function templatingTask(\n templateDir: string,\n destinationDir: string,\n context: any,\n version: string,\n) {\n const files = await recursive(templateDir).catch(error => {\n throw new Error(`Failed to read template directory: ${error.message}`);\n });\n\n for (const file of files) {\n const destinationFile = resolvePath(\n destinationDir,\n relativePath(templateDir, file),\n );\n await fs.ensureDir(dirname(destinationFile));\n\n if (file.endsWith('.hbs')) {\n await Task.forItem('templating', basename(file), async () => {\n const destination = destinationFile.replace(/\\.hbs$/, '');\n\n const template = await fs.readFile(file);\n const compiled = handlebars.compile(template.toString());\n const contents = compiled(\n { name: basename(destination), ...context },\n {\n helpers: {\n version(name: keyof typeof packageVersions) {\n if (name in packageVersions) {\n return packageVersions[name];\n }\n throw new Error(`No version available for package ${name}`);\n },\n },\n },\n );\n\n await fs.writeFile(destination, contents).catch(error => {\n throw new Error(\n `Failed to create file: ${destination}: ${error.message}`,\n );\n });\n });\n } else {\n await Task.forItem('copying', basename(file), async () => {\n await fs.copyFile(file, destinationFile).catch(error => {\n const destination = destinationFile;\n throw new Error(\n `Failed to copy file to ${destination} : ${error.message}`,\n );\n });\n });\n }\n }\n await Task.forItem('creating', BACKSTAGE_JSON, () =>\n fs.writeFile(\n join(destinationDir, BACKSTAGE_JSON),\n `{\\n \"version\": ${JSON.stringify(version)}\\n}\\n`,\n ),\n );\n}\n\n/**\n * Verify that application target does not already exist\n *\n * @param rootDir - The directory to create application folder `name`\n * @param name - The specified name of the application\n * @Throws Error - If directory with name of `destination` already exists\n */\nexport async function checkAppExistsTask(rootDir: string, name: string) {\n await Task.forItem('checking', name, async () => {\n const destination = resolvePath(rootDir, name);\n\n if (await fs.pathExists(destination)) {\n const existing = chalk.cyan(destination.replace(`${rootDir}/`, ''));\n throw new Error(\n `A directory with the same name already exists: ${existing}\\nPlease try again with a different app name`,\n );\n }\n });\n}\n\n/**\n * Verify that application `path` exists, otherwise create the directory\n *\n * @param path - target to create directory\n * @throws if `path` is a file, or `fs.mkdir` fails\n */\nexport async function checkPathExistsTask(path: string) {\n await Task.forItem('checking', path, async () => {\n try {\n await fs.mkdirs(path);\n } catch (error) {\n // will fail if a file already exists at given `path`\n throw new Error(`Failed to create app directory: ${error.message}`);\n }\n });\n}\n\n/**\n * Create a folder to store templated files\n *\n * @param tempDir - target temporary directory\n * @throws if `fs.mkdir` fails\n */\nexport async function createTemporaryAppFolderTask(tempDir: string) {\n await Task.forItem('creating', 'temporary directory', async () => {\n try {\n await fs.mkdir(tempDir);\n } catch (error) {\n throw new Error(`Failed to create temporary app directory, ${error}`);\n }\n });\n}\n\n/**\n * Run `yarn install` and `run tsc` in application directory\n *\n * @param appDir - location of application to build\n */\nexport async function buildAppTask(appDir: string) {\n const runCmd = async (cmd: string) => {\n await Task.forItem('executing', cmd, async () => {\n process.chdir(appDir);\n await exec(cmd).catch(error => {\n process.stdout.write(error.stderr);\n process.stdout.write(error.stdout);\n throw new Error(`Could not execute command ${chalk.cyan(cmd)}`);\n });\n });\n };\n\n await runCmd('yarn install');\n await runCmd('yarn tsc');\n}\n\n/**\n * Move temporary directory to destination application folder\n *\n * @param tempDir - source path to copy files from\n * @param destination - target path to copy files\n * @param id - item ID\n * @throws if `fs.move` fails\n */\nexport async function moveAppTask(\n tempDir: string,\n destination: string,\n id: string,\n) {\n await Task.forItem('moving', id, async () => {\n await fs\n .move(tempDir, destination)\n .catch(error => {\n throw new Error(\n `Failed to move app from ${tempDir} to ${destination}: ${error.message}`,\n );\n })\n .finally(() => {\n // remove temporary files on both success and failure\n fs.removeSync(tempDir);\n });\n });\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport inquirer, { Answers } from 'inquirer';\nimport { resolve as resolvePath } from 'path';\nimport { findPaths } from '@backstage/cli-common';\nimport os from 'os';\nimport {\n Task,\n buildAppTask,\n checkAppExistsTask,\n checkPathExistsTask,\n createTemporaryAppFolderTask,\n moveAppTask,\n templatingTask,\n} from './lib/tasks';\n\nexport default async (cmd: Command, version: string): Promise<void> => {\n /* eslint-disable-next-line no-restricted-syntax */\n const paths = findPaths(__dirname);\n\n const answers: Answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'name',\n message: chalk.blue('Enter a name for the app [required]'),\n validate: (value: any) => {\n if (!value) {\n return chalk.red('Please enter a name for the app');\n } else if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(value)) {\n return chalk.red(\n 'App name must be lowercase and contain only letters, digits, and dashes.',\n );\n }\n return true;\n },\n },\n {\n type: 'list',\n name: 'dbType',\n message: chalk.blue('Select database for the backend [required]'),\n choices: ['SQLite', 'PostgreSQL'],\n },\n ]);\n answers.dbTypePG = answers.dbType === 'PostgreSQL';\n answers.dbTypeSqlite = answers.dbType === 'SQLite';\n\n const templateDir = paths.resolveOwn('templates/default-app');\n const tempDir = resolvePath(os.tmpdir(), answers.name);\n\n // Use `--path` argument as application directory when specified, otherwise\n // create a directory using `answers.name`\n const appDir = cmd.path\n ? resolvePath(paths.targetDir, cmd.path)\n : resolvePath(paths.targetDir, answers.name);\n\n Task.log();\n Task.log('Creating the app...');\n\n try {\n if (cmd.path) {\n // Template directly to specified path\n\n Task.section('Checking that supplied path exists');\n await checkPathExistsTask(appDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, cmd.path, answers, version);\n } else {\n // Template to temporary location, and then move files\n\n Task.section('Checking if the directory is available');\n await checkAppExistsTask(paths.targetDir, answers.name);\n\n Task.section('Creating a temporary app directory');\n await createTemporaryAppFolderTask(tempDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, tempDir, answers, version);\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (!cmd.skipInstall) {\n Task.section('Building the app');\n await buildAppTask(appDir);\n }\n\n Task.log();\n Task.log(\n chalk.green(`🥇 Successfully created ${chalk.cyan(answers.name)}`),\n );\n Task.log();\n Task.section('All set! Now you might want to');\n Task.log(` Run the app: ${chalk.cyan(`cd ${answers.name} && yarn dev`)}`);\n Task.log(\n ' Set up the software catalog: https://backstage.io/docs/features/software-catalog/configuration',\n );\n Task.log(' Add authentication: https://backstage.io/docs/auth/');\n Task.log();\n Task.exit();\n } catch (error) {\n Task.error(String(error));\n\n Task.log('It seems that something went wrong when creating the app 🤔');\n\n Task.error('🔥 Failed to create app!');\n Task.exit(1);\n }\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A CLI that helps you create your own Backstage app\n *\n * @packageDocumentation\n */\n\nimport program from 'commander';\nimport { exitWithError } from './lib/errors';\nimport { version } from '../package.json';\nimport createApp from './createApp';\n\nconst main = (argv: string[]) => {\n program\n .name('backstage-create-app')\n .version(version)\n .description('Creates a new app in a new directory or specified path')\n .option(\n '--path [directory]',\n 'Location to store the app defaulting to a new folder with the app name',\n )\n .option(\n '--skip-install',\n 'Skip the install and builds steps after creating the app',\n )\n .action(cmd => createApp(cmd, version));\n\n program.parse(argv);\n};\n\nprocess.on('unhandledRejection', rejection => {\n if (rejection instanceof Error) {\n exitWithError(rejection);\n } else {\n exitWithError(new Error(`Unknown rejection: '${rejection}'`));\n }\n});\n\nmain(process.argv);\n"],"names":["chalk","appDefaults","backendCommon","backendTasks","catalogClient","catalogModel","cli","config","coreAppApi","coreComponents","corePluginApi","errors","integrationReact","pluginApiDocs","pluginAppBackend","pluginAuthBackend","pluginCatalog","pluginCatalogReact","pluginCatalogBackend","pluginCatalogImport","pluginCircleci","pluginExplore","pluginGithubActions","pluginLighthouse","pluginOrg","pluginPermissionCommon","pluginPermissionNode","pluginProxyBackend","pluginRollbarBackend","pluginScaffolder","pluginScaffolderBackend","pluginSearch","pluginSearchBackend","pluginSearchBackendNode","pluginTechRadar","pluginTechdocs","pluginTechdocsBackend","pluginUserSettings","testUtils","theme","promisify","execCb","ora","recursive","resolvePath","relativePath","fs","dirname","basename","handlebars","BACKSTAGE_JSON","join","findPaths","inquirer","os","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;0BAkBiC,MAAM;AAAA,MACjC,OAAe;AACjB,WAAO,KAAK,YAAY;AAAA;AAAA;4BAIO,YAAY;AAAA,EAG7C,YAAY,MAAc,SAAkB;AAC1C,QAAI,SAAS;AACX,YAAM,YAAY,6BAA6B;AAAA,WAC1C;AACL,YAAM,0BAA0B;AAAA;AAElC,SAAK,OAAO;AAAA;AAAA;uBAIc,OAAqB;AACjD,MAAI,iBAAiB,eAAe;AAClC,YAAQ,OAAO,MAAM;AAAA,EAAKA,0BAAM,IAAI,MAAM;AAAA;AAAA;AAC1C,YAAQ,KAAK,MAAM;AAAA,SACd;AACL,YAAQ,OAAO,MA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b,YAAM,mBAAmB,MAAM,WAAW,QAAQ;AAElD,WAAK,QAAQ;AACb,YAAM,6BAA6B;AAEnC,WAAK,QAAQ;AACb,YAAM,eAAe,aAAa,SAAS,SAAS;AAEpD,WAAK,QAAQ;AACb,YAAM,YAAY,SAAS,QAAQ,QAAQ;AAAA;AAG7C,QAAI,CAAC,IAAI,aAAa;AACpB,WAAK,QAAQ;AACb,YAAM,aAAa;AAAA;AAGrB,SAAK;AACL,SAAK,IACH5C,0BAAM,MAAM,mCAA4BA,0BAAM,KAAK,QAAQ;AAE7D,SAAK;AACL,SAAK,QAAQ;AACb,SAAK,IAAI,kBAAkBA,0BAAM,KAAK,MAAM,QAAQ;AACpD,SAAK,IACH;AAEF,SAAK,IAAI;AACT,SAAK;AACL,SAAK;AAAA,WACE,OAAP;AACA,SAAK,MAAM,OAAO;AAElB,SAAK,IAAI;AAET,SAAK,MAAM;AACX,SAAK,KAAK;AAAA;AAAA;;AChGd,MAAM,OAAO,CAAC,SAAmB;AAC/B,8BACG,KAAK,wBACL,QAAQuD,WACR,YAAY,0DACZ,OACC,sBACA,0EAED,OACC,kBACA,4DAED,OAAO,SAAO,UAAU,KAAKA;AAEhC,8BAAQ,MAAM;AAAA;AAGhB,QAAQ,GAAG,sBAAsB,eAAa;AAC5C,MAAI,qBAAqB,OAAO;AAC9B,kBAAc;AAAA,SACT;AACL,kBAAc,IAAI,MAAM,uBAAuB;AAAA;AAAA;AAInD,KAAK,QAAQ;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/lib/errors.ts","../src/lib/versions.ts","../src/lib/tasks.ts","../src/createApp.ts","../src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\n\nexport class CustomError extends Error {\n get name(): string {\n return this.constructor.name;\n }\n}\n\nexport class ExitCodeError extends CustomError {\n readonly code: number;\n\n constructor(code: number, command?: string) {\n if (command) {\n super(`Command '${command}' exited with code ${code}`);\n } else {\n super(`Child exited with code ${code}`);\n }\n this.code = code;\n }\n}\n\nexport function exitWithError(error: Error): never {\n if (error instanceof ExitCodeError) {\n process.stderr.write(`\\n${chalk.red(error.message)}\\n\\n`);\n process.exit(error.code);\n } else {\n process.stderr.write(`\\n${chalk.red(`${error}`)}\\n\\n`);\n process.exit(1);\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable monorepo/no-relative-import */\n\n/*\nThis is a list of all packages used by the template. If dependencies are added or removed,\nthis list should be updated as well.\n\nThe list, and the accompanying peerDependencies entries, are here to ensure correct versioning\nand bumping of this package. Without this list the version would not be bumped unless we\nmanually trigger a release.\n\nThis does not create an actual dependency on these packages and does not bring in any code.\nRelative imports are used rather than package imports to make sure the packages aren't externalized.\nRollup will extract the value of the version field in each package at build time without\nleaving any imports in place.\n*/\n\nimport { version as appDefaults } from '../../../app-defaults/package.json';\nimport { version as backendCommon } from '../../../backend-common/package.json';\nimport { version as backendTasks } from '../../../backend-tasks/package.json';\nimport { version as catalogClient } from '../../../catalog-client/package.json';\nimport { version as catalogModel } from '../../../catalog-model/package.json';\nimport { version as cli } from '../../../cli/package.json';\nimport { version as config } from '../../../config/package.json';\nimport { version as coreAppApi } from '../../../core-app-api/package.json';\nimport { version as coreComponents } from '../../../core-components/package.json';\nimport { version as corePluginApi } from '../../../core-plugin-api/package.json';\nimport { version as errors } from '../../../errors/package.json';\nimport { version as integrationReact } from '../../../integration-react/package.json';\nimport { version as testUtils } from '../../../test-utils/package.json';\nimport { version as theme } from '../../../theme/package.json';\n\nimport { version as pluginApiDocs } from '../../../../plugins/api-docs/package.json';\nimport { version as pluginAppBackend } from '../../../../plugins/app-backend/package.json';\nimport { version as pluginAuthBackend } from '../../../../plugins/auth-backend/package.json';\nimport { version as pluginCatalog } from '../../../../plugins/catalog/package.json';\nimport { version as pluginCatalogCommon } from '../../../../plugins/catalog-common/package.json';\nimport { version as pluginCatalogReact } from '../../../../plugins/catalog-react/package.json';\nimport { version as pluginCatalogBackend } from '../../../../plugins/catalog-backend/package.json';\nimport { version as pluginCatalogGraph } from '../../../../plugins/catalog-graph/package.json';\nimport { version as pluginCatalogImport } from '../../../../plugins/catalog-import/package.json';\nimport { version as pluginCircleci } from '../../../../plugins/circleci/package.json';\nimport { version as pluginExplore } from '../../../../plugins/explore/package.json';\nimport { version as pluginGithubActions } from '../../../../plugins/github-actions/package.json';\nimport { version as pluginLighthouse } from '../../../../plugins/lighthouse/package.json';\nimport { version as pluginOrg } from '../../../../plugins/org/package.json';\nimport { version as pluginPermissionCommon } from '../../../../plugins/permission-common/package.json';\nimport { version as pluginPermissionReact } from '../../../../plugins/permission-react/package.json';\nimport { version as pluginPermissionNode } from '../../../../plugins/permission-node/package.json';\nimport { version as pluginProxyBackend } from '../../../../plugins/proxy-backend/package.json';\nimport { version as pluginRollbarBackend } from '../../../../plugins/rollbar-backend/package.json';\nimport { version as pluginScaffolder } from '../../../../plugins/scaffolder/package.json';\nimport { version as pluginScaffolderBackend } from '../../../../plugins/scaffolder-backend/package.json';\nimport { version as pluginSearch } from '../../../../plugins/search/package.json';\nimport { version as pluginSearchBackend } from '../../../../plugins/search-backend/package.json';\nimport { version as pluginSearchBackendNode } from '../../../../plugins/search-backend-node/package.json';\nimport { version as pluginTechRadar } from '../../../../plugins/tech-radar/package.json';\nimport { version as pluginTechdocs } from '../../../../plugins/techdocs/package.json';\nimport { version as pluginTechdocsBackend } from '../../../../plugins/techdocs-backend/package.json';\nimport { version as pluginUserSettings } from '../../../../plugins/user-settings/package.json';\n\nexport const packageVersions = {\n '@backstage/app-defaults': appDefaults,\n '@backstage/backend-common': backendCommon,\n '@backstage/backend-tasks': backendTasks,\n '@backstage/catalog-client': catalogClient,\n '@backstage/catalog-model': catalogModel,\n '@backstage/cli': cli,\n '@backstage/config': config,\n '@backstage/core-app-api': coreAppApi,\n '@backstage/core-components': coreComponents,\n '@backstage/core-plugin-api': corePluginApi,\n '@backstage/errors': errors,\n '@backstage/integration-react': integrationReact,\n '@backstage/plugin-api-docs': pluginApiDocs,\n '@backstage/plugin-app-backend': pluginAppBackend,\n '@backstage/plugin-auth-backend': pluginAuthBackend,\n '@backstage/plugin-catalog': pluginCatalog,\n '@backstage/plugin-catalog-common': pluginCatalogCommon,\n '@backstage/plugin-catalog-react': pluginCatalogReact,\n '@backstage/plugin-catalog-backend': pluginCatalogBackend,\n '@backstage/plugin-catalog-graph': pluginCatalogGraph,\n '@backstage/plugin-catalog-import': pluginCatalogImport,\n '@backstage/plugin-circleci': pluginCircleci,\n '@backstage/plugin-explore': pluginExplore,\n '@backstage/plugin-github-actions': pluginGithubActions,\n '@backstage/plugin-lighthouse': pluginLighthouse,\n '@backstage/plugin-org': pluginOrg,\n '@backstage/plugin-permission-common': pluginPermissionCommon,\n '@backstage/plugin-permission-node': pluginPermissionNode,\n '@backstage/plugin-permission-react': pluginPermissionReact,\n '@backstage/plugin-proxy-backend': pluginProxyBackend,\n '@backstage/plugin-rollbar-backend': pluginRollbarBackend,\n '@backstage/plugin-scaffolder': pluginScaffolder,\n '@backstage/plugin-scaffolder-backend': pluginScaffolderBackend,\n '@backstage/plugin-search': pluginSearch,\n '@backstage/plugin-search-backend': pluginSearchBackend,\n '@backstage/plugin-search-backend-node': pluginSearchBackendNode,\n '@backstage/plugin-tech-radar': pluginTechRadar,\n '@backstage/plugin-techdocs': pluginTechdocs,\n '@backstage/plugin-techdocs-backend': pluginTechdocsBackend,\n '@backstage/plugin-user-settings': pluginUserSettings,\n '@backstage/test-utils': testUtils,\n '@backstage/theme': theme,\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BACKSTAGE_JSON } from '@backstage/cli-common';\nimport chalk from 'chalk';\nimport fs from 'fs-extra';\nimport handlebars from 'handlebars';\nimport ora from 'ora';\nimport recursive from 'recursive-readdir';\nimport {\n basename,\n dirname,\n join,\n resolve as resolvePath,\n relative as relativePath,\n} from 'path';\nimport { exec as execCb } from 'child_process';\nimport { packageVersions } from './versions';\nimport { promisify } from 'util';\n\nconst TASK_NAME_MAX_LENGTH = 14;\nconst exec = promisify(execCb);\n\nexport class Task {\n static log(name: string = '') {\n process.stdout.write(`${chalk.green(name)}\\n`);\n }\n\n static error(message: string = '') {\n process.stdout.write(`\\n${chalk.red(message)}\\n\\n`);\n }\n\n static section(name: string) {\n const title = chalk.green(`${name}:`);\n process.stdout.write(`\\n ${title}\\n`);\n }\n\n static exit(code: number = 0) {\n process.exit(code);\n }\n\n static async forItem(\n task: string,\n item: string,\n taskFunc: () => Promise<void>,\n ): Promise<void> {\n const paddedTask = chalk.green(task.padEnd(TASK_NAME_MAX_LENGTH));\n\n const spinner = ora({\n prefixText: chalk.green(` ${paddedTask}${chalk.cyan(item)}`),\n spinner: 'arc',\n color: 'green',\n }).start();\n\n try {\n await taskFunc();\n spinner.succeed();\n } catch (error) {\n spinner.fail();\n throw error;\n }\n }\n}\n\n/**\n * Generate a templated backstage project\n *\n * @param templateDir - location containing template files\n * @param destinationDir - location to save templated project\n * @param context - template parameters\n */\nexport async function templatingTask(\n templateDir: string,\n destinationDir: string,\n context: any,\n version: string,\n) {\n const files = await recursive(templateDir).catch(error => {\n throw new Error(`Failed to read template directory: ${error.message}`);\n });\n\n for (const file of files) {\n const destinationFile = resolvePath(\n destinationDir,\n relativePath(templateDir, file),\n );\n await fs.ensureDir(dirname(destinationFile));\n\n if (file.endsWith('.hbs')) {\n await Task.forItem('templating', basename(file), async () => {\n const destination = destinationFile.replace(/\\.hbs$/, '');\n\n const template = await fs.readFile(file);\n const compiled = handlebars.compile(template.toString());\n const contents = compiled(\n { name: basename(destination), ...context },\n {\n helpers: {\n version(name: keyof typeof packageVersions) {\n if (name in packageVersions) {\n return packageVersions[name];\n }\n throw new Error(`No version available for package ${name}`);\n },\n },\n },\n );\n\n await fs.writeFile(destination, contents).catch(error => {\n throw new Error(\n `Failed to create file: ${destination}: ${error.message}`,\n );\n });\n });\n } else {\n await Task.forItem('copying', basename(file), async () => {\n await fs.copyFile(file, destinationFile).catch(error => {\n const destination = destinationFile;\n throw new Error(\n `Failed to copy file to ${destination} : ${error.message}`,\n );\n });\n });\n }\n }\n await Task.forItem('creating', BACKSTAGE_JSON, () =>\n fs.writeFile(\n join(destinationDir, BACKSTAGE_JSON),\n `{\\n \"version\": ${JSON.stringify(version)}\\n}\\n`,\n ),\n );\n}\n\n/**\n * Verify that application target does not already exist\n *\n * @param rootDir - The directory to create application folder `name`\n * @param name - The specified name of the application\n * @Throws Error - If directory with name of `destination` already exists\n */\nexport async function checkAppExistsTask(rootDir: string, name: string) {\n await Task.forItem('checking', name, async () => {\n const destination = resolvePath(rootDir, name);\n\n if (await fs.pathExists(destination)) {\n const existing = chalk.cyan(destination.replace(`${rootDir}/`, ''));\n throw new Error(\n `A directory with the same name already exists: ${existing}\\nPlease try again with a different app name`,\n );\n }\n });\n}\n\n/**\n * Verify that application `path` exists, otherwise create the directory\n *\n * @param path - target to create directory\n * @throws if `path` is a file, or `fs.mkdir` fails\n */\nexport async function checkPathExistsTask(path: string) {\n await Task.forItem('checking', path, async () => {\n try {\n await fs.mkdirs(path);\n } catch (error) {\n // will fail if a file already exists at given `path`\n throw new Error(`Failed to create app directory: ${error.message}`);\n }\n });\n}\n\n/**\n * Create a folder to store templated files\n *\n * @param tempDir - target temporary directory\n * @throws if `fs.mkdir` fails\n */\nexport async function createTemporaryAppFolderTask(tempDir: string) {\n await Task.forItem('creating', 'temporary directory', async () => {\n try {\n await fs.mkdir(tempDir);\n } catch (error) {\n throw new Error(`Failed to create temporary app directory, ${error}`);\n }\n });\n}\n\n/**\n * Run `yarn install` and `run tsc` in application directory\n *\n * @param appDir - location of application to build\n */\nexport async function buildAppTask(appDir: string) {\n const runCmd = async (cmd: string) => {\n await Task.forItem('executing', cmd, async () => {\n process.chdir(appDir);\n await exec(cmd).catch(error => {\n process.stdout.write(error.stderr);\n process.stdout.write(error.stdout);\n throw new Error(`Could not execute command ${chalk.cyan(cmd)}`);\n });\n });\n };\n\n await runCmd('yarn install');\n await runCmd('yarn tsc');\n}\n\n/**\n * Move temporary directory to destination application folder\n *\n * @param tempDir - source path to copy files from\n * @param destination - target path to copy files\n * @param id - item ID\n * @throws if `fs.move` fails\n */\nexport async function moveAppTask(\n tempDir: string,\n destination: string,\n id: string,\n) {\n await Task.forItem('moving', id, async () => {\n await fs\n .move(tempDir, destination)\n .catch(error => {\n throw new Error(\n `Failed to move app from ${tempDir} to ${destination}: ${error.message}`,\n );\n })\n .finally(() => {\n // remove temporary files on both success and failure\n fs.removeSync(tempDir);\n });\n });\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport inquirer, { Answers } from 'inquirer';\nimport { resolve as resolvePath } from 'path';\nimport { findPaths } from '@backstage/cli-common';\nimport os from 'os';\nimport {\n Task,\n buildAppTask,\n checkAppExistsTask,\n checkPathExistsTask,\n createTemporaryAppFolderTask,\n moveAppTask,\n templatingTask,\n} from './lib/tasks';\n\nexport default async (cmd: Command, version: string): Promise<void> => {\n /* eslint-disable-next-line no-restricted-syntax */\n const paths = findPaths(__dirname);\n\n const answers: Answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'name',\n message: chalk.blue('Enter a name for the app [required]'),\n validate: (value: any) => {\n if (!value) {\n return chalk.red('Please enter a name for the app');\n } else if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(value)) {\n return chalk.red(\n 'App name must be lowercase and contain only letters, digits, and dashes.',\n );\n }\n return true;\n },\n },\n {\n type: 'list',\n name: 'dbType',\n message: chalk.blue('Select database for the backend [required]'),\n choices: ['SQLite', 'PostgreSQL'],\n },\n ]);\n answers.dbTypePG = answers.dbType === 'PostgreSQL';\n answers.dbTypeSqlite = answers.dbType === 'SQLite';\n\n const templateDir = paths.resolveOwn('templates/default-app');\n const tempDir = resolvePath(os.tmpdir(), answers.name);\n\n // Use `--path` argument as application directory when specified, otherwise\n // create a directory using `answers.name`\n const appDir = cmd.path\n ? resolvePath(paths.targetDir, cmd.path)\n : resolvePath(paths.targetDir, answers.name);\n\n Task.log();\n Task.log('Creating the app...');\n\n try {\n if (cmd.path) {\n // Template directly to specified path\n\n Task.section('Checking that supplied path exists');\n await checkPathExistsTask(appDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, cmd.path, answers, version);\n } else {\n // Template to temporary location, and then move files\n\n Task.section('Checking if the directory is available');\n await checkAppExistsTask(paths.targetDir, answers.name);\n\n Task.section('Creating a temporary app directory');\n await createTemporaryAppFolderTask(tempDir);\n\n Task.section('Preparing files');\n await templatingTask(templateDir, tempDir, answers, version);\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (!cmd.skipInstall) {\n Task.section('Building the app');\n await buildAppTask(appDir);\n }\n\n Task.log();\n Task.log(\n chalk.green(`🥇 Successfully created ${chalk.cyan(answers.name)}`),\n );\n Task.log();\n Task.section('All set! Now you might want to');\n Task.log(` Run the app: ${chalk.cyan(`cd ${answers.name} && yarn dev`)}`);\n Task.log(\n ' Set up the software catalog: https://backstage.io/docs/features/software-catalog/configuration',\n );\n Task.log(' Add authentication: https://backstage.io/docs/auth/');\n Task.log();\n Task.exit();\n } catch (error) {\n Task.error(String(error));\n\n Task.log('It seems that something went wrong when creating the app 🤔');\n\n Task.error('🔥 Failed to create app!');\n Task.exit(1);\n }\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A CLI that helps you create your own Backstage app\n *\n * @packageDocumentation\n */\n\nimport program from 'commander';\nimport { exitWithError } from './lib/errors';\nimport { version } from '../package.json';\nimport createApp from './createApp';\n\nconst main = (argv: string[]) => {\n program\n .name('backstage-create-app')\n .version(version)\n .description('Creates a new app in a new directory or specified path')\n .option(\n '--path [directory]',\n 'Location to store the app defaulting to a new folder with the app name',\n )\n .option(\n '--skip-install',\n 'Skip the install and builds steps after creating the app',\n )\n .action(cmd => createApp(cmd, version));\n\n program.parse(argv);\n};\n\nprocess.on('unhandledRejection', rejection => {\n if (rejection instanceof Error) {\n exitWithError(rejection);\n } else {\n exitWithError(new Error(`Unknown rejection: '${rejection}'`));\n }\n});\n\nmain(process.argv);\n"],"names":["chalk","appDefaults","backendCommon","backendTasks","catalogClient","catalogModel","cli","config","coreAppApi","coreComponents","corePluginApi","errors","integrationReact","pluginApiDocs","pluginAppBackend","pluginAuthBackend","pluginCatalog","pluginCatalogCommon","pluginCatalogReact","pluginCatalogBackend","pluginCatalogGraph","pluginCatalogImport","pluginCircleci","pluginExplore","pluginGithubActions","pluginLighthouse","pluginOrg","pluginPermissionCommon","pluginPermissionNode","pluginPermissionReact","pluginProxyBackend","pluginRollbarBackend","pluginScaffolder","pluginScaffolderBackend","pluginSearch","pluginSearchBackend","pluginSearchBackendNode","pluginTechRadar","pluginTechdocs","pluginTechdocsBackend","pluginUserSettings","testUtils","theme","promisify","execCb","ora","recursive","resolvePath","relativePath","fs","dirname","basename","handlebars","BACKSTAGE_JSON","join","findPaths","inquirer","os","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;0BAkBiC,MAAM;AAAA,MACjC,OAAe;AACjB,WAAO,KAAK,YAAY;AAAA;AAAA;4BAIO,YAAY;AAAA,EAG7C,YAAY,MAAc,SAAkB;AAC1C,QAAI,SAAS;AACX,YAAM,YAAY,6BAA6B;AAAA,WAC1C;AACL,YAAM,0BAA0B;AAAA;AAElC,SAAK,OAAO;AAAA;AAAA;uBAIc,OAAqB;AACjD,MAAI,iBAAiB,eAAe;AAClC,YAAQ,OAAO,MAAM;AAAA,EAAKA,0BAAM,IAAI,MAAM;AAAA;AAAA;AAC1C,YAAQ,KAAK,MAAM;AAAA,SACd;AACL,YAAQ,OAAO,MAAM;AAAA,EAAKA,0BAAM,IAAI,GAAG;AAAA;AAAA;AACvC,YAAQ,KAAK;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,eAAe,aAAa,SAAS,SAAS;AAEpD,WAAK,QAAQ;AACb,YAAM,YAAY,SAAS,QAAQ,QAAQ;AAAA;AAG7C,QAAI,CAAC,IAAI,aAAa;AACpB,WAAK,QAAQ;AACb,YAAM,aAAa;AAAA;AAGrB,SAAK;AACL,SAAK,IACH/C,0BAAM,MAAM,mCAA4BA,0BAAM,KAAK,QAAQ;AAE7D,SAAK;AACL,SAAK,QAAQ;AACb,SAAK,IAAI,kBAAkBA,0BAAM,KAAK,MAAM,QAAQ;AACpD,SAAK,IACH;AAEF,SAAK,IAAI;AACT,SAAK;AACL,SAAK;AAAA,WACE,OAAP;AACA,SAAK,MAAM,OAAO;AAElB,SAAK,IAAI;AAET,SAAK,MAAM;AACX,SAAK,KAAK;AAAA;AAAA;;AChGd,MAAM,OAAO,CAAC,SAAmB;AAC/B,8BACG,KAAK,wBACL,QAAQ0D,WACR,YAAY,0DACZ,OACC,sBACA,0EAED,OACC,kBACA,4DAED,OAAO,SAAO,UAAU,KAAKA;AAEhC,8BAAQ,MAAM;AAAA;AAGhB,QAAQ,GAAG,sBAAsB,eAAa;AAC5C,MAAI,qBAAqB,OAAO;AAC9B,kBAAc;AAAA,SACT;AACL,kBAAc,IAAI,MAAM,uBAAuB;AAAA;AAAA;AAInD,KAAK,QAAQ;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/create-app",
3
3
  "description": "A CLI that helps you create your own Backstage app",
4
- "version": "0.4.14",
4
+ "version": "0.4.18-next.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -35,7 +35,7 @@
35
35
  "commander": "^6.1.0",
36
36
  "fs-extra": "9.1.0",
37
37
  "handlebars": "^4.7.3",
38
- "inquirer": "^7.0.4",
38
+ "inquirer": "^8.2.0",
39
39
  "ora": "^5.3.0",
40
40
  "recursive-readdir": "^2.2.2"
41
41
  },
@@ -57,5 +57,5 @@
57
57
  "dist",
58
58
  "templates"
59
59
  ],
60
- "gitHead": "600d6e3c854bbfb12a0078ca6f726d1c0d1fea0b"
60
+ "gitHead": "d6da97a1edeb21fcefc682d91916987ba9f3d89a"
61
61
  }
@@ -7,7 +7,8 @@ organization:
7
7
 
8
8
  backend:
9
9
  # Used for enabling authentication, secret is shared by all backend plugins
10
- # See backend-to-backend-auth.md in the docs for information on the format
10
+ # See https://backstage.io/docs/tutorials/backend-to-backend-auth for
11
+ # information on the format
11
12
  # auth:
12
13
  # keys:
13
14
  # - secret: ${BACKEND_SECRET}
@@ -80,6 +81,9 @@ scaffolder:
80
81
  # see https://backstage.io/docs/features/software-templates/configuration for software template options
81
82
 
82
83
  catalog:
84
+ import:
85
+ entityFilename: catalog-info.yaml
86
+ pullRequestBranchName: backstage-integration
83
87
  rules:
84
88
  - allow: [Component, System, API, Group, User, Resource, Location]
85
89
  locations:
@@ -13,10 +13,13 @@
13
13
  "@backstage/integration-react": "^{{version '@backstage/integration-react'}}",
14
14
  "@backstage/plugin-api-docs": "^{{version '@backstage/plugin-api-docs'}}",
15
15
  "@backstage/plugin-catalog": "^{{version '@backstage/plugin-catalog'}}",
16
+ "@backstage/plugin-catalog-common": "^{{version '@backstage/plugin-catalog-common'}}",
17
+ "@backstage/plugin-catalog-graph": "^{{version '@backstage/plugin-catalog-graph'}}",
16
18
  "@backstage/plugin-catalog-import": "^{{version '@backstage/plugin-catalog-import'}}",
17
19
  "@backstage/plugin-catalog-react": "^{{version '@backstage/plugin-catalog-react'}}",
18
20
  "@backstage/plugin-github-actions": "^{{version '@backstage/plugin-github-actions'}}",
19
21
  "@backstage/plugin-org": "^{{version '@backstage/plugin-org'}}",
22
+ "@backstage/plugin-permission-react": "^{{version '@backstage/plugin-permission-react'}}",
20
23
  "@backstage/plugin-scaffolder": "^{{version '@backstage/plugin-scaffolder'}}",
21
24
  "@backstage/plugin-search": "^{{version '@backstage/plugin-search'}}",
22
25
  "@backstage/plugin-tech-radar": "^{{version '@backstage/plugin-tech-radar'}}",
@@ -29,6 +29,9 @@ import { Root } from './components/Root';
29
29
  import { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';
30
30
  import { createApp } from '@backstage/app-defaults';
31
31
  import { FlatRoutes } from '@backstage/core-app-api';
32
+ import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
33
+ import { PermissionedRoute } from '@backstage/plugin-permission-react';
34
+ import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';
32
35
 
33
36
  const app = createApp({
34
37
  apis,
@@ -75,11 +78,16 @@ const routes = (
75
78
  path="/tech-radar"
76
79
  element={<TechRadarPage width={1500} height={800} />}
77
80
  />
78
- <Route path="/catalog-import" element={<CatalogImportPage />} />
81
+ <PermissionedRoute
82
+ path="/catalog-import"
83
+ permission={catalogEntityCreatePermission}
84
+ element={<CatalogImportPage />}
85
+ />
79
86
  <Route path="/search" element={<SearchPage />}>
80
87
  {searchPage}
81
88
  </Route>
82
89
  <Route path="/settings" element={<UserSettingsPage />} />
90
+ <Route path="/catalog-graph" element={<CatalogGraphPage />} />
83
91
  </FlatRoutes>
84
92
  );
85
93
 
@@ -27,7 +27,6 @@ import {
27
27
  EntityAboutCard,
28
28
  EntityDependsOnComponentsCard,
29
29
  EntityDependsOnResourcesCard,
30
- EntitySystemDiagramCard,
31
30
  EntityHasComponentsCard,
32
31
  EntityHasResourcesCard,
33
32
  EntityHasSubcomponentsCard,
@@ -54,6 +53,20 @@ import {
54
53
  } from '@backstage/plugin-org';
55
54
  import { EntityTechdocsContent } from '@backstage/plugin-techdocs';
56
55
  import { EmptyState } from '@backstage/core-components';
56
+ import {
57
+ Direction,
58
+ EntityCatalogGraphCard,
59
+ } from '@backstage/plugin-catalog-graph';
60
+ import {
61
+ RELATION_API_CONSUMED_BY,
62
+ RELATION_API_PROVIDED_BY,
63
+ RELATION_CONSUMES_API,
64
+ RELATION_DEPENDENCY_OF,
65
+ RELATION_DEPENDS_ON,
66
+ RELATION_HAS_PART,
67
+ RELATION_PART_OF,
68
+ RELATION_PROVIDES_API,
69
+ } from '@backstage/catalog-model';
57
70
 
58
71
  const cicdContent = (
59
72
  // This is an example of how you can implement your company's logic in entity page.
@@ -108,6 +121,10 @@ const overviewContent = (
108
121
  <Grid item md={6}>
109
122
  <EntityAboutCard variant="gridItem" />
110
123
  </Grid>
124
+ <Grid item md={6} xs={12}>
125
+ <EntityCatalogGraphCard variant="gridItem" height={400} />
126
+ </Grid>
127
+
111
128
  <Grid item md={4} xs={12}>
112
129
  <EntityLinksCard />
113
130
  </Grid>
@@ -223,6 +240,9 @@ const apiPage = (
223
240
  <Grid item md={6}>
224
241
  <EntityAboutCard />
225
242
  </Grid>
243
+ <Grid item md={6} xs={12}>
244
+ <EntityCatalogGraphCard variant="gridItem" height={400} />
245
+ </Grid>
226
246
  <Grid item md={4} xs={12}>
227
247
  <EntityLinksCard />
228
248
  </Grid>
@@ -290,6 +310,9 @@ const systemPage = (
290
310
  <Grid item md={6}>
291
311
  <EntityAboutCard variant="gridItem" />
292
312
  </Grid>
313
+ <Grid item md={6} xs={12}>
314
+ <EntityCatalogGraphCard variant="gridItem" height={400} />
315
+ </Grid>
293
316
  <Grid item md={6}>
294
317
  <EntityHasComponentsCard variant="gridItem" />
295
318
  </Grid>
@@ -302,7 +325,23 @@ const systemPage = (
302
325
  </Grid>
303
326
  </EntityLayout.Route>
304
327
  <EntityLayout.Route path="/diagram" title="Diagram">
305
- <EntitySystemDiagramCard />
328
+ <EntityCatalogGraphCard
329
+ variant="gridItem"
330
+ direction={Direction.TOP_BOTTOM}
331
+ title="System Diagram"
332
+ height={700}
333
+ relations={[
334
+ RELATION_PART_OF,
335
+ RELATION_HAS_PART,
336
+ RELATION_API_CONSUMED_BY,
337
+ RELATION_API_PROVIDED_BY,
338
+ RELATION_CONSUMES_API,
339
+ RELATION_PROVIDES_API,
340
+ RELATION_DEPENDENCY_OF,
341
+ RELATION_DEPENDS_ON,
342
+ ]}
343
+ unidirectional={false}
344
+ />
306
345
  </EntityLayout.Route>
307
346
  </EntityLayout>
308
347
  );
@@ -315,6 +354,9 @@ const domainPage = (
315
354
  <Grid item md={6}>
316
355
  <EntityAboutCard variant="gridItem" />
317
356
  </Grid>
357
+ <Grid item md={6} xs={12}>
358
+ <EntityCatalogGraphCard variant="gridItem" height={400} />
359
+ </Grid>
318
360
  <Grid item md={6}>
319
361
  <EntityHasSystemsCard variant="gridItem" />
320
362
  </Grid>
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import { makeStyles, Theme, Grid, List, Paper } from '@material-ui/core';
3
3
 
4
4
  import { CatalogResultListItem } from '@backstage/plugin-catalog';
5
+ import {
6
+ catalogApiRef,
7
+ CATALOG_FILTER_EXISTS,
8
+ } from '@backstage/plugin-catalog-react';
5
9
  import { DocsResultListItem } from '@backstage/plugin-techdocs';
6
10
 
7
11
  import {
@@ -10,6 +14,7 @@ import {
10
14
  SearchResult,
11
15
  SearchType,
12
16
  DefaultResultListItem,
17
+ useSearch,
13
18
  } from '@backstage/plugin-search';
14
19
  import {
15
20
  CatalogIcon,
@@ -18,6 +23,7 @@ import {
18
23
  Header,
19
24
  Page,
20
25
  } from '@backstage/core-components';
26
+ import { useApi } from '@backstage/core-plugin-api';
21
27
 
22
28
  const useStyles = makeStyles((theme: Theme) => ({
23
29
  bar: {
@@ -36,6 +42,8 @@ const useStyles = makeStyles((theme: Theme) => ({
36
42
 
37
43
  const SearchPage = () => {
38
44
  const classes = useStyles();
45
+ const { types } = useSearch();
46
+ const catalogApi = useApi(catalogApiRef);
39
47
 
40
48
  return (
41
49
  <Page themeId="home">
@@ -65,13 +73,36 @@ const SearchPage = () => {
65
73
  ]}
66
74
  />
67
75
  <Paper className={classes.filters}>
76
+ {types.includes('techdocs') && (
77
+ <SearchFilter.Select
78
+ className={classes.filter}
79
+ label="Entity"
80
+ name="name"
81
+ values={async () => {
82
+ // Return a list of entities which are documented.
83
+ const { items } = await catalogApi.getEntities({
84
+ fields: ['metadata.name'],
85
+ filter: {
86
+ 'metadata.annotations.backstage.io/techdocs-ref':
87
+ CATALOG_FILTER_EXISTS,
88
+ },
89
+ });
90
+
91
+ const names = items.map(entity => entity.metadata.name);
92
+ names.sort();
93
+ return names;
94
+ }}
95
+ />
96
+ )}
68
97
  <SearchFilter.Select
69
98
  className={classes.filter}
99
+ label="Kind"
70
100
  name="kind"
71
101
  values={['Component', 'Template']}
72
102
  />
73
103
  <SearchFilter.Checkbox
74
104
  className={classes.filter}
105
+ label="Lifecycle"
75
106
  name="lifecycle"
76
107
  values={['experimental', 'production']}
77
108
  />
@@ -14,7 +14,7 @@
14
14
  "migrate:create": "knex migrate:make -x ts"
15
15
  },
16
16
  "dependencies": {
17
- "app": "0.0.0",
17
+ "app": "file:../app",
18
18
  "@backstage/backend-common": "^{{version '@backstage/backend-common'}}",
19
19
  "@backstage/backend-tasks": "^{{version '@backstage/backend-tasks'}}",
20
20
  "@backstage/catalog-model": "^{{version '@backstage/catalog-model'}}",
@@ -7,6 +7,13 @@ export default async function createPlugin({
7
7
  database,
8
8
  config,
9
9
  discovery,
10
+ tokenManager,
10
11
  }: PluginEnvironment): Promise<Router> {
11
- return await createRouter({ logger, config, database, discovery });
12
+ return await createRouter({
13
+ logger,
14
+ config,
15
+ database,
16
+ discovery,
17
+ tokenManager,
18
+ });
12
19
  }
@@ -10,6 +10,7 @@ import { DefaultTechDocsCollator } from '@backstage/plugin-techdocs-backend';
10
10
 
11
11
  export default async function createPlugin({
12
12
  logger,
13
+ permissions,
13
14
  discovery,
14
15
  config,
15
16
  tokenManager,
@@ -49,6 +50,9 @@ export default async function createPlugin({
49
50
 
50
51
  return await createRouter({
51
52
  engine: indexBuilder.getSearchEngine(),
53
+ types: indexBuilder.getDocumentTypes(),
54
+ permissions,
55
+ config,
52
56
  logger,
53
57
  });
54
58
  }