@pisell/common 0.0.19 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.fatherrc.ts +7 -0
- package/CHANGELOG.md +7 -0
- package/README.md +1 -38
- package/{lib/components → es}/button/index.d.ts +5 -4
- package/es/button/index.d.ts.map +1 -0
- package/es/button/index.js +33 -0
- package/{es/components → lib}/button/index.d.ts +5 -4
- package/lib/button/index.d.ts.map +1 -0
- package/lib/{components/avatar → button}/index.js +14 -11
- package/package.json +20 -77
- package/src/button/index.md +17 -0
- package/src/button/index.tsx +38 -0
- package/tsconfig.json +14 -0
- package/LICENSE +0 -21
- package/es/bin/pisell.js +0 -2
- package/es/business-components/colorInput/index.d.ts +0 -21
- package/es/business-components/colorInput/index.js +0 -43
- package/es/business-components/colorInput/index.less +0 -10
- package/es/business-components/index.d.ts +0 -11
- package/es/business-components/index.js +0 -7
- package/es/business-components/rechargeOption/index.d.ts +0 -36
- package/es/business-components/rechargeOption/index.js +0 -132
- package/es/business-components/rechargeOption/index.less +0 -0
- package/es/business-components/selectTag/index.d.ts +0 -25
- package/es/business-components/selectTag/index.js +0 -179
- package/es/business-components/selectTag/index.less +0 -22
- package/es/business-components/sortModal/index.d.ts +0 -30
- package/es/business-components/sortModal/index.js +0 -85
- package/es/business-components/sortModal/index.less +0 -29
- package/es/business-components/statistics/index.d.ts +0 -12
- package/es/business-components/statistics/index.js +0 -38
- package/es/business-components/statistics/index.less +0 -64
- package/es/business-components/tagModal/index.d.ts +0 -17
- package/es/business-components/tagModal/index.js +0 -58
- package/es/business-hooks/index.d.ts +0 -2
- package/es/business-hooks/index.js +0 -2
- package/es/business-hooks/useModal/index.d.ts +0 -31
- package/es/business-hooks/useModal/index.js +0 -91
- package/es/business-hooks/useModal/index.less +0 -0
- package/es/business-hooks/useTagModal/index.d.ts +0 -17
- package/es/business-hooks/useTagModal/index.js +0 -47
- package/es/components/ColorPicker/index.d.ts +0 -22
- package/es/components/ColorPicker/index.js +0 -51
- package/es/components/ColorPicker/index.less +0 -17
- package/es/components/DragSort/index.d.ts +0 -2
- package/es/components/DragSort/index.js +0 -68
- package/es/components/EditorPreview/index.d.ts +0 -5
- package/es/components/EditorPreview/index.js +0 -14
- package/es/components/EditorPreview/index.less +0 -81
- package/es/components/Iconfont/index.d.ts +0 -6
- package/es/components/Iconfont/index.js +0 -29
- package/es/components/Iconfont/index.less +0 -0
- package/es/components/agreement/Detail/index.d.ts +0 -3
- package/es/components/agreement/Detail/index.js +0 -77
- package/es/components/agreement/Detail/serve.d.ts +0 -1
- package/es/components/agreement/Detail/serve.js +0 -6
- package/es/components/agreement/index.d.ts +0 -11
- package/es/components/agreement/index.js +0 -45
- package/es/components/agreement/index.less +0 -20
- package/es/components/avatar/index.d.ts +0 -13
- package/es/components/avatar/index.js +0 -25
- package/es/components/button/index.js +0 -36
- package/es/components/card/index.d.ts +0 -5
- package/es/components/card/index.js +0 -16
- package/es/components/card/index.less +0 -9
- package/es/components/checkbox/index.d.ts +0 -20
- package/es/components/checkbox/index.js +0 -43
- package/es/components/configProvider/index.d.ts +0 -113
- package/es/components/configProvider/index.js +0 -114
- package/es/components/datePicker/index.d.ts +0 -9
- package/es/components/datePicker/index.js +0 -17
- package/es/components/index.d.ts +0 -30
- package/es/components/index.js +0 -16
- package/es/components/input/index.d.ts +0 -35
- package/es/components/input/index.js +0 -97
- package/es/components/inputNumber/index.d.ts +0 -9
- package/es/components/inputNumber/index.js +0 -17
- package/es/components/pagination/index.d.ts +0 -10
- package/es/components/pagination/index.js +0 -18
- package/es/components/radio/index.d.ts +0 -13
- package/es/components/radio/index.js +0 -28
- package/es/components/select/index.d.ts +0 -9
- package/es/components/select/index.js +0 -17
- package/es/components/switch/index.d.ts +0 -10
- package/es/components/switch/index.js +0 -18
- package/es/config/index.d.ts +0 -30
- package/es/config/index.js +0 -18
- package/es/config/request.d.ts +0 -7
- package/es/config/request.js +0 -67
- package/es/config/utils.d.ts +0 -0
- package/es/config/utils.js +0 -0
- package/es/hooks/index.d.ts +0 -8
- package/es/hooks/index.js +0 -8
- package/es/hooks/useCountDown/index.d.ts +0 -10
- package/es/hooks/useCountDown/index.js +0 -48
- package/es/hooks/useDocumentScroll/index.d.ts +0 -8
- package/es/hooks/useDocumentScroll/index.js +0 -41
- package/es/hooks/useDocumentScroll/index.less +0 -0
- package/es/hooks/useMousemove/index.d.ts +0 -8
- package/es/hooks/useMousemove/index.js +0 -61
- package/es/hooks/useResponsive/index.d.ts +0 -2
- package/es/hooks/useResponsive/index.js +0 -29
- package/es/hooks/useResponsive/index.less +0 -0
- package/es/hooks/useSize/index.d.ts +0 -2
- package/es/hooks/useSize/index.js +0 -27
- package/es/hooks/useSize/index.less +0 -0
- package/es/hooks/useStateMulti/index.d.ts +0 -2
- package/es/hooks/useStateMulti/index.js +0 -29
- package/es/hooks/useStateWithCb/index.d.ts +0 -2
- package/es/hooks/useStateWithCb/index.js +0 -42
- package/es/hooks/useTable/index.d.ts +0 -12
- package/es/hooks/useTable/index.js +0 -74
- package/es/hooks/useTable/index.less +0 -0
- package/es/hooks/useTableModal/index.d.ts +0 -12
- package/es/hooks/useTableModal/index.js +0 -25
- package/es/hooks/useTableModal/index.less +0 -0
- package/es/hooks/useUrlState/index.d.ts +0 -2
- package/es/hooks/useUrlState/index.js +0 -56
- package/es/hooks/useWebSocket/index.d.ts +0 -13
- package/es/hooks/useWebSocket/index.js +0 -121
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- package/es/locales/en-US.d.ts +0 -11
- package/es/locales/en-US.js +0 -10
- package/es/locales/index.d.ts +0 -1
- package/es/locales/index.js +0 -23
- package/es/locales/zh-CN.d.ts +0 -11
- package/es/locales/zh-CN.js +0 -10
- package/es/locales/zh-TW.d.ts +0 -11
- package/es/locales/zh-TW.js +0 -10
- package/es/script/constants/index.js +0 -8
- package/es/script/deploy.js +0 -47
- package/es/script/index.js +0 -40
- package/es/script/package.json +0 -4
- package/es/script/release/index.js +0 -161
- package/es/script/release/release.js +0 -163
- package/es/script/uploadCode/index.js +0 -278
- package/es/script/uploadCode/uploadCode.js +0 -401
- package/es/script/utils/index.js +0 -321
- package/es/utils/index.d.ts +0 -3
- package/es/utils/index.js +0 -3
- package/es/utils/otherUtils.d.ts +0 -8
- package/es/utils/otherUtils.js +0 -12
- package/es/utils/storage.d.ts +0 -30
- package/es/utils/storage.js +0 -70
- package/es/utils/typeUtils.d.ts +0 -42
- package/es/utils/typeUtils.js +0 -86
- package/lib/bin/pisell.js +0 -26
- package/lib/business-components/colorInput/index.d.ts +0 -21
- package/lib/business-components/colorInput/index.js +0 -70
- package/lib/business-components/colorInput/index.less +0 -10
- package/lib/business-components/index.d.ts +0 -11
- package/lib/business-components/index.js +0 -54
- package/lib/business-components/rechargeOption/index.d.ts +0 -36
- package/lib/business-components/rechargeOption/index.js +0 -112
- package/lib/business-components/rechargeOption/index.less +0 -0
- package/lib/business-components/selectTag/index.d.ts +0 -25
- package/lib/business-components/selectTag/index.js +0 -181
- package/lib/business-components/selectTag/index.less +0 -22
- package/lib/business-components/sortModal/index.d.ts +0 -30
- package/lib/business-components/sortModal/index.js +0 -100
- package/lib/business-components/sortModal/index.less +0 -29
- package/lib/business-components/statistics/index.d.ts +0 -12
- package/lib/business-components/statistics/index.js +0 -63
- package/lib/business-components/statistics/index.less +0 -64
- package/lib/business-components/tagModal/index.d.ts +0 -17
- package/lib/business-components/tagModal/index.js +0 -66
- package/lib/business-hooks/index.d.ts +0 -2
- package/lib/business-hooks/index.js +0 -42
- package/lib/business-hooks/useModal/index.d.ts +0 -31
- package/lib/business-hooks/useModal/index.js +0 -68
- package/lib/business-hooks/useModal/index.less +0 -0
- package/lib/business-hooks/useTagModal/index.d.ts +0 -17
- package/lib/business-hooks/useTagModal/index.js +0 -61
- package/lib/components/ColorPicker/index.d.ts +0 -22
- package/lib/components/ColorPicker/index.js +0 -80
- package/lib/components/ColorPicker/index.less +0 -17
- package/lib/components/DragSort/index.d.ts +0 -2
- package/lib/components/DragSort/index.js +0 -101
- package/lib/components/EditorPreview/index.d.ts +0 -5
- package/lib/components/EditorPreview/index.js +0 -37
- package/lib/components/EditorPreview/index.less +0 -81
- package/lib/components/Iconfont/index.d.ts +0 -6
- package/lib/components/Iconfont/index.js +0 -48
- package/lib/components/Iconfont/index.less +0 -0
- package/lib/components/agreement/Detail/index.d.ts +0 -3
- package/lib/components/agreement/Detail/index.js +0 -86
- package/lib/components/agreement/Detail/serve.d.ts +0 -1
- package/lib/components/agreement/Detail/serve.js +0 -30
- package/lib/components/agreement/index.d.ts +0 -11
- package/lib/components/agreement/index.js +0 -82
- package/lib/components/agreement/index.less +0 -20
- package/lib/components/avatar/index.d.ts +0 -13
- package/lib/components/button/index.js +0 -36
- package/lib/components/card/index.d.ts +0 -5
- package/lib/components/card/index.js +0 -42
- package/lib/components/card/index.less +0 -9
- package/lib/components/checkbox/index.d.ts +0 -20
- package/lib/components/checkbox/index.js +0 -36
- package/lib/components/configProvider/index.d.ts +0 -113
- package/lib/components/configProvider/index.js +0 -159
- package/lib/components/datePicker/index.d.ts +0 -9
- package/lib/components/datePicker/index.js +0 -31
- package/lib/components/index.d.ts +0 -30
- package/lib/components/index.js +0 -83
- package/lib/components/input/index.d.ts +0 -35
- package/lib/components/input/index.js +0 -53
- package/lib/components/inputNumber/index.d.ts +0 -9
- package/lib/components/inputNumber/index.js +0 -31
- package/lib/components/pagination/index.d.ts +0 -10
- package/lib/components/pagination/index.js +0 -42
- package/lib/components/radio/index.d.ts +0 -13
- package/lib/components/radio/index.js +0 -36
- package/lib/components/select/index.d.ts +0 -9
- package/lib/components/select/index.js +0 -36
- package/lib/components/switch/index.d.ts +0 -10
- package/lib/components/switch/index.js +0 -42
- package/lib/config/index.d.ts +0 -30
- package/lib/config/index.js +0 -39
- package/lib/config/request.d.ts +0 -7
- package/lib/config/request.js +0 -76
- package/lib/config/utils.d.ts +0 -0
- package/lib/config/utils.js +0 -0
- package/lib/hooks/index.d.ts +0 -8
- package/lib/hooks/index.js +0 -57
- package/lib/hooks/useCountDown/index.d.ts +0 -10
- package/lib/hooks/useCountDown/index.js +0 -57
- package/lib/hooks/useDocumentScroll/index.d.ts +0 -8
- package/lib/hooks/useDocumentScroll/index.js +0 -54
- package/lib/hooks/useDocumentScroll/index.less +0 -0
- package/lib/hooks/useMousemove/index.d.ts +0 -8
- package/lib/hooks/useMousemove/index.js +0 -70
- package/lib/hooks/useResponsive/index.d.ts +0 -2
- package/lib/hooks/useResponsive/index.js +0 -47
- package/lib/hooks/useResponsive/index.less +0 -0
- package/lib/hooks/useSize/index.d.ts +0 -2
- package/lib/hooks/useSize/index.js +0 -45
- package/lib/hooks/useSize/index.less +0 -0
- package/lib/hooks/useStateMulti/index.d.ts +0 -2
- package/lib/hooks/useStateMulti/index.js +0 -43
- package/lib/hooks/useStateWithCb/index.d.ts +0 -2
- package/lib/hooks/useStateWithCb/index.js +0 -53
- package/lib/hooks/useTable/index.d.ts +0 -12
- package/lib/hooks/useTable/index.js +0 -75
- package/lib/hooks/useTable/index.less +0 -0
- package/lib/hooks/useTableModal/index.d.ts +0 -12
- package/lib/hooks/useTableModal/index.js +0 -43
- package/lib/hooks/useTableModal/index.less +0 -0
- package/lib/hooks/useUrlState/index.d.ts +0 -2
- package/lib/hooks/useUrlState/index.js +0 -59
- package/lib/hooks/useWebSocket/index.d.ts +0 -13
- package/lib/hooks/useWebSocket/index.js +0 -91
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -22
- package/lib/locales/en-US.d.ts +0 -11
- package/lib/locales/en-US.js +0 -36
- package/lib/locales/index.d.ts +0 -1
- package/lib/locales/index.js +0 -59
- package/lib/locales/zh-CN.d.ts +0 -11
- package/lib/locales/zh-CN.js +0 -36
- package/lib/locales/zh-TW.d.ts +0 -11
- package/lib/locales/zh-TW.js +0 -36
- package/lib/script/constants/index.js +0 -35
- package/lib/script/deploy.js +0 -61
- package/lib/script/index.js +0 -61
- package/lib/script/package.json +0 -4
- package/lib/script/release/index.js +0 -116
- package/lib/script/release/release.js +0 -89
- package/lib/script/uploadCode/index.js +0 -202
- package/lib/script/uploadCode/uploadCode.js +0 -208
- package/lib/script/utils/index.js +0 -248
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +0 -21
- package/lib/utils/otherUtils.d.ts +0 -8
- package/lib/utils/otherUtils.js +0 -31
- package/lib/utils/storage.d.ts +0 -30
- package/lib/utils/storage.js +0 -63
- package/lib/utils/typeUtils.d.ts +0 -42
- package/lib/utils/typeUtils.js +0 -75
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/script/uploadCode/uploadCode.js
|
|
30
|
-
var uploadCode_exports = {};
|
|
31
|
-
__export(uploadCode_exports, {
|
|
32
|
-
default: () => uploadCode_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(uploadCode_exports);
|
|
35
|
-
var import_archiver = __toESM(require("archiver"));
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_constants = require("../constants/index.js");
|
|
38
|
-
var import_utils = require("../utils/index.js");
|
|
39
|
-
var UploadCode = class {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
const { project, env, version, changelog, is_release } = props;
|
|
42
|
-
this.projectName = project.fileName;
|
|
43
|
-
this.projectRelativePath = project.path;
|
|
44
|
-
this.env = env;
|
|
45
|
-
this.version = version;
|
|
46
|
-
this.changelog = changelog;
|
|
47
|
-
this.is_release = is_release;
|
|
48
|
-
this.currentVersion = "";
|
|
49
|
-
this.projectAbsolutePath = "";
|
|
50
|
-
this.conn = null;
|
|
51
|
-
this.serverConfig = null;
|
|
52
|
-
this.outPath = import_constants.outPathMap[this.projectName][this.env];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @Title: 设置服务器连接配置
|
|
56
|
-
* @Describe:
|
|
57
|
-
* @Author: Zsj
|
|
58
|
-
*/
|
|
59
|
-
setConfig(serverConfig) {
|
|
60
|
-
this.serverConfig = serverConfig;
|
|
61
|
-
return this.serverConfig;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @Title: 发布前检查环境和参数是否正确
|
|
65
|
-
* @Describe:
|
|
66
|
-
* @Author: Zsj
|
|
67
|
-
*/
|
|
68
|
-
async check() {
|
|
69
|
-
const serverConfigMap = await (0, import_utils.getServerConfig)();
|
|
70
|
-
if (!serverConfigMap) {
|
|
71
|
-
console.log("未找到发布脚本!");
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
cd(this.projectRelativePath);
|
|
75
|
-
this.projectAbsolutePath = process.cwd();
|
|
76
|
-
if (!await (0, import_utils.isWorkingTreeClean)()) {
|
|
77
|
-
console.log("工作区不干净, 请先提交代码");
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
let serverConfig = this.setConfig(serverConfigMap[this.env]);
|
|
81
|
-
if (this.env === "prod") {
|
|
82
|
-
serverConfig.privateKey = fs.readFileSync(
|
|
83
|
-
import_path.default.join(process.env.HOME, ".ssh", "id_rsa")
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
if (this.env === "release") {
|
|
87
|
-
serverConfig = this.setConfig(serverConfigMap.cn[this.env]);
|
|
88
|
-
}
|
|
89
|
-
if (!serverConfig) {
|
|
90
|
-
console.log("您当前没有权限!");
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
console.log("当前主项目分支", await (0, import_utils.getGitCurrentBranch)());
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @Title: 更新项目中version 并加入changelog
|
|
98
|
-
* @Describe:
|
|
99
|
-
* @Author: Zsj
|
|
100
|
-
*/
|
|
101
|
-
async updateVersion() {
|
|
102
|
-
if (this.env === "prod") {
|
|
103
|
-
await $`npm version ${this.version} -m "%s ${this.changelog}"`;
|
|
104
|
-
let { version } = await fs.readJson("./package.json");
|
|
105
|
-
this.currentVersion = version;
|
|
106
|
-
}
|
|
107
|
-
if (this.env !== "prod") {
|
|
108
|
-
await $`npm version ${this.version} --no-git-tag-version`;
|
|
109
|
-
await $`git add package.json`;
|
|
110
|
-
let { version } = await fs.readJson("./package.json");
|
|
111
|
-
this.currentVersion = version;
|
|
112
|
-
await $`git commit -m "chore: ${this.currentVersion} ${this.changelog}"`;
|
|
113
|
-
}
|
|
114
|
-
return this.currentVersion;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* @Title: 根据env执行打包
|
|
118
|
-
* @Describe:
|
|
119
|
-
* @Author: Zsj
|
|
120
|
-
*/
|
|
121
|
-
async build() {
|
|
122
|
-
await $`npm run build:${this.env}`;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @Title: 压缩dist文件为zip
|
|
126
|
-
* @Describe:
|
|
127
|
-
* @Author: Zsj
|
|
128
|
-
*/
|
|
129
|
-
async compress() {
|
|
130
|
-
return new Promise((resolve, reject) => {
|
|
131
|
-
const __dirname = process.cwd();
|
|
132
|
-
const zipFile = import_path.default.resolve(__dirname, `${this.currentVersion}.zip`);
|
|
133
|
-
const originFilePath = import_path.default.resolve(__dirname, "dist");
|
|
134
|
-
const output = fs.createWriteStream(zipFile);
|
|
135
|
-
const archive = (0, import_archiver.default)("zip", {
|
|
136
|
-
zlib: { level: 9 }
|
|
137
|
-
// 设置压缩级别
|
|
138
|
-
});
|
|
139
|
-
archive.on("error", function(err) {
|
|
140
|
-
reject(err);
|
|
141
|
-
});
|
|
142
|
-
output.on("close", function() {
|
|
143
|
-
resolve(true);
|
|
144
|
-
});
|
|
145
|
-
archive.pipe(output);
|
|
146
|
-
archive.directory(originFilePath, "/dist");
|
|
147
|
-
archive.finalize();
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @Title: 连接服务器
|
|
152
|
-
* @Describe:
|
|
153
|
-
* @Author: Zsj
|
|
154
|
-
*/
|
|
155
|
-
async connectServer() {
|
|
156
|
-
if (!this.serverConfig) {
|
|
157
|
-
console.log("未找到发布配置!");
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
this.conn = await (0, import_utils.connectServer)(this.serverConfig);
|
|
161
|
-
return this.conn;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @Title: 本地zip文件上传到服务器
|
|
165
|
-
* @Describe:
|
|
166
|
-
* @Author: Zsj
|
|
167
|
-
*/
|
|
168
|
-
async serverUpload() {
|
|
169
|
-
const localPath = import_path.default.resolve(
|
|
170
|
-
this.projectAbsolutePath,
|
|
171
|
-
`${this.currentVersion}.zip`
|
|
172
|
-
);
|
|
173
|
-
const remotePath = `${this.outPath}/${this.currentVersion}.zip`;
|
|
174
|
-
return await (0, import_utils.serverUpload)(this.conn, { localPath, remotePath });
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* @Title: 服务器中解压文件
|
|
178
|
-
* @Describe:
|
|
179
|
-
* @Author: Zsj
|
|
180
|
-
*/
|
|
181
|
-
async serverUnpack() {
|
|
182
|
-
return await (0, import_utils.serverUnpack)(this.conn, {
|
|
183
|
-
path: this.outPath,
|
|
184
|
-
fileName: `${this.currentVersion}`,
|
|
185
|
-
fullFileName: `${this.currentVersion}.zip`,
|
|
186
|
-
changelog: this.changelog
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* @Title: 删除本地zip文件
|
|
191
|
-
* @Describe:
|
|
192
|
-
* @Author: Zsj
|
|
193
|
-
*/
|
|
194
|
-
deleteLocalZip() {
|
|
195
|
-
return $`rm -rf ${this.currentVersion}.zip`;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @Title: 断开服务连接
|
|
199
|
-
* @Describe:
|
|
200
|
-
* @Author: Zsj
|
|
201
|
-
*/
|
|
202
|
-
async disconnectServer() {
|
|
203
|
-
return await this.conn.end();
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
var uploadCode_default = UploadCode;
|
|
207
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
208
|
-
0 && (module.exports = {});
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/script/utils/index.js
|
|
30
|
-
var utils_exports = {};
|
|
31
|
-
__export(utils_exports, {
|
|
32
|
-
connectServer: () => connectServer,
|
|
33
|
-
getCurrentProjectName: () => getCurrentProjectName,
|
|
34
|
-
getCurrentUserName: () => getCurrentUserName,
|
|
35
|
-
getGitCurrentBranch: () => getGitCurrentBranch,
|
|
36
|
-
getServerConfig: () => getServerConfig,
|
|
37
|
-
isWorkingTreeClean: () => isWorkingTreeClean,
|
|
38
|
-
loadJSON: () => loadJSON,
|
|
39
|
-
releaseProject: () => releaseProject,
|
|
40
|
-
sendWebhook: () => sendWebhook,
|
|
41
|
-
serverUnpack: () => serverUnpack,
|
|
42
|
-
serverUpload: () => serverUpload,
|
|
43
|
-
versionSort: () => versionSort
|
|
44
|
-
});
|
|
45
|
-
module.exports = __toCommonJS(utils_exports);
|
|
46
|
-
var dotenv = __toESM(require("dotenv"));
|
|
47
|
-
var import_path = __toESM(require("path"));
|
|
48
|
-
var import_ssh2 = __toESM(require("ssh2"));
|
|
49
|
-
var isWorkingTreeClean = async () => {
|
|
50
|
-
const v = await $`git status --porcelain`;
|
|
51
|
-
return v.stdout === "";
|
|
52
|
-
};
|
|
53
|
-
var getGitCurrentBranch = async () => {
|
|
54
|
-
const v = await $`git symbolic-ref --short HEAD`;
|
|
55
|
-
return v.stdout;
|
|
56
|
-
};
|
|
57
|
-
var getServerConfig = async () => {
|
|
58
|
-
return await fs.readJson("../lm_config.json");
|
|
59
|
-
};
|
|
60
|
-
var connectServer = (config2) => {
|
|
61
|
-
const conn = new import_ssh2.default.Client();
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
conn.on("ready", () => {
|
|
64
|
-
resolve(conn);
|
|
65
|
-
}).on("error", (err) => {
|
|
66
|
-
console.log(err, "connect error");
|
|
67
|
-
reject();
|
|
68
|
-
}).connect(config2);
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
var serverUpload = (conn, { localPath, remotePath }) => {
|
|
72
|
-
if (!conn)
|
|
73
|
-
return Promise.reject("未连接服务器");
|
|
74
|
-
return new Promise((resolve, reject) => {
|
|
75
|
-
conn.sftp((err, sftp) => {
|
|
76
|
-
if (err) {
|
|
77
|
-
console.log(err);
|
|
78
|
-
reject(err);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
sftp.fastPut(
|
|
82
|
-
localPath,
|
|
83
|
-
remotePath,
|
|
84
|
-
{
|
|
85
|
-
step: (total, nb, fsize) => {
|
|
86
|
-
console.table([
|
|
87
|
-
{
|
|
88
|
-
标题: "当前已上传",
|
|
89
|
-
值: `${(total / fsize * 100).toFixed(2)}%`
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
标题: "每次上传",
|
|
93
|
-
值: `${(nb / 1024 / 1024).toFixed(2)}M`
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
标题: "总大小",
|
|
97
|
-
值: `${(fsize / 1024 / 1024).toFixed(2)}M`
|
|
98
|
-
}
|
|
99
|
-
]);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
(err2) => {
|
|
103
|
-
if (err2) {
|
|
104
|
-
console.log(err2);
|
|
105
|
-
reject(err2);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
console.log("上传成功");
|
|
109
|
-
resolve(conn);
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) => {
|
|
116
|
-
if (!conn)
|
|
117
|
-
return Promise.reject("未连接服务器");
|
|
118
|
-
return new Promise((resolve, reject) => {
|
|
119
|
-
conn.shell((err, stream) => {
|
|
120
|
-
if (err) {
|
|
121
|
-
console.log(err);
|
|
122
|
-
reject(err);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
stream.end(
|
|
126
|
-
`
|
|
127
|
-
cd ${path2}
|
|
128
|
-
unzip ${fullFileName} -d ${fileName} && mv ${fileName}/dist/* ${fileName}/ && rmdir ${fileName}/dist
|
|
129
|
-
rm -rf ${fullFileName}
|
|
130
|
-
echo "${changelog}" > ./${fileName}/changelog.md
|
|
131
|
-
sh deleteOldVersion.sh
|
|
132
|
-
exit
|
|
133
|
-
`
|
|
134
|
-
// 打开到path
|
|
135
|
-
// 解压 1.0.0.zip 文件到 1.0.0 移动dist中内容到 1.0.0内 删除dist
|
|
136
|
-
// 删除1.0.0.zip
|
|
137
|
-
// 写入changelog到changelog.md
|
|
138
|
-
// 执行deleteOldVersion脚本 删除过早版本
|
|
139
|
-
).on("data", (data) => {
|
|
140
|
-
console.log(data.toString());
|
|
141
|
-
}).on("close", () => {
|
|
142
|
-
console.log("✅上传完成");
|
|
143
|
-
resolve();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
var releaseProject = (conn, { path: path2, fileName }) => {
|
|
149
|
-
return new Promise((resolve, reject) => {
|
|
150
|
-
conn.shell((err, stream) => {
|
|
151
|
-
if (err) {
|
|
152
|
-
console.log(err);
|
|
153
|
-
reject(err);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
stream.end(
|
|
157
|
-
`
|
|
158
|
-
cd ${path2}
|
|
159
|
-
cp -R -f pre-master next-master
|
|
160
|
-
rm -rf pre-master
|
|
161
|
-
\\cp -R -f ${fileName}/* next-master
|
|
162
|
-
cp -R -f ${fileName} pre-master
|
|
163
|
-
rm -rf master
|
|
164
|
-
cp -R next-master master
|
|
165
|
-
rm -rf next-master
|
|
166
|
-
exit
|
|
167
|
-
`
|
|
168
|
-
// 打开到path
|
|
169
|
-
// 复制pre-master到next-master
|
|
170
|
-
// 删除pre-master
|
|
171
|
-
// 复制1.0.0到next-master
|
|
172
|
-
// 复制1.0.0到pre-master
|
|
173
|
-
// 删除master
|
|
174
|
-
// 复制next-master到master
|
|
175
|
-
// 删除next-master
|
|
176
|
-
).on("data", (data) => {
|
|
177
|
-
console.log(data.toString());
|
|
178
|
-
}).on("close", () => {
|
|
179
|
-
console.log("✅发布完成");
|
|
180
|
-
resolve();
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
var versionSort = (versionList) => {
|
|
186
|
-
return versionList.sort((a, b) => {
|
|
187
|
-
const aParts = a.split(".");
|
|
188
|
-
const bParts = b.split(".");
|
|
189
|
-
for (let i = 0; i < aParts.length && i < bParts.length; i++) {
|
|
190
|
-
const aNum = parseInt(aParts[i]);
|
|
191
|
-
const bNum = parseInt(bParts[i]);
|
|
192
|
-
if (aNum !== bNum) {
|
|
193
|
-
return bNum - aNum;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return bParts.length - aParts.length;
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
var getCurrentProjectName = () => {
|
|
200
|
-
return loadJSON(import_path.default.join(process.cwd(), "./package.json")).name;
|
|
201
|
-
};
|
|
202
|
-
var loadJSON = (path2) => JSON.parse(fs.readFileSync(path2));
|
|
203
|
-
var getCurrentUserName = async () => {
|
|
204
|
-
const { stdout } = await $`git config user.name`;
|
|
205
|
-
return stdout;
|
|
206
|
-
};
|
|
207
|
-
var createFeishuMessageContent = (contentArr) => {
|
|
208
|
-
return JSON.stringify(
|
|
209
|
-
contentArr.map((item) => {
|
|
210
|
-
return [
|
|
211
|
-
{ tag: "text", text: `${item.key}: ` },
|
|
212
|
-
{ tag: "text", text: `${item.value}` }
|
|
213
|
-
];
|
|
214
|
-
})
|
|
215
|
-
);
|
|
216
|
-
};
|
|
217
|
-
var sendWebhook = async ({ title, content }) => {
|
|
218
|
-
var _a, _b, _c, _d;
|
|
219
|
-
const contentStr = createFeishuMessageContent(content);
|
|
220
|
-
if (!((_b = (_a = dotenv.config()) == null ? void 0 : _a.parsed) == null ? void 0 : _b.WEBHOOK))
|
|
221
|
-
return;
|
|
222
|
-
const response = await fetch((_d = (_c = dotenv.config()) == null ? void 0 : _c.parsed) == null ? void 0 : _d.WEBHOOK, {
|
|
223
|
-
headers: {
|
|
224
|
-
"Content-Type": "application/json"
|
|
225
|
-
},
|
|
226
|
-
method: "POST",
|
|
227
|
-
body: JSON.stringify({
|
|
228
|
-
msg_type: "post",
|
|
229
|
-
content: `{"post":{"zh_cn":{"title":"${title}","content":${contentStr}}}}`
|
|
230
|
-
})
|
|
231
|
-
});
|
|
232
|
-
return await response.json();
|
|
233
|
-
};
|
|
234
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
235
|
-
0 && (module.exports = {
|
|
236
|
-
connectServer,
|
|
237
|
-
getCurrentProjectName,
|
|
238
|
-
getCurrentUserName,
|
|
239
|
-
getGitCurrentBranch,
|
|
240
|
-
getServerConfig,
|
|
241
|
-
isWorkingTreeClean,
|
|
242
|
-
loadJSON,
|
|
243
|
-
releaseProject,
|
|
244
|
-
sendWebhook,
|
|
245
|
-
serverUnpack,
|
|
246
|
-
serverUpload,
|
|
247
|
-
versionSort
|
|
248
|
-
});
|
package/lib/utils/index.d.ts
DELETED
package/lib/utils/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/utils/index.ts
|
|
17
|
-
var utils_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(utils_exports);
|
|
19
|
-
__reExport(utils_exports, require("./otherUtils"), module.exports);
|
|
20
|
-
__reExport(utils_exports, require("./storage"), module.exports);
|
|
21
|
-
__reExport(utils_exports, require("./typeUtils"), module.exports);
|
package/lib/utils/otherUtils.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/otherUtils.ts
|
|
20
|
-
var otherUtils_exports = {};
|
|
21
|
-
__export(otherUtils_exports, {
|
|
22
|
-
getUniqueId: () => getUniqueId
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(otherUtils_exports);
|
|
25
|
-
var getUniqueId = (prefix = "", maxLength = 11) => {
|
|
26
|
-
return prefix + (Math.random() + "").replace(/\D/g, "").substring(0, maxLength);
|
|
27
|
-
};
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
getUniqueId
|
|
31
|
-
});
|
package/lib/utils/storage.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @title: 设置storage
|
|
3
|
-
* @description:
|
|
4
|
-
* @param {*} T
|
|
5
|
-
* @param {*} param2
|
|
6
|
-
* @return {*}
|
|
7
|
-
* @Author: Wzw
|
|
8
|
-
* @Date: 2022-02-21 10:30
|
|
9
|
-
*/
|
|
10
|
-
export declare const setStorage: (key: string, value: any, type?: 'local' | 'session', prefix?: string) => any;
|
|
11
|
-
/**
|
|
12
|
-
* @title: 获取storage
|
|
13
|
-
* @description:
|
|
14
|
-
* @param {string} key
|
|
15
|
-
* @param {string} prefix
|
|
16
|
-
* @return {*}
|
|
17
|
-
* @Author: Wzw
|
|
18
|
-
* @Date: 2022-02-21 10:30
|
|
19
|
-
*/
|
|
20
|
-
export declare const getStorage: (key: string, prefix?: string, type?: 'local' | 'session') => any;
|
|
21
|
-
/**
|
|
22
|
-
* @title: 删除storage
|
|
23
|
-
* @description:
|
|
24
|
-
* @param {string} key
|
|
25
|
-
* @param {string} prefix
|
|
26
|
-
* @return {*}
|
|
27
|
-
* @Author: Wzw
|
|
28
|
-
* @Date: 2022-02-21 10:30
|
|
29
|
-
*/
|
|
30
|
-
export declare const removeStorage: (key: string, prefix?: string, type?: 'local' | 'session') => void;
|
package/lib/utils/storage.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/storage.ts
|
|
20
|
-
var storage_exports = {};
|
|
21
|
-
__export(storage_exports, {
|
|
22
|
-
getStorage: () => getStorage,
|
|
23
|
-
removeStorage: () => removeStorage,
|
|
24
|
-
setStorage: () => setStorage
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(storage_exports);
|
|
27
|
-
var default_prefix = "shop_";
|
|
28
|
-
var setStorage = (key, value, type, prefix) => {
|
|
29
|
-
const _value = value;
|
|
30
|
-
let _key = (prefix || default_prefix) + key;
|
|
31
|
-
if (type === void 0 || type === "local") {
|
|
32
|
-
localStorage.setItem(_key, _value);
|
|
33
|
-
} else {
|
|
34
|
-
sessionStorage.setItem(_key, _value);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var getStorage = (key, prefix, type) => {
|
|
38
|
-
let _key = (prefix || default_prefix) + key;
|
|
39
|
-
if (key === "umi_locale") {
|
|
40
|
-
_key = key;
|
|
41
|
-
}
|
|
42
|
-
if (type === void 0 || type === "local") {
|
|
43
|
-
let _localValue = localStorage.getItem(_key) || "";
|
|
44
|
-
return _localValue;
|
|
45
|
-
} else {
|
|
46
|
-
let _sessionValue = sessionStorage.getItem(_key) || "";
|
|
47
|
-
return _sessionValue;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var removeStorage = (key, prefix, type) => {
|
|
51
|
-
let _key = (prefix || default_prefix) + key;
|
|
52
|
-
if (type === void 0 || type === "local") {
|
|
53
|
-
localStorage.removeItem(_key);
|
|
54
|
-
} else {
|
|
55
|
-
sessionStorage.removeItem(_key);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
-
0 && (module.exports = {
|
|
60
|
-
getStorage,
|
|
61
|
-
removeStorage,
|
|
62
|
-
setStorage
|
|
63
|
-
});
|
package/lib/utils/typeUtils.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 判断是否是函数
|
|
3
|
-
* @param obj
|
|
4
|
-
*/
|
|
5
|
-
export declare const isFunction: (obj: any) => obj is Function;
|
|
6
|
-
/**
|
|
7
|
-
* 判断是否是数组
|
|
8
|
-
* @param obj
|
|
9
|
-
*/
|
|
10
|
-
export declare const isArr: (obj: any) => obj is any[];
|
|
11
|
-
/**
|
|
12
|
-
* 判断是否是字符串
|
|
13
|
-
* @param obj
|
|
14
|
-
*/
|
|
15
|
-
export declare const isString: (obj: any) => obj is string;
|
|
16
|
-
/**
|
|
17
|
-
* 判断是否是数字
|
|
18
|
-
* @param obj
|
|
19
|
-
*/
|
|
20
|
-
export declare const isNumber: (obj: any) => obj is number;
|
|
21
|
-
/**
|
|
22
|
-
* 判断是否是undefined
|
|
23
|
-
* @param obj
|
|
24
|
-
*/
|
|
25
|
-
export declare const isUndefined: (obj: any) => obj is undefined;
|
|
26
|
-
/**
|
|
27
|
-
* 判断是否是boolean
|
|
28
|
-
* @param obj
|
|
29
|
-
*/
|
|
30
|
-
export declare const isBoolean: (obj: any) => obj is boolean;
|
|
31
|
-
/**
|
|
32
|
-
* 判断是否是json字符串
|
|
33
|
-
* @param v
|
|
34
|
-
*/
|
|
35
|
-
export declare const isJson: (v: any) => boolean;
|
|
36
|
-
/**
|
|
37
|
-
* @Title: 判断是否为对象
|
|
38
|
-
* @Describe:
|
|
39
|
-
* @Author: Wzw
|
|
40
|
-
* @param {any} obj
|
|
41
|
-
*/
|
|
42
|
-
export declare const isPlainObject: (obj: any) => boolean;
|