在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):graphql-editor/graphql-editor-cli开源软件地址(OpenSource Url):https://github.com/graphql-editor/graphql-editor-cli开源编程语言(OpenSource Language):TypeScript 94.1%开源软件介绍(OpenSource Introduction):
GraphQL Editor CliTranslate GraphQL to Anything and make it your one and only source of truth. Schema. Compatible with GraphQL Editor projects( Free and Paid Tiers). So the main goal is to provide interactive experience creating GraphQL as a service. InstallationGlobalnpm i -g graphql-editor-cli Inside Reponpm i -D graphql-editor-cli then use with npx for example or as a UsageAll comands work in 3 ways.
In this order CLI will try to get argument. Commmon OptionsAll commands also take these options which refer to your GraphQL Editor project
CommandsSchemaFetch schema from GraphQL Editor project. Schema will be compiled with GraphQL libraries you are using for this project $ gecli schema Additional options
TypingsGenerate TypeScript typings from GraphQL Editor project. $ gecli typings Additional options
BackendBootstrap$ gecli bootstrap Bootstrap a backend stucco project. It will create folder with Development$ gecli dev To start stucco development server reacting to your code changes, Models$ gecli models Generate TypeScript Models from GraphQL types. They are very useful to use with popular Databases type Person {
firstName: String!
lastName: String!
email: String
phone: String
friends: [Person!]!
} will be transformed to a model file import type { ModelTypes } from '@/zeus';
export type Person = ModelTypes['Person']; later on you may want to transform it so it is a database model. import type { ModelTypes } from '@/zeus';
export type Person = Omit<ModelTypes['Person'], 'friends'> & { friends: string[] }; So you see the concept. MongoDBHere is an example how you can use your model in MongoDB. db.collection<MyModel>.find({}) ResolversCLI tool to generate Stucco resolvers in TypeScript from GraphQL fields. Given the following schema: type Person {
firstName: String!
}
type Query {
people: [Person]!
}
schema {
query: Query
} After chosing:
It should generate TypeScript resolver placed in import { FieldResolveInput, FieldResolveOutput } from 'stucco-js';
import { PersonCollection } from '../db/collections';
import { DB } from '../db/mongo';
import { Utils } from '../Utils';
import { Person, ResolverType, ValueTypes } from '../graphql-zeus';
export const handler = async (): Promise<FieldResolveOutput> => {}; and append correct entries to {
"resolvers": {
"Query.people": {
"resolve": {
"name": "lib/Query/people"
}
}
}
} and after running Deploy to GraphQL Editor Shared WorkerShared workers are really powerful. With one command you can deploy stucco based backend to them.
Environment inside shared workerTo pass environment variables use gecli deploy -e DB_URL=https://exampledb.com -e HOME=$HOME Push to cloudSometimes you will want to push to cloud GraphQL Editor back from repo. So editor users can see/test the changes in Editor browser IDE. To do it $ gecli push This will clean cloud folder and push cwd to the editor cloud. Pull from cloudWhen you want to move from cloud folder as your service is getting bigger and put the project inside repository. You can use pull command $ gecli pull It will pull the project to the project name folder Roadmap
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论