.github/workflows/test-cli-options.yml 20.7 K raw
1
name: Test CLI Options
2
3
on:
4
  push:
5
    branches: [main]
6
  pull_request:
7
    branches: [main]
8
9
jobs:
10
  test-cli-options:
11
    runs-on: ubuntu-latest
12
13
    strategy:
14
      fail-fast: false
15
      matrix:
16
        include:
17
          # Default template combinations
18
          - template: "default"
19
            rpc: true
20
            tanstackQuery: false
21
            router: "none"
22
            linter: "eslint"
23
            test_name: "Default + RPC + No TanStack Query + No Router + ESLint"
24
          - template: "default"
25
            rpc: true
26
            tanstackQuery: false
27
            router: "none"
28
            linter: "biome"
29
            test_name: "Default + RPC + No TanStack Query + No Router + Biome"
30
          - template: "default"
31
            rpc: false
32
            tanstackQuery: false
33
            router: "none"
34
            linter: "eslint"
35
            test_name: "Default + No RPC + No TanStack Query + No Router + ESLint"
36
          - template: "default"
37
            rpc: false
38
            tanstackQuery: false
39
            router: "none"
40
            linter: "biome"
41
            test_name: "Default + No RPC + No TanStack Query + No Router + Biome"
42
          - template: "default"
43
            rpc: true
44
            tanstackQuery: true
45
            router: "none"
46
            linter: "eslint"
47
            test_name: "Default + RPC + TanStack Query + No Router + ESLint"
48
          - template: "default"
49
            rpc: true
50
            tanstackQuery: true
51
            router: "none"
52
            linter: "biome"
53
            test_name: "Default + RPC + TanStack Query + No Router + Biome"
54
          - template: "default"
55
            rpc: false
56
            tanstackQuery: true
57
            router: "none"
58
            linter: "eslint"
59
            test_name: "Default + No RPC + TanStack Query + No Router + ESLint"
60
          - template: "default"
61
            rpc: false
62
            tanstackQuery: true
63
            router: "none"
64
            linter: "biome"
65
            test_name: "Default + No RPC + TanStack Query + No Router + Biome"
66
67
          # Tailwind template combinations
68
          - template: "tailwind"
69
            rpc: true
70
            tanstackQuery: false
71
            router: "none"
72
            linter: "eslint"
73
            test_name: "Tailwind + RPC + No TanStack Query + No Router + ESLint"
74
          - template: "tailwind"
75
            rpc: true
76
            tanstackQuery: false
77
            router: "none"
78
            linter: "biome"
79
            test_name: "Tailwind + RPC + No TanStack Query + No Router + Biome"
80
          - template: "tailwind"
81
            rpc: false
82
            tanstackQuery: false
83
            router: "none"
84
            linter: "eslint"
85
            test_name: "Tailwind + No RPC + No TanStack Query + No Router + ESLint"
86
          - template: "tailwind"
87
            rpc: false
88
            tanstackQuery: false
89
            router: "none"
90
            linter: "biome"
91
            test_name: "Tailwind + No RPC + No TanStack Query + No Router + Biome"
92
          - template: "tailwind"
93
            rpc: true
94
            tanstackQuery: true
95
            router: "none"
96
            linter: "eslint"
97
            test_name: "Tailwind + RPC + TanStack Query + No Router + ESLint"
98
          - template: "tailwind"
99
            rpc: true
100
            tanstackQuery: true
101
            router: "none"
102
            linter: "biome"
103
            test_name: "Tailwind + RPC + TanStack Query + No Router + Biome"
104
          - template: "tailwind"
105
            rpc: false
106
            tanstackQuery: true
107
            router: "none"
108
            linter: "eslint"
109
            test_name: "Tailwind + No RPC + TanStack Query + No Router + ESLint"
110
          - template: "tailwind"
111
            rpc: false
112
            tanstackQuery: true
113
            router: "none"
114
            linter: "biome"
115
            test_name: "Tailwind + No RPC + TanStack Query + No Router + Biome"
116
117
          # Shadcn template combinations
118
          - template: "shadcn"
119
            rpc: true
120
            tanstackQuery: false
121
            router: "none"
122
            linter: "eslint"
123
            test_name: "Shadcn + RPC + No TanStack Query + No Router + ESLint"
124
          - template: "shadcn"
125
            rpc: true
