Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ Every session has three phases: start, work, end.
<!-- BEGIN:REPO:current-state -->
## Current State

Pre-migration. The monorepo migration has not started yet.
All 10 packages imported. PR #16 (`feature/monorepo-import-graphql-codegen-treeshake`) open for the final import.

Migration plan: `projects/ecosystem/briefs/monorepo-migration.md` in the fleet repo (`~/repos/fleet/claude-fleet-shellicar`).
Previous phases (PRs #7-#15) all merged to main. CI workflows, root tooling, and scaffold all in place.

No packages have been imported. No CI workflows exist yet. The repo has only a harness.
Migration plan: `projects/ecosystem/briefs/monorepo-migration.md` in the fleet repo (`~/repos/fleet/claude-fleet-shellicar`).
<!-- END:REPO:current-state -->

<!-- BEGIN:REPO:architecture -->
Expand Down
29 changes: 28 additions & 1 deletion .claude/sessions/2026-04-11.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,31 @@ The original tsconfig had `moduleResolution: "node"`. Base.json sets `verbatimMo
## What's next

- SC reviews and merges PR #15
- Phase 10: import `@shellicar/graphql-codegen-treeshake`
- Phase 10: import `@shellicar/graphql-codegen-treeshake`

# Session: 2026-04-11 (Phase 10: graphql-codegen-treeshake import)

PR #16 on `feature/monorepo-import-graphql-codegen-treeshake`. Last import phase. All 10 packages are now in the monorepo.

## State of the migration

Every package from the import table has a merged PR (or open, for this last one). The monorepo has root tooling (scaffold PR #6), CI workflows, and all 10 packages with aligned configs.

The prompt (`2026-04-11_2_monorepo-import.md`) status is set to `completed`.

## Fixtures are in a non-standard location

This package has a `fixtures/` directory (a large GraphQL schema for treeshake testing) that lived at the old repo root. The examples reference it via `../../fixtures/schema.graphql`. I placed it at `examples/graphql-codegen-treeshake/fixtures/` to keep it with the examples, but the relative path in the codegen.ts files now resolves to `examples/fixtures/` instead. Source can't be modified during migration, and the examples aren't built in CI, so this is a known broken path.

## This package has no tests

The vitest.config.ts is there (standard template) but there are no test files. `turbo test` reports 0 tasks. This is not a failure.

## tsconfig carries forward isolatedDeclarations and declaration

The original tsconfig had both. Base.json doesn't include them. The root `tsconfig.check.json` sets `isolatedDeclarations: false` for type-checking, so they only affect tsup's DTS generation.

## What's next

- SC reviews and merges PR #16
- Import phase complete. Next work is whatever comes after the migration plan's import phase.
28 changes: 28 additions & 0 deletions examples/graphql-codegen-treeshake/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "../../node_modules/@biomejs/biome/configuration_schema.json",
"extends": "//",
"root": false,
"formatter": {
"enabled": false
},
"assist": {
"actions": {
"source": {
"organizeImports": "off"
}
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "info"
},
"style": {
"useBlockStatements": "error",
"noNonNullAssertion": "warn"
}
}
}
}
21 changes: 21 additions & 0 deletions examples/graphql-codegen-treeshake/client-naive/codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { CodegenConfig } from '@graphql-codegen/cli';
import type { ClientPresetConfig } from '@graphql-codegen/client-preset';
import type { TypeScriptPluginConfig } from '@graphql-codegen/typescript';

const config: CodegenConfig = {
schema: '../fixtures/schema.graphql',
documents: ['src/**/*.graphql'],
generates: {
'src/generated/': {
preset: 'client',
presetConfig: {
fragmentMasking: false,
} satisfies ClientPresetConfig,
config: {
useTypeImports: true,
} satisfies TypeScriptPluginConfig,
},
},
};

export default config;
18 changes: 18 additions & 0 deletions examples/graphql-codegen-treeshake/client-naive/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@shellicar-examples/client-naive",
"version": "1.0.0",
"description": "Naive graphql-codegen example using client-preset — generates all schema types regardless of usage",
"scripts": {
"codegen": "graphql-codegen --config codegen.ts"
},
"private": true,
"devDependencies": {
"@graphql-codegen/cli": "^6.1.3",
"@graphql-codegen/client-preset": "^5.2.4",
"@graphql-codegen/typescript": "^5.0.9",
"@graphql-typed-document-node/core": "^3.2.0",
"graphql": "^16.13.1",
"tsx": "^4.21.0",
"typescript": "^5.9.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* eslint-disable */
import * as types from './graphql';
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';

/**
* Map of all GraphQL operations in the project.
*
* This map has several performance disadvantages:
* 1. It is not tree-shakeable, so it will include all operations in the project.
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
* 3. It does not support dead code elimination, so it will add unused operations.
*
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
type Documents = {
"fragment WandFields on Wand {\n id\n wood\n core\n lengthInches\n flexibility\n}\n\nfragment SpellFields on Spell {\n id\n name\n incantation\n school\n difficulty\n description\n damagePoints\n healingPoints\n}\n\nfragment WizardFields on Wizard {\n id\n name\n rank\n age\n specialisation\n wand {\n ...WandFields\n }\n createdAt\n updatedAt\n}\n\nquery GetWizard($id: UUID!) {\n wizard(id: $id) {\n ...WizardFields\n spells {\n ...SpellFields\n }\n familiars {\n id\n name\n species\n magicAffinity\n bonded\n }\n academy {\n id\n name\n foundedYear\n }\n }\n}\n\nquery ListWizards($filter: WizardFilterInput, $pagination: PaginationInput) {\n wizards(filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n ...WizardFields\n }\n }\n }\n}\n\nquery GetSpells($school: SpellSchool, $difficulty: SpellDifficulty) {\n spells(school: $school, difficulty: $difficulty) {\n totalCount\n edges {\n node {\n ...SpellFields\n discoveredBy {\n id\n name\n rank\n }\n }\n }\n }\n}\n\nmutation CreateWizard($input: CreateWizardInput!) {\n createWizard(input: $input) {\n ...WizardFields\n }\n}\n\nmutation UpdateWizard($input: UpdateWizardInput!) {\n updateWizard(input: $input) {\n ...WizardFields\n }\n}": typeof types.WandFieldsFragmentDoc,
};
const documents: Documents = {
"fragment WandFields on Wand {\n id\n wood\n core\n lengthInches\n flexibility\n}\n\nfragment SpellFields on Spell {\n id\n name\n incantation\n school\n difficulty\n description\n damagePoints\n healingPoints\n}\n\nfragment WizardFields on Wizard {\n id\n name\n rank\n age\n specialisation\n wand {\n ...WandFields\n }\n createdAt\n updatedAt\n}\n\nquery GetWizard($id: UUID!) {\n wizard(id: $id) {\n ...WizardFields\n spells {\n ...SpellFields\n }\n familiars {\n id\n name\n species\n magicAffinity\n bonded\n }\n academy {\n id\n name\n foundedYear\n }\n }\n}\n\nquery ListWizards($filter: WizardFilterInput, $pagination: PaginationInput) {\n wizards(filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n ...WizardFields\n }\n }\n }\n}\n\nquery GetSpells($school: SpellSchool, $difficulty: SpellDifficulty) {\n spells(school: $school, difficulty: $difficulty) {\n totalCount\n edges {\n node {\n ...SpellFields\n discoveredBy {\n id\n name\n rank\n }\n }\n }\n }\n}\n\nmutation CreateWizard($input: CreateWizardInput!) {\n createWizard(input: $input) {\n ...WizardFields\n }\n}\n\nmutation UpdateWizard($input: UpdateWizardInput!) {\n updateWizard(input: $input) {\n ...WizardFields\n }\n}": types.WandFieldsFragmentDoc,
};

/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*
*
* @example
* ```ts
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
* ```
*
* The query argument is unknown!
* Please regenerate the types.
*/
export function graphql(source: string): unknown;

/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "fragment WandFields on Wand {\n id\n wood\n core\n lengthInches\n flexibility\n}\n\nfragment SpellFields on Spell {\n id\n name\n incantation\n school\n difficulty\n description\n damagePoints\n healingPoints\n}\n\nfragment WizardFields on Wizard {\n id\n name\n rank\n age\n specialisation\n wand {\n ...WandFields\n }\n createdAt\n updatedAt\n}\n\nquery GetWizard($id: UUID!) {\n wizard(id: $id) {\n ...WizardFields\n spells {\n ...SpellFields\n }\n familiars {\n id\n name\n species\n magicAffinity\n bonded\n }\n academy {\n id\n name\n foundedYear\n }\n }\n}\n\nquery ListWizards($filter: WizardFilterInput, $pagination: PaginationInput) {\n wizards(filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n ...WizardFields\n }\n }\n }\n}\n\nquery GetSpells($school: SpellSchool, $difficulty: SpellDifficulty) {\n spells(school: $school, difficulty: $difficulty) {\n totalCount\n edges {\n node {\n ...SpellFields\n discoveredBy {\n id\n name\n rank\n }\n }\n }\n }\n}\n\nmutation CreateWizard($input: CreateWizardInput!) {\n createWizard(input: $input) {\n ...WizardFields\n }\n}\n\nmutation UpdateWizard($input: UpdateWizardInput!) {\n updateWizard(input: $input) {\n ...WizardFields\n }\n}"): (typeof documents)["fragment WandFields on Wand {\n id\n wood\n core\n lengthInches\n flexibility\n}\n\nfragment SpellFields on Spell {\n id\n name\n incantation\n school\n difficulty\n description\n damagePoints\n healingPoints\n}\n\nfragment WizardFields on Wizard {\n id\n name\n rank\n age\n specialisation\n wand {\n ...WandFields\n }\n createdAt\n updatedAt\n}\n\nquery GetWizard($id: UUID!) {\n wizard(id: $id) {\n ...WizardFields\n spells {\n ...SpellFields\n }\n familiars {\n id\n name\n species\n magicAffinity\n bonded\n }\n academy {\n id\n name\n foundedYear\n }\n }\n}\n\nquery ListWizards($filter: WizardFilterInput, $pagination: PaginationInput) {\n wizards(filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n cursor\n node {\n ...WizardFields\n }\n }\n }\n}\n\nquery GetSpells($school: SpellSchool, $difficulty: SpellDifficulty) {\n spells(school: $school, difficulty: $difficulty) {\n totalCount\n edges {\n node {\n ...SpellFields\n discoveredBy {\n id\n name\n rank\n }\n }\n }\n }\n}\n\nmutation CreateWizard($input: CreateWizardInput!) {\n createWizard(input: $input) {\n ...WizardFields\n }\n}\n\nmutation UpdateWizard($input: UpdateWizardInput!) {\n updateWizard(input: $input) {\n ...WizardFields\n }\n}"];

export function graphql(source: string) {
return (documents as any)[source] ?? {};
}

export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;
Loading
Loading