SeongBrave/gckit

代码生成工具

★ 241Forks 33HTMLGitHub ↗Compare

Project website ↗

README

Gckit-CLI

npm version Test license

Gckit-CLI代码生成的命令行工具,主要针对iOS(当然也支持自定义,比如Dart、Java)开发过程中Swift或者Objective-C语法的文件生成,可以通过一个简单的JSON文件即可生成对应的ViewController、Model、Cell等文件,生成的文件类型、文件路径都可以自定义。一键生成最大的提高了开发效率,再也不用复制、粘贴操作了,开发者只需关注业务代码的开发和 UI 界面的绘制。

项目状态

这个项目正在恢复维护中。当前优先目标是保证已有 CLI 能在现代 Node.js 环境下稳定运行,并逐步补充自动化测试、文档和兼容性修复。

已验证的基础命令:

$ gckit --help
$ gckit g product vc

安装

Node.js 环境

$ brew install node

更多安装方式可以参考Node.js 官方信息

安装完成后,可以使用以下命令检测是否安装成功:

$ node -v
v10.7.0
$ npm -v
6.4.1

安装 Gckit CLI 工具

$ npm install gckit -g

然后执行命令检测是否安装成功

$ gckit --help

开发

$ npm install
$ npm test

npm test 会运行 CLI 冒烟测试,覆盖帮助命令和默认 Swift ViewController 模板生成流程。

使用

查看命令参数

$ gckit --help
Usage: gckit [options] [command] <command>

Options:
  -h, --help            output usage information

Commands:
  generate|g [options]  生成对应语言的文件
  config|c [options]    基本参数配置

  运行 gckit <command> --help 查看详细帮助信息.

简单尝试

执行 Shell 命令

$ gckit g product vc

然后会在当前目录下生成对应文件:

001

执行命令会相对于当前目录,根据默认配置生成Swift语言ViewController类型的文件

  • vc:指定生成的文件类型为ViewController
  • product:为输入的参数name
  • g为generate的缩写,代表生成文件

体验一键生成

001

首先保证在tempJson文件夹下存在name为"product"的JSON文件

然后执行 Shell 命令:

$ gckit g product

默认提供的Swift模板,需要依赖三个开源库才可以编译通过:

 s.dependency 'UtilCore', '~> 0.1.0'
 s.dependency 'NetWorkCore', '~> 0.1.0'
 s.dependency 'EmptyDataView', '~> 0.1.0'

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Contributors

monkeywithacupcakeseongbrave-botdependabot[bot]

Issues