126
            tanstackQuery: false
127
            router: "none"
128
            linter: "biome"
129
            test_name: "Shadcn + RPC + No TanStack Query + No Router + Biome"
130
          - template: "shadcn"
131
            rpc: false
132
            tanstackQuery: false
133
            router: "none"
134
            linter: "eslint"
135
            test_name: "Shadcn + No RPC + No TanStack Query + No Router + ESLint"
136
          - template: "shadcn"
137
            rpc: false
138
            tanstackQuery: false
139
            router: "none"
140
            linter: "biome"
141
            test_name: "Shadcn + No RPC + No TanStack Query + No Router + Biome"
142
          - template: "shadcn"
143
            rpc: true
144
            tanstackQuery: true
145
            router: "none"
146
            linter: "eslint"
147
            test_name: "Shadcn + RPC + TanStack Query + No Router + ESLint"
148
          - template: "shadcn"
149
            rpc: true
150
            tanstackQuery: true
151
            router: "none"
152
            linter: "biome"
153
            test_name: "Shadcn + RPC + TanStack Query + No Router + Biome"
154
          - template: "shadcn"
155
            rpc: false
156
            tanstackQuery: true
157
            router: "none"
158
            linter: "eslint"
159
            test_name: "Shadcn + No RPC + TanStack Query + No Router + ESLint"
160
          - template: "shadcn"
161
            rpc: false
162
            tanstackQuery: true
163
            router: "none"
164
            linter: "biome"
165
            test_name: "Shadcn + No RPC + TanStack Query + No Router + Biome"
166
167
          # React Router
168
          # Default template combinations
169
          - template: "default"
170
            rpc: true
171
            tanstackQuery: false
172
            router: "reactrouter"
173
            linter: "eslint"
174
            test_name: "Default + RPC + No TanStack Query + React Router + ESLint"
175
          - template: "default"
176
            rpc: true
177
            tanstackQuery: false
178
            router: "reactrouter"
179
            linter: "biome"
180
            test_name: "Default + RPC + No TanStack Query + React Router + Biome"
181
          - template: "default"
182
            rpc: false
183
            tanstackQuery: false
184
            router: "reactrouter"
185
            linter: "eslint"
186
            test_name: "Default + No RPC + No TanStack Query + React Router + ESLint"
187
          - template: "default"
188
            rpc: false
189
            tanstackQuery: false
190
            router: "reactrouter"
191
            linter: "biome"
192
            test_name: "Default + No RPC + No TanStack Query + React Router + Biome"
193
          - template: "default"
194
            rpc: true
195
            tanstackQuery: true
196
            router: "reactrouter"
197
            linter: "eslint"
198
            test_name: "Default + RPC + TanStack Query + React Router + ESLint"
199
          - template: "default"
200
            rpc: true
201
            tanstackQuery: true
202
            router: "reactrouter"
203
            linter: "biome"
204
            test_name: "Default + RPC + TanStack Query + React Router + Biome"
205
          - template: "default"
206
            rpc: false
207
            tanstackQuery: true
208
            router: "reactrouter"
209
            linter: "eslint"
210
            test_name: "Default + No RPC + TanStack Query + React Router + ESLint"
211
          - template: "default"
212
            rpc: false
213
            tanstackQuery: true
214
            router: "reactrouter"
215
            linter: "biome"
216
            test_name: "Default + No RPC + TanStack Query + React Router + Biome"
217
218
          # Tailwind template combinations
219
          - template: "tailwind"
220
            rpc: true
221
            tanstackQuery: false
222
            router: "reactrouter"
223
            linter: "eslint"
224
            test_name: "Tailwind + RPC + No TanStack Query + React Router + ESLint"
225
          - template: "tailwind"
226
            rpc: true
227
            tanstackQuery: false
228
            router: "reactrouter"
229
            linter: "biome"
230
            test_name: "Tailwind + RPC + No TanStack Query + React Router + Biome"
231
          - template: "tailwind"
232
            rpc: false
233
            tanstackQuery: false
234
            router: "reactrouter"
235
            linter: "eslint"
236
            test_name: "Tailwind + No RPC + No TanStack Query + React Router + ESLint"
237
          - template: "tailwind"
238
            rpc: false
239
            tanstackQuery: false
240
            router: "reactrouter"
241
            linter: "biome"
