Skip to content

Commit d9c85d6

Browse files
feat(flow): add include-tanstack-query question to frontend flow
1 parent 5cc1c14 commit d9c85d6

17 files changed

Lines changed: 95 additions & 4 deletions

docs/contributor/authoring-flows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ The flow immediately appears in `dot flows` and `dot scaffold`.
389389
| `fullstack` | `flows/fullstack.go` | `project_name`, `api_language`, `frontend_framework` |
390390
| `microservices` | `flows/microservices.go` | `project_name`, `services` (loop: `service_name`, `service_port`) |
391391
| `plugin-template` | `flows/plugin_template.go` | `project_name`, `module_path`, `plugin_description`, `plugin_author`, `plugin_year`, `plugin_include_injection`, `plugin_include_generator` |
392-
| `frontend` | `flows/frontend.go` | `project_name`, `framework`, `frontend-router`, `ui-library`, `frontend-styling`, `frontend-state`, `frontend-formatter`, `frontend-linter`, `include-vitest`, `include-playwright`, `include-storybook`, `include-auth`, `include-theme`, `include-feature-flags`, `include-sentry`, `include-analytics`, `include-seo` |
392+
| `frontend` | `flows/frontend.go` | `project_name`, `framework`, `frontend-router`, `ui-library`, `frontend-styling`, `frontend-state`, `include-tanstack-query`, `frontend-formatter`, `frontend-linter`, `include-vitest`, `include-playwright`, `include-storybook`, `include-auth`, `include-theme`, `include-feature-flags`, `include-sentry`, `include-analytics`, `include-seo` |
393393

394394
---
395395

flows/frontend.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,21 @@ func FrontendFlow() *FlowDef {
182182
},
183183
}
184184

185+
includeTanstackQuery := &flow.ConfirmQuestion{
186+
QuestionBase: flow.QuestionBase{ID_: "include-tanstack-query"},
187+
Label: "Include TanStack Query (server-state management)?",
188+
Default: false,
189+
Then: &flow.Next{Question: formatter},
190+
Else: &flow.Next{Question: formatter},
191+
}
192+
185193
state := &flow.OptionQuestion{
186194
QuestionBase: flow.QuestionBase{ID_: "frontend-state"},
187195
Label: "State management",
188196
Options: []*flow.Option{
189-
{Label: "Zustand", Value: FRONTEND_STATE_ZUSTAND, Next: &flow.Next{Question: formatter}},
190-
{Label: "Jotai", Value: FRONTEND_STATE_JOTAI, Next: &flow.Next{Question: formatter}},
191-
{Label: "None", Value: FRONTEND_STATE_NONE, Next: &flow.Next{Question: formatter}},
197+
{Label: "Zustand", Value: FRONTEND_STATE_ZUSTAND, Next: &flow.Next{Question: includeTanstackQuery}},
198+
{Label: "Jotai", Value: FRONTEND_STATE_JOTAI, Next: &flow.Next{Question: includeTanstackQuery}},
199+
{Label: "None", Value: FRONTEND_STATE_NONE, Next: &flow.Next{Question: includeTanstackQuery}},
192200
},
193201
}
194202

