@backstage/cli 0.22.8-next.1 → 0.22.8-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.
Files changed (42) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/{build-35dca9e9.cjs.js → build-94b166b9.cjs.js} +7 -7
  3. package/dist/cjs/{buildBackend-9a35e487.cjs.js → buildBackend-1610ed47.cjs.js} +6 -6
  4. package/dist/cjs/{buildWorkspace-089f788e.cjs.js → buildWorkspace-0729ac23.cjs.js} +4 -4
  5. package/dist/cjs/{bump-9aae289f.cjs.js → bump-2e41888b.cjs.js} +5 -5
  6. package/dist/cjs/{clean-00814511.cjs.js → clean-707fb954.cjs.js} +2 -2
  7. package/dist/cjs/{clean-9a826eb9.cjs.js → clean-fef9647d.cjs.js} +2 -2
  8. package/dist/cjs/{codeowners-2a307ab7.cjs.js → codeowners-5b10b186.cjs.js} +2 -2
  9. package/dist/cjs/{config-d36b4649.cjs.js → config-1d171d7e.cjs.js} +2 -2
  10. package/dist/cjs/{createDistWorkspace-4534a3aa.cjs.js → createDistWorkspace-6f0f28d5.cjs.js} +3 -3
  11. package/dist/cjs/{createPlugin-41dfb133.cjs.js → createPlugin-33d16874.cjs.js} +4 -4
  12. package/dist/cjs/{diff-4dad26b4.cjs.js → diff-c80533a8.cjs.js} +2 -2
  13. package/dist/cjs/{docs-a619fd5a.cjs.js → docs-c23fb420.cjs.js} +3 -3
  14. package/dist/cjs/{fix-bfd1c7d1.cjs.js → fix-7ed7159b.cjs.js} +2 -2
  15. package/dist/cjs/{index-c2e407b0.cjs.js → index-4438059a.cjs.js} +8 -8
  16. package/dist/cjs/{index-181bc0fa.cjs.js → index-7b1afb9b.cjs.js} +3 -3
  17. package/dist/cjs/{index-05bbfd22.cjs.js → index-a83455a6.cjs.js} +7 -7
  18. package/dist/cjs/{index-ea9b48ac.cjs.js → index-ad52f12e.cjs.js} +40 -40
  19. package/dist/cjs/{index-22ef6e6b.cjs.js → index-dc7cc004.cjs.js} +2 -2
  20. package/dist/cjs/{info-30e71876.cjs.js → info-5202a3df.cjs.js} +3 -3
  21. package/dist/cjs/{install-37c68b4c.cjs.js → install-ad1fcacf.cjs.js} +4 -4
  22. package/dist/cjs/{lint-f98521ff.cjs.js → lint-0c3133b5.cjs.js} +2 -2
  23. package/dist/cjs/{lint-0589cc7e.cjs.js → lint-733ca435.cjs.js} +3 -3
  24. package/dist/cjs/{lint-da8aff35.cjs.js → lint-784a0c3b.cjs.js} +2 -2
  25. package/dist/cjs/{list-deprecations-67bfbc9e.cjs.js → list-deprecations-9eac9ad6.cjs.js} +2 -2
  26. package/dist/cjs/{new-461e6cc9.cjs.js → new-dd994b5f.cjs.js} +4 -4
  27. package/dist/cjs/{pack-d699629f.cjs.js → pack-5a0cf2b2.cjs.js} +2 -2
  28. package/dist/cjs/{packageLintConfigs-cb25f165.cjs.js → packageLintConfigs-0041e26e.cjs.js} +3 -3
  29. package/dist/cjs/{packageRole-55642d7f.cjs.js → packageRole-908ff155.cjs.js} +2 -2
  30. package/dist/cjs/{packages-78b086ea.cjs.js → packages-93128416.cjs.js} +3 -3
  31. package/dist/cjs/{paths-d561e3b3.cjs.js → paths-82663f40.cjs.js} +3 -3
  32. package/dist/cjs/{print-86b616e7.cjs.js → print-64356633.cjs.js} +3 -3
  33. package/dist/cjs/{role-d9dbf82f.cjs.js → role-1007229a.cjs.js} +2 -2
  34. package/dist/cjs/{run-135ea3c4.cjs.js → run-b5198e24.cjs.js} +2 -2
  35. package/dist/cjs/{schema-88691315.cjs.js → schema-04967f8e.cjs.js} +3 -3
  36. package/dist/cjs/{test-0d3d63d8.cjs.js → test-dcc99d38.cjs.js} +3 -3
  37. package/dist/cjs/{test-53acdfb0.cjs.js → test-fc1fa743.cjs.js} +3 -3
  38. package/dist/cjs/{validate-4984be5e.cjs.js → validate-e8119f4f.cjs.js} +3 -3
  39. package/dist/index.cjs.js +1 -1
  40. package/package.json +7 -7
  41. package/templates/default-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +12 -18
  42. package/templates/default-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +231 -18
