@backstage/cli 0.33.2-next.0 → 0.34.0-next.2
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 +51 -0
- package/asset-types/asset-types.d.ts +0 -38
- package/config/nodeTransformHooks.mjs +12 -0
- package/dist/lib/version.cjs.js +20 -14
- package/dist/modules/build/commands/package/build/command.cjs.js +3 -3
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +4 -7
- package/dist/modules/build/commands/repo/build.cjs.js +2 -3
- package/dist/modules/build/lib/buildFrontend.cjs.js +7 -10
- package/dist/modules/build/lib/builder/config.cjs.js +0 -7
- package/dist/modules/build/lib/bundler/bundle.cjs.js +24 -29
- package/dist/modules/build/lib/bundler/config.cjs.js +40 -28
- package/dist/modules/build/lib/bundler/optimization.cjs.js +6 -5
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +4 -9
- package/dist/modules/build/lib/bundler/server.cjs.js +18 -22
- package/dist/modules/build/lib/bundler/transforms.cjs.js +7 -35
- package/dist/packages/cli/package.json.cjs.js +15 -19
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/frontend-defaults/package.json.cjs.js +6 -0
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +6 -0
- package/dist/packages/frontend-test-utils/package.json.cjs.js +6 -0
- package/package.json +46 -26
- package/templates/new-frontend-plugin/.eslintrc.js.hbs +1 -0
- package/templates/new-frontend-plugin/README.md.hbs +20 -0
- package/templates/new-frontend-plugin/dev/index.tsx +10 -0
- package/templates/new-frontend-plugin/package.json.hbs +49 -0
- package/templates/new-frontend-plugin/portable-template.yaml +5 -0
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +28 -0
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +37 -0
- package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +1 -0
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +19 -0
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +308 -0
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +1 -0
- package/templates/new-frontend-plugin/src/index.ts.hbs +1 -0
- package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +7 -0
- package/templates/new-frontend-plugin/src/plugin.tsx.hbs +26 -0
- package/templates/new-frontend-plugin/src/routes.ts +3 -0
- package/templates/new-frontend-plugin/src/setupTests.ts +1 -0
- package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +1 -0
- package/templates/new-frontend-plugin-module/README.md.hbs +5 -0
- package/templates/new-frontend-plugin-module/package.json.hbs +35 -0
- package/templates/new-frontend-plugin-module/portable-template.yaml +5 -0
- package/templates/new-frontend-plugin-module/src/index.ts.hbs +1 -0
- package/templates/new-frontend-plugin-module/src/module.tsx.hbs +8 -0
- package/templates/new-frontend-plugin-module/src/setupTests.ts +1 -0
- package/dist/lib/svgrTemplate.cjs.js +0 -23
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
+
import {
|
|
3
|
+
Table,
|
|
4
|
+
TableColumn,
|
|
5
|
+
Progress,
|
|
6
|
+
ResponseErrorPanel,
|
|
7
|
+
} from '@backstage/core-components';
|
|
8
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
9
|
+
|
|
10
|
+
export const exampleUsers = {
|
|
11
|
+
results: [
|
|
12
|
+
{
|
|
13
|
+
gender: 'female',
|
|
14
|
+
name: {
|
|
15
|
+
title: 'Miss',
|
|
16
|
+
first: 'Carolyn',
|
|
17
|
+
last: 'Moore',
|
|
18
|
+
},
|
|
19
|
+
email: 'carolyn.moore@example.com',
|
|
20
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Carolyn',
|
|
21
|
+
nat: 'GB',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
gender: 'female',
|
|
25
|
+
name: {
|
|
26
|
+
title: 'Ms',
|
|
27
|
+
first: 'Esma',
|
|
28
|
+
last: 'Berberoğlu',
|
|
29
|
+
},
|
|
30
|
+
email: 'esma.berberoglu@example.com',
|
|
31
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Esma',
|
|
32
|
+
nat: 'TR',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
gender: 'female',
|
|
36
|
+
name: {
|
|
37
|
+
title: 'Ms',
|
|
38
|
+
first: 'Isabella',
|
|
39
|
+
last: 'Rhodes',
|
|
40
|
+
},
|
|
41
|
+
email: 'isabella.rhodes@example.com',
|
|
42
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella',
|
|
43
|
+
nat: 'GB',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
gender: 'male',
|
|
47
|
+
name: {
|
|
48
|
+
title: 'Mr',
|
|
49
|
+
first: 'Derrick',
|
|
50
|
+
last: 'Carter',
|
|
51
|
+
},
|
|
52
|
+
email: 'derrick.carter@example.com',
|
|
53
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Derrick',
|
|
54
|
+
nat: 'IE',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
gender: 'female',
|
|
58
|
+
name: {
|
|
59
|
+
title: 'Miss',
|
|
60
|
+
first: 'Mattie',
|
|
61
|
+
last: 'Lambert',
|
|
62
|
+
},
|
|
63
|
+
email: 'mattie.lambert@example.com',
|
|
64
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mattie',
|
|
65
|
+
nat: 'AU',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
gender: 'male',
|
|
69
|
+
name: {
|
|
70
|
+
title: 'Mr',
|
|
71
|
+
first: 'Mijat',
|
|
72
|
+
last: 'Rakić',
|
|
73
|
+
},
|
|
74
|
+
email: 'mijat.rakic@example.com',
|
|
75
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mijat',
|
|
76
|
+
nat: 'RS',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
gender: 'male',
|
|
80
|
+
name: {
|
|
81
|
+
title: 'Mr',
|
|
82
|
+
first: 'Javier',
|
|
83
|
+
last: 'Reid',
|
|
84
|
+
},
|
|
85
|
+
email: 'javier.reid@example.com',
|
|
86
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Javier',
|
|
87
|
+
nat: 'US',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
gender: 'female',
|
|
91
|
+
name: {
|
|
92
|
+
title: 'Ms',
|
|
93
|
+
first: 'Isabella',
|
|
94
|
+
last: 'Li',
|
|
95
|
+
},
|
|
96
|
+
email: 'isabella.li@example.com',
|
|
97
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella',
|
|
98
|
+
nat: 'CA',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
gender: 'female',
|
|
102
|
+
name: {
|
|
103
|
+
title: 'Mrs',
|
|
104
|
+
first: 'Stephanie',
|
|
105
|
+
last: 'Garrett',
|
|
106
|
+
},
|
|
107
|
+
email: 'stephanie.garrett@example.com',
|
|
108
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Stephanie',
|
|
109
|
+
nat: 'AU',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
gender: 'female',
|
|
113
|
+
name: {
|
|
114
|
+
title: 'Ms',
|
|
115
|
+
first: 'Antonia',
|
|
116
|
+
last: 'Núñez',
|
|
117
|
+
},
|
|
118
|
+
email: 'antonia.nunez@example.com',
|
|
119
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Antonia',
|
|
120
|
+
nat: 'ES',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
gender: 'male',
|
|
124
|
+
name: {
|
|
125
|
+
title: 'Mr',
|
|
126
|
+
first: 'Donald',
|
|
127
|
+
last: 'Young',
|
|
128
|
+
},
|
|
129
|
+
email: 'donald.young@example.com',
|
|
130
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Donald',
|
|
131
|
+
nat: 'US',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
gender: 'male',
|
|
135
|
+
name: {
|
|
136
|
+
title: 'Mr',
|
|
137
|
+
first: 'Iegor',
|
|
138
|
+
last: 'Holodovskiy',
|
|
139
|
+
},
|
|
140
|
+
email: 'iegor.holodovskiy@example.com',
|
|
141
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Iegor',
|
|
142
|
+
nat: 'UA',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
gender: 'female',
|
|
146
|
+
name: {
|
|
147
|
+
title: 'Madame',
|
|
148
|
+
first: 'Jessica',
|
|
149
|
+
last: 'David',
|
|
150
|
+
},
|
|
151
|
+
email: 'jessica.david@example.com',
|
|
152
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Jessica',
|
|
153
|
+
nat: 'CH',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
gender: 'female',
|
|
157
|
+
name: {
|
|
158
|
+
title: 'Ms',
|
|
159
|
+
first: 'Eve',
|
|
160
|
+
last: 'Martinez',
|
|
161
|
+
},
|
|
162
|
+
email: 'eve.martinez@example.com',
|
|
163
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Eve',
|
|
164
|
+
nat: 'FR',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
gender: 'male',
|
|
168
|
+
name: {
|
|
169
|
+
title: 'Mr',
|
|
170
|
+
first: 'Caleb',
|
|
171
|
+
last: 'Silva',
|
|
172
|
+
},
|
|
173
|
+
email: 'caleb.silva@example.com',
|
|
174
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Caleb',
|
|
175
|
+
nat: 'US',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
gender: 'female',
|
|
179
|
+
name: {
|
|
180
|
+
title: 'Miss',
|
|
181
|
+
first: 'Marcia',
|
|
182
|
+
last: 'Jenkins',
|
|
183
|
+
},
|
|
184
|
+
email: 'marcia.jenkins@example.com',
|
|
185
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Marcia',
|
|
186
|
+
nat: 'US',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
gender: 'female',
|
|
190
|
+
name: {
|
|
191
|
+
title: 'Mrs',
|
|
192
|
+
first: 'Mackenzie',
|
|
193
|
+
last: 'Jones',
|
|
194
|
+
},
|
|
195
|
+
email: 'mackenzie.jones@example.com',
|
|
196
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mackenzie',
|
|
197
|
+
nat: 'NZ',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
gender: 'male',
|
|
201
|
+
name: {
|
|
202
|
+
title: 'Mr',
|
|
203
|
+
first: 'Jeremiah',
|
|
204
|
+
last: 'Gutierrez',
|
|
205
|
+
},
|
|
206
|
+
email: 'jeremiah.gutierrez@example.com',
|
|
207
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Jeremiah',
|
|
208
|
+
nat: 'AU',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
gender: 'female',
|
|
212
|
+
name: {
|
|
213
|
+
title: 'Ms',
|
|
214
|
+
first: 'Luciara',
|
|
215
|
+
last: 'Souza',
|
|
216
|
+
},
|
|
217
|
+
email: 'luciara.souza@example.com',
|
|
218
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Luciara',
|
|
219
|
+
nat: 'BR',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
gender: 'male',
|
|
223
|
+
name: {
|
|
224
|
+
title: 'Mr',
|
|
225
|
+
first: 'Valgi',
|
|
226
|
+
last: 'da Cunha',
|
|
227
|
+
},
|
|
228
|
+
email: 'valgi.dacunha@example.com',
|
|
229
|
+
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Valgi',
|
|
230
|
+
nat: 'BR',
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const useStyles = makeStyles({
|
|
236
|
+
avatar: {
|
|
237
|
+
height: 32,
|
|
238
|
+
width: 32,
|
|
239
|
+
borderRadius: '50%',
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
type User = {
|
|
244
|
+
gender: string; // "male"
|
|
245
|
+
name: {
|
|
246
|
+
title: string; // "Mr",
|
|
247
|
+
first: string; // "Duane",
|
|
248
|
+
last: string; // "Reed"
|
|
249
|
+
};
|
|
250
|
+
email: string; // "duane.reed@example.com"
|
|
251
|
+
picture: string; // "https://api.dicebear.com/6.x/open-peeps/svg?seed=Duane"
|
|
252
|
+
nat: string; // "AU"
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
type DenseTableProps = {
|
|
256
|
+
users: User[];
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const DenseTable = ({ users }: DenseTableProps) => {
|
|
260
|
+
const classes = useStyles();
|
|
261
|
+
|
|
262
|
+
const columns: TableColumn[] = [
|
|
263
|
+
{ title: 'Avatar', field: 'avatar' },
|
|
264
|
+
{ title: 'Name', field: 'name' },
|
|
265
|
+
{ title: 'Email', field: 'email' },
|
|
266
|
+
{ title: 'Nationality', field: 'nationality' },
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
const data = users.map(user => {
|
|
270
|
+
return {
|
|
271
|
+
avatar: (
|
|
272
|
+
<img
|
|
273
|
+
src={user.picture}
|
|
274
|
+
className={classes.avatar}
|
|
275
|
+
alt={user.name.first}
|
|
276
|
+
/>
|
|
277
|
+
),
|
|
278
|
+
name: `${user.name.first} ${user.name.last}`,
|
|
279
|
+
email: user.email,
|
|
280
|
+
nationality: user.nat,
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
return (
|
|
285
|
+
<Table
|
|
286
|
+
title="Example User List"
|
|
287
|
+
options=\{{ search: false, paging: false }}
|
|
288
|
+
columns={columns}
|
|
289
|
+
data={data}
|
|
290
|
+
/>
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export const ExampleFetchComponent = () => {
|
|
295
|
+
|
|
296
|
+
const { value, loading, error } = useAsync(async (): Promise<User[]> => {
|
|
297
|
+
// Would use fetch in a real world example
|
|
298
|
+
return exampleUsers.results;
|
|
299
|
+
}, []);
|
|
300
|
+
|
|
301
|
+
if (loading) {
|
|
302
|
+
return <Progress />;
|
|
303
|
+
} else if (error) {
|
|
304
|
+
return <ResponseErrorPanel error={error} />;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return <DenseTable users={value || []} />;
|
|
308
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExampleFetchComponent } from './ExampleFetchComponent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { {{ pluginVar }} as default } from './plugin';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
createFrontendPlugin,
|
|
4
|
+
PageBlueprint,
|
|
5
|
+
} from '@backstage/frontend-plugin-api';
|
|
6
|
+
|
|
7
|
+
import { rootRouteRef } from './routes';
|
|
8
|
+
|
|
9
|
+
export const page = PageBlueprint.make({
|
|
10
|
+
params: {
|
|
11
|
+
path: '/{{pluginId}}',
|
|
12
|
+
routeRef: rootRouteRef,
|
|
13
|
+
loader: () =>
|
|
14
|
+
import('./components/ExampleComponent').then(m =>
|
|
15
|
+
<m.ExampleComponent />,
|
|
16
|
+
),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const {{ pluginVar }} = createFrontendPlugin({
|
|
21
|
+
id: '{{pluginId}}',
|
|
22
|
+
extensions: [page],
|
|
23
|
+
routes: {
|
|
24
|
+
root: rootRouteRef,
|
|
25
|
+
}
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"description": "The {{moduleId}} frontend module for the {{pluginId}} plugin.",
|
|
4
|
+
"main": "src/index.ts",
|
|
5
|
+
"types": "src/index.ts",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"main": "dist/index.cjs.js",
|
|
9
|
+
"module": "dist/index.esm.js",
|
|
10
|
+
"types": "dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"backstage": {
|
|
13
|
+
"role": "frontend-plugin-module",
|
|
14
|
+
"pluginId": "{{pluginId}}"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "backstage-cli package build",
|
|
19
|
+
"lint": "backstage-cli package lint",
|
|
20
|
+
"test": "backstage-cli package test",
|
|
21
|
+
"clean": "backstage-cli package clean",
|
|
22
|
+
"prepack": "backstage-cli package prepack",
|
|
23
|
+
"postpack": "backstage-cli package postpack"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@backstage/frontend-plugin-api": "{{versionQuery '@backstage/frontend-plugin-api'}}"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@backstage/cli": "{{versionQuery '@backstage/cli'}}",
|
|
30
|
+
"@testing-library/jest-dom": "{{versionQuery '@testing-library/jest-dom' '6.0.0'}}"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { {{ moduleVar }} as default } from './plugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function svgrTemplate({ imports, interfaces, componentName, props, jsx }, { tpl }) {
|
|
4
|
-
const name = `${componentName.replace(/icon$/, "")}Icon`;
|
|
5
|
-
const defaultExport = {
|
|
6
|
-
type: "ExportDefaultDeclaration",
|
|
7
|
-
declaration: { type: "Identifier", name }
|
|
8
|
-
};
|
|
9
|
-
return tpl`
|
|
10
|
-
${imports}
|
|
11
|
-
import SvgIcon from '@material-ui/core/SvgIcon';
|
|
12
|
-
|
|
13
|
-
console.log('DEPRECATION WARNING: The .icon.svg extension is deprecated, inline the SVG elements in a MUI SvgIcon instead.', Object.assign(new Error(), {name: 'Warning'}).stack);
|
|
14
|
-
|
|
15
|
-
${interfaces}
|
|
16
|
-
|
|
17
|
-
const ${name} = (${props}) => React.createElement(SvgIcon, ${props}, ${jsx.children});
|
|
18
|
-
|
|
19
|
-
${defaultExport}`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.svgrTemplate = svgrTemplate;
|
|
23
|
-
//# sourceMappingURL=svgrTemplate.cjs.js.map
|