242
            test_name: "Tailwind + No RPC + No TanStack Query + React Router + Biome"
243
          - template: "tailwind"
244
            rpc: true
245
            tanstackQuery: true
246
            router: "reactrouter"
247
            linter: "eslint"
248
            test_name: "Tailwind + RPC + TanStack Query + React Router + ESLint"
249
          - template: "tailwind"
250
            rpc: true
251
            tanstackQuery: true
252
            router: "reactrouter"
253
            linter: "biome"
254
            test_name: "Tailwind + RPC + TanStack Query + React Router + Biome"
255
          - template: "tailwind"
256
            rpc: false
257
            tanstackQuery: true
258
            router: "reactrouter"
259
            linter: "eslint"
260
            test_name: "Tailwind + No RPC + TanStack Query + React Router + ESLint"
261
          - template: "tailwind"
262
            rpc: false
263
            tanstackQuery: true
264
            router: "reactrouter"
265
            linter: "biome"
266
            test_name: "Tailwind + No RPC + TanStack Query + React Router + Biome"
267
268
          # Shadcn template combinations
269
          - template: "shadcn"
270
            rpc: true
271
            tanstackQuery: false
272
            router: "reactrouter"
273
            linter: "eslint"
274
            test_name: "Shadcn + RPC + No TanStack Query + React Router + ESLint"
275
          - template: "shadcn"
276
            rpc: true
277
            tanstackQuery: false
278
            router: "reactrouter"
279
            linter: "biome"
280
            test_name: "Shadcn + RPC + No TanStack Query + React Router + Biome"
281
          - template: "shadcn"
282
            rpc: false
283
            tanstackQuery: false
284
            router: "reactrouter"
285
            linter: "eslint"
286
            test_name: "Shadcn + No RPC + No TanStack Query + React Router + ESLint"
287
          - template: "shadcn"
288
            rpc: false
289
            tanstackQuery: false
290
            router: "reactrouter"
291
            linter: "biome"
292
            test_name: "Shadcn + No RPC + No TanStack Query + React Router + Biome"
293
          - template: "shadcn"
294
            rpc: true
295
            tanstackQuery: true
296
            router: "reactrouter"
297
            linter: "eslint"
298
            test_name: "Shadcn + RPC + TanStack Query + React Router + ESLint"
299
          - template: "shadcn"
300
            rpc: true
301
            tanstackQuery: true
302
            router: "reactrouter"
303
            linter: "biome"
304
            test_name: "Shadcn + RPC + TanStack Query + React Router + Biome"
305
          - template: "shadcn"
306
            rpc: false
307
            tanstackQuery: true
308
            router: "reactrouter"
309
            linter: "eslint"
310
            test_name: "Shadcn + No RPC + TanStack Query + React Router + ESLint"
311
          - template: "shadcn"
312
            rpc: false
313
            tanstackQuery: true
314
            router: "reactrouter"
315
            linter: "biome"
316
            test_name: "Shadcn + No RPC + TanStack Query + React Router + Biome"
317
318
          # TanStack Router
319
          # Default template combinations
320
          - template: "default"
321
            rpc: true
322
            tanstackQuery: false
323
            router: "tanstackrouter"
324
            linter: "eslint"
325
            test_name: "Default + RPC + No TanStack Query + TanStack Router + ESLint"
326
          - template: "default"
327
            rpc: true
328
            tanstackQuery: false
329
            router: "tanstackrouter"
330
            linter: "biome"
331
            test_name: "Default + RPC + No TanStack Query + TanStack Router + Biome"
332
          - template: "default"
333
            rpc: false
334
            tanstackQuery: false
335
            router: "tanstackrouter"
336
            linter: "eslint"
337
            test_name: "Default + No RPC + No TanStack Query + TanStack Router + ESLint"
338
          - template: "default"
339
            rpc: false
340
            tanstackQuery: false
341
            router: "tanstackrouter"
342
            linter: "biome"
343
            test_name: "Default + No RPC + No TanStack Query + TanStack Router + Biome"
344
          - template: "default"
345
            rpc: true
346
            tanstackQuery: true
347
            router: "tanstackrouter"
348
            linter: "eslint"
349
            test_name: "Default + RPC + TanStack Query + TanStack Router + ESLint"
350
          - template: "default"
351
            rpc: true
352
            tanstackQuery: true
