Skip to content

Commit

Permalink
lesscode-v0.2.1 (#360)
Browse files Browse the repository at this point in the history
* 先去掉 bk-PaaS 中的其他内容,只保留 paas-ce/lesscode 目录

* init lesscode

* add .pre-commit-config.yaml

* test

* test

* add pre-commit & update dev_install doc & add bk-PaaS doc

* typo

* up dev_install doc

* up dev_install doc

* up dev_install doc

* up dev_install doc

* up .pre-commit-config.yaml

* up comment info

* add .pre-commit-config.yaml to ignore

* feature: 组件属性配置类型提示首字母大写

* 可视化布局 => 可视化开发

* 可视化布局 => 可视化开发

* 可视化布局 => 可视化开发

* Lesscode update doc (#199)

* ignore .idea

* update bk-magic-vue version (for bk-color-picker select '')

* 组件属性提示增加 tips 配置字段

* button 按钮组件使用说明

* text 按钮组件使用说明

* image 图片组件使用说明

* input 输入框组件使用说明

* events 配置数据结构优化 ['change'] ==> [{ name: 'change', tips: ''}]

* 组件使用帮助 tips

* 帮助文档页面移除单个组件导航

* 帮助文档:栅格布局

* merge #201

* merge manually from #201

* merge manually from #201 (#202)

* merge #201

* merge manually from #201

* 添加快捷操作功能 (#205)

* 增加chart图表 (#206)

* 增加chart图表

* fix冲突

* 删除consolelog

* 更新图标库

* merge manually from #203

* merge manually from #203 (#212)

* 拖拽快捷操作支持Mac Command键 (#213)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* fix some bug

* 修复 charts-line options.tips 小问题

* 修复 charts-line options.tips 小问题 (#215)

* 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题

* 【lesscode】修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 (#216)

* merge #201

* merge manually from #201

* merge manually from #203

* fix some bug

* 修复 charts-line options.tips 小问题

* 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题

* 修复 chart 组件样式被覆盖的问题

* 【lesscode】修复 chart 组件样式被覆盖的问题 (#217)

* merge #201

* merge manually from #201

* merge manually from #203

* fix some bug

* 修复 charts-line options.tips 小问题

* 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题

* 修复 chart 组件样式被覆盖的问题

* fix图表问题 (#218)

* 增加chart图表

* fix冲突

* 删除consolelog

* 更新图标库

* 同步新的lesscode-develop,fix图表bug

* 修改快捷操作 (#219)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 修改快捷操作 (#220)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

Co-authored-by: ielgnaw <[email protected]>

* 体验 bug 修复

* 【lesscode】体验 bug 修复 (#221)

* merge #201

* merge manually from #201

* merge manually from #203

* fix some bug

* 修复 charts-line options.tips 小问题

* 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题

* 修复 chart 组件样式被覆盖的问题

* 体验 bug 修复

* 修改快捷操作判断 (#222)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 修复体验问题

* 修复体验问题 (#223)

* 增加backspace快捷删除 (#224)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 增加backspace快速删除
修改快捷面版样式

* 画布仅剩一个 grid 时,不允许删除;增加清空 grid 操作

* 画布仅剩一个 grid 时,不允许删除;增加清空 grid 操作 (#225)

* 修复 clone grid 时,右侧面板没有默认选中的问题;更新日志

* 修复 clone grid 时,右侧面板没有默认选中的问题;更新日志 (#226)

* 文案

* 文案 (#227)

* 后端orm采用TypeORM (#229)

* 后端采用typeorm

* orm添加migration (#230)

* 修改数据迁移表

* 添加初始化脚本 (#233)

* 增加data-base.js.example

* 添加初始化SQL

* 修改初始化脚本

* 新增项目级别页面布局和项目列表页UI (#232)

* 新增数据库部署文档 (#234)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 增加backspace快速删除
修改快捷面版样式

* 后端采用typeorm

* orm添加migration

* 修改文件名

* 修改数据迁移表

* 1. 新增数据库部署文档
2. 去掉test相关接口
3. 修改initial.sql注释

* 去掉数据迁移部分,采用SQL自己控制

* 1. 修改数据库说明
2. 修改数据库配置注释

* feature: db 操作demo (#235)

* 提交项目模块layout和router & fix高版本echart图表自适应不生效问题 (#236)

* 增加chart图表

* fix冲突

* 删除consolelog

* 更新图标库

* 同步新的lesscode-develop,fix图表bug

* fix高版本echarts无法自适应大小的问题

* project模块layout和router

* 添加函数相关entity (#237)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 增加backspace快速删除
修改快捷面版样式

* 后端采用typeorm

* orm添加migration

* 修改文件名

* 修改数据迁移表

* 1. 新增数据库部署文档
2. 去掉test相关接口
3. 修改initial.sql注释

* 去掉数据迁移部分,采用SQL自己控制

* 1. 修改数据库说明
2. 修改数据库配置注释

* 1. entity的base 添加创建人和修改人字段
2. 添加函数相关的entities
3. 修改initial.sql

* 修改字段类型

* 新增项目相关功能 (#238)

* 新增项目级别页面布局和项目列表页UI

* 新增创建项目和查询项目列表功能

* 新增项目收藏功能

* 新增项目重命名功能

* 新增项目列表分类和搜索查询

* 新增复制项目功能

* 修改项目收藏功能使用独立的数据接口和模型

* 优化项目列表查询

* 新增删除项目功能

Co-authored-by: ielgnaw <[email protected]>

* 添加权限相关方法 (#240)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 增加backspace快速删除
修改快捷面版样式

* 后端采用typeorm

* orm添加migration

* 修改文件名

* 修改数据迁移表

* 1. 新增数据库部署文档
2. 去掉test相关接口
3. 修改initial.sql注释

* 去掉数据迁移部分,采用SQL自己控制

* 1. 修改数据库说明
2. 修改数据库配置注释

* 1. entity的base 添加创建人和修改人字段
2. 添加函数相关的entities
3. 修改initial.sql

* 修改字段类型

* 1. 添加权限相关的实体和接口
2. 添加创建人和更新人字段

Co-authored-by: ielgnaw <[email protected]>

* 解决冲突 (#241)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 增加backspace快速删除
修改快捷面版样式

* 后端采用typeorm

* orm添加migration

* 修改文件名

* 修改数据迁移表

* 1. 新增数据库部署文档
2. 去掉test相关接口
3. 修改initial.sql注释

* 去掉数据迁移部分,采用SQL自己控制

* 1. 修改数据库说明
2. 修改数据库配置注释

* 1. entity的base 添加创建人和修改人字段
2. 添加函数相关的entities
3. 修改initial.sql

* 修改字段类型

* 解决冲突

* 统一实体导入导出与命名规则 (#242)

* 新增项目级别页面布局和项目列表页UI

* 新增创建项目和查询项目列表功能

* 新增项目收藏功能

* 新增项目重命名功能

* 新增项目列表分类和搜索查询

* 新增复制项目功能

* 修改项目收藏功能使用独立的数据接口和模型

* 优化项目列表查询

* 新增删除项目功能

Co-authored-by: ielgnaw <[email protected]>

* 自定义组件接口 (#243)

* feature: db 操作demo

* perf: 组件管理接口联调

* perf: 修改实体引入方式

* fix: 自定义组件上传 (#244)

* feature: db 操作demo

* perf: 组件管理接口联调

* perf: 修改实体引入方式

* fix: 自定义组件上传

Co-authored-by: ielgnaw <[email protected]>

* 函数页面及接口 (#245)

* 添加快捷操作功能

* 拖拽快捷键支持Mac Command键

* 修改快捷操作说明

* 修复剪切快捷操作,修改快捷操作说明

* 兼容数据为空的情况

* 兼容数据为空的情况

* 仅在选中拖拽区域触发快捷操作

* 修改判断是否在拖拽区域

* 增加backspace快速删除
修改快捷面版样式

* 后端采用typeorm

* orm添加migration

* 修改文件名

* 修改数据迁移表

* 1. 新增数据库部署文档
2. 去掉test相关接口
3. 修改initial.sql注释

* 去掉数据迁移部分,采用SQL自己控制

* 1. 修改数据库说明
2. 修改数据库配置注释

* 1. entity的base 添加创建人和修改人字段
2. 添加函数相关的entities
3. 修改initial.sql

* 修改字段类型

* 解决冲突

* 添加函数相关页面及接口

* up data-base conf example

* up data-base conf example (#246)

* 提交页面管理 (#247)

* 提交页面管理

* merge

Co-authored-by: ielgnaw <[email protected]>

* merge page && page 表,content 和 sourceCode 改为允许 null

* merge page && page 表,content 和 sourceCode 改为允许 null (#248)

* fix页面管理问题 (#249)

* fix复制页面问题

* 删除preview页面的query参数

* update msg

Co-authored-by: ielgnaw <[email protected]>

* format code style

* format code style (#250)

* page 模块小问题修复

* page 模块小问题修复 (#251)

* 1. 函数体验优化
2. 函数对接项目

* 修改整体路由、生成页面缩略图 (#253)

* 增加chart图表

* fix冲突

* 删除consolelog

* 更新图标库

* 同步新的lesscode-develop,fix图表bug

* fix高版本echarts无法自适应大小的问题

* project模块layout和router

* 提交页面管理

* merge

* fix复制页面问题

* 删除preview页面的query参数

* update msg

* 修改整体路由、生成页面缩略图

Co-authored-by: ielgnaw <[email protected]>

* 1. 函数体验优化 (#252)

2. 函数对接项目

* 通过手动保存方式串联流程 (#254)

* 修改整体路由、生成页面缩略图

* 增加手动保存串连流程

* 删除consolelog

Co-authored-by: ielgnaw <[email protected]>

* merge

* merge && cookie

* merge && cookie (#255)

* 修改删除和新增分类的项目

* 修改删除和新增分类的项目 (#256)

* 1. 函数体验优化
2. 函数对接项目

* 修改删除和新增分类的项目

* 函数修改为可以选中所有模板生成的函数

* 登录权限控制 & 账号管理页面 & 用户信息

* 登录权限控制 & 账号管理页面 & 用户信息 (#259)

* entities base 中尝试获取 curLoginUser (#260)

* 登录权限控制 & 账号管理页面 & 用户信息

* entities base 中尝试获取 curLoginUser

* fix页面管理体验问题 (#257)

* fix页面管理体验问题

* 下拉项目列表增加搜索

Co-authored-by: ielgnaw <[email protected]>

* 使用函数的时候,可以选择所有模板生成的函数 (#258)

* 1. 函数体验优化
2. 函数对接项目

* 修改删除和新增分类的项目

* 函数修改为可以选中所有模板生成的函数

* add http.js.example

* add http.js.example (#261)

* 项目管理对接登录用户和复制项目及样式与交互优化 (#262)

* 新增项目级别页面布局和项目列表页UI

* 新增创建项目和查询项目列表功能

* 新增项目收藏功能

* 新增项目重命名功能

* 新增项目列表分类和搜索查询

* 新增复制项目功能

* 修改项目收藏功能使用独立的数据接口和模型

* 优化项目列表查询

* 新增删除项目功能

* 项目管理样式和交互优化

* 项目对接登录用户和复制项目优化

Co-authored-by: ielgnaw <[email protected]>

* 处理projectId不存在情况,fix页面管理样式问题 (#263)

* 增加chart图表

* fix冲突

* 删除consolelog

* 更新图标库

* 同步新的lesscode-develop,fix图表bug

* fix高版本echarts无法自适应大小的问题

* project模块layout和router

* 提交页面管理

* merge

* fix复制页面问题

* 删除preview页面的query参数

* update msg

* 修改整体路由、生成页面缩略图

* 增加手动保存串连流程

* 删除consolelog

* fix页面管理体验问题

* 下拉项目列表增加搜索

* 处理projectId不存在情况,fix页面管理样式问题

Co-authored-by: ielgnaw <[email protected]>

* 数据库默认值调整 (#264)

* merge #201

* merge manually from #201

* merge manually from #203

* fix some bug

* 修复 charts-line options.tips 小问题

* 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题

* 修复 chart 组件样式被覆盖的问题

* 体验 bug 修复

* 修复体验问题

* 画布仅剩一个 grid 时,不允许删除;增加清空 grid 操作

* 修复 clone grid 时,右侧面板没有默认选中的问题;更新日志

* 文案

* up data-base conf example

* merge page && page 表,content 和 sourceCode 改为允许 null

* format code style

* page 模块小问题修复

* merge

* merge && cookie

* 登录权限控制 & 账号管理页面 & 用户信息

* add http.js.example

* 修复自定义组件 x-table 获取数据的问题

* 统一操作用户

* 修复自定义组件 x-table 获取数据的问题 (#265)

* 统一操作用户 (#266)

* 1. 函数体验优化
2. 函数对接项目

* 修改删除和新增分类的项目

* 函数修改为可以选中所有模板生成的函数

* 统一操作用户

* 获取正确的当前登录用户写入数据库 createUser 和 updateUser

* 获取正确的当前登录用户写入数据库 createUser 和 updateUser (#267)

* 修复 cookie 中 bktoken 失效的问题

* 项目复制完善和项目列表体验问题修复 (#268)

* 项目列表体验优化

Co-authored-by: ielgnaw <[email protected]>

* 修复 cookie 中 bktoken 失效的问题 (#269)

* 函数体验优化

* 去除重复js

* fix页面管理相关体验问题 (#271)

* 处理projectId不存在情况,fix页面管理样式问题

* 页面管理体验问题修复

* fix page style

Co-authored-by: ielgnaw <[email protected]>

* 函数体验问题修复 (#270)

* 1. 函数体验优化
2. 函数对接项目

* 修改删除和新增分类的项目

* 函数修改为可以选中所有模板生成的函数

* 统一操作用户

* 函数体验优化

* 去除重复js

* 函数api url提示,默认函数填写绝对路径

* 去掉多余的空格

* 函数体验问题修复 (#272)

* 1. 函数体验优化
2. 函数对接项目

* 修改删除和新增分类的项目

* 函数修改为可以选中所有模板生成的函数

* 统一操作用户

* 函数体验优化

* 去除重复js

* 函数api url提示,默认函数填写绝对路径

* 去掉多余的空格

* 修改layout样式

* 导航与主站一致

* 导航与主站一致 (#274)

* 导航与主站一致

* 导航与主站一致

* 隐藏项目删除操作和画布内容区加loading等体验问题修复 (#275)

* 新增项目级别页面布局和项目列表页UI

* 新增创建项目和查询项目列表功能

* 新增项目收藏功能

* 新增项目重命名功能

* 新增项目列表分类和搜索查询

* 新增复制项目功能

* 修改项目收藏功能使用独立的数据接口和模型

* 优化项目列表查询

* 新增删除项目功能

* 项目管理样式和交互优化

* 项目对接登录用户和复制项目优化

* 复制项目补充页面函数关联记录

* 项目列表体验优化

* 体验问题修复

Co-authored-by: ielgnaw <[email protected]>

* 修复属性面板中 switch 组件不会正确渲染的问题

* 修复属性面板中 switch 组件不会正确渲染的问题 (#276)

* 函数提示优化,增加按钮获取数据 (#277)

* 项目名称、ID 校验去重在当前用户维度下

* 项目名称、ID 校验去重在当前用户维度下 (#278)

* 修复 compId 的问题

* 修复 compId 的问题 (#280)

* initcode (#326)

* initCode

* update ignore文件

* feat:修改conf目录下npm、bkrepo、migrate配置文件引用方式和相应文档说明 (#329)

* initCode

* update ignore文件

* 修改conf目录下npm、bkrepo、migrate配置文件引用方式和相应文档说明

* 修改gitignore文件

* feature: 新增sideslider交互式组件;feature: 路由功能增强,支持删除路由、修改父路径、绑定跳转路由及自动识别项目默认首页 (#336)

* bugfix: 增加路由跳转的sql变更 (#337)

* bugfix: 增加路由跳转的sql变更

* bugfix: 增加路由跳转的sql变更

* bugfix: delete图标库相关code (#341)

* bugfix: 增加路由跳转的sql变更

* bugfix: 增加路由跳转的sql变更

* fix: delete图标库相关code

* fix: 页面预览图偶发失败 (#344)

* fix: 修复侧栏sideSlider的配置问题 (#348)

fix: 变量名优化

Co-authored-by: vincenttgao <[email protected]>

* fix: 页面绑定路由时未禁用已绑定跳转的路由问题 (#350)

* fix(edit): 路由参数tips (#352)

* fix: 修复交互式组件的若干问题 (#351)

* fix: 修复侧栏sideSlider的配置问题

fix: 变量名优化

* fix: 修复交互式组件中,自由布局定位错误的问题

* fix: 修复diff组件缺少language报错的问题

* fix: 修复交互式组件处于激活态时,底层下仍然可交互的问题

* fix: 修复交互式组件拖拽的问题

Co-authored-by: vincenttgao <[email protected]>

* feat: new version (#354)

* bugfix: fix自定义组件第一次拖入时不显示问题 (#357)

* feat: add db index sql (#358)

Co-authored-by: hLinx <[email protected]>
Co-authored-by: sundytt <[email protected]>
Co-authored-by: Arman19941113 <[email protected]>
Co-authored-by: xuzhan <[email protected]>
Co-authored-by: terlinhe <[email protected]>
Co-authored-by: yangyy <[email protected]>
Co-authored-by: Vincent Ko <[email protected]>
Co-authored-by: vincenttgao <[email protected]>
  • Loading branch information
9 people authored Jun 4, 2021
1 parent 24ee127 commit b18423a
Show file tree
Hide file tree
Showing 683 changed files with 45,211 additions and 34,736 deletions.
16 changes: 16 additions & 0 deletions paas-ce/lesscode/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ module.exports = {
// 如果一个变量不会被重新赋值必须使用 `const` 进行声明
'prefer-const': 'error',

// eslint-plugin-vue@7 新增的规则暂时先全部关闭
'vue/no-dupe-v-else-if': 'off',
'vue/component-definition-name-casing': 'off',
'vue/one-component-per-file': 'off',
'vue/v-slot-style': 'off',
'vue/no-arrow-functions-in-watch': 'off',
'vue/no-custom-modifiers-on-v-model': 'off',
'vue/no-multiple-template-root': 'off',
'vue/no-mutating-props': 'off',
'vue/no-v-for-template-key': 'off',
'vue/no-v-model-argument': 'off',
'vue/valid-v-bind-sync': 'off',
'vue/valid-v-slot': 'off',
'vue/experimental-script-setup-vars': 'off',
'vue/no-lone-template': 'off',

// https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/array-bracket-spacing.md
'vue/array-bracket-spacing': ['error', 'never'],

Expand Down
15 changes: 14 additions & 1 deletion paas-ce/lesscode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
node_modules
npm-debug.log
yarn-error.log
yarn.lock
selenium-debug.log
test/unit/coverage
test/e2e/reports
Expand All @@ -12,10 +13,12 @@ templates_c/
compile
output
logs
v3logs
sock
pids
*bak*
*.0
*.local*
.example-cache
.idea
lib/client/.webpack_cache
Expand All @@ -25,6 +28,16 @@ lib/client/.webpack_cache
lib/client/static/lib-manifest.json
lib/client/static/lib.bundle.js
lib/client/static/vue-layout-demo*.vue
!lib/client/static/ResizeSensor.js
upload
!lib/client/src/element-materials/**/upload
temp
npmTemp
lib/server/conf/data-base.js
lib/server/conf/http.js
lib/server/conf/db-migrate.json
lib/server/conf/npm.js
lib/server/conf/bk-repo.js

!lib/server/project-template/project-init-code/bin
lib/server/project-template/project-target*
lib/server/project-template/bklesscode-proj*
22 changes: 16 additions & 6 deletions paas-ce/lesscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- 可视化拖拽布局:集成蓝鲸MagicBox Vue通用组件,支持在线画布拖拽组件进行页面布局编辑、在线预览、查看及下载源码
- 在线函数库管理:支持在线灵活编写管理事件函数及远程接口返回数据清洗函数
- 在线组件配置:支持组件样式、属性、事件在线配置
- 布局模板:提供多种导航布局模板
- 支持自定义组件开发:提供自定义组件开发规范及示例,开放自定义组件开发能力,满足业务场景组件集成需求
- 二次开发能力:生成的Vue源码文件支持无缝集成到蓝鲸前端开发框架([BKUI-CLI](https://bk.tencent.com/docs/document/5.1/19/583))进行二次开发

Expand All @@ -24,6 +25,7 @@
│   │      ......
│   │   ├── index-dev.html # 本地开发使用的 html
│   │   ├── index.html # 生产环境使用的 html
│   │   ├── preview.html # 预览模块使用的 html
│   │   ├── require-monaco.html # 辅助引入 monaco 编辑器的 html
│   │   ├── src/ # 前端源码目录
│   │   │   ├── App.vue # App 组件
Expand All @@ -36,14 +38,11 @@
│   │   │      ......
│   │   │   ├── css/ # 前端 css 目录
│   │   │       ......
│   │   │   ├── custom/ # 自定义组件的存放目录
│   │   │   │   ├── index.js # 自定义组件的入口文件,如增加自定义组件,需要在此文件中注册
│   │   │   │   ......
│   │   │   ├── element-materials/ # 基础组件的配置以及修改配置和页面渲染的逻辑
│   │   │   │      ......
│   │   │   ├── images/ # 前端使用的图片存放目录
│   │   │      .....
│   │   │   ├── mixins/ # 前端使用的 mixins
│   │   │   ├── preview/ # 前端预览模块 目录
│   │   │      ......
│   │   │   ├── router/ # 前端 router 目录
│   │   │      ......
Expand All @@ -65,12 +64,17 @@
│   │   ......
│   ├── model/ # 后端实体目录
│   │   ......
│   ├── project-template/ # 后端生成项目源码模板
│   │   ......
│   ├── router/ # 后端路由目录
│   │   ......
│   ├── service/ # 后端服务目录
│   │   ......
│   ├── utils/ # 后端utils 目录
│   │   ......
├── nodemon.json # nodemon 配置文件
├── package.json # 项目描述文件
├── forever.json # forever 配置文件
```

## 技术栈
Expand All @@ -82,18 +86,24 @@

## 依赖说明

#### 环境依赖
项目主要的依赖是目前常用的比较新的模块,webpack@4,babel@7,vue@2,koa@2 等。**运行的 nodejs 要求为 >= 8.9.0**

> 安装 Node.js 参见[官方文档](https://nodejs.org/)。安装完成后,注意设置 node 到 PATH 中
#### 服务依赖
- 蓝鲸社区版登录(必须):可视化平台的登录服务对接的是蓝鲸社区版登录,请事先搭建蓝鲸社区版环境
- 蓝鲸制品库服务(非必须): 若需要使用到平台的自定义组件功能开发模块,请事先搭建 [蓝鲸制品库服务](https://github.com/Tencent/bk-ci/tree/master/src/backend/storage/core)
- npm镜像仓库(非必须):若需要使用到平台的自定义组件功能开发模块,请事先搭建npm镜像仓库

## 分支说明
可视化开发平台使用 lesscode-develop, lesscode-master 两个分支进行迭代。其中 lesscode-master 为稳定版分支,每次 release 都会基于这个分支;lesscode-develop 为日常开发的分支,给可视化开发平台贡献代码统一向主库 [bk-PaaS](https://github.com/Tencent/bk-PaaS)[lesscode-develop](https://github.com/Tencent/bk-PaaS/tree/lesscode-develop) 分支提 pr。

## 安装部署
- [本地开发部署](./docs/install/dev_install.md)
- [生产环境部署](./docs/install/prod_install.md)
- [数据库说明](./docs/install/database.md)
- [配置文件说明](./docs/install/conf.md)

## 开发文档
- [自定义组件开发文档](./docs/develop/dev_com.md)
- [自定义组件管理文档](./docs/develop/release_com.md)
- [自定义组件开发和管理文档](./lib/client/src/views/help/docs/custom.md)
30 changes: 30 additions & 0 deletions paas-ce/lesscode/docs/install/conf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 蓝鲸智云PaaS平台社区版之可视化开发平台

## 配置文件说明

在将代码拉取到本地准备开发之前,需先将配置信息填写好,相应的配置文件都位于`lesscode/lib/server/conf`目录下,

- 其中必须配置的文件为data-base.js、db-migrate.json、http.js
- 可选的配置文件为npm.js和bk-repo.js

### 各配置文件说明如下:

#### data-base.js (用于数据库的连接)

`lesscode/lib/server/conf` 中新建 `data-base.js` 文件(复制 `data-base.js.example`,并删除 `.example`即可)。然后依照 [data-base.js.example](../../lib/server/conf/data-base.js.example) 的注释填写本地开发和线上运行时的数据库的配置信息。

#### lesscode/lib/server/conf/db-migrate.json (用于自动执行db导入和变更)

`lesscode/lib/server/conf` 中新建 `db-migrate.json` 文件(复制 `db-migrate.json.example`,并删除 `.example`即可)。然后依照 [db-migrate.json.example](../../lib/server/conf/db-migrate.json.example) 的注释填写本地开发和线上运行时的数据库的配置信息。

#### http.js (蓝鲸社区版相关配置)

`lesscode/lib/server/conf` 中新建 `http.js` 文件(复制 `http.js.example`,并删除 `.example`即可)。然后依照 [http.js.example](../../lib/server/conf/http.js.example) 的注释填写本地开发和线上运行时蓝鲸社区版的配置信息。

#### bk-repo.js (蓝鲸制品库相关配置,用到自定义组件功能时需填写,未用到则可以忽略此文件)

`lesscode/lib/server/conf` 中新建 `bk-repo.js` 文件(复制 `bk-repo.js.example`,并删除 `.example`即可)。然后依照 [bk-repo.js.example](../../lib/server/conf/bk-repo.js.example) 的注释填写本地开发和线上运行时蓝鲸制品库的配置信息。

#### npm.js (npm镜像仓库配置,用到自定义组件功能时需填写,未用到则可以忽略此文件)

`lesscode/lib/server/conf` 中新建 `npm.js` 文件(复制 `npm.js.example`,并删除 `.example`即可)。然后依照 [npm.js.example](../../lib/server/conf/npm.js.example) 的注释填写本地开发和线上运行时的npm镜像仓库的配置信息。
19 changes: 13 additions & 6 deletions paas-ce/lesscode/docs/install/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@

## 数据库说明

需要用户自己提供 MySQL 服务并做 db 授权。本地开发和生产环境的数据库初始化和变更流程是一样的,都需要自己执行SQL对数据库进行修改。执行 SQL 分两种,初始化时执行的 SQL 和升级时执行的 SQL。SQL 文件存放于 `lesscode/lib/server/model/sql` 文件夹下。
需要用户自己提供 MySQL 服务并做 db 授权。

可视化平台内置数据库自动导入和更新功能(db-migrate),程序每次启动时会自动执行数据库表结构的导入和更新操作,在同一个数据库内,内置的db-migrate框架会先检测每次的db变更是否已执行过,未执行过的db变更才会执行

相应的db初始化和变更文件可在`lesscode/lib/server/model/migrations/sql` 文件夹下查看

因此用户搭建好可用的MySQL服务,创建好相应数据库,按以下数据库配置说明配置好相应数据库信息即可

## 数据库配置说明

在本地开发和生产环境中,需要依照 [数据库配置示例](../../lib/server/conf/data-base.js.example)`lesscode/lib/server/conf` 中新建 `data-base.js` 文件(复制 `data-base.js.example`,并删除 `.example`即可)。然后依照 `data-base.js.example` 的注释填写数据库的配置信息。
数据库相关配置文件共有两个,分别是

#### lesscode/lib/server/conf/data-base.js (用于数据库的连接)

## 数据库初始化说明
`lesscode/lib/server/conf` 中新建 `data-base.js` 文件(复制 `data-base.js.example`,并删除 `.example`即可)。然后依照 [data-base.js.example](../../lib/server/conf/data-base.js.example) 的注释填写本地开发和线上运行时的数据库的配置信息。

`lesscode/lib/server/model/sql` 文件夹下,每次发版都会新建一个文件夹,以发布日期命名,里面的 `initial.sql` 为安装该版本需要的所有 SQL,包含了建表语句和初始化数据。初次安装的时候,需要手动执行该SQL,即完成了数据库初始化。注意:如果不是数据库初始化,执行该 SQL 会导致数据丢失。如果是升级,请按照数据库表结构变更来操作。
#### lesscode/lib/server/conf/db-migrate.json (用于自动执行db导入和变更)

## 数据库表结构变更说明
`lesscode/lib/server/conf` 中新建 `db-migrate.json` 文件(复制 `db-migrate.json.example`,并删除 `.example`即可)。然后依照 [db-migrate.json.example](../../lib/server/conf/db-migrate.json.example) 的注释填写本地开发和线上运行时的数据库的配置信息。

`lesscode/lib/server/model/sql` 文件夹下,每次发布还会生成 `update.sql``update.sql` 是从上一个版本升级到这个版本的 SQL 语句,包含了修改表结构语句和初始化数据。如果这次升级数据库,跨越了3个版本,那么这3个版本的 `update.sql` 需要按照版本顺序都执行一次,即完成了数据库表结构变更。
2 changes: 1 addition & 1 deletion paas-ce/lesscode/forever.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"logFile": "./logs/forever.log",
"outFile": "./logs/out.log",
"errFile": "./logs/err.log"
}
}
9 changes: 5 additions & 4 deletions paas-ce/lesscode/lib/client/build/build-dll.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ora = require('ora')
const fse = require('fs-extra')

const clientConf = require('./conf')
const { pathToNodeModules } = require('./util')

const manifestExist = fse.pathExistsSync(resolve(__dirname, '..', 'static', 'lib-manifest.json'))
const bundleExist = fse.pathExistsSync(resolve(__dirname, '..', 'static', 'lib.bundle.js'))
Expand All @@ -26,10 +27,10 @@ const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development
if (!(manifestExist & bundleExist)) {
// 需要打包到一起的 js 文件
const vendors = [
resolve(__dirname, '../../../node_modules', 'vue'),
resolve(__dirname, '../../../node_modules', 'vuex'),
resolve(__dirname, '../../../node_modules', 'vue-router'),
resolve(__dirname, '../../../node_modules', 'axios')
resolve(__dirname, pathToNodeModules, 'vue'),
resolve(__dirname, pathToNodeModules, 'vuex'),
resolve(__dirname, pathToNodeModules, 'vue-router'),
resolve(__dirname, pathToNodeModules, 'axios')
]

const clientDLLConf = {
Expand Down
15 changes: 10 additions & 5 deletions paas-ce/lesscode/lib/client/build/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,33 @@ module.exports = {
build: {
env: {
'process.env': {
'NODE_ENV': JSON.stringify(NODE_ENV)
'NODE_ENV': JSON.stringify(NODE_ENV),
'V3_ENV': JSON.stringify(process.env.BKPAAS_ENVIRONMENT || 'prod')
},
NODE_ENV: JSON.stringify(NODE_ENV),
APP_CODE: JSON.stringify(APP_CODE),
// AJAX_URL_PREFIX: NODE_ENV === 'local' ? JSON.stringify('/api') : JSON.stringify(`/${APP_CODE}/api`)
AJAX_URL_PREFIX: JSON.stringify('/api'),
ENV: JSON.stringify(ENV)

},
assetsPublicPath: '{{STATIC_URL}}',
staticUrl: '/static'
staticUrl: '/static',
BKPAAS_ENVIRONMENT: 'stag'
},
dev: {
env: {
'process.env': {
'NODE_ENV': JSON.stringify(NODE_ENV)
'NODE_ENV': JSON.stringify(NODE_ENV),
'V3_ENV': JSON.stringify('dev')
},
NODE_ENV: JSON.stringify(NODE_ENV),
APP_CODE: JSON.stringify(APP_CODE),
AJAX_URL_PREFIX: JSON.stringify('/api'),
ENV: JSON.stringify(ENV)

},
assetsPublicPath: '/',
staticUrl: '/static'
staticUrl: '/static',
BKPAAS_ENVIRONMENT: 'stag'
}
}
52 changes: 52 additions & 0 deletions paas-ce/lesscode/lib/client/build/md-highlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* @file highlight.js markdown-it 插件
* https://github.com/valeriangalliat/markdown-it-highlightjs/
*/
const hljs = require('./md-hljs')

const maybe = f => {
try {
return f()
} catch (e) {
return false
}
}

// Highlight with given language.
const highlight = (code, lang) =>
maybe(() => hljs.highlight(lang, code, true).value) || ''

// Highlight with given language or automatically.
const highlightAuto = (code, lang) =>
lang
? highlight(code, lang)
: maybe(() => hljs.highlightAuto(code).value) || ''

// Wrap a render function to add `hljs` class to code blocks.
const wrap = render =>
function (...args) {
return render.apply(this, args)
.replace('<code class="', '<code class="hljs ')
.replace('<code>', '<code class="hljs">')
}

const highlightjs = (md, opts) => {
opts = Object.assign({}, highlightjs.defaults, opts)

md.renderer.rules.table_open = () => '<table class="table">'

md.options.highlight = opts.auto ? highlightAuto : highlight
md.renderer.rules.fence = wrap(md.renderer.rules.fence)

if (opts.code) {
md.renderer.rules.code_block = wrap(md.renderer.rules.code_block)
}
}

highlightjs.defaults = {
auto: true,
code: true
}

module.exports = highlightjs
16 changes: 16 additions & 0 deletions paas-ce/lesscode/lib/client/build/md-hljs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @file highlight.js 设置高亮语言默认的加载的语言太多了
*
* Copyright © 2012-2019 Tencent BlueKing. All Rights Reserved. 蓝鲸智云 版权所有
*/

const hljs = require('highlight.js/lib/highlight')
const bash = require('highlight.js/lib/languages/bash')
const css = require('highlight.js/lib/languages/css')
const javascript = require('highlight.js/lib/languages/javascript')

hljs.registerLanguage('bash', bash)
hljs.registerLanguage('css', css)
hljs.registerLanguage('javascript', javascript)

module.exports = hljs
2 changes: 2 additions & 0 deletions paas-ce/lesscode/lib/client/build/md-loader-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { slugify } = require('transliteration')

const { strip } = require('./strip-tags')
const markdownItReplace = require('./markdown-it-replace')
const markdownItHighlightjs = require('./md-highlight')

const convert = str => {
str = str.replace(/(&#x)(\w{4});/gi, () => String.fromCharCode(
Expand Down Expand Up @@ -69,6 +70,7 @@ module.exports = {
}
}],
// [markdownItReplaceLink],
[markdownItHighlightjs],
[markdownItAttrs],
[markdownItAnchor, {
level: 3,
Expand Down
1 change: 0 additions & 1 deletion paas-ce/lesscode/lib/client/build/postcss-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module.exports = function (loader) {
// see https://github.com/csstools/postcss-preset-env#options
stage: 0,
autoprefixer: {
grid: true
}
}),
// 这个插件可以在写 nested 样式时省略开头的 &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const dealCSS = compilation => {
continue
}

if (fileName.indexOf('static/init-code') > -1) {
continue
}

const asset = compilation.assets[fileName]
const minifyCSSFileContent = asset.source().replace(
/\{\{STATIC_URL\}\}/g,
Expand Down
Loading

0 comments on commit b18423a

Please sign in to comment.