Commit f1a3fb9
Enhance bin/dev error messages with verbose flag suggestion (#2083)
## Summary
When `bin/dev` fails with a non-zero exit code, users now see a helpful
suggestion to run with the `--verbose` flag for detailed output. This
improves the debugging experience by making it clear how to get more
information about failures.
Additionally, the `--verbose` flag now properly propagates to child
processes like pack generation through the `REACT_ON_RAILS_VERBOSE`
environment variable.
## Changes
- **PackGenerator**: Suggests `--verbose` flag on failure (unless
already in verbose mode)
- **Verbose propagation**: Verbose mode propagates via
`REACT_ON_RAILS_VERBOSE` env var to child processes
- **PacksGenerator**: Respects verbose flag to control output verbosity
- **Rake task**: `generate_packs` respects `REACT_ON_RAILS_VERBOSE` env
var
- **Tests**: Added comprehensive tests for verbose flag behavior
## Before
```
📦 Generating packs... ❌
❌ Pack generation failed
```
## After
```
📦 Generating packs... ❌
❌ Pack generation failed
💡 Run with --verbose flag for detailed output:
bin/dev --verbose
```
## With --verbose flag
```
📦 Generating React on Rails packs...
🚀 Starting React on Rails pack generation...
📁 Auto-load bundle: true
📂 Components subdirectory: ror_components
🧹 Cleaning non-generated files...
No unexpected files found in /path/to/generated
✨ Pack generation completed in 81.8ms
```
## Testing
All existing tests pass, plus new tests for:
- Verbose flag suggestion on failure
- No suggestion when already in verbose mode
- Environment variable propagation to child processes
## Motivation
This addresses the issue where `bin/dev` failures showed terse error
messages without guidance on how to get detailed diagnostic output,
making debugging difficult for users.
---------
Co-authored-by: Claude <[email protected]>1 parent b2a9aeb commit f1a3fb9
File tree
6 files changed
+192
-62
lines changed- lib
- react_on_rails
- dev
- tasks
- sig/react_on_rails/dev
- spec
- dummy/spec
- react_on_rails/dev
6 files changed
+192
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
62 | | - | |
| 70 | + | |
63 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
| |||
140 | 151 | | |
141 | 152 | | |
142 | 153 | | |
143 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
144 | 159 | | |
145 | 160 | | |
146 | 161 | | |
147 | 162 | | |
148 | 163 | | |
| 164 | + | |
149 | 165 | | |
150 | 166 | | |
151 | 167 | | |
152 | 168 | | |
153 | | - | |
| 169 | + | |
154 | 170 | | |
155 | 171 | | |
156 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
43 | | - | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
129 | | - | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
133 | | - | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| |||
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
203 | | - | |
| 205 | + | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
207 | | - | |
| 209 | + | |
208 | 210 | | |
209 | 211 | | |
210 | | - | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | | - | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| |||
225 | 227 | | |
226 | 228 | | |
227 | 229 | | |
228 | | - | |
| 230 | + | |
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
235 | | - | |
| 237 | + | |
236 | 238 | | |
237 | 239 | | |
238 | | - | |
| 240 | + | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| |||
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
261 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
262 | 270 | | |
263 | 271 | | |
264 | 272 | | |
265 | 273 | | |
266 | 274 | | |
267 | 275 | | |
268 | 276 | | |
269 | | - | |
| 277 | + | |
270 | 278 | | |
271 | 279 | | |
272 | 280 | | |
273 | 281 | | |
274 | 282 | | |
275 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
276 | 286 | | |
277 | | - | |
| 287 | + | |
278 | 288 | | |
279 | 289 | | |
280 | 290 | | |
| |||
283 | 293 | | |
284 | 294 | | |
285 | 295 | | |
286 | | - | |
287 | | - | |
| 296 | + | |
| 297 | + | |
288 | 298 | | |
289 | 299 | | |
290 | 300 | | |
291 | 301 | | |
292 | | - | |
293 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
294 | 306 | | |
295 | 307 | | |
296 | 308 | | |
297 | 309 | | |
298 | | - | |
| 310 | + | |
299 | 311 | | |
300 | 312 | | |
301 | 313 | | |
302 | 314 | | |
303 | 315 | | |
304 | 316 | | |
305 | | - | |
306 | | - | |
| 317 | + | |
| 318 | + | |
307 | 319 | | |
308 | 320 | | |
309 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
30 | | - | |
31 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
| 417 | + | |
416 | 418 | | |
417 | 419 | | |
418 | 420 | | |
| 421 | + | |
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
422 | 425 | | |
423 | 426 | | |
424 | 427 | | |
425 | 428 | | |
| 429 | + | |
| 430 | + | |
426 | 431 | | |
427 | 432 | | |
428 | 433 | | |
| 434 | + | |
429 | 435 | | |
430 | 436 | | |
431 | 437 | | |
| |||
0 commit comments