@backstage/create-app 0.4.27-next.1 → 0.4.28-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +376 -0
- package/dist/index.cjs.js +93 -89
- package/dist/index.cjs.js.map +1 -1
- package/package.json +3 -3
- package/templates/default-app/.dockerignore +2 -2
- package/templates/default-app/app-config.yaml.hbs +21 -29
- package/templates/default-app/examples/entities.yaml +41 -0
- package/templates/default-app/examples/org.yaml +17 -0
- package/templates/default-app/examples/template/content/catalog-info.yaml +8 -0
- package/templates/default-app/examples/template/content/index.js +1 -0
- package/templates/default-app/examples/template/content/package.json +5 -0
- package/templates/default-app/examples/template/template.yaml +74 -0
- package/templates/default-app/packages/app/package.json.hbs +2 -0
- package/templates/default-app/packages/app/src/App.tsx +7 -1
- package/templates/default-app/packages/app/src/components/Root/Root.tsx +1 -0
- package/templates/default-app/packages/app/src/components/catalog/EntityPage.tsx +14 -3
- package/templates/default-app/packages/app/src/components/search/SearchPage.tsx +4 -1
- package/templates/default-app/packages/backend/package.json.hbs +0 -1
- package/templates/default-app/packages/backend/src/plugins/search.ts.hbs +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,381 @@
|
|
|
1
1
|
# @backstage/create-app
|
|
2
2
|
|
|
3
|
+
## 0.4.28-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 881fbd7e8d: Register `TechDocs` addons on catalog entity pages, follow the steps below to add them manually:
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
// packages/app/src/components/catalog/EntityPage.tsx
|
|
11
|
+
|
|
12
|
+
+ import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
13
|
+
+ import {
|
|
14
|
+
+ ReportIssue,
|
|
15
|
+
+ } from '@backstage/plugin-techdocs-module-addons-contrib';
|
|
16
|
+
|
|
17
|
+
+ const techdocsContent = (
|
|
18
|
+
+ <EntityTechdocsContent>
|
|
19
|
+
+ <TechDocsAddons>
|
|
20
|
+
+ <ReportIssue />
|
|
21
|
+
+ </TechDocsAddons>
|
|
22
|
+
+ </EntityTechdocsContent>
|
|
23
|
+
+ );
|
|
24
|
+
|
|
25
|
+
const defaultEntityPage = (
|
|
26
|
+
...
|
|
27
|
+
<EntityLayout.Route path="/docs" title="Docs">
|
|
28
|
+
+ {techdocsContent}
|
|
29
|
+
</EntityLayout.Route>
|
|
30
|
+
...
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const serviceEntityPage = (
|
|
34
|
+
...
|
|
35
|
+
<EntityLayout.Route path="/docs" title="Docs">
|
|
36
|
+
+ {techdocsContent}
|
|
37
|
+
</EntityLayout.Route>
|
|
38
|
+
...
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const websiteEntityPage = (
|
|
42
|
+
...
|
|
43
|
+
<EntityLayout.Route path="/docs" title="Docs">
|
|
44
|
+
+ {techdocsContent}
|
|
45
|
+
</EntityLayout.Route>
|
|
46
|
+
...
|
|
47
|
+
);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- 935d8515da: Updated the `--version` flag to output the version of the current backstage release instead of the version of create-app.
|
|
51
|
+
- 1f70704580: Accessibility updates:
|
|
52
|
+
|
|
53
|
+
- Added `aria-label` to the sidebar Logo link. To enable this for an existing app, please make the following changes:
|
|
54
|
+
|
|
55
|
+
`packages/app/src/components/Root/Root.tsx`
|
|
56
|
+
|
|
57
|
+
```diff
|
|
58
|
+
const SidebarLogo = () => {
|
|
59
|
+
const classes = useSidebarLogoStyles();
|
|
60
|
+
const { isOpen } = useContext(SidebarContext);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div className={classes.root}>
|
|
64
|
+
<Link
|
|
65
|
+
component={NavLink}
|
|
66
|
+
to="/"
|
|
67
|
+
underline="none"
|
|
68
|
+
className={classes.link}
|
|
69
|
+
+ aria-label="Home"
|
|
70
|
+
>
|
|
71
|
+
{isOpen ? <LogoFull /> : <LogoIcon />}
|
|
72
|
+
</Link>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 0.4.27
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- 73480846dd: Simplified the search collator scheduling by removing the need for the `luxon` dependency.
|
|
83
|
+
|
|
84
|
+
For existing installations the scheduling can be simplified by removing the `luxon` dependency and using the human friendly duration object instead.
|
|
85
|
+
Please note that this only applies if luxon is not used elsewhere in your installation.
|
|
86
|
+
|
|
87
|
+
`packages/backend/package.json`
|
|
88
|
+
|
|
89
|
+
```diff
|
|
90
|
+
"express": "^4.17.1",
|
|
91
|
+
"express-promise-router": "^4.1.0",
|
|
92
|
+
- "luxon": "^2.0.2",
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`packages/backend/src/plugins/search.ts`
|
|
96
|
+
|
|
97
|
+
```diff
|
|
98
|
+
import { Router } from 'express';
|
|
99
|
+
-import { Duration } from 'luxon';
|
|
100
|
+
|
|
101
|
+
// omitted other code
|
|
102
|
+
|
|
103
|
+
const schedule = env.scheduler.createScheduledTaskRunner({
|
|
104
|
+
- frequency: Duration.fromObject({ minutes: 10 }),
|
|
105
|
+
- timeout: Duration.fromObject({ minutes: 15 }),
|
|
106
|
+
+ frequency: { minutes: 10 },
|
|
107
|
+
+ timeout: { minutes: 15 },
|
|
108
|
+
// A 3 second delay gives the backend server a chance to initialize before
|
|
109
|
+
// any collators are executed, which may attempt requests against the API.
|
|
110
|
+
- initialDelay: Duration.fromObject({ seconds: 3 }),
|
|
111
|
+
+ initialDelay: { seconds: 3 },
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- 7cda923c16: Tweaked the `.dockerignore` file so that it's easier to add additional backend packages if desired.
|
|
116
|
+
|
|
117
|
+
To apply this change to an existing app, make the following change to `.dockerignore`:
|
|
118
|
+
|
|
119
|
+
```diff
|
|
120
|
+
cypress
|
|
121
|
+
microsite
|
|
122
|
+
node_modules
|
|
123
|
+
-packages
|
|
124
|
+
-!packages/backend/dist
|
|
125
|
+
+packages/*/src
|
|
126
|
+
+packages/*/node_modules
|
|
127
|
+
plugins
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- 3983940a21: Optimized the command order in `packages/backend/Dockerfile` as well as added the `--no-install-recommends` to the `apt-get install` and tweaked the installed packages.
|
|
131
|
+
|
|
132
|
+
To apply this change to an existing app, update your `packages/backend/Dockerfile` to match the documented `Dockerfile` at https://backstage.io/docs/deployment/docker#host-build.
|
|
133
|
+
|
|
134
|
+
- 28bbf5aff6: Added some instruction comments to the generated config files, to clarify the
|
|
135
|
+
usage of `backend.baseUrl` and `backend.listen.host`. Importantly, it also per
|
|
136
|
+
default now listens on all IPv4 interfaces, to make it easier to take the step
|
|
137
|
+
over to production. If you want to do the same, update your
|
|
138
|
+
`app-config.production.yaml` as follows:
|
|
139
|
+
|
|
140
|
+
```diff
|
|
141
|
+
backend:
|
|
142
|
+
listen:
|
|
143
|
+
port: 7007
|
|
144
|
+
+ host: 0.0.0.0
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Also, updated the builtin backend Dockerfile to honor the
|
|
148
|
+
`app-config.production.yaml` file. If you want to do the same, change
|
|
149
|
+
`packages/backend/Dockerfile` as follows:
|
|
150
|
+
|
|
151
|
+
```diff
|
|
152
|
+
-COPY packages/backend/dist/bundle.tar.gz app-config.yaml ./
|
|
153
|
+
+COPY packages/backend/dist/bundle.tar.gz app-config*.yaml ./
|
|
154
|
+
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz
|
|
155
|
+
|
|
156
|
+
-CMD ["node", "packages/backend", "--config", "app-config.yaml"]
|
|
157
|
+
+CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
If you look carefully, this adds a glob match on app-config files. For those
|
|
161
|
+
that try out the build flows locally, you also want to make sure that the docker
|
|
162
|
+
daemon does NOT pick up any local/private config files that might contain
|
|
163
|
+
secrets. You should therefore also update your local `.dockerignore` file at the
|
|
164
|
+
same time:
|
|
165
|
+
|
|
166
|
+
```diff
|
|
167
|
+
+*.local.yaml
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- 7b253072c6: Tweaked template to provide an example and guidance for how to configure sign-in in `packages/backend/src/plugins/auth.ts`. There is no need to add this to existing apps, but for more information about sign-in configuration, see https://backstage.io/docs/auth/identity-resolver.
|
|
171
|
+
- cfc0f19699: Updated dependency `fs-extra` to `10.1.0`.
|
|
172
|
+
- f55414f895: Added sample catalog data to the template under a top-level `examples` directory. This includes some simple entities, org data, and a template. You can find the sample data at https://github.com/backstage/backstage/tree/master/packages/create-app/templates/default-app/examples.
|
|
173
|
+
- 344ea56acc: Bump `commander` to version 9.1.0
|
|
174
|
+
- 00fa0dada0: Removed the database choice from the `create-app` command.
|
|
175
|
+
|
|
176
|
+
This reduces the step from development to production by always installing the dependencies and templating the production configuration in `app-config.production.yaml`.
|
|
177
|
+
|
|
178
|
+
Added `app-config.local.yaml` to allow for local configuration overrides.
|
|
179
|
+
To replicate this behavior in an existing installation simply `touch app-config.local.yaml` in the project root and apply your local configuration.
|
|
180
|
+
|
|
181
|
+
`better-sqlite3` has been moved to devDependencies, for existing installations using postgres in production and SQLite in development it's recommended to move SQLite into the devDependencies section to avoid unnecessary dependencies during builds.
|
|
182
|
+
|
|
183
|
+
in `packages/backend/package.json`
|
|
184
|
+
|
|
185
|
+
```diff
|
|
186
|
+
"dependencies": {
|
|
187
|
+
...
|
|
188
|
+
"pg": "^8.3.0",
|
|
189
|
+
- "better-sqlite3": "^7.5.0",
|
|
190
|
+
"winston": "^3.2.1"
|
|
191
|
+
},
|
|
192
|
+
"devDependencies": {
|
|
193
|
+
...
|
|
194
|
+
"@types/luxon": "^2.0.4",
|
|
195
|
+
+ "better-sqlite3": "^7.5.0"
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
- 10d86dedc0: Integrates TechDocs add-ons with the app package so add-ons are configured when creating an app using the Backstage CLI. To apply these changes to an existing application do the following:
|
|
200
|
+
|
|
201
|
+
1. Add the `@backstage/plugin-techdocs-react` and `@backstage/plugin-techdocs-module-addons-contrib` packages to your app's dependencies;
|
|
202
|
+
2. And then register the `<ReportIssue/ >` Addon in your `packages/app/src/App.tsx` file, there where you define a route to `<TechDocsReaderPage />`:
|
|
203
|
+
|
|
204
|
+
```diff
|
|
205
|
+
import {
|
|
206
|
+
DefaultTechDocsHome,
|
|
207
|
+
TechDocsIndexPage,
|
|
208
|
+
TechDocsReaderPage,
|
|
209
|
+
} from '@backstage/plugin-techdocs';
|
|
210
|
+
+ import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
211
|
+
+ import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
|
|
212
|
+
|
|
213
|
+
// ...
|
|
214
|
+
|
|
215
|
+
const AppRoutes = () => {
|
|
216
|
+
<FlatRoutes>
|
|
217
|
+
// ... other plugin routes
|
|
218
|
+
<Route path="/docs" element={<TechDocsIndexPage />}>
|
|
219
|
+
<DefaultTechDocsHome />
|
|
220
|
+
</Route>
|
|
221
|
+
<Route
|
|
222
|
+
path="/docs/:namespace/:kind/:name/*"
|
|
223
|
+
element={<TechDocsReaderPage />}
|
|
224
|
+
>
|
|
225
|
+
+ <TechDocsAddons>
|
|
226
|
+
+ <ReportIssue />
|
|
227
|
+
+ </TechDocsAddons>
|
|
228
|
+
</Route>
|
|
229
|
+
</FlatRoutes>;
|
|
230
|
+
};
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- 806427545f: Added a link to the `${GITHUB_TOKEN}` to document how to generate a token
|
|
234
|
+
- 3a74e203a8: Implement highlighting matching terms in search results. To enable this for an existing app, make the following changes:
|
|
235
|
+
|
|
236
|
+
```diff
|
|
237
|
+
// packages/app/src/components/search/SearchPage.tsx
|
|
238
|
+
...
|
|
239
|
+
- {results.map(({ type, document }) => {
|
|
240
|
+
+ {results.map(({ type, document, highlight }) => {
|
|
241
|
+
switch (type) {
|
|
242
|
+
case 'software-catalog':
|
|
243
|
+
return (
|
|
244
|
+
<CatalogSearchResultListItem
|
|
245
|
+
key={document.location}
|
|
246
|
+
result={document}
|
|
247
|
+
+ highlight={highlight}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
250
|
+
case 'techdocs':
|
|
251
|
+
return (
|
|
252
|
+
<TechDocsSearchResultListItem
|
|
253
|
+
key={document.location}
|
|
254
|
+
result={document}
|
|
255
|
+
+ highlight={highlight}
|
|
256
|
+
/>
|
|
257
|
+
);
|
|
258
|
+
default:
|
|
259
|
+
return (
|
|
260
|
+
<DefaultResultListItem
|
|
261
|
+
key={document.location}
|
|
262
|
+
result={document}
|
|
263
|
+
+ highlight={highlight}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
})}
|
|
268
|
+
...
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
- d41f19ca2a: Bumped the `typescript` version in the template to `~4.6.4`.
|
|
272
|
+
|
|
273
|
+
To apply this change to an existing app, make the following change to the root `package.json`:
|
|
274
|
+
|
|
275
|
+
```diff
|
|
276
|
+
dependencies: {
|
|
277
|
+
...
|
|
278
|
+
- "typescript": "~4.5.4"
|
|
279
|
+
+ "typescript": "~4.6.4"
|
|
280
|
+
},
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- Updated dependencies
|
|
284
|
+
- @backstage/cli-common@0.1.9
|
|
285
|
+
|
|
286
|
+
## 0.4.27-next.2
|
|
287
|
+
|
|
288
|
+
### Patch Changes
|
|
289
|
+
|
|
290
|
+
- 73480846dd: Simplified the search collator scheduling by removing the need for the `luxon` dependency.
|
|
291
|
+
|
|
292
|
+
For existing installations the scheduling can be simplified by removing the `luxon` dependency and using the human friendly duration object instead.
|
|
293
|
+
Please note that this only applies if luxon is not used elsewhere in your installation.
|
|
294
|
+
|
|
295
|
+
`packages/backend/package.json`
|
|
296
|
+
|
|
297
|
+
```diff
|
|
298
|
+
"express": "^4.17.1",
|
|
299
|
+
"express-promise-router": "^4.1.0",
|
|
300
|
+
- "luxon": "^2.0.2",
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
`packages/backend/src/plugins/search.ts`
|
|
304
|
+
|
|
305
|
+
```diff
|
|
306
|
+
import { Router } from 'express';
|
|
307
|
+
-import { Duration } from 'luxon';
|
|
308
|
+
|
|
309
|
+
// omitted other code
|
|
310
|
+
|
|
311
|
+
const schedule = env.scheduler.createScheduledTaskRunner({
|
|
312
|
+
- frequency: Duration.fromObject({ minutes: 10 }),
|
|
313
|
+
- timeout: Duration.fromObject({ minutes: 15 }),
|
|
314
|
+
+ frequency: { minutes: 10 },
|
|
315
|
+
+ timeout: { minutes: 15 },
|
|
316
|
+
// A 3 second delay gives the backend server a chance to initialize before
|
|
317
|
+
// any collators are executed, which may attempt requests against the API.
|
|
318
|
+
- initialDelay: Duration.fromObject({ seconds: 3 }),
|
|
319
|
+
+ initialDelay: { seconds: 3 },
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
- 7cda923c16: Tweaked the `.dockerignore` file so that it's easier to add additional backend packages if desired.
|
|
324
|
+
|
|
325
|
+
To apply this change to an existing app, make the following change to `.dockerignore`:
|
|
326
|
+
|
|
327
|
+
```diff
|
|
328
|
+
cypress
|
|
329
|
+
microsite
|
|
330
|
+
node_modules
|
|
331
|
+
-packages
|
|
332
|
+
-!packages/backend/dist
|
|
333
|
+
+packages/*/src
|
|
334
|
+
+packages/*/node_modules
|
|
335
|
+
plugins
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
- f55414f895: Added sample catalog data to the template under a top-level `examples` directory. This includes some simple entities, org data, and a template. You can find the sample data at https://github.com/backstage/backstage/tree/master/packages/create-app/templates/default-app/examples.
|
|
339
|
+
- 3a74e203a8: Implement highlighting matching terms in search results. To enable this for an existing app, make the following changes:
|
|
340
|
+
|
|
341
|
+
```diff
|
|
342
|
+
// packages/app/src/components/search/SearchPage.tsx
|
|
343
|
+
...
|
|
344
|
+
- {results.map(({ type, document }) => {
|
|
345
|
+
+ {results.map(({ type, document, highlight }) => {
|
|
346
|
+
switch (type) {
|
|
347
|
+
case 'software-catalog':
|
|
348
|
+
return (
|
|
349
|
+
<CatalogSearchResultListItem
|
|
350
|
+
key={document.location}
|
|
351
|
+
result={document}
|
|
352
|
+
+ highlight={highlight}
|
|
353
|
+
/>
|
|
354
|
+
);
|
|
355
|
+
case 'techdocs':
|
|
356
|
+
return (
|
|
357
|
+
<TechDocsSearchResultListItem
|
|
358
|
+
key={document.location}
|
|
359
|
+
result={document}
|
|
360
|
+
+ highlight={highlight}
|
|
361
|
+
/>
|
|
362
|
+
);
|
|
363
|
+
default:
|
|
364
|
+
return (
|
|
365
|
+
<DefaultResultListItem
|
|
366
|
+
key={document.location}
|
|
367
|
+
result={document}
|
|
368
|
+
+ highlight={highlight}
|
|
369
|
+
/>
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
})}
|
|
373
|
+
...
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
- Updated dependencies
|
|
377
|
+
- @backstage/cli-common@0.1.9-next.0
|
|
378
|
+
|
|
3
379
|
## 0.4.27-next.1
|
|
4
380
|
|
|
5
381
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -57,144 +57,148 @@ ${chalk__default["default"].red(`${error}`)}
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
var version$
|
|
60
|
+
var version$K = "1.3.0-next.0";
|
|
61
61
|
|
|
62
|
-
var version$
|
|
62
|
+
var version$J = "1.0.3-next.0";
|
|
63
63
|
|
|
64
|
-
var version$
|
|
64
|
+
var version$I = "0.13.6-next.0";
|
|
65
65
|
|
|
66
|
-
var version$
|
|
66
|
+
var version$H = "0.3.2-next.0";
|
|
67
67
|
|
|
68
|
-
var version$
|
|
68
|
+
var version$G = "1.0.2";
|
|
69
69
|
|
|
70
|
-
var version$
|
|
70
|
+
var version$F = "1.0.2";
|
|
71
|
+
|
|
72
|
+
var version$E = "0.17.2-next.0";
|
|
71
73
|
|
|
72
74
|
var version$D = "1.0.1";
|
|
73
75
|
|
|
74
|
-
var version$C = "0.
|
|
76
|
+
var version$C = "1.0.2";
|
|
75
77
|
|
|
76
|
-
var version$B = "
|
|
78
|
+
var version$B = "0.9.5-next.0";
|
|
77
79
|
|
|
78
|
-
var version$A = "1.0.2
|
|
80
|
+
var version$A = "1.0.2";
|
|
79
81
|
|
|
80
|
-
var version$z = "0.
|
|
82
|
+
var version$z = "1.0.0";
|
|
81
83
|
|
|
82
|
-
var version$y = "1.
|
|
84
|
+
var version$y = "1.1.1-next.0";
|
|
83
85
|
|
|
84
|
-
var version$x = "1.
|
|
86
|
+
var version$x = "1.1.0";
|
|
85
87
|
|
|
86
|
-
var version$w = "
|
|
88
|
+
var version$w = "0.2.15";
|
|
87
89
|
|
|
88
|
-
var version$v = "
|
|
90
|
+
var version$v = "0.8.6-next.0";
|
|
89
91
|
|
|
90
|
-
var version$u = "0.
|
|
92
|
+
var version$u = "0.3.33-next.0";
|
|
91
93
|
|
|
92
|
-
var version$t = "0.
|
|
94
|
+
var version$t = "0.14.1-next.0";
|
|
93
95
|
|
|
94
|
-
var version$s = "
|
|
96
|
+
var version$s = "1.2.1-next.0";
|
|
95
97
|
|
|
96
|
-
var version$r = "0.
|
|
98
|
+
var version$r = "1.0.2";
|
|
97
99
|
|
|
98
|
-
var version$q = "1.
|
|
100
|
+
var version$q = "1.1.1-next.0";
|
|
99
101
|
|
|
100
|
-
var version$p = "1.0.
|
|
102
|
+
var version$p = "1.2.0-next.0";
|
|
101
103
|
|
|
102
|
-
var version$o = "
|
|
104
|
+
var version$o = "0.2.18-next.0";
|
|
103
105
|
|
|
104
|
-
var version$n = "
|
|
106
|
+
var version$n = "0.8.9-next.0";
|
|
105
107
|
|
|
106
|
-
var version$m = "0.
|
|
108
|
+
var version$m = "0.3.6-next.0";
|
|
107
109
|
|
|
108
|
-
var version$l = "0.
|
|
110
|
+
var version$l = "0.3.37-next.0";
|
|
109
111
|
|
|
110
|
-
var version$k = "0.
|
|
112
|
+
var version$k = "0.5.6-next.0";
|
|
111
113
|
|
|
112
|
-
var version$j = "0.3.
|
|
114
|
+
var version$j = "0.3.6-next.0";
|
|
113
115
|
|
|
114
|
-
var version$i = "0.5.
|
|
116
|
+
var version$i = "0.5.6-next.0";
|
|
115
117
|
|
|
116
|
-
var version$h = "0.
|
|
118
|
+
var version$h = "0.6.1";
|
|
117
119
|
|
|
118
|
-
var version$g = "0.
|
|
120
|
+
var version$g = "0.4.1";
|
|
119
121
|
|
|
120
|
-
var version$f = "0.6.0";
|
|
122
|
+
var version$f = "0.6.2-next.0";
|
|
121
123
|
|
|
122
|
-
var version$e = "0.
|
|
124
|
+
var version$e = "0.2.27-next.0";
|
|
123
125
|
|
|
124
|
-
var version$d = "0.
|
|
126
|
+
var version$d = "0.1.30-next.0";
|
|
125
127
|
|
|
126
|
-
var version$c = "
|
|
128
|
+
var version$c = "1.3.0-next.0";
|
|
127
129
|
|
|
128
|
-
var version$b = "
|
|
130
|
+
var version$b = "1.3.0-next.0";
|
|
129
131
|
|
|
130
|
-
var version$a = "
|
|
132
|
+
var version$a = "0.8.2-next.0";
|
|
131
133
|
|
|
132
|
-
var version$9 = "
|
|
134
|
+
var version$9 = "0.2.0";
|
|
133
135
|
|
|
134
|
-
var version$8 = "0.
|
|
136
|
+
var version$8 = "0.5.3-next.0";
|
|
135
137
|
|
|
136
|
-
var version$7 = "0.
|
|
138
|
+
var version$7 = "0.3.4-next.0";
|
|
137
139
|
|
|
138
|
-
var version$6 = "0.
|
|
140
|
+
var version$6 = "0.6.2-next.0";
|
|
139
141
|
|
|
140
|
-
var version$5 = "0.
|
|
142
|
+
var version$5 = "0.5.13-next.0";
|
|
141
143
|
|
|
142
|
-
var version$4 = "
|
|
144
|
+
var version$4 = "1.1.2-next.0";
|
|
143
145
|
|
|
144
|
-
var version$3 = "0.
|
|
146
|
+
var version$3 = "1.0.1-next.0";
|
|
145
147
|
|
|
146
|
-
var version$2 = "1.
|
|
148
|
+
var version$2 = "1.0.1-next.0";
|
|
147
149
|
|
|
148
|
-
var version$1 = "1.1.
|
|
150
|
+
var version$1 = "1.1.2-next.0";
|
|
149
151
|
|
|
150
|
-
var version = "0.4.
|
|
152
|
+
var version = "0.4.5-next.0";
|
|
151
153
|
|
|
152
154
|
const packageVersions = {
|
|
153
|
-
root: version$
|
|
154
|
-
"@backstage/app-defaults": version$
|
|
155
|
-
"@backstage/backend-common": version$
|
|
156
|
-
"@backstage/backend-tasks": version$
|
|
157
|
-
"@backstage/catalog-client": version$
|
|
158
|
-
"@backstage/catalog-model": version$
|
|
159
|
-
"@backstage/cli": version$
|
|
160
|
-
"@backstage/config": version$
|
|
161
|
-
"@backstage/core-app-api": version$
|
|
162
|
-
"@backstage/core-components": version$
|
|
163
|
-
"@backstage/core-plugin-api": version$
|
|
164
|
-
"@backstage/errors": version$
|
|
165
|
-
"@backstage/integration-react": version$
|
|
166
|
-
"@backstage/plugin-api-docs": version$
|
|
167
|
-
"@backstage/plugin-app-backend": version$
|
|
168
|
-
"@backstage/plugin-auth-backend": version$
|
|
169
|
-
"@backstage/plugin-catalog": version$
|
|
170
|
-
"@backstage/plugin-catalog-common": version$
|
|
171
|
-
"@backstage/plugin-catalog-react": version$
|
|
172
|
-
"@backstage/plugin-catalog-backend": version$
|
|
173
|
-
"@backstage/plugin-catalog-graph": version$
|
|
174
|
-
"@backstage/plugin-catalog-import": version$
|
|
175
|
-
"@backstage/plugin-circleci": version$
|
|
176
|
-
"@backstage/plugin-explore": version$
|
|
177
|
-
"@backstage/plugin-github-actions": version$
|
|
178
|
-
"@backstage/plugin-lighthouse": version$
|
|
179
|
-
"@backstage/plugin-org": version$
|
|
180
|
-
"@backstage/plugin-permission-common": version$
|
|
181
|
-
"@backstage/plugin-permission-node": version$
|
|
182
|
-
"@backstage/plugin-permission-react": version$
|
|
183
|
-
"@backstage/plugin-proxy-backend": version$
|
|
184
|
-
"@backstage/plugin-rollbar-backend": version$
|
|
185
|
-
"@backstage/plugin-scaffolder": version$
|
|
186
|
-
"@backstage/plugin-scaffolder-backend": version$
|
|
187
|
-
"@backstage/plugin-search": version$
|
|
188
|
-
"@backstage/plugin-search-react": version$
|
|
189
|
-
"@backstage/plugin-search-backend": version$
|
|
190
|
-
"@backstage/plugin-search-backend-module-pg": version$
|
|
191
|
-
"@backstage/plugin-search-backend-node": version$
|
|
192
|
-
"@backstage/plugin-tech-radar": version$
|
|
193
|
-
"@backstage/plugin-techdocs": version$
|
|
155
|
+
root: version$K,
|
|
156
|
+
"@backstage/app-defaults": version$J,
|
|
157
|
+
"@backstage/backend-common": version$I,
|
|
158
|
+
"@backstage/backend-tasks": version$H,
|
|
159
|
+
"@backstage/catalog-client": version$G,
|
|
160
|
+
"@backstage/catalog-model": version$F,
|
|
161
|
+
"@backstage/cli": version$E,
|
|
162
|
+
"@backstage/config": version$D,
|
|
163
|
+
"@backstage/core-app-api": version$C,
|
|
164
|
+
"@backstage/core-components": version$B,
|
|
165
|
+
"@backstage/core-plugin-api": version$A,
|
|
166
|
+
"@backstage/errors": version$z,
|
|
167
|
+
"@backstage/integration-react": version$y,
|
|
168
|
+
"@backstage/plugin-api-docs": version$v,
|
|
169
|
+
"@backstage/plugin-app-backend": version$u,
|
|
170
|
+
"@backstage/plugin-auth-backend": version$t,
|
|
171
|
+
"@backstage/plugin-catalog": version$s,
|
|
172
|
+
"@backstage/plugin-catalog-common": version$r,
|
|
173
|
+
"@backstage/plugin-catalog-react": version$q,
|
|
174
|
+
"@backstage/plugin-catalog-backend": version$p,
|
|
175
|
+
"@backstage/plugin-catalog-graph": version$o,
|
|
176
|
+
"@backstage/plugin-catalog-import": version$n,
|
|
177
|
+
"@backstage/plugin-circleci": version$m,
|
|
178
|
+
"@backstage/plugin-explore": version$l,
|
|
179
|
+
"@backstage/plugin-github-actions": version$k,
|
|
180
|
+
"@backstage/plugin-lighthouse": version$j,
|
|
181
|
+
"@backstage/plugin-org": version$i,
|
|
182
|
+
"@backstage/plugin-permission-common": version$h,
|
|
183
|
+
"@backstage/plugin-permission-node": version$f,
|
|
184
|
+
"@backstage/plugin-permission-react": version$g,
|
|
185
|
+
"@backstage/plugin-proxy-backend": version$e,
|
|
186
|
+
"@backstage/plugin-rollbar-backend": version$d,
|
|
187
|
+
"@backstage/plugin-scaffolder": version$c,
|
|
188
|
+
"@backstage/plugin-scaffolder-backend": version$b,
|
|
189
|
+
"@backstage/plugin-search": version$a,
|
|
190
|
+
"@backstage/plugin-search-react": version$9,
|
|
191
|
+
"@backstage/plugin-search-backend": version$8,
|
|
192
|
+
"@backstage/plugin-search-backend-module-pg": version$7,
|
|
193
|
+
"@backstage/plugin-search-backend-node": version$6,
|
|
194
|
+
"@backstage/plugin-tech-radar": version$5,
|
|
195
|
+
"@backstage/plugin-techdocs": version$4,
|
|
196
|
+
"@backstage/plugin-techdocs-react": version$3,
|
|
197
|
+
"@backstage/plugin-techdocs-module-addons-contrib": version$2,
|
|
194
198
|
"@backstage/plugin-techdocs-backend": version$1,
|
|
195
199
|
"@backstage/plugin-user-settings": version,
|
|
196
|
-
"@backstage/test-utils": version$
|
|
197
|
-
"@backstage/theme": version$
|
|
200
|
+
"@backstage/test-utils": version$x,
|
|
201
|
+
"@backstage/theme": version$w
|
|
198
202
|
};
|
|
199
203
|
|
|
200
204
|
const TASK_NAME_MAX_LENGTH = 14;
|
|
@@ -383,7 +387,7 @@ var createApp = async (opts) => {
|
|
|
383
387
|
};
|
|
384
388
|
|
|
385
389
|
const main = (argv) => {
|
|
386
|
-
commander.program.name("backstage-create-app").version(version$
|
|
390
|
+
commander.program.name("backstage-create-app").version(version$K).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));
|
|
387
391
|
commander.program.parse(argv);
|
|
388
392
|
};
|
|
389
393
|
process.on("unhandledRejection", (rejection) => {
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -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 root } from '../../../../package.json';\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 pluginSearchReact } from '../../../../plugins/search-react/package.json';\nimport { version as pluginSearchBackend } from '../../../../plugins/search-backend/package.json';\nimport { version as pluginSearchBackendModulePg } from '../../../../plugins/search-backend-module-pg/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 root,\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-react': pluginSearchReact,\n '@backstage/plugin-search-backend': pluginSearchBackend,\n '@backstage/plugin-search-backend-module-pg': pluginSearchBackendModulePg,\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 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 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) {\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}\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 { OptionValues } 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 (opts: OptionValues): 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\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 = opts.path\n ? resolvePath(paths.targetDir, opts.path)\n : resolvePath(paths.targetDir, answers.name);\n\n Task.log();\n Task.log('Creating the app...');\n\n try {\n if (opts.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, opts.path, answers);\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);\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (!opts.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));\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","root","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","pluginSearchReact","pluginSearchBackend","pluginSearchBackendModulePg","pluginSearchBackendNode","pluginTechRadar","pluginTechdocs","pluginTechdocsBackend","pluginUserSettings","testUtils","theme","promisify","execCb","ora","recursive","resolvePath","relativePath","fs","dirname","basename","handlebars","findPaths","inquirer","os","program","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACO,MAAM,WAAW,SAAS,KAAK,CAAC;AACvC,EAAE,IAAI,IAAI,GAAG;AACb,IAAI,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjC,GAAG;AACH,CAAC;AACM,MAAM,aAAa,SAAS,WAAW,CAAC;AAC/C,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE;AAC7B,IAAI,IAAI,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EAAE,0DAA0D,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1V,EAAED,iBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC,CAAC;AACF,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,SAAS,KAAK;AAChD,EAAE,IAAI,SAAS,YAAY,KAAK,EAAE;AAClC,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AAC7B,GAAG,MAAM;AACT,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,GAAG;AACH,CAAC,CAAC,CAAC;AACH,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;;"}
|
|
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 root } from '../../../../package.json';\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 pluginSearchReact } from '../../../../plugins/search-react/package.json';\nimport { version as pluginSearchBackend } from '../../../../plugins/search-backend/package.json';\nimport { version as pluginSearchBackendModulePg } from '../../../../plugins/search-backend-module-pg/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 pluginTechdocsReact } from '../../../../plugins/techdocs-react/package.json';\nimport { version as pluginTechdocsModuleAddonsContrib } from '../../../../plugins/techdocs-module-addons-contrib/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 root,\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-react': pluginSearchReact,\n '@backstage/plugin-search-backend': pluginSearchBackend,\n '@backstage/plugin-search-backend-module-pg': pluginSearchBackendModulePg,\n '@backstage/plugin-search-backend-node': pluginSearchBackendNode,\n '@backstage/plugin-tech-radar': pluginTechRadar,\n '@backstage/plugin-techdocs': pluginTechdocs,\n '@backstage/plugin-techdocs-react': pluginTechdocsReact,\n '@backstage/plugin-techdocs-module-addons-contrib':\n pluginTechdocsModuleAddonsContrib,\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 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 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) {\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}\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 { OptionValues } 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 (opts: OptionValues): 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\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 = opts.path\n ? resolvePath(paths.targetDir, opts.path)\n : resolvePath(paths.targetDir, answers.name);\n\n Task.log();\n Task.log('Creating the app...');\n\n try {\n if (opts.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, opts.path, answers);\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);\n\n Task.section('Moving to final location');\n await moveAppTask(tempDir, appDir, answers.name);\n }\n\n if (!opts.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));\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","root","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","pluginSearchReact","pluginSearchBackend","pluginSearchBackendModulePg","pluginSearchBackendNode","pluginTechRadar","pluginTechdocs","pluginTechdocsReact","pluginTechdocsModuleAddonsContrib","pluginTechdocsBackend","pluginUserSettings","testUtils","theme","promisify","execCb","ora","recursive","resolvePath","relativePath","fs","dirname","basename","handlebars","findPaths","inquirer","os","program","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACO,MAAM,WAAW,SAAS,KAAK,CAAC;AACvC,EAAE,IAAI,IAAI,GAAG;AACb,IAAI,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjC,GAAG;AACH,CAAC;AACM,MAAM,aAAa,SAAS,WAAW,CAAC;AAC/C,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE;AAC7B,IAAI,IAAI,OAAO,GAAG,CAAC,GAAG,IAAI,KAAK;AAC/B,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACrB,KAAK,CAAC;AACN,IAAI,IAAI,OAAO,EAAE;AACjB,MAAM,OAAO,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/D,KAAK,MAAM;AACX,MAAM,OAAO,CAAC,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH,CAAC;AACM,SAAS,aAAa,CAAC,KAAK,EAAE;AACrC,EAAE,IAAI,KAAK,YAAY,aAAa,EAAE;AACtC,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1B,EAAEA,yBAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,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GED
|
@@ -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.
|
|
4
|
+
"version": "0.4.28-next.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"start": "nodemon --"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@backstage/cli-common": "^0.1.
|
|
36
|
+
"@backstage/cli-common": "^0.1.9",
|
|
37
37
|
"chalk": "^4.0.0",
|
|
38
38
|
"commander": "^9.1.0",
|
|
39
39
|
"fs-extra": "10.1.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"dist",
|
|
61
61
|
"templates"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c1511c99a532aeb003a97510a5638bd939ee65ca"
|
|
64
64
|
}
|
|
@@ -76,36 +76,28 @@ catalog:
|
|
|
76
76
|
rules:
|
|
77
77
|
- allow: [Component, System, API, Resource, Location]
|
|
78
78
|
locations:
|
|
79
|
-
#
|
|
80
|
-
- type:
|
|
81
|
-
target:
|
|
79
|
+
# Local example data, file locations are relative to the backend process, typically `packages/backend`
|
|
80
|
+
- type: file
|
|
81
|
+
target: ../../examples/entities.yaml
|
|
82
82
|
|
|
83
|
-
#
|
|
84
|
-
- type:
|
|
85
|
-
target:
|
|
86
|
-
|
|
87
|
-
# Backstage example APIs
|
|
88
|
-
- type: url
|
|
89
|
-
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all-apis.yaml
|
|
90
|
-
|
|
91
|
-
# Backstage example resources
|
|
92
|
-
- type: url
|
|
93
|
-
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all-resources.yaml
|
|
94
|
-
|
|
95
|
-
# Backstage example organization groups
|
|
96
|
-
- type: url
|
|
97
|
-
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme/org.yaml
|
|
98
|
-
|
|
99
|
-
# Backstage example templates
|
|
100
|
-
- type: url
|
|
101
|
-
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/react-ssr-template/template.yaml
|
|
102
|
-
rules:
|
|
103
|
-
- allow: [Template]
|
|
104
|
-
- type: url
|
|
105
|
-
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/springboot-grpc-template/template.yaml
|
|
83
|
+
# Local example template
|
|
84
|
+
- type: file
|
|
85
|
+
target: ../../examples/template/template.yaml
|
|
106
86
|
rules:
|
|
107
87
|
- allow: [Template]
|
|
108
|
-
|
|
109
|
-
|
|
88
|
+
|
|
89
|
+
# Local example organizational data
|
|
90
|
+
- type: file
|
|
91
|
+
target: ../../examples/org.yaml
|
|
110
92
|
rules:
|
|
111
|
-
- allow: [
|
|
93
|
+
- allow: [User, Group]
|
|
94
|
+
|
|
95
|
+
## Uncomment these lines to add more example data
|
|
96
|
+
# - type: url
|
|
97
|
+
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml
|
|
98
|
+
|
|
99
|
+
## Uncomment these lines to add an example org
|
|
100
|
+
# - type: url
|
|
101
|
+
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml
|
|
102
|
+
# rules:
|
|
103
|
+
# - allow: [User, Group]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system
|
|
3
|
+
apiVersion: backstage.io/v1alpha1
|
|
4
|
+
kind: System
|
|
5
|
+
metadata:
|
|
6
|
+
name: examples
|
|
7
|
+
spec:
|
|
8
|
+
owner: guests
|
|
9
|
+
---
|
|
10
|
+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
|
|
11
|
+
apiVersion: backstage.io/v1alpha1
|
|
12
|
+
kind: Component
|
|
13
|
+
metadata:
|
|
14
|
+
name: example-website
|
|
15
|
+
spec:
|
|
16
|
+
type: website
|
|
17
|
+
lifecycle: experimental
|
|
18
|
+
owner: guests
|
|
19
|
+
system: examples
|
|
20
|
+
providesApis: [example-grpc-api]
|
|
21
|
+
---
|
|
22
|
+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api
|
|
23
|
+
apiVersion: backstage.io/v1alpha1
|
|
24
|
+
kind: API
|
|
25
|
+
metadata:
|
|
26
|
+
name: example-grpc-api
|
|
27
|
+
spec:
|
|
28
|
+
type: grpc
|
|
29
|
+
lifecycle: experimental
|
|
30
|
+
owner: guests
|
|
31
|
+
system: examples
|
|
32
|
+
definition: |
|
|
33
|
+
syntax = "proto3";
|
|
34
|
+
|
|
35
|
+
service Exampler {
|
|
36
|
+
rpc Example (ExampleMessage) returns (ExampleMessage) {};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message ExampleMessage {
|
|
40
|
+
string example = 1;
|
|
41
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-user
|
|
3
|
+
apiVersion: backstage.io/v1alpha1
|
|
4
|
+
kind: User
|
|
5
|
+
metadata:
|
|
6
|
+
name: guest
|
|
7
|
+
spec:
|
|
8
|
+
memberOf: [guests]
|
|
9
|
+
---
|
|
10
|
+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-group
|
|
11
|
+
apiVersion: backstage.io/v1alpha1
|
|
12
|
+
kind: Group
|
|
13
|
+
metadata:
|
|
14
|
+
name: guests
|
|
15
|
+
spec:
|
|
16
|
+
type: team
|
|
17
|
+
children: []
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Hello from ${{ values.name }}!');
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
apiVersion: scaffolder.backstage.io/v1beta3
|
|
2
|
+
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template
|
|
3
|
+
kind: Template
|
|
4
|
+
metadata:
|
|
5
|
+
name: example-nodejs-template
|
|
6
|
+
title: Example Node.js Template
|
|
7
|
+
description: An example template for the scaffolder that creates a simple Node.js service
|
|
8
|
+
spec:
|
|
9
|
+
owner: user:guest
|
|
10
|
+
type: service
|
|
11
|
+
|
|
12
|
+
# These parameters are used to generate the input form in the frontend, and are
|
|
13
|
+
# used to gather input data for the execution of the template.
|
|
14
|
+
parameters:
|
|
15
|
+
- title: Fill in some steps
|
|
16
|
+
required:
|
|
17
|
+
- name
|
|
18
|
+
properties:
|
|
19
|
+
name:
|
|
20
|
+
title: Name
|
|
21
|
+
type: string
|
|
22
|
+
description: Unique name of the component
|
|
23
|
+
ui:autofocus: true
|
|
24
|
+
ui:options:
|
|
25
|
+
rows: 5
|
|
26
|
+
- title: Choose a location
|
|
27
|
+
required:
|
|
28
|
+
- repoUrl
|
|
29
|
+
properties:
|
|
30
|
+
repoUrl:
|
|
31
|
+
title: Repository Location
|
|
32
|
+
type: string
|
|
33
|
+
ui:field: RepoUrlPicker
|
|
34
|
+
ui:options:
|
|
35
|
+
allowedHosts:
|
|
36
|
+
- github.com
|
|
37
|
+
|
|
38
|
+
# These steps are executed in the scaffolder backend, using data that we gathered
|
|
39
|
+
# via the parameters above.
|
|
40
|
+
steps:
|
|
41
|
+
# Each step executes an action, in this case one templates files into the working directory.
|
|
42
|
+
- id: fetch-base
|
|
43
|
+
name: Fetch Base
|
|
44
|
+
action: fetch:template
|
|
45
|
+
input:
|
|
46
|
+
url: ./content
|
|
47
|
+
values:
|
|
48
|
+
name: ${{ parameters.name }}
|
|
49
|
+
|
|
50
|
+
# This step publishes the contents of the working directory to GitHub.
|
|
51
|
+
- id: publish
|
|
52
|
+
name: Publish
|
|
53
|
+
action: publish:github
|
|
54
|
+
input:
|
|
55
|
+
allowedHosts: ['github.com']
|
|
56
|
+
description: This is ${{ parameters.name }}
|
|
57
|
+
repoUrl: ${{ parameters.repoUrl }}
|
|
58
|
+
|
|
59
|
+
# The final step is to register our new component in the catalog.
|
|
60
|
+
- id: register
|
|
61
|
+
name: Register
|
|
62
|
+
action: catalog:register
|
|
63
|
+
input:
|
|
64
|
+
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
|
|
65
|
+
catalogInfoPath: '/catalog-info.yaml'
|
|
66
|
+
|
|
67
|
+
# Outputs are displayed to the user after a successful execution of the template.
|
|
68
|
+
output:
|
|
69
|
+
links:
|
|
70
|
+
- title: Repository
|
|
71
|
+
url: ${{ steps.publish.output.remoteUrl }}
|
|
72
|
+
- title: Open in catalog
|
|
73
|
+
icon: catalog
|
|
74
|
+
entityRef: ${{ steps.register.output.entityRef }}
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"@backstage/plugin-search-react": "^{{version '@backstage/plugin-search-react'}}",
|
|
29
29
|
"@backstage/plugin-tech-radar": "^{{version '@backstage/plugin-tech-radar'}}",
|
|
30
30
|
"@backstage/plugin-techdocs": "^{{version '@backstage/plugin-techdocs'}}",
|
|
31
|
+
"@backstage/plugin-techdocs-react": "^{{version '@backstage/plugin-techdocs-react'}}",
|
|
32
|
+
"@backstage/plugin-techdocs-module-addons-contrib": "^{{version '@backstage/plugin-techdocs-module-addons-contrib'}}",
|
|
31
33
|
"@backstage/plugin-user-settings": "^{{version '@backstage/plugin-user-settings'}}",
|
|
32
34
|
"@backstage/theme": "^{{version '@backstage/theme'}}",
|
|
33
35
|
"@material-ui/core": "^4.12.2",
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
techdocsPlugin,
|
|
20
20
|
TechDocsReaderPage,
|
|
21
21
|
} from '@backstage/plugin-techdocs';
|
|
22
|
+
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
23
|
+
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
|
|
22
24
|
import { UserSettingsPage } from '@backstage/plugin-user-settings';
|
|
23
25
|
import { apis } from './apis';
|
|
24
26
|
import { entityPage } from './components/catalog/EntityPage';
|
|
@@ -68,7 +70,11 @@ const routes = (
|
|
|
68
70
|
<Route
|
|
69
71
|
path="/docs/:namespace/:kind/:name/*"
|
|
70
72
|
element={<TechDocsReaderPage />}
|
|
71
|
-
|
|
73
|
+
>
|
|
74
|
+
<TechDocsAddons>
|
|
75
|
+
<ReportIssue />
|
|
76
|
+
</TechDocsAddons>
|
|
77
|
+
</Route>
|
|
72
78
|
<Route path="/create" element={<ScaffolderPage />} />
|
|
73
79
|
<Route path="/api-docs" element={<ApiExplorerPage />} />
|
|
74
80
|
<Route
|
|
@@ -68,6 +68,17 @@ import {
|
|
|
68
68
|
RELATION_PROVIDES_API,
|
|
69
69
|
} from '@backstage/catalog-model';
|
|
70
70
|
|
|
71
|
+
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
|
72
|
+
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
|
|
73
|
+
|
|
74
|
+
const techdocsContent = (
|
|
75
|
+
<EntityTechdocsContent>
|
|
76
|
+
<TechDocsAddons>
|
|
77
|
+
<ReportIssue />
|
|
78
|
+
</TechDocsAddons>
|
|
79
|
+
</EntityTechdocsContent>
|
|
80
|
+
);
|
|
81
|
+
|
|
71
82
|
const cicdContent = (
|
|
72
83
|
// This is an example of how you can implement your company's logic in entity page.
|
|
73
84
|
// You can for example enforce that all components of type 'service' should use GitHubActions
|
|
@@ -167,7 +178,7 @@ const serviceEntityPage = (
|
|
|
167
178
|
</EntityLayout.Route>
|
|
168
179
|
|
|
169
180
|
<EntityLayout.Route path="/docs" title="Docs">
|
|
170
|
-
|
|
181
|
+
{techdocsContent}
|
|
171
182
|
</EntityLayout.Route>
|
|
172
183
|
</EntityLayout>
|
|
173
184
|
);
|
|
@@ -194,7 +205,7 @@ const websiteEntityPage = (
|
|
|
194
205
|
</EntityLayout.Route>
|
|
195
206
|
|
|
196
207
|
<EntityLayout.Route path="/docs" title="Docs">
|
|
197
|
-
|
|
208
|
+
{techdocsContent}
|
|
198
209
|
</EntityLayout.Route>
|
|
199
210
|
</EntityLayout>
|
|
200
211
|
);
|
|
@@ -213,7 +224,7 @@ const defaultEntityPage = (
|
|
|
213
224
|
</EntityLayout.Route>
|
|
214
225
|
|
|
215
226
|
<EntityLayout.Route path="/docs" title="Docs">
|
|
216
|
-
|
|
227
|
+
{techdocsContent}
|
|
217
228
|
</EntityLayout.Route>
|
|
218
229
|
</EntityLayout>
|
|
219
230
|
);
|
|
@@ -112,13 +112,14 @@ const SearchPage = () => {
|
|
|
112
112
|
<SearchResult>
|
|
113
113
|
{({ results }) => (
|
|
114
114
|
<List>
|
|
115
|
-
{results.map(({ type, document }) => {
|
|
115
|
+
{results.map(({ type, document, highlight }) => {
|
|
116
116
|
switch (type) {
|
|
117
117
|
case 'software-catalog':
|
|
118
118
|
return (
|
|
119
119
|
<CatalogSearchResultListItem
|
|
120
120
|
key={document.location}
|
|
121
121
|
result={document}
|
|
122
|
+
highlight={highlight}
|
|
122
123
|
/>
|
|
123
124
|
);
|
|
124
125
|
case 'techdocs':
|
|
@@ -126,6 +127,7 @@ const SearchPage = () => {
|
|
|
126
127
|
<TechDocsSearchResultListItem
|
|
127
128
|
key={document.location}
|
|
128
129
|
result={document}
|
|
130
|
+
highlight={highlight}
|
|
129
131
|
/>
|
|
130
132
|
);
|
|
131
133
|
default:
|
|
@@ -133,6 +135,7 @@ const SearchPage = () => {
|
|
|
133
135
|
<DefaultResultListItem
|
|
134
136
|
key={document.location}
|
|
135
137
|
result={document}
|
|
138
|
+
highlight={highlight}
|
|
136
139
|
/>
|
|
137
140
|
);
|
|
138
141
|
}
|
|
@@ -8,7 +8,6 @@ import { PluginEnvironment } from '../types';
|
|
|
8
8
|
import { DefaultCatalogCollatorFactory } from '@backstage/plugin-catalog-backend';
|
|
9
9
|
import { DefaultTechDocsCollatorFactory } from '@backstage/plugin-techdocs-backend';
|
|
10
10
|
import { Router } from 'express';
|
|
11
|
-
import { Duration } from 'luxon';
|
|
12
11
|
|
|
13
12
|
export default async function createPlugin(
|
|
14
13
|
env: PluginEnvironment,
|
|
@@ -23,11 +22,11 @@ export default async function createPlugin(
|
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
const schedule = env.scheduler.createScheduledTaskRunner({
|
|
26
|
-
frequency:
|
|
27
|
-
timeout:
|
|
25
|
+
frequency: { minutes: 10 },
|
|
26
|
+
timeout: { minutes: 15 },
|
|
28
27
|
// A 3 second delay gives the backend server a chance to initialize before
|
|
29
28
|
// any collators are executed, which may attempt requests against the API.
|
|
30
|
-
initialDelay:
|
|
29
|
+
initialDelay: { seconds: 3 },
|
|
31
30
|
});
|
|
32
31
|
|
|
33
32
|
// Collators are responsible for gathering documents known to plugins. This
|