Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .github/workflows/vite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ jobs:
run: yarn build
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Requires yarn build, so convenient to run here
- name: Codegen freshness
run: yarn codegen:check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dist
.venv/
coverage
coverage.lcov
schema.graphql
2,530 changes: 2,475 additions & 55 deletions .pnp.cjs

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { CodegenConfig } from "@graphql-codegen/cli"

const config: CodegenConfig = {
// For the moment, we use a schema dumped by scripts/dump-schema.ts.
// If we can make it work in the future, we may be able to point directly
// at packages/openneuro-server/src/graphql/schema.ts, or import and pass
// the generated text.
// pnp seems to be the sticking point here, and I've given up for now.
schema: "schema.graphql",
documents: [
"packages/openneuro-app/src/**/*.{ts,tsx}",
"!packages/openneuro-app/src/gql/**",
// Exclude files with duplicate operation names.
// These must be deduplicated before they can be included.
// Cross-file duplicates:
"!packages/openneuro-app/src/scripts/datalad/mutations/snapshot.tsx",
"!packages/openneuro-app/src/scripts/dataset/mutations/snapshot.tsx",
"!packages/openneuro-app/src/scripts/dataset/download/download-script.tsx",
"!packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx",
"!packages/openneuro-app/src/scripts/search/use-search-results.tsx",
// Intra-file duplicates (two operations share a name):
"!packages/openneuro-app/src/scripts/queries/dataset.ts",
// Type mismatches (nullable list items vs non-nullable schema):
"!packages/openneuro-app/src/scripts/dataset/files/files.tsx",
],
generates: {
"packages/openneuro-app/src/gql/": {
preset: "client",
presetConfig: { fragmentMasking: false },
config: {
scalars: {
Date: "string",
DateTime: "string",
BigInt: "number",
JSON: "unknown",
},
useTypeImports: true,
avoidOptionals: { field: false, inputValue: false, object: false },
},
},
},
hooks: {
afterAllFileWrite: ["deno fmt"],
},
}

export default config
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
"prepublish": "rm -fr packages/*/dist .build-cache/ && yarn build",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable",
"codegen": "yarn dump-schema && graphql-codegen --config codegen.ts",
"codegen:check": "yarn dump-schema && graphql-codegen --config codegen.ts && git diff --exit-code packages/openneuro-app/src/gql",
"version": "cat cli/deno.json | jq \".version = $(cat lerna.json | jq '.version')\" > cli/deno.json && git add cli/deno.json && yarn install && git stage yarn.lock"
},
"devDependencies": {
"@elastic/apm-rum-react": "2.0.2",
"@eslint/js": "^9.13.0",
"@graphql-codegen/cli": "6.3.1",
"@graphql-codegen/client-preset": "5.3.0",
"@sentry/cli": "1.37.4",
"@testing-library/jest-dom": "6.1.3",
"@types/ioredis-mock": "^8.2.2",
Expand Down
1 change: 1 addition & 0 deletions packages/openneuro-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@bids/validator": "npm:@jsr/bids__validator@^2.3.2",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@niivue/niivue": "0.57.0",
"@openneuro/components": "^4.33.4",
"@sentry/react": "^10.37.0",
Expand Down
611 changes: 611 additions & 0 deletions packages/openneuro-app/src/gql/gql.ts

Large diffs are not rendered by default.

Loading
Loading