
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@bn-digital/graphql-codegen
Advanced tools
GraphQL Types generator configuration and preset, used in @bn-digital projects
Add dependencies to package.json
following configuration options.
In case of workspaces, add snippet to project root file. Examples provided considering default @bn-digital project structure and Strapi connected.
{
"devDependencies": {
"@graphql-codegen/cli": "^2.2.0",
"@bn-digital/graphql-codegen": "^1.0.0"
},
"scripts": {
"graphql": "graphql-codegen --watch"
}
}
.graphqlconfig
exists in project root with similar content (change %app-name%
at least):{
"name": "BN Digital",
"schemaPath": "./packages/cms/exports/graphql/schema.graphql",
"includes": [
"packages/*/exports/graphql/*/*.graphql",
"packages/*/api/*/config/graphql.schema.js",
"packages/*/extensions/*/config/graphql.schema.js",
"packages/*/src/graphql/*/*.graphql"
],
"extensions": {
"endpoints": {
"development": {
"url": "http://localhost:1337/graphql"
},
"staging": {
"url": "https://%application%.bndigital.dev/graphql"
}
}
}
}
codegen.yaml
exists in project root with similar content (change %app-name%
at least):schema: packages/cms/exports/graphql/schema.graphql
documents:
- packages/cms/exports/graphql/fragments/*.graphql
hooks:
afterAllFileWrite:
- eslint --fix --quiet
- prettier --write
config:
avoidOptionals: true
dedupeFragments: true
noExport: false
preResolveTypes: true
strictScalars: true
withComponent: true
withHooks: true
withResultType: true
scalars:
Upload: unknown
Date: Date
Time: Date
JSON: Record<string, any>
Long: number
DateTime: Date
generates:
packages/website/src/graphql/index.tsx:
documents:
- packages/website/src/graphql/**/*.graphql
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
packages/website/tsconfig.json
:{
"compilerOptions": {
"types": ["src/graphql"]
}
}
Use following command for continuous types generation. It will generate required scripts and watch for used *.graphql
file changes, so types will be automatically updated.
IDE types resolution and availability could be bit delayed in terms of change detection or typescript recompile.
yarn graphql
FAQs
GraphQL Types generator configuration and preset, used in @bn-digital projects
We found that @bn-digital/graphql-codegen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.