mirror of
https://github.com/YMFE/yapi.git
synced 2025-02-17 13:49:43 +08:00
chore: Merge branch hotfix
This commit is contained in:
commit
ed6771a25a
139
.prettierrc.js
Normal file
139
.prettierrc.js
Normal file
@ -0,0 +1,139 @@
|
||||
module.exports = {
|
||||
/**
|
||||
* 设置prettier单行输出(不折行)的(最大)长度。
|
||||
* 出于代码的可读性,我们不推荐(单行)超过80个字符的coding方式。
|
||||
* 如果在格式markdown时,不想折行,请设置 prose wrap参数来禁止这一行为。
|
||||
* default: 80
|
||||
*/
|
||||
printWidth: 100,
|
||||
|
||||
/**
|
||||
* 设置工具每一个水平缩进的空格数
|
||||
* default: 2
|
||||
*/
|
||||
// tabWidth: 4,
|
||||
|
||||
/**
|
||||
* 使用tab(制表位)缩进而非空格;
|
||||
* default: false
|
||||
*/
|
||||
useTabs: false,
|
||||
|
||||
/**
|
||||
* 在语句末尾添加分号;
|
||||
* 有效参数:
|
||||
* true - 在每一条语句后面添加分号
|
||||
* false - 只在有可能导致ASI错误的行首添加分号
|
||||
* default: true
|
||||
*/
|
||||
semi: true,
|
||||
|
||||
/**
|
||||
* 使用单引号而非双引号;
|
||||
* 在JSX语法中,所有引号均为双引号,该设置在JSX中被自动忽略
|
||||
* default: false
|
||||
*/
|
||||
singleQuote: true,
|
||||
|
||||
/**
|
||||
* default: "as-needed"
|
||||
*/
|
||||
quoteProps: "as-needed",
|
||||
|
||||
/**
|
||||
* default: false
|
||||
*/
|
||||
jsxSingleQuote: true,
|
||||
|
||||
/**
|
||||
* 在任何可能的多行中输入尾逗号。
|
||||
* none - 无尾逗号;
|
||||
* es5 - 添加es5中被支持的尾逗号;
|
||||
* all - 所有可能的地方都被添加尾逗号;(包括函数参数),这个参数需要安装nodejs8或更高版本;
|
||||
* default: "none"
|
||||
*/
|
||||
trailingComma: "none",
|
||||
|
||||
/**
|
||||
* 在对象字面量声明所使用的的花括号后({)和前(})输出空格
|
||||
* true - Example: { foo: bar }
|
||||
* false - Example: {foo: bar}
|
||||
* default: true
|
||||
*/
|
||||
bracketSpacing: true,
|
||||
|
||||
/**
|
||||
* 在多行JSX元素最后一行的末尾添加 > 而使 > 单独一行(不适用于自闭和元素)
|
||||
* true - Example:
|
||||
* <br
|
||||
* onClick={this.handleClick} />
|
||||
* false - Example:
|
||||
* <br
|
||||
* onClick={this.handleClick}
|
||||
* />
|
||||
* default: false
|
||||
*/
|
||||
jsxBracketSameLine: false,
|
||||
|
||||
/**
|
||||
* 为单行箭头函数的参数添加圆括号。
|
||||
* avoid - 尽可能不添加圆括号,示例:x => x
|
||||
* always - 总是添加圆括号,示例: (x) => x
|
||||
* default: "avoid"
|
||||
*/
|
||||
arrowParens: "avoid",
|
||||
|
||||
/**
|
||||
* 只格式化某个文件的一部分;
|
||||
* 这两个参数可以用于从指定起止偏移字符(单独指定开始或结束、两者同时指定、分别指定)格式化代码。
|
||||
* 一下情况,范围将会扩展:
|
||||
* 回退至包含选中语句的第一行的开始
|
||||
* 向前直到选中语句的末尾
|
||||
* 注意:这些参数不可以同 cursorOffset 共用;
|
||||
* default: 0, Infinity
|
||||
*/
|
||||
rangeStart: 0,
|
||||
rangeEnd: Infinity,
|
||||
|
||||
/**
|
||||
* 指定使用哪一种解析器。 docs: https://prettier.io/docs/en/options.html#parser
|
||||
* default: None
|
||||
*/
|
||||
// parser: "None",
|
||||
|
||||
/**
|
||||
* Prettier可以严格按照按照文件顶部的一些特殊的注释格式化代码,这些注释
|
||||
* 称为“require pragma”(必须杂注)。这在逐步格式化一些大型、未经格式化过的代码是十分有用的。
|
||||
* 示例: https://prettier.io/docs/en/options.html#require-pragma
|
||||
* default: false
|
||||
*/
|
||||
requirePragma: false,
|
||||
|
||||
/**
|
||||
* Prettier可以在文件的顶部插入一个 @format的特殊注释,以表明改文件已经被Prettier格式化过了。
|
||||
* 在使用 --require-pragma 参数处理一连串的文件时这个功能将十分有用。如果文件顶部
|
||||
* 已经有一个doclock,这个选项将新建一行注释,并打上@format标记。
|
||||
* default: false
|
||||
*/
|
||||
insertPragma: false,
|
||||
|
||||
/**
|
||||
* 默认情况下,Prettier会因为使用了一些折行敏感型的渲染器(如GitHub comment 和 BitBucket)而按照markdown文本样式进行折行,但在某些情况下,你可能只是希望这个文本在编译器或查看器中soft-wrapping(是当屏幕放不下时发生的软折行),所以这一参数允许设置为 " never "
|
||||
* 有效参数:
|
||||
* always - 当超出print width(上面有这个参数)时就折行
|
||||
* never - 不折行
|
||||
* perserve - 按照文件原样折行 (v1.9.0+)
|
||||
* default: "preserve"
|
||||
*/
|
||||
proseWrap: "preserve",
|
||||
|
||||
/**
|
||||
* default: "css"
|
||||
*/
|
||||
htmlWhitespaceSensitivity: "css",
|
||||
|
||||
/**
|
||||
* default: "auto"
|
||||
*/
|
||||
endOfLine: "auto"
|
||||
};
|
18
CHANGELOG.md
18
CHANGELOG.md
@ -1,3 +1,21 @@
|
||||
## [1.10.2](https://github.com/YMFE/yapi/compare/v1.10.1...v1.10.2) (2021-10-13)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [2361] 修复所有分类被删除时,同步问题. 解决方案: 增加 "默认分类" ([01207e2](https://github.com/YMFE/yapi/commit/01207e29cdceba2ea783d6e06b983cc34b283d51))
|
||||
* issues 2357 ([5bab76c](https://github.com/YMFE/yapi/commit/5bab76c14429e7fb46f16d7b0d06851cf98b82e1))
|
||||
|
||||
### Features
|
||||
|
||||
* add nonexistent tags from `/interface/(add/up/save)` ([#1918](https://github.com/YMFE/yapi/issues/1918)) ([4d24c39](https://github.com/YMFE/yapi/commit/4d24c397483d2703e85c6977236270f52edf2d70))
|
||||
|
||||
## 1.10.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复沙盒漏洞
|
||||
|
||||
|
||||
## v1.9.2
|
||||
* fix: 修复高级 mock 无效的bug
|
||||
* opti: 对登录 email 空格的过滤
|
||||
|
@ -10,6 +10,7 @@ if(!version){
|
||||
|
||||
shell.exec ('npm install --registry https://registry.npm.taobao.org');
|
||||
shell.exec ('npm run build-client');
|
||||
shell.exec ('npm run changelog');
|
||||
shell.exec ('git add .');
|
||||
shell.exec ('git commit -a -m "chore: update static file"');
|
||||
|
||||
|
2394
package-lock.json
generated
2394
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yapi-vendor",
|
||||
"version": "1.10.1",
|
||||
"version": "1.10.2",
|
||||
"description": "YAPI",
|
||||
"main": "server/app.js",
|
||||
"scripts": {
|
||||
@ -11,6 +11,7 @@
|
||||
"dev": "npm run dev-server & npm run dev-client",
|
||||
"start": " node server/app.js",
|
||||
"test": "ava",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
"build-client": "NODE_ENV=production ykit pack -m",
|
||||
"npm-publish": "node ./npm-publish.js",
|
||||
"docs": "ydoc build"
|
||||
@ -108,6 +109,7 @@
|
||||
"brace": "^0.10.0",
|
||||
"buffer-shims": "^1.0.0",
|
||||
"compression-webpack-plugin": "^1.0.0",
|
||||
"conventional-changelog-cli": "^2.1.1",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"core-decorators": "^0.17.0",
|
||||
"css-loader": "^0.28.4",
|
||||
|
@ -297,6 +297,8 @@ class interfaceController extends baseController {
|
||||
this.projectModel.up(params.project_id, { up_time: new Date().getTime() }).then();
|
||||
});
|
||||
|
||||
await this.autoAddTag(params);
|
||||
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}
|
||||
|
||||
@ -387,6 +389,45 @@ class interfaceController extends baseController {
|
||||
// return ctx.body = yapi.commons.resReturn(null, 400, 'path第一位必需为 /, 只允许由 字母数字-/_:.! 组成');
|
||||
}
|
||||
|
||||
async autoAddTag(params) {
|
||||
//检查是否提交了目前不存在的tag
|
||||
let tags = params.tag;
|
||||
if (tags && Array.isArray(tags) && tags.length > 0) {
|
||||
let projectData = await this.projectModel.get(params.project_id);
|
||||
let tagsInProject = projectData.tag;
|
||||
let needUpdate = false;
|
||||
if (tagsInProject && Array.isArray(tagsInProject) && tagsInProject.length > 0) {
|
||||
tags.forEach(tag => {
|
||||
if (!_.find(tagsInProject, item => {
|
||||
return item.name === tag;
|
||||
})) {//tag不存在
|
||||
needUpdate = true;
|
||||
tagsInProject.push({
|
||||
name: tag,
|
||||
desc: tag
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
needUpdate = true
|
||||
tagsInProject = []
|
||||
tags.forEach(tag => {
|
||||
tagsInProject.push({
|
||||
name: tag,
|
||||
desc: tag
|
||||
});
|
||||
});
|
||||
}
|
||||
if (needUpdate) {//需要更新tag
|
||||
let data = {
|
||||
tag: tagsInProject,
|
||||
up_time: yapi.commons.time()
|
||||
};
|
||||
await this.projectModel.up(params.project_id, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目分组
|
||||
* @interface /interface/get
|
||||
@ -781,6 +822,8 @@ class interfaceController extends baseController {
|
||||
}
|
||||
|
||||
yapi.emitHook('interface_update', id).then();
|
||||
await this.autoAddTag(params);
|
||||
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
return 1;
|
||||
}
|
||||
|
@ -122,6 +122,22 @@ class openController extends baseController {
|
||||
}
|
||||
|
||||
let menuList = await this.interfaceCatModel.list(project_id);
|
||||
/**
|
||||
* 防止分类被都被删除时取不到 selectCatid
|
||||
* 如果没有分类,增加一个默认分类
|
||||
*/
|
||||
if (menuList.length === 0) {
|
||||
const catInst = yapi.getInst(interfaceCatModel);
|
||||
const menu = await catInst.save({
|
||||
name: '默认分类',
|
||||
project_id: project_id,
|
||||
desc: '默认分类',
|
||||
uid: this.getUid(),
|
||||
add_time: yapi.commons.time(),
|
||||
up_time: yapi.commons.time()
|
||||
});
|
||||
menuList.push(menu);
|
||||
}
|
||||
let selectCatid = menuList[0]._id;
|
||||
let projectData = await this.projectModel.get(project_id);
|
||||
let res = await importDataModule[type](content);
|
||||
|
@ -26,6 +26,15 @@ function connect(callback) {
|
||||
options.pass = config.db.pass;
|
||||
}
|
||||
|
||||
if (config.db.reconnectTries) {
|
||||
options.reconnectTries = config.db.reconnectTries;
|
||||
}
|
||||
|
||||
if (config.db.reconnectInterval) {
|
||||
options.reconnectInterval = config.db.reconnectInterval;
|
||||
}
|
||||
|
||||
|
||||
options = Object.assign({}, options, config.db.options)
|
||||
|
||||
var connectString = '';
|
||||
|
@ -7,6 +7,7 @@ module.exports = async function sandboxFn(context, script) {
|
||||
asyncTimeout: 60000
|
||||
})
|
||||
|
||||
script += "; return this;";
|
||||
// 执行动态代码
|
||||
const result = await safeVm.run(script, context)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
window.WEBPACK_ASSETS = {"index.js":{"js":"index@e45a4de49431db58f52c.js","css":"index@e45a4de49431db58f52c.css"},"lib":{"js":"lib@aaed0f9bfcc4ff921c5a.js"},"lib2":{"js":"lib2@819909a89ca45b94d9bf.js"},"lib3":{"js":"lib3@93b22d7460620277a5da.js"},"manifest":{"js":"manifest@f2f4bd774d6c221b3d5f.js"}}
|
||||
window.WEBPACK_ASSETS = {"index.js":{"js":"index@40d464d7fa4bb1bea815.js","css":"index@40d464d7fa4bb1bea815.css"},"lib":{"js":"lib@aaed0f9bfcc4ff921c5a.js"},"lib2":{"js":"lib2@819909a89ca45b94d9bf.js"},"lib3":{"js":"lib3@93b22d7460620277a5da.js"},"manifest":{"js":"manifest@f2f4bd774d6c221b3d5f.js"}}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
1054
test/swagger.v2.json
Normal file
1054
test/swagger.v2.json
Normal file
File diff suppressed because it is too large
Load Diff
1027
test/swagger.v3.json
Normal file
1027
test/swagger.v3.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user