0 Star 0 Fork 0

ctrlc-git/uni-vue-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

uni-vue-cli 开发文档

基于vue2 + vue-cli

实现方案

依赖Vue Cli远程Preset功能,保证各个项目文件系统一致。

目录说明

├─generator.js # 一个可以注入或是修改项目中文件的 Generator
├─package.json # package.json
├─preset.json #  包含 preset 数据的主要文件(必需)
├─prompts.js # 一个可以通过命令行对话为 generator 收集选项的 prompts 文件
├─node_modules # 依赖包文件(不可忽略)
├─template # 模板文本
|  ├─cli-wx # 微信自动化
|  |   ├─config.json # 配置文件
|  |   ├─miniprogram.js # 执行脚本
|  |   └─utils.js # 工具函数
|  ├─common # 公共文件系统
|  ├─common-ts # 公共文件系统(ts模块)
|  ├─default # 默认模板文件系统
|  └─default-ts # 默认模板文件系统(ts模块)
  • preset.json

一个Vue CLI preset是一个包含创建新项目所需预定义选项和插件的JSON对象,让用户无需在命令提示中选择它们。

vue create过程中保存的preset会被放在你的home目录下的一个配置文件中(~/.vuerc)。你可以通过直接编辑这个文件来调整、添加、删除保存好的preset

{
    "useConfigFiles": true,
    "cssPreprocessor": "dart-sass",
    "plugins": {
        "@dcloudio/vue-cli-plugin-uni": {
            "version": "^2.0.0-31420210305001"
        },
        "@dcloudio/vue-cli-plugin-uni-optimize": {
            "version": "^2.0.0-31420210305001"
        },
        "@dcloudio/vue-cli-plugin-hbuilderx": {
            "version": "^2.0.0-31420210305001"
        },
      
        "@vue/cli-plugin-eslint": {
            "config": "prettier",
            "lintOn": [
                "save"
            ]
        },
        "@vue/cli-plugin-babel": {
            "presets": [
                [
                    "@vue/app",
                    {
                        "useBuiltIns": "entry"
                    }
                ]
            ]
        }
    }
}
  • prompts.js

    人机交互配置文件

  • generator.js

    重点了解的三个api

    • api.render('./template')

    • api.extendPackage({})

    • api.injectImports()

      Generator

集成方案介绍

1. 代码检测方案

相关配置文件

文件名 描述
.editorconfig 编辑器风格配置
.eslintrc.js 代码语法检测
.prettierrc.js 代码格式化

2. GIT提交检测方案

相关配置文件

文件名 描述
git.sh 分支保护
.commitlintrc.js 提交检测

3. API环境配置实现方案

相关配置文件

文件名 描述
vue.config.js 环境变量参数设置文件
.config.js 环境参数配置文件

需要将node环境中命令参数暴露给客户端, 获取的参数通过chainWebpack传递。

npm run cli --SPACE_ENV=trial  robot=1 v=1.0.0 desc=release

4. 微信自动化上传、预览实现方案

相关配置文件

文件名 描述
config.json 参数配置文件
miniprogram.js 自动化脚本
utils.js 工具函数解析指令参数

创建项目

vue create --preset direct:https://gitee.com/ctrlc-git/uni-vue-cli.git#develop --clone my-project
# vue create --preset direct:ssh://git@gitee.com:ctrlc-git/uni-vue-cli.git#develop --clone my-project gitee不支持

参考文档

插件和 Preset
微信小程序-miniprogram-ci

MIT License Copyright (c) 2023 提莫打野迷了路 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

vue2 + uniapp 远程脚手架 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/ctrlc-git/uni-vue-cli.git
git@gitee.com:ctrlc-git/uni-vue-cli.git
ctrlc-git
uni-vue-cli
uni-vue-cli
develop

搜索帮助