0gql

中文文档
0.0.10发布于 2023/04/16MITTypeScriptCommonJS

Migrate from gql tag

原始使用文档

0gql

Codemod tool to detect gql tag templates and extract them to separate files

Usage

By default, this codemod finds all gql tag usage from graphql-tag imports of a given pattern. Then, it analyses and puts GraphQL content and fragments into a separate .graphql file.

# This codemods all .ts and .tsx files under path/to/files that import and use gql tag
$ npx 0gql@latest "path/to/files/*.ts*"

There are other options as well. Check the full options in the Options section.

Options

Usage: 0gql [options] <file pattern>

Options:
  -V, --version                       output the version number
  -e, --extension <target extension>  extension of the generated file/s (default: ".graphql")
  -m, --modules <gql tag module/s>    module/s where gql tag are imported from. Comma separated (default: "graphql-tag")
  -r, --remove                        remove original gql tag usage
  -h, --help                          display help for command

版本与发布记录

0gql 共发布 10 个版本,首次发布于 2022/09/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.0.10latest2023/04/163 年前
0.0.92023/03/253 年前
0.0.82022/10/134 年前
0.0.72022/09/204 年前
0.0.62022/09/204 年前
0.0.52022/09/204 年前

关于 0gql 的常见问题

0gql 是什么?

从gql标签迁移

如何安装 0gql?

在项目目录运行 npm install 0gql,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 0gql,可以用 npx 0gql 直接运行。

0gql 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

0gql 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

0gql 可以商用吗?

0gql 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

0gql 还在维护吗?

最新版本 0.0.10 发布于 2023/04/16(3 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/09/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。