1.2.13 • Published 8 months ago

gong-create v1.2.13

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

gong-create

What

目标是打造一个通用的cli引擎,可以作为一个脚手架的脚手架。

使用者可以插件化的方式,扩展生成适合自己的脚手架。

Install

node version >= 18.0.0

notes: 由于插件安装默认使用pnpm作为包管理器,所以需要安装pnpm

npm -g install pnpm

cli使用

npx gong-create@latest

如果您仅是想初始化eslint,可以

npx gong-create@latest --lint

如果您仅是想初始化docs,可以

npx gong-create@latest --docs

Feature

  • 项目模版独立
  • 模版地址支持gihtub、gitlab、gitee
  • 提供常用的生成器功能 「待完善」

Usage

视频链接

本项目对模版项目进行了三种分类

  • 项目类型:业务项目、组件项目、cli项目
  • 业务框架:react、vue
  • 仓库管理:monorepo、single-repo

故而,如果想设置自己的模版。需要有一个特定的命名方式

如:template-react-monorepo: 代表他是一个react的monorepo的模版,没有指定项目类型默认全匹配

如果你不喜欢上面这三种划分方式,没关系。自己配置也很容易 找到core/cli.config.json,修改configData 字段

{
  "name": "gong-cl",
  "userPath": "gong-cli",
  "configData": [
    {
      "name": "project",
      "label": "项目类型",
      "type": "select",
      "title": "请选择所要创建的项目类型",
      "items": [
        {
          "label": "业务",
          "value": "business"
        },
        {
          "label": "库",
          "value": "lib"
        },
        {
          "label": "脚手架",
          "value": "cli"
        }
      ]
    },
    {
      "name": "codeManagement",
      "label": "仓库管理方式",
      "type": "select",
      "title": "请选择仓库管理方式",
      "items": [
        {
          "label": "单库项目",
          "value": "singlerepo"
        },
        {
          "label": "多库管理",
          "value": "monorepo"
        }
      ]
    },
    {
      "name": "frame",
      "label": "框架类型",
      "type": "select",
      "title": "请选择框架",
      "items": [
        {
          "label": "React",
          "value": "react"
        },
        {
          "label": "Vue",
          "value": "vue"
        },
        {
          "label": "None",
          "value": "none"
        }
      ]
    }
  ]
}
  • name: 当前选项控件的唯一key 「必填」
  • label: 选项控件的label 「必填」
  • type: 选项控件的类型 「必填」
    • select: 下拉框
    • input: 输入框
  • items: 「type为select时必填」: 下拉框的选项
    • label: 选项的label
    • value: 选项的value

不过需要注意的还是要模版名字遵循一定的规范,否则会导致引擎无法识别,eg:['cli','singlerepo','react'] => template-cli-singlerepo-react

如何私有化使用

平台目前存在两个公共配置属性

设置方式

pnpm start -c

此命令在上线时也支持设置

npx gong-create@latest -c

如何使用插件

如果你的模版仓库在github或者gitlab或者gitee,则你需要使用本项目的插件功能将指定平台的下载插件安装到本地

开发环境使用,配置完成之后,私有化打包发布即可「即:将包名改为自己的,为希望后面可以继续使用插件生态不推荐对项目进行其他改造」

打开插件商店,进行插件安装

pnpm start -p

安装完成后,需要启用插件

pnpm start -l

notes: 下载插件引擎只会使用一个。「目前插件功能还未完善,仅github、gitee下载插件开发完成,非需token版本」

1.2.12

8 months ago

1.2.13

8 months ago

1.2.10

8 months ago

1.2.11

8 months ago

1.2.0

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.17

10 months ago

1.0.16

10 months ago

1.2.8

9 months ago

1.1.9

10 months ago

1.2.7

9 months ago

1.1.8

10 months ago

1.2.6

9 months ago

1.2.5

9 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.2.1

9 months ago

1.1.2

10 months ago

1.2.9

9 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.11

12 months ago

0.0.9

1 year ago

1.0.10

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.5

1 year ago

0.0.6

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago