Working on the repo
Directorysling_gql/
- .tool-versions flutter 3.47 · nodejs 24 (asdf)
Directorypackages/
Directorysling_gql/ runtime — Accessor, Selection, Cache, SlingClient, QueryBuilder
- …
Directorysling_gql_gen/ generator — introspection JSON → Dart
- …
Directorysling_gql_test/ test helpers — MockGraphQLServer, pumpUntilSettled
- …
Directorymock-api/ graphql-yoga server the example and its tests run against
- …
Directoryexample/ iOS-only Flutter app
- …
Directorywebsite/ this site (Astro + Starlight)
- …
- AGENTS.md conventions and design decisions, read it first
-
Install the toolchains. Flutter and Node are pinned with asdf; run every command from inside the repo so the pins apply.
Terminal window git clone https://github.com/tpucci/sling_gql && cd sling_gqlasdf installdart pub global activate melosmelos bootstrap # pub workspace: one `pub get` for all packages -
Start the mock API. Space-themed, ~180 launches, cursor and offset pagination, 400 ms of artificial latency so skeletons are visible.
Terminal window cd mock-api && npm install && npm start# → http://localhost:4000/graphql (GraphiQL) -
Run the tests.
Terminal window melos run test # all four gates belowmelos run test:runtime # runtime, pure Dart + widget testsmelos run test:gen # generatormelos run test:example # e2e; starts the mock API itself if neededmelos run test:website # docs buildThe example test asserts exact request counts after each interaction. It is the one test that catches waterfalls — keep it exact.
-
Run the example.
Terminal window cd example && flutter run -d <ios-simulator-id>Every request is printed to the console and listed in-app (antenna icon).
-
Change the schema.
mock-api/schema.graphqlis the contract; everything else is derived from it.Terminal window cd mock-api && npm run introspect # → example/graphql/schema.jsoncd .. && melos run generate # example/lib/generated/schema.dart -
Work on the website.
Terminal window cd website && npm install && npm run dev # http://localhost:4321/sling_gql/It deploys to GitHub Pages on every push to
mainthat toucheswebsite/. -
CI and releases. Every push and pull request runs the four gates above (
.github/workflows/ci.yml), plus analyze, format and a check that the example’s generated file is up to date.Commits follow Conventional Commits scoped by package (
feat(sling_gql): …,fix(sling_gql_gen): …,docs(website): …), because releases are cut by melos from them:Terminal window melos run publish:dry-run # pub.dev validationmelos version # bump + CHANGELOG + commit + `<pkg>-vX.Y.Z` tagsgit push --follow-tags # publish.yml publishes each tagged package to pub.dev
Conventions
Section titled “Conventions”- Runtime stays dependency-light:
package:httponly. Nogql, noferry, nobuild_runner. - Every runtime behaviour change ships with a test in
packages/sling_gql/test, usingMockClientfrompackage:http/testing.dartrather than the network. - The hand-written accessor classes at the top of
packages/sling_gql/test/core_test.dartare the contract the generator must produce. Change both together. example/lib/generated/schema.dartis committed and never edited by hand.- In example widgets, read every field you will need at the top of
build(), into locals.