@@ -1,25 +1,19 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
3
  import { ExampleFetchComponent } from './ExampleFetchComponent';
4
- import { rest } from 'msw';
5
- import { setupServer } from 'msw/node';
6
- import { setupRequestMockHandlers } from '@backstage/test-utils';
7
4
 
8
5
  describe('ExampleFetchComponent', () => {
9
- const server = setupServer();
10
- // Enable sane handlers for network requests
11
- setupRequestMockHandlers(server);
6
+ it('renders the user table', async () => {
7
+ render(<ExampleFetchComponent />);
12
8
 
13
- // setup mock response
14
- beforeEach(() => {
15
- server.use(
16
- rest.get('https://randomuser.me/*', (_, res, ctx) =>
17
- res(ctx.status(200), ctx.delay(2000), ctx.json({})),
18
- ),
19
- );
9
+ // Wait for the table to render
10
+ const table = await screen.findByRole('table');
11
+ const nationality = screen.getAllByText("GB")
12
+ // Assert that the table contains the expected user data
13
+ expect(table).toBeInTheDocument();
14
+ expect(screen.getByAltText('Carolyn')).toBeInTheDocument();
15
+ expect(screen.getByText('Carolyn Moore')).toBeInTheDocument();
16
+ expect(screen.getByText('carolyn.moore@example.com')).toBeInTheDocument();
17
+ expect(nationality[0]).toBeInTheDocument();
20
18
  });
21
- it('should render', async () => {
22
- await render(<ExampleFetchComponent />);
23
- expect(await screen.findByTestId('progress')).toBeInTheDocument();
24
- });
25
- });
19
+ });
@@ -1,9 +1,233 @@
1
1
  import React from 'react';
2
2
  import { makeStyles } from '@material-ui/core/styles';
3
3
  import { Table, TableColumn, Progress, ResponseErrorPanel } from '@backstage/core-components';
4
- import { fetchApiRef, useApi } from '@backstage/core-plugin-api';
5
4
  import useAsync from 'react-use/lib/useAsync';
6
5
 