353
            router: "tanstackrouter"
354
            linter: "biome"
355
            test_name: "Default + RPC + TanStack Query + TanStack Router + Biome"
356
          - template: "default"
357
            rpc: false
358
            tanstackQuery: true
359
            router: "tanstackrouter"
360
            linter: "eslint"
361
            test_name: "Default + No RPC + TanStack Query + TanStack Router + ESLint"
362
          - template: "default"
363
            rpc: false
364
            tanstackQuery: true
365
            router: "tanstackrouter"
366
            linter: "biome"
367
            test_name: "Default + No RPC + TanStack Query + TanStack Router + Biome"
368
369
          # Tailwind template combinations
370
          - template: "tailwind"
371
            rpc: true
372
            tanstackQuery: false
373
            router: "tanstackrouter"
374
            linter: "eslint"
375
            test_name: "Tailwind + RPC + No TanStack Query + TanStack Router + ESLint"
376
          - template: "tailwind"
377
            rpc: true
378
            tanstackQuery: false
379
            router: "tanstackrouter"
380
            linter: "biome"
381
            test_name: "Tailwind + RPC + No TanStack Query + TanStack Router + Biome"
382
          - template: "tailwind"
383
            rpc: false
384
            tanstackQuery: false
385
            router: "tanstackrouter"
386
            linter: "eslint"
387
            test_name: "Tailwind + No RPC + No TanStack Query + TanStack Router + ESLint"
388
          - template: "tailwind"
389
            rpc: false
390
            tanstackQuery: false
391
            router: "tanstackrouter"
392
            linter: "biome"
393
            test_name: "Tailwind + No RPC + No TanStack Query + TanStack Router + Biome"
394
          - template: "tailwind"
395
            rpc: true
396
            tanstackQuery: true
397
            router: "tanstackrouter"
398
            linter: "eslint"
399
            test_name: "Tailwind + RPC + TanStack Query + TanStack Router + ESLint"
400
          - template: "tailwind"
401
            rpc: true
402
            tanstackQuery: true
403
            router: "tanstackrouter"
404
            linter: "biome"
405
            test_name: "Tailwind + RPC + TanStack Query + TanStack Router + Biome"
406
          - template: "tailwind"
407
            rpc: false
408
            tanstackQuery: true
409
            router: "tanstackrouter"
410
            linter: "eslint"
411
            test_name: "Tailwind + No RPC + TanStack Query + TanStack Router + ESLint"
412
          - template: "tailwind"
413
            rpc: false
414
            tanstackQuery: true
415
            router: "tanstackrouter"
416
            linter: "biome"
417
            test_name: "Tailwind + No RPC + TanStack Query + TanStack Router + Biome"
418
419
          # Shadcn template combinations
420
          - template: "shadcn"
421
            rpc: true
422
            tanstackQuery: false
423
            router: "tanstackrouter"
424
            linter: "eslint"
425
            test_name: "Shadcn + RPC + No TanStack Query + TanStack Router + ESLint"
426
          - template: "shadcn"
427
            rpc: true
428
            tanstackQuery: false
429
            router: "tanstackrouter"
430
            linter: "biome"
431
            test_name: "Shadcn + RPC + No TanStack Query + TanStack Router + Biome"
432
          - template: "shadcn"
433
            rpc: false
434
            tanstackQuery: false
435
            router: "tanstackrouter"
436
            linter: "eslint"
437
            test_name: "Shadcn + No RPC + No TanStack Query + TanStack Router + ESLint"
438
          - template: "shadcn"
439
            rpc: false
440
            tanstackQuery: false
441
            router: "tanstackrouter"
442
            linter: "biome"
443
            test_name: "Shadcn + No RPC + No TanStack Query + TanStack Router + Biome"
444
          - template: "shadcn"
445
            rpc: true
446
            tanstackQuery: true
447
            router: "tanstackrouter"
448
            linter: "eslint"
449
            test_name: "Shadcn + RPC + TanStack Query + TanStack Router + ESLint"
450
          - template: "shadcn"
451
            rpc: true
452
            tanstackQuery: true
453
            router: "tanstackrouter"
454
            linter: "biome"
455
            test_name: "Shadcn + RPC + TanStack Query + TanStack Router + Biome"
456
          - template: "shadcn"
457
            rpc: false
458
            tanstackQuery: true