@@ -265,6 +273,7 @@ func resolveFrontendGenerators(s *spec.ProjectSpec) []Invocation {
265273
uiLib, _ := s.Answers["ui-library"].(string)
266274
stylingChoice, _ := s.Answers["frontend-styling"].(string)
267275
stateChoice, _ := s.Answers["frontend-state"].(string)
276+
includeTanstackQuery, _ := s.Answers["include-tanstack-query"].(bool)
268277
formatterChoice, _ := s.Answers["frontend-formatter"].(string)
269278
includeVitest, _ := s.Answers["include-vitest"].(bool)
270279
includePlaywright, _ := s.Answers["include-playwright"].(bool)
@@ -332,6 +341,11 @@ func resolveFrontendGenerators(s *spec.ProjectSpec) []Invocation {
332341
out = append(out, Invocation{Name: "jotai_setup"})
333342
}
334343

344+
// Server-state management
345+
if includeTanstackQuery {
346+
out = append(out, Invocation{Name: "tanstack_query"})
347+
}
348+
335349
// Testing
336350
if includeVitest && fw == FRONTEND_REACT_VITE {
337351
out = append(out, Invocation{Name: "vitest_testing_library"})
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "frontend_react_vite_tanstack_query",
3+
"flow_id": "frontend",
4+
"answers": {
5+
"project_name": "my-app",
6+
"framework": "react-vite",
7+
"frontend-router": "none",
8+
"ui-library": "none",
9+
"frontend-styling": "tailwind",
10+
"frontend-state": "none",
11+
"include-tanstack-query": true,
12+
"frontend-formatter": "biome",
13+
"frontend-linter": "biome",
14+
"include-vitest": false,
15+
"include-playwright": false,
16+
"include-storybook": false,
17+
"include-auth": false,
18+
"include-theme": false,
19+
"include-feature-flags": false,
20+
"include-sentry": false,
21+
"include-analytics": false,
22+
"include-seo": false,
23+
"confirm-generate": true
24+
},
25+
"expected_visited": [
26+
"project_name",
27+
"framework",
28+
"frontend-router",
29+
"ui-library",
30+
"frontend-styling",
31+
"frontend-state",
32+
"include-tanstack-query",
33+
"frontend-formatter",
34+
"frontend-linter",
35+
"check-vitest-available",
36+
"include-vitest",
37+
"include-playwright",
38+
"include-storybook",
39+
"include-auth",
40+
"include-theme",
41+
"include-feature-flags",
42+
"include-sentry",
43+
"include-analytics",
44+
"include-seo",
45+
"confirm-generate"
46+
],
47+
"skip_post_commands": false,
48+
"skip_test_commands": false
49+
}

tools/test-flow/testdata/202605270001_frontend_react_vite_minimal.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ui-library": "none",
99
"frontend-styling": "tailwind",
1010
"frontend-state": "none",
11+
"include-tanstack-query": false,
1112
"frontend-formatter": "biome",
1213
"frontend-linter": "biome",
1314
"include-vitest": false,
@@ -28,6 +29,7 @@
2829
"ui-library",
2930
"frontend-styling",
3031
"frontend-state",
32+
"include-tanstack-query",
3133
"frontend-formatter",
3234
"frontend-linter",
3335
"check-vitest-available",

tools/test-flow/testdata/202605270002_frontend_react_vite_tanstack_shadcn_modules.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"frontend-router": "tanstack-router",
88
"ui-library": "shadcn",
99
"frontend-state": "zustand",
10+
"include-tanstack-query": false,
1011
"frontend-formatter": "biome",
1112
"frontend-linter": "biome",
1213
"include-vitest": true,
@@ -29,6 +30,7 @@
2930
"frontend-router",
3031
"ui-library",
3132
"frontend-state",
33+
"include-tanstack-query",
3234
"frontend-formatter",
3335
"frontend-linter",
3436
"check-vitest-available",

tools/test-flow/testdata/202605270003_frontend_next_panda_prettier_modules.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"ui-library": "arkui",
88
"frontend-styling": "panda-css",
99
"frontend-state": "jotai",
10+
"include-tanstack-query": false,
1011
"frontend-formatter": "prettier",
1112
"frontend-linter": "prettier",
1213
"include-playwright": true,
@@ -28,6 +29,7 @@
2829
"ui-library",
2930
"frontend-styling",
3031
"frontend-state",
32+
"include-tanstack-query",
3133
"frontend-formatter",
3234
"frontend-linter",
3335
"check-vitest-available",

tools/test-flow/testdata/202605270004_frontend_react_router_css_modules_prettier.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ui-library": "version14",
99
"frontend-styling": "css-modules",
1010
"frontend-state": "none",
11+
"include-tanstack-query": false,
1112
"frontend-formatter": "prettier",
1213
"frontend-linter": "prettier",
1314
"include-vitest": false,
@@ -31,6 +32,7 @@
3132
"ui-library",
3233
"frontend-styling",
3334
"frontend-state",
35+
"include-tanstack-query",
3436
"frontend-formatter",
3537
"frontend-linter",
3638
"check-vitest-available",

tools/test-flow/testdata/202605280001_frontend_react_vite_minimal.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ui-library": "none",
99
"frontend-styling": "tailwind",
1010
"frontend-state": "none",
11+
"include-tanstack-query": false,
1112
"frontend-formatter": "biome",
1213
"frontend-linter": "biome",
1314
"include-vitest": false,
@@ -28,6 +29,7 @@
2829
"ui-library",
2930
"frontend-styling",
3031
"frontend-state",
32+
"include-tanstack-query",
3133
"frontend-formatter",
3234
"frontend-linter",
3335
"check-vitest-available",

tools/test-flow/testdata/202605280002_frontend_next_minimal.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"ui-library": "none",
88
"frontend-styling": "tailwind",
99
"frontend-state": "none",
10+
"include-tanstack-query": false,
1011
"frontend-formatter": "biome",
1112
"frontend-linter": "biome",
1213
"include-playwright": false,
@@ -25,6 +26,7 @@
2526
"ui-library",
2627
"frontend-styling",
2728
"frontend-state",
29+
"include-tanstack-query",
2830
"frontend-formatter",
2931
"frontend-linter",
3032
"check-vitest-available",

tools/test-flow/testdata/202605280003_frontend_react_vite_shadcn_clerk_all_tests.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"frontend-router": "react-router",
88
"ui-library": "shadcn",
99
"frontend-state": "zustand",
10+
"include-tanstack-query": false,
1011
"frontend-formatter": "prettier",
1112
"frontend-linter": "prettier",
1213
"include-vitest": true,
@@ -28,6 +29,7 @@
2829
"frontend-router",
2930
"ui-library",
3031
"frontend-state",
32+
"include-tanstack-query",
3133
"frontend-formatter",
3234
"frontend-linter",
3335
"check-vitest-available",

0 commit comments

Comments
 (0)