![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
graphql-codegen-graphql-codegen-data-persist
Advanced tools
This plugin for [GraphQL Code Generator](https://www.graphql-code-generator.com/) facilitates fetching data from a GraphQL server using specific queries and subsequently generates static TypeScript files that encapsulate this data.
This plugin for GraphQL Code Generator facilitates fetching data from a GraphQL server using specific queries and subsequently generates static TypeScript files that encapsulate this data.
To install the plugin, run:
npm install --save-dev @graphql-codegen/plugin-helpers graphql-request
In your codegen.yml
file, the plugin should be configured as follows:
schema: "http://localhost:4000/graphql"
documents: "src/**/*.graphql"
generates:
src/generated/staticData.ts:
plugins:
- "path/to/your-plugin"
config:
url: "http://localhost:4000/graphql"
queries:
- |
query {
data {
foo
bar
}
}
- |
query {
otherData {
id
value
}
}
outputFile: "src/generated/staticData.ts"
Define your GraphQL queries to fetch the required static data.
Configure the plugin in your codegen.yml
file as shown above.
Run the GraphQL Code Generator:
npx graphql-codegen
The plugin will generate a TypeScript file containing static constants that hold the data fetched by your queries.
The generated TypeScript file (staticData.ts
) will include static constants representing the results of your queries, structured as follows:
export const Query0 = {
data: {
boo: false,
bar: true
// ... other data
}
};
export const Query1 = {
otherData: {
id: 1,
value: 'example'
// ... other data
}
};
// ... other queries
To build the plugin for both CommonJS and ES Modules:
Ensure TypeScript is installed:
npm install --save-dev typescript
Execute the build scripts:
npm run build:cjs
npm run build:esm
The compiled files will be available in the cjs
and esm
directories.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
This plugin for [GraphQL Code Generator](https://www.graphql-code-generator.com/) facilitates fetching data from a GraphQL server using specific queries and subsequently generates static TypeScript files that encapsulate this data.
The npm package graphql-codegen-graphql-codegen-data-persist receives a total of 0 weekly downloads. As such, graphql-codegen-graphql-codegen-data-persist popularity was classified as not popular.
We found that graphql-codegen-graphql-codegen-data-persist demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.