Skip to content

Commit fa81ef0

Browse files
authored
feat(dart_frog_prod_server): upgrade to dart_frog_gen ^0.2.0 (#376)
1 parent aef2509 commit fa81ef0

File tree

2 files changed

+142
-25
lines changed

2 files changed

+142
-25
lines changed

bricks/dart_frog_prod_server/hooks/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
sdk: ">=2.18.0 <3.0.0"
66

77
dependencies:
8-
dart_frog_gen: ^0.1.0
8+
dart_frog_gen: ^0.2.0
99
io: ^1.0.3
1010
mason: ^0.1.0-dev.31
1111
path: ^1.8.1

bricks/dart_frog_prod_server/hooks/test/pre_gen_test.dart

Lines changed: 141 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,53 @@ void main() {
118118
route: '/',
119119
middleware: null,
120120
files: [
121-
RouteFile(name: 'index', path: 'index.dart', route: '/'),
122-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
121+
RouteFile(
122+
name: 'index',
123+
path: 'index.dart',
124+
route: '/',
125+
params: [],
126+
),
127+
RouteFile(
128+
name: 'hello',
129+
path: 'hello.dart',
130+
route: '/hello',
131+
params: [],
132+
),
123133
],
134+
params: [],
124135
)
125136
],
126137
routes: [
127-
RouteFile(name: 'index', path: 'index.dart', route: '/'),
128-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
138+
RouteFile(
139+
name: 'index',
140+
path: 'index.dart',
141+
route: '/',
142+
params: [],
143+
),
144+
RouteFile(
145+
name: 'hello',
146+
path: 'hello.dart',
147+
route: '/hello',
148+
params: [],
149+
),
129150
],
130151
rogueRoutes: [],
131152
endpoints: {
132153
'/': [
133-
RouteFile(name: 'index', path: 'index.dart', route: '/'),
154+
RouteFile(
155+
name: 'index',
156+
path: 'index.dart',
157+
route: '/',
158+
params: [],
159+
),
134160
],
135161
'/hello': [
136-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
162+
RouteFile(
163+
name: 'hello',
164+
path: 'hello.dart',
165+
route: '/hello',
166+
params: [],
167+
),
137168
]
138169
},
139170
serveStaticFiles: true,
@@ -155,14 +186,35 @@ void main() {
155186
'route': '/',
156187
'middleware': false,
157188
'files': [
158-
{'name': 'index', 'path': 'index.dart', 'route': '/'},
159-
{'name': 'hello', 'path': 'hello.dart', 'route': '/hello'}
160-
]
189+
{
190+
'name': 'index',
191+
'path': 'index.dart',
192+
'route': '/',
193+
'file_params': const <String>[]
194+
},
195+
{
196+
'name': 'hello',
197+
'path': 'hello.dart',
198+
'route': '/hello',
199+
'file_params': const <String>[]
200+
}
201+
],
202+
'directory_params': const <String>[],
161203
}
162204
],
163205
'routes': [
164-
{'name': 'index', 'path': 'index.dart', 'route': '/'},
165-
{'name': 'hello', 'path': 'hello.dart', 'route': '/hello'}
206+
{
207+
'name': 'index',
208+
'path': 'index.dart',
209+
'route': '/',
210+
'file_params': const <String>[]
211+
},
212+
{
213+
'name': 'hello',
214+
'path': 'hello.dart',
215+
'route': '/hello',
216+
'file_params': const <String>[]
217+
}
166218
],
167219
'middleware': [
168220
{'name': 'hello_middleware', 'path': 'hello/middleware.dart'}
@@ -273,10 +325,20 @@ dev_dependencies:
273325
final exitCalls = <int>[];
274326
when(() => configuration.endpoints).thenReturn({
275327
'/': const [
276-
RouteFile(name: 'index', path: 'index.dart', route: '/'),
328+
RouteFile(
329+
name: 'index',
330+
path: 'index.dart',
331+
route: '/',
332+
params: [],
333+
),
277334
],
278335
'/hello': const [
279-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello')
336+
RouteFile(
337+
name: 'hello',
338+
path: 'hello.dart',
339+
route: '/hello',
340+
params: [],
341+
)
280342
]
281343
});
282344
reportRouteConflicts(context, configuration, exitCalls.add);
@@ -290,11 +352,26 @@ dev_dependencies:
290352
final exitCalls = <int>[];
291353
when(() => configuration.endpoints).thenReturn({
292354
'/': const [
293-
RouteFile(name: 'index', path: 'index.dart', route: '/'),
355+
RouteFile(
356+
name: 'index',
357+
path: 'index.dart',
358+
route: '/',
359+
params: [],
360+
),
294361
],
295362
'/hello': const [
296-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
297-
RouteFile(name: 'hello_index', path: 'hello/index.dart', route: '/')
363+
RouteFile(
364+
name: 'hello',
365+
path: 'hello.dart',
366+
route: '/hello',
367+
params: [],
368+
),
369+
RouteFile(
370+
name: 'hello_index',
371+
path: 'hello/index.dart',
372+
route: '/',
373+
params: [],
374+
)
298375
]
299376
});
300377
reportRouteConflicts(context, configuration, exitCalls.add);
@@ -312,15 +389,40 @@ dev_dependencies:
312389
final exitCalls = <int>[];
313390
when(() => configuration.endpoints).thenReturn({
314391
'/': const [
315-
RouteFile(name: 'index', path: 'index.dart', route: '/'),
392+
RouteFile(
393+
name: 'index',
394+
path: 'index.dart',
395+
route: '/',
396+
params: [],
397+
),
316398
],
317399
'/hello': const [
318-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
319-
RouteFile(name: 'hello_index', path: 'hello/index.dart', route: '/')
400+
RouteFile(
401+
name: 'hello',
402+
path: 'hello.dart',
403+
route: '/hello',
404+
params: [],
405+
),
406+
RouteFile(
407+
name: 'hello_index',
408+
path: 'hello/index.dart',
409+
route: '/',
410+
params: [],
411+
)
320412
],
321413
'/echo': const [
322-
RouteFile(name: 'echo', path: 'echo.dart', route: '/echo'),
323-
RouteFile(name: 'echo_index', path: 'echo/index.dart', route: '/')
414+
RouteFile(
415+
name: 'echo',
416+
path: 'echo.dart',
417+
route: '/echo',
418+
params: [],
419+
),
420+
RouteFile(
421+
name: 'echo_index',
422+
path: 'echo/index.dart',
423+
route: '/',
424+
params: [],
425+
)
324426
]
325427
});
326428
reportRouteConflicts(context, configuration, exitCalls.add);
@@ -363,7 +465,12 @@ dev_dependencies:
363465
final exitCalls = <int>[];
364466
when(() => configuration.rogueRoutes).thenReturn(
365467
const [
366-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
468+
RouteFile(
469+
name: 'hello',
470+
path: 'hello.dart',
471+
route: '/hello',
472+
params: [],
473+
),
367474
],
368475
);
369476
reportRogueRoutes(context, configuration, exitCalls.add);
@@ -379,8 +486,18 @@ dev_dependencies:
379486
final exitCalls = <int>[];
380487
when(() => configuration.rogueRoutes).thenReturn(
381488
const [
382-
RouteFile(name: 'hello', path: 'hello.dart', route: '/hello'),
383-
RouteFile(name: 'hi', path: 'hi.dart', route: '/hi'),
489+
RouteFile(
490+
name: 'hello',
491+
path: 'hello.dart',
492+
route: '/hello',
493+
params: [],
494+
),
495+
RouteFile(
496+
name: 'hi',
497+
path: 'hi.dart',
498+
route: '/hi',
499+
params: [],
500+
),
384501
],
385502
);
386503
reportRogueRoutes(context, configuration, exitCalls.add);

0 commit comments

Comments
 (0)