6
+ export const exampleUsers = {
7
+ "results": [
8
+ {
9
+ "gender": "female",
10
+ "name": {
11
+ "title": "Miss",
12
+ "first": "Carolyn",
13
+ "last": "Moore"
14
+ },
15
+ "email": "carolyn.moore@example.com",
16
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Carolyn",
17
+ "nat": "GB"
18
+ },
19
+ {
20
+ "gender": "female",
21
+ "name": {
22
+ "title": "Ms",
23
+ "first": "Esma",
24
+ "last": "Berberoğlu"
25
+ },
26
+ "email": "esma.berberoglu@example.com",
27
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Esma",
28
+ "nat": "TR"
29
+ },
30
+ {
31
+ "gender": "female",
32
+ "name": {
33
+ "title": "Ms",
34
+ "first": "Isabella",
35
+ "last": "Rhodes"
36
+ },
37
+ "email": "isabella.rhodes@example.com",
38
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella",
39
+ "nat": "GB"
40
+ },
41
+ {
42
+ "gender": "male",
43
+ "name": {
44
+ "title": "Mr",
45
+ "first": "Derrick",
46
+ "last": "Carter"
47
+ },
48
+ "email": "derrick.carter@example.com",
49
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Derrick",
50
+ "nat": "IE"
51
+ },
52
+ {
53
+ "gender": "female",
54
+ "name": {
55
+ "title": "Miss",
56
+ "first": "Mattie",
57
+ "last": "Lambert"
58
+ },
59
+ "email": "mattie.lambert@example.com",
60
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Mattie",
61
+ "nat": "AU"
62
+ },
63
+ {
64
+ "gender": "male",
65
+ "name": {
66
+ "title": "Mr",
67
+ "first": "Mijat",
68
+ "last": "Rakić"
69
+ },
70
+ "email": "mijat.rakic@example.com",
71
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Mijat",
72
+ "nat": "RS"
73
+ },
74
+ {
75
+ "gender": "male",
76
+ "name": {
77
+ "title": "Mr",
78
+ "first": "Javier",
79
+ "last": "Reid"
80
+ },
81
+ "email": "javier.reid@example.com",
82
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Javier",
83
+ "nat": "US"
84
+ },
85
+ {
86
+ "gender": "female",
87
+ "name": {
88
+ "title": "Ms",
89
+ "first": "Isabella",
90
+ "last": "Li"
91
+ },
92
+ "email": "isabella.li@example.com",
93
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella",
94
+ "nat": "CA"
95
+ },
96
+ {
97
+ "gender": "female",
98
+ "name": {
99
+ "title": "Mrs",
100
+ "first": "Stephanie",
101
+ "last": "Garrett"
102
+ },
103
+ "email": "stephanie.garrett@example.com",
104
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Stephanie",
105
+ "nat": "AU"
106
+ },
107
+ {
108
+ "gender": "female",
109
+ "name": {
110
+ "title": "Ms",
111
+ "first": "Antonia",
112
+ "last": "Núñez"
113
+ },
114
+ "email": "antonia.nunez@example.com",
115
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Antonia",
116
+ "nat": "ES"
117
+ },
118
+ {
119
+ "gender": "male",
120
+ "name": {
121
+ "title": "Mr",
122
+ "first": "Donald",
123
+ "last": "Young"
124
+ },
125
+ "email": "donald.young@example.com",
126
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Donald",
127
+ "nat": "US"
128
+ },
129
+ {
130
+ "gender": "male",
131
+ "name": {
132
+ "title": "Mr",
133
+ "first": "Iegor",
134
+ "last": "Holodovskiy"
135
+ },
136
+ "email": "iegor.holodovskiy@example.com",
137
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Iegor",
138
+ "nat": "UA"
139
+ },
140
+ {
141
+ "gender": "female",
142
+ "name": {
143
+ "title": "Madame",
144
+ "first": "Jessica",
145
+ "last": "David"
146
+ },
147
+ "email": "jessica.david@example.com",
148
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Jessica",
149
+ "nat": "CH"
150
+ },
151
+ {
152
+ "gender": "female",
153
+ "name": {
154
+ "title": "Ms",
155
+ "first": "Eve",
156
+ "last": "Martinez"
157
+ },
158
+ "email": "eve.martinez@example.com",
159
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Eve",
160
+ "nat": "FR"
161
+ },
162
+ {
163
+ "gender": "male",
164
+ "name": {
165
+ "title": "Mr",
166
+ "first": "Caleb",
167
+ "last": "Silva"
168
+ },
169
+ "email": "caleb.silva@example.com",
170
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Caleb",
171
+ "nat": "US"
172
+ },
173
+ {
174
+ "gender": "female",
175
+ "name": {
176
+ "title": "Miss",
177
+ "first": "Marcia",
178
+ "last": "Jenkins"
179
+ },
180
+ "email": "marcia.jenkins@example.com",
181
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Marcia",
182
+ "nat": "US"
183
+ },
184
+ {
185
+ "gender": "female",
186
+ "name": {
187
+ "title": "Mrs",
188
+ "first": "Mackenzie",
189
+ "last": "Jones"
190
+ },
191
+ "email": "mackenzie.jones@example.com",
192
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Mackenzie",
193
+ "nat": "NZ"
194
+ },
195
+ {
196
+ "gender": "male",
197
+ "name": {
198
+ "title": "Mr",
199
+ "first": "Jeremiah",
200
+ "last": "Gutierrez"
201
+ },
202
+ "email": "jeremiah.gutierrez@example.com",
203
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Jeremiah",
204
+ "nat": "AU"
205
+ },
206
+ {
207
+ "gender": "female",
208
+ "name": {
209
+ "title": "Ms",
210
+ "first": "Luciara",
211
+ "last": "Souza"
212
+ },
213
+ "email": "luciara.souza@example.com",
214
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Luciara",
215
+ "nat": "BR"
216
+ },
217
+ {
218
+ "gender": "male",
219
+ "name": {
220
+ "title": "Mr",
221
+ "first": "Valgi",
222
+ "last": "da Cunha"
223
+ },
224
+ "email": "valgi.dacunha@example.com",
225
+ "picture": "https://api.dicebear.com/6.x/open-peeps/svg?seed=Valgi",
226
+ "nat": "BR"
227
+ }
228
+ ]
229
+ }
230
+
7
231
  const useStyles = makeStyles({
8
232
  avatar: {
9
233
  height: 32,
@@ -19,18 +243,8 @@ type User = {
19
243
  first: string; // "Duane",
20
244
  last: string; // "Reed"
21
245
  };
22
- location: object; // {street: {number: 5060, name: "Hickory Creek Dr"}, city: "Albany", state: "New South Wales",…}
23
246
  email: string; // "duane.reed@example.com"
24
- login: object; // {uuid: "4b785022-9a23-4ab9-8a23-cb3fb43969a9", username: "blackdog796", password: "patch",…}
25
- dob: object; // {date: "1983-06-22T12:30:23.016Z", age: 37}
26
- registered: object; // {date: "2006-06-13T18:48:28.037Z", age: 14}
27
- phone: string; // "07-2154-5651"
28
- cell: string; // "0405-592-879"
29
- id: {
30
- name: string; // "TFN",
31
- value: string; // "796260432"
32
- };
33
- picture: { medium: string }; // {medium: "https://randomuser.me/api/portraits/men/95.jpg",…}
247
+ picture: string; // "https://api.dicebear.com/6.x/open-peeps/svg?seed=Duane"
34
248
  nat: string; // "AU"
35
249
  };
36
250
 
@@ -52,7 +266,7 @@ export const DenseTable = ({ users }: DenseTableProps) => {
52
266
  return {
53
267
  avatar: (
54
268
  <img
55
- src={user.picture.medium}
269
+ src={user.picture}
56
270
  className={classes.avatar}
57
271
  alt={user.name.first}
58
272
  />
@@ -65,7 +279,7 @@ export const DenseTable = ({ users }: DenseTableProps) => {
65
279
 
66
280
  return (
67
281
  <Table
68
- title="Example User List (fetching data from randomuser.me)"
282
+ title="Example User List"
69
283
  options=\{{ search: false, paging: false }}
70
284
  columns={columns}
71
285
  data={data}
@@ -74,11 +288,10 @@ export const DenseTable = ({ users }: DenseTableProps) => {
74
288
  };
75
289
 
76
290
  export const ExampleFetchComponent = () => {
77
- const { fetch } = useApi(fetchApiRef);
291
+
78
292
  const { value, loading, error } = useAsync(async (): Promise<User[]> => {
79
- const response = await fetch('https://randomuser.me/api/?results=20');
80
- const data = await response.json();
81
- return data.results;
293
+ // Would use fetch in a real world example
294
+ return exampleUsers.results;
82
295
  }, []);
83
296
 
84
297
  if (loading) {