![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@dreamonkey/graphql-codegen-near-operation-file
Advanced tools
Write your documents in `.graphql` files, then import the generated code from `.graphql` files in your code!
Write your documents in .graphql
files, then import the generated code from .graphql
files in your code!
Make sure you have installed and configured GraphQL Code Generator and the near-operation-file preset first:
Install the package:
pnpm add -D @dreamonkey/graphql-codegen-near-operation-file
Configure the near-operation-file preset to use .graphql.ts
extension:
// codegen.ts
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
// ...
generates: {
// ...
'src/': {
preset: 'near-operation-file',
presetConfig: {
extension: '.graphql.ts', // <--- This is the important part
// ...
},
// ...
},
},
// ...
};
export default config;
Add the following line to your .gitignore
file:
# GraphQL Code Generator
src/**/*.graphql.ts
If you are using a different folder instead of src/
in codegen.ts > generates
, adjust the path above accordingly.
Add the plugin to your Vite config:
// vite.config.ts
import { defineConfig } from 'vite';
import graphqlNearOperationFile from '@dreamonkey/graphql-codegen-near-operation-file';
export default defineConfig({
plugins: [
// ...
graphqlNearOperationFile(),
],
});
(App Extension is coming soon)
If you are not using the App Extension, you can add the plugin to your quasar.config.js
:
// quasar.config.js
const { configure } = require('quasar/wrappers');
module.exports = configure(function (/* ctx */) {
return {
// ...
build: {
// ...
vitePlugins: [
// ...
['@dreamonkey/graphql-codegen-near-operation-file'],
// ...
],
},
// ...
};
});
Define your documents in .graphql
files:
# src/composables/posts.graphql
fragment PostDetails on Post {
id
title
body
}
query getPosts {
posts {
...PostDetails
}
}
GraphQL Code Generator will generate the corresponding code as .graphql.ts
files.
Then, you will be able to import the generated code from .graphql
files in a natural fashion:
// src/composables/posts.ts
import {
useGetPostsQuery,
GetPostsDocument,
PostDetailsFragment,
} from './posts.graphql';
// Use the generated code
If you appreciate the work that went into this package, please consider donating.
FAQs
Write your documents in `.graphql` files, then import the generated code from `.graphql` files in your code!
The npm package @dreamonkey/graphql-codegen-near-operation-file receives a total of 0 weekly downloads. As such, @dreamonkey/graphql-codegen-near-operation-file popularity was classified as not popular.
We found that @dreamonkey/graphql-codegen-near-operation-file 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.