1 Star 1 Fork 0

Notadd / notadd-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.md 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
vqqIM_admin 提交于 2019-12-09 16:57 . chore(*) update readme

English | 简体中文

Features

  • Pure typescript generation, no need to maintain graphql files
  • No dependencies

TODO

  • Supports simultaneous generation of proto files (for grpc)
  • Support webapck package release

@notadd/cli

a simple tool to generate graphql for @nestjs/graphql

install
npm i -g @notadd/cli
use
notadd graphql 
    -i main.ts // input file default `main.ts`
    -o notadd.graphql // output file default `notadd.graphql`
demo.ts and run notadd graphql
import { Resolver, Query } from "@nestjs/graphql";
export interface List<T> {
    data: T[];
    currentPage: number;
    pageSize: number;
    total: number;
}
export interface User {
    username: string;
}
export interface Article {
    title: string;
}
@Resolver()
export class DemoResolver {
    @Query()
    getUser(): List<User> {
        return {} as any;
    }
    @Query()
    getArticles(): List<Article> {
        return {} as any;
    }
}
type User {
  username: String!
}

type UserList {
  data: [User]!
  currentPage: Int!
  pageSize: Int!
  total: Int!
}

type Article {
  title: String!
}

type ArticleList {
  data: [Article]!
  currentPage: Int!
  pageSize: Int!
  total: Int!
}

type Query {
  getUser: UserList!
  getArticles: ArticleList!
}
1
https://gitee.com/notadd/notadd-cli.git
git@gitee.com:notadd/notadd-cli.git
notadd
notadd-cli
notadd-cli
master

搜索帮助