@adgstudio/graphql-generator 中文文档教程
Graphql Generator
生成 graphql 对象、类型定义和合并 sdl 从
Install
从 graphql sdl/s从 npm 安装
npm install -D @adgstudio/graphql-generator
Usage
Generate Graphql Types
graphql sdl 文件生成graphql 打字稿类型 从 graphql sdl 文件
import { GraphqlTypesGenerator } from "@adgstudio/graphql-generator";
async function main() {
const generator = new GraphqlTypesGenerator();
await factory.generate("./src/**/*.graphql", {
outputPath: "path/to/destination.ts",
});
}
main();
Generate Graphql Object
生成 graphql 对象定义 将
import { GraphqlObjectGenerator } from "@adgstudio/graphql-generator";
async function main() {
const generator = new GraphqlObjectGenerator();
await generator.generate("./src/modules/**/*.graphql", {
outputPath: "path/to/destination.ts",
});
}
main();
Merge graphql sdl to a single file
多个 graphql sdl 文件合并到一个 graphql sdl 文件
import { GraphqlSdlFactory } from "@adgstudio/graphql-generator";
async function main() {
const generator = new GraphqlSdlFactory();
await generator.merge("./src/modules/**/*.graphql", {
outputPath: "path/to/destination.graphql",
});
}
main();
Contributing
Fork this repo 并创建 pull向 dev
分支发出
Support
请求abdulghani0">youtube。
Graphql Generator
Generate graphql object, type definition and merge sdl from graphql sdl/s
Install
install from npm
npm install -D @adgstudio/graphql-generator
Usage
Generate Graphql Types
Generate graphql typescript types from graphql sdl file
import { GraphqlTypesGenerator } from "@adgstudio/graphql-generator";
async function main() {
const generator = new GraphqlTypesGenerator();
await factory.generate("./src/**/*.graphql", {
outputPath: "path/to/destination.ts",
});
}
main();
Generate Graphql Object
Generate graphql object definition from graphql sdl file
import { GraphqlObjectGenerator } from "@adgstudio/graphql-generator";
async function main() {
const generator = new GraphqlObjectGenerator();
await generator.generate("./src/modules/**/*.graphql", {
outputPath: "path/to/destination.ts",
});
}
main();
Merge graphql sdl to a single file
Merge multiple graphql sdl files to a single graphql sdl file
import { GraphqlSdlFactory } from "@adgstudio/graphql-generator";
async function main() {
const generator = new GraphqlSdlFactory();
await generator.merge("./src/modules/**/*.graphql", {
outputPath: "path/to/destination.graphql",
});
}
main();
Contributing
Fork this repo and create pull request to dev
branch