Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@graphql-codegen/near-operation-file-preset
Advanced tools
GraphQL Code Generator preset for generating operation code near the operation file
@graphql-codegen/near-operation-file-preset is a preset for GraphQL Code Generator that generates TypeScript/Flow types for your GraphQL operations and fragments near the file where they are used. This helps in keeping the generated types close to the actual usage, making it easier to manage and maintain.
Generate TypeScript types for GraphQL operations
This configuration generates TypeScript types for GraphQL operations and fragments, placing the generated types near the operation files. The `baseTypesPath` specifies the path to the base types.
{
"schema": "./schema.graphql",
"documents": "./src/**/*.graphql",
"generates": {
"./src/": {
"preset": "near-operation-file",
"presetConfig": {
"baseTypesPath": "types/graphql.d.ts"
},
"plugins": [
"typescript",
"typescript-operations"
]
}
}
}
Generate Flow types for GraphQL operations
This configuration generates Flow types for GraphQL operations and fragments, placing the generated types near the operation files. The `baseTypesPath` specifies the path to the base types.
{
"schema": "./schema.graphql",
"documents": "./src/**/*.graphql",
"generates": {
"./src/": {
"preset": "near-operation-file",
"presetConfig": {
"baseTypesPath": "types/graphql.js"
},
"plugins": [
"flow",
"flow-operations"
]
}
}
}
Custom file extension for generated files
This configuration allows you to specify a custom file extension for the generated files. In this example, the generated files will have a `.generated.tsx` extension.
{
"schema": "./schema.graphql",
"documents": "./src/**/*.graphql",
"generates": {
"./src/": {
"preset": "near-operation-file",
"presetConfig": {
"extension": ".generated.tsx",
"baseTypesPath": "types/graphql.d.ts"
},
"plugins": [
"typescript",
"typescript-operations"
]
}
}
}
This package generates TypeScript types for your GraphQL operations and fragments. Unlike the `near-operation-file-preset`, it does not place the generated types near the operation files but rather in a single output file.
This package generates Flow types for your GraphQL operations and fragments. Similar to `@graphql-codegen/typescript-operations`, it does not place the generated types near the operation files but in a single output file.
This package generates TypeScript types and React Apollo components for your GraphQL operations. It focuses on generating React components and hooks, rather than just types, and does not place the generated files near the operation files.
FAQs
GraphQL Code Generator preset for generating operation code near the operation file
The npm package @graphql-codegen/near-operation-file-preset receives a total of 431,362 weekly downloads. As such, @graphql-codegen/near-operation-file-preset popularity was classified as popular.
We found that @graphql-codegen/near-operation-file-preset demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.