459
            router: "tanstackrouter"
460
            linter: "eslint"
461
            test_name: "Shadcn + No RPC + TanStack Query + TanStack Router + ESLint"
462
          - template: "shadcn"
463
            rpc: false
464
            tanstackQuery: true
465
            router: "tanstackrouter"
466
            linter: "biome"
467
            test_name: "Shadcn + No RPC + TanStack Query + TanStack Router + Biome"
468
469
    steps:
470
      - name: Checkout repository
471
        uses: actions/checkout@v4
472
473
      - name: Setup Bun
474
        uses: oven-sh/setup-bun@v2
475
        with:
476
          bun-version: latest
477
478
      - name: Install dependencies
479
        run: bun install
480
481
      - name: Build CLI
482
        run: bun run build
483
484
      - name: Create test project - ${{ matrix.test_name }}
485
        run: |
486
          # Create project with specified options
487
          echo "Creating project with options:"
488
          echo "Template: ${{ matrix.template }}"
489
          echo "RPC: ${{ matrix.rpc }}"
490
          echo "TanStack Query: ${{ matrix.tanstackQuery }}"
491
          echo "Router: ${{ matrix.router }}"
492
          echo "Linter: ${{ matrix.linter }}"
493
494
          # Build the command with conditional flags
495
          cmd="./dist/index.js test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.tanstackQuery }}-${{ matrix.router }}-${{ matrix.linter }} --yes --template ${{ matrix.template }}"
496
          
497
          if [ "${{ matrix.rpc }}" = "true" ]; then
498
            cmd="$cmd --rpc"
499
          fi
500
          
501
          if [ "${{ matrix.tanstackQuery }}" = "true" ]; then
502
            cmd="$cmd --tsquery"
503
          fi
504
          
505
          if [ "${{ matrix.router }}" != "none" ]; then
506
            cmd="$cmd --router ${{ matrix.router }}"
507
          fi
508
          
509
          cmd="$cmd --linter ${{ matrix.linter }}"
510
          
511
          echo "Running: $cmd"
512
          eval $cmd
513
514
      - name: Install project dependencies
515
        run: |
516
          cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.tanstackQuery }}-${{ matrix.router }}-${{ matrix.linter }}
517
          bun install
518
519
      - name: Build test project
520
        run: |
521
          cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.tanstackQuery }}-${{ matrix.router }}-${{ matrix.linter }}
522
          bun run build
523
524
      - name: Verify build outputs
525
        run: |
526
          cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.tanstackQuery }}-${{ matrix.router }}-${{ matrix.linter }}
527
528
          # Check that dist directories exist
529
          if [ ! -d "client/dist" ]; then
530
            echo "❌ Client build failed - dist directory not found"
531
            exit 1
532
          fi
533
534
          if [ ! -d "server/dist" ]; then
535
            echo "❌ Server build failed - dist directory not found"
536
            exit 1
537
          fi
538
539
          # Check for expected files
540
          if [ ! -f "client/dist/index.html" ]; then
541
            echo "❌ Client build incomplete - index.html not found"
542
            exit 1
543
          fi
544
545
          if [ ! -f "server/dist/index.js" ]; then
546
            echo "❌ Server build incomplete - index.js not found"
547
            exit 1
548
          fi
549
550
          echo "✅ Build verification passed for ${{ matrix.test_name }}"
551
552
      - name: Run linter on generated project
553
        run: |
554
          cd test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.tanstackQuery }}-${{ matrix.router }}-${{ matrix.linter }}
555
556
          if [ "${{ matrix.linter }}" = "eslint" ]; then
557
            # Check if ESLint config exists and run it
558
            if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then
559
              echo "Running ESLint..."
560
              bun run lint || echo "ESLint warnings/errors found but continuing..."
561
            fi
562
          elif [ "${{ matrix.linter }}" = "biome" ]; then
563
            # Check if Biome config exists and run it
564
            if [ -f "biome.json" ]; then
565
              echo "Running Biome..."
566
              bun run lint || echo "Biome warnings/errors found but continuing..."
567
            fi
568
          fi
569
570
      - name: Cleanup test project
571
        if: always()
572
        run: |
573
          rm -rf test-project-${{ matrix.template }}-${{ matrix.rpc }}-${{ matrix.tanstackQuery }}-${{ matrix.router }}-${{ matrix.linter }}