V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Johnsen
V2EX  ›  程序员

Gundam-cli:前端项目创建发布流程解决方案

  •  
  •   Johnsen · 2018-04-27 09:24:56 +08:00 · 1765 次点击
    这是一个创建于 2184 天前的主题,其中的信息可能已经有所发展或是发生改变。

    文档版本号:1.0.0

    Github 地址:https://github.com/JohnsenZhou/gundam-cli

    Gundam-cli是一个前端项目创建发布流程解决方案,通过命令行工具来减少开发流程中的重复劳动。

    大多数的前端团队都会有一套自己的开发脚手架,在一个新的项目启动时,至少要进行以下步骤:

    • 从远端仓库克隆脚手架
    • 改好后推送到新的仓库

    当项目数一多,在这些繁琐的工作上所花费的时间也是不容小觑的。

    下图是我司在使用 cli 前后的对比图:

    gundam-cli 是在原有为公司开发的 cli 基础上做了功能拓展,可参见317hu-cli,具体流程类似

    开始

    安装

    $ npm install -g gundam-cli
    

    使用

    $ gundam new <project-name>
    

    执行后主要有以下需要输入的选项:

    1. 仓库类型( github、gitlab )

    2. 模板地址

      1. 若仓库类型选择 github 填写格式为:owner/name, 例如 JohnsenZhou/gundam-cli

      2. 若仓库类型选择 gitlab 填写格式为:custom.com:owner/name, 例如gitlab.johnsenzhou.com:example/test-projects

    3. 项目名称(默认project-name

    4. 项目版本号(默认为模板的版本号)

    5. 项目描述

    6. 开发人员名称

    7. 是否进行git push操作(若选是,则进行下一项操作,否则跳出,开发人员后续手动进行git操作)

    8. 输入新项目远端git remote 地址

    具体操作流程可参见下图:

    开发

    gundam-cli 为了达到社区的通用性,稍微增加了一部分功能,如果想针对自己公司开发一套对应的 cli 工具,可以对 gundam-cli 进行定制

    克隆到本地

    $ git clone https://github.com/JohnsenZhou/gundam-cli.git
    

    软链接`gundam-cli`到开发环境

    $ cd gundam-cli
    $ npm link
    

    开源支持

    文章推荐

    API

    Usage: gundam <command> [options]
    
      Options:
    
        -v, --version  output the version number
        -h, --help     output usage information
    
      Commands:
    
        new <string>   Creates a new application
    

    License

    MIT

    4 条回复    2018-04-27 13:51:08 +08:00
    nyfair
        1
    nyfair  
       2018-04-27 09:33:50 +08:00 via iPhone
    是大牛就应该开扎古
    yuutan
        2
    yuutan  
       2018-04-27 09:45:58 +08:00
    激光剑不是只有傻子那那台才有的吗?
    Vogan
        3
    Vogan  
       2018-04-27 10:24:40 +08:00
    原来的这几步也没感觉多浪费时间呀。
    花时间最多的地方不是 debug 吗?
    Lawlieti
        4
    Lawlieti  
       2018-04-27 13:51:08 +08:00
    是男人就开扎古
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5719 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 02:22 · PVG 10:22 · LAX 19:22 · JFK 22:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.