node-karin 0.0.3 → 0.1.0

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.
Files changed (105) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +57 -57
  3. package/config/defSet/App.yaml +37 -37
  4. package/config/defSet/config.yaml +43 -43
  5. package/config/defSet/group.yaml +18 -18
  6. package/config/defSet/pm2.yaml +21 -21
  7. package/config/defSet/server.yaml +42 -42
  8. package/config/view/App.yaml +74 -74
  9. package/config/view/config.yaml +100 -100
  10. package/config/view/group.yaml +62 -62
  11. package/config/view/pm2.yaml +41 -41
  12. package/config/view/redis.yaml +25 -25
  13. package/config/view/server.yaml +93 -93
  14. package/lib/adapter/onebot/onebot11.d.ts +430 -430
  15. package/lib/adapter/onebot/onebot11.js +1265 -1302
  16. package/lib/core/init.js +4 -4
  17. package/lib/core/karin.d.ts +72 -72
  18. package/lib/core/karin.js +51 -51
  19. package/lib/core/listener.d.ts +121 -121
  20. package/lib/core/listener.js +178 -178
  21. package/lib/core/plugin.app.d.ts +15 -15
  22. package/lib/core/plugin.app.js +18 -18
  23. package/lib/core/plugin.d.ts +182 -182
  24. package/lib/core/plugin.js +132 -132
  25. package/lib/core/plugin.loader.d.ts +149 -149
  26. package/lib/core/plugin.loader.js +451 -451
  27. package/lib/core/server.d.ts +26 -26
  28. package/lib/core/server.js +209 -209
  29. package/lib/db/level.d.ts +20 -20
  30. package/lib/db/level.js +36 -36
  31. package/lib/db/redis.d.ts +41 -41
  32. package/lib/db/redis.js +131 -131
  33. package/lib/db/redis_level.d.ts +113 -113
  34. package/lib/db/redis_level.js +274 -274
  35. package/lib/event/event.d.ts +138 -138
  36. package/lib/event/event.handler.d.ts +29 -29
  37. package/lib/event/event.handler.js +138 -138
  38. package/lib/event/event.js +120 -120
  39. package/lib/event/message.d.ts +102 -102
  40. package/lib/event/message.handler.d.ts +25 -25
  41. package/lib/event/message.handler.js +237 -237
  42. package/lib/event/message.js +69 -69
  43. package/lib/event/notice.d.ts +49 -49
  44. package/lib/event/notice.js +14 -14
  45. package/lib/event/request.d.ts +49 -49
  46. package/lib/event/request.js +14 -14
  47. package/lib/event/review.handler.d.ts +54 -54
  48. package/lib/event/review.handler.js +374 -374
  49. package/lib/index.d.ts +23 -23
  50. package/lib/index.js +39 -40
  51. package/lib/renderer/app.d.ts +53 -53
  52. package/lib/renderer/app.js +88 -88
  53. package/lib/renderer/base.d.ts +30 -30
  54. package/lib/renderer/base.js +68 -68
  55. package/lib/renderer/client.d.ts +30 -30
  56. package/lib/renderer/client.js +155 -155
  57. package/lib/renderer/http.d.ts +19 -19
  58. package/lib/renderer/http.js +50 -50
  59. package/lib/renderer/server.d.ts +42 -42
  60. package/lib/renderer/server.js +110 -110
  61. package/lib/renderer/wormhole.d.ts +1 -1
  62. package/lib/renderer/wormhole.js +154 -154
  63. package/lib/types/adapter.d.ts +575 -575
  64. package/lib/types/adapter.js +1 -1
  65. package/lib/types/config.d.ts +327 -327
  66. package/lib/types/config.js +1 -1
  67. package/lib/types/element.d.ts +576 -576
  68. package/lib/types/element.js +1 -1
  69. package/lib/types/index.d.ts +8 -8
  70. package/lib/types/index.js +8 -8
  71. package/lib/types/logger.d.ts +109 -109
  72. package/lib/types/logger.js +1 -1
  73. package/lib/types/onebots11.d.ts +1371 -1371
  74. package/lib/types/onebots11.js +1 -1
  75. package/lib/types/plugin.d.ts +282 -282
  76. package/lib/types/plugin.js +1 -1
  77. package/lib/types/render.d.ts +111 -111
  78. package/lib/types/render.js +1 -1
  79. package/lib/types/reply.d.ts +40 -40
  80. package/lib/types/reply.js +1 -1
  81. package/lib/types/types.d.ts +898 -898
  82. package/lib/types/types.js +1 -1
  83. package/lib/utils/YamlEditor.d.ts +62 -62
  84. package/lib/utils/YamlEditor.js +197 -197
  85. package/lib/utils/button.d.ts +49 -49
  86. package/lib/utils/button.js +75 -75
  87. package/lib/utils/common.d.ts +123 -123
  88. package/lib/utils/common.js +396 -396
  89. package/lib/utils/config.d.ts +72 -72
  90. package/lib/utils/config.js +254 -254
  91. package/lib/utils/exec.d.ts +22 -22
  92. package/lib/utils/exec.js +36 -36
  93. package/lib/utils/ffmpeg.d.ts +12 -12
  94. package/lib/utils/ffmpeg.js +25 -25
  95. package/lib/utils/handler.d.ts +76 -76
  96. package/lib/utils/handler.js +98 -98
  97. package/lib/utils/logger.d.ts +3 -3
  98. package/lib/utils/logger.js +104 -104
  99. package/lib/utils/segment.d.ts +276 -276
  100. package/lib/utils/segment.js +420 -420
  101. package/lib/utils/update.d.ts +69 -69
  102. package/lib/utils/update.js +145 -145
  103. package/lib/utils/updateVersion.d.ts +33 -33
  104. package/lib/utils/updateVersion.js +140 -140
  105. package/package.json +92 -91
@@ -1,69 +1,69 @@
1
- import fs from 'fs';
2
- declare const _default: {
3
- dir: string;
4
- /**
5
- * 获取插件列表 拥有packageon才会被识别
6
- * @returns {string[]}
7
- */
8
- getPlugins(): string[];
9
- /**
10
- * 更新框架或插件
11
- * @param path - 插件相对路径
12
- * @param cmd - 更新命令 默认git pull
13
- * @param time - 超时时间 默认120s
14
- */
15
- update(path: string, cmd?: string, time?: number): Promise<{
16
- status: string;
17
- data: string;
18
- }>;
19
- /**
20
- * 获取指定仓库最后一次提交时间日期
21
- * @param path - 插件相对路径
22
- */
23
- getTime(path: string): Promise<string>;
24
- /**
25
- * 获取指定仓库最后一次提交哈希值
26
- * @param {string} path - 插件相对路径
27
- * @param {boolean} [short] - 是否获取短哈希 默认true
28
- * @returns {Promise<string>}
29
- */
30
- getHash(path: string, short?: boolean): Promise<string>;
31
- /**
32
- * 获取指定仓库的提交记录
33
- * @param {{
34
- * path: string,
35
- * count?: number,
36
- * hash?: string
37
- * }} options - 参数
38
- * @param {string} options.path - 插件相对路径
39
- * @param {number} [options.count] - 获取日志条数 默认1条
40
- * @param {string} [options.hash] - 指定HEAD
41
- * @returns {Promise<string>}
42
- */
43
- getCommit(options: {
44
- path: any;
45
- count?: any;
46
- hash?: any;
47
- branch?: any;
48
- }): Promise<string>;
49
- /**
50
- * 检查插件是否有更新
51
- * @param {string} path - 插件相对路径
52
- * @param {number} [time] - 超时时间 默认120s
53
- * @returns {Promise<{status: 'ok'|'failed', data: string|boolean}>}
54
- */
55
- checkUpdate(path: fs.PathLike, time?: number): Promise<{
56
- status: string;
57
- data: string | undefined;
58
- count?: undefined;
59
- } | {
60
- status: string;
61
- data: boolean;
62
- count?: undefined;
63
- } | {
64
- status: string;
65
- data: string;
66
- count: string | number;
67
- }>;
68
- };
69
- export default _default;
1
+ import fs from 'fs';
2
+ declare const _default: {
3
+ dir: string;
4
+ /**
5
+ * 获取插件列表 拥有packageon才会被识别
6
+ * @returns {string[]}
7
+ */
8
+ getPlugins(): string[];
9
+ /**
10
+ * 更新框架或插件
11
+ * @param path - 插件相对路径
12
+ * @param cmd - 更新命令 默认git pull
13
+ * @param time - 超时时间 默认120s
14
+ */
15
+ update(path: string, cmd?: string, time?: number): Promise<{
16
+ status: string;
17
+ data: string;
18
+ }>;
19
+ /**
20
+ * 获取指定仓库最后一次提交时间日期
21
+ * @param path - 插件相对路径
22
+ */
23
+ getTime(path: string): Promise<string>;
24
+ /**
25
+ * 获取指定仓库最后一次提交哈希值
26
+ * @param {string} path - 插件相对路径
27
+ * @param {boolean} [short] - 是否获取短哈希 默认true
28
+ * @returns {Promise<string>}
29
+ */
30
+ getHash(path: string, short?: boolean): Promise<string>;
31
+ /**
32
+ * 获取指定仓库的提交记录
33
+ * @param {{
34
+ * path: string,
35
+ * count?: number,
36
+ * hash?: string
37
+ * }} options - 参数
38
+ * @param {string} options.path - 插件相对路径
39
+ * @param {number} [options.count] - 获取日志条数 默认1条
40
+ * @param {string} [options.hash] - 指定HEAD
41
+ * @returns {Promise<string>}
42
+ */
43
+ getCommit(options: {
44
+ path: any;
45
+ count?: any;
46
+ hash?: any;
47
+ branch?: any;
48
+ }): Promise<string>;
49
+ /**
50
+ * 检查插件是否有更新
51
+ * @param {string} path - 插件相对路径
52
+ * @param {number} [time] - 超时时间 默认120s
53
+ * @returns {Promise<{status: 'ok'|'failed', data: string|boolean}>}
54
+ */
55
+ checkUpdate(path: fs.PathLike, time?: number): Promise<{
56
+ status: string;
57
+ data: string | undefined;
58
+ count?: undefined;
59
+ } | {
60
+ status: string;
61
+ data: boolean;
62
+ count?: undefined;
63
+ } | {
64
+ status: string;
65
+ data: string;
66
+ count: string | number;
67
+ }>;
68
+ };
69
+ export default _default;
@@ -1,151 +1,151 @@
1
- import fs from 'fs'
2
- import exec from './exec.js'
3
- export default new (class Update {
4
- dir
5
- constructor () {
6
- this.dir = './plugins'
1
+ import fs from 'fs'
2
+ import exec from './exec.js'
3
+ export default new (class Update {
4
+ dir
5
+ constructor () {
6
+ this.dir = './plugins'
7
7
  }
8
-
9
- /**
10
- * 获取插件列表 拥有packageon才会被识别
11
- * @returns {string[]}
12
- */
13
- getPlugins () {
14
- const list = []
15
- const files = fs.readdirSync(this.dir, { withFileTypes: true })
16
- /** 忽略非文件夹、非karin-plugin-开头的文件夹或/karin-adapter-开头的文件夹 */
17
- files.forEach(file => {
18
- if (!file.isDirectory()) { return }
19
- if (!file.name.startsWith('karin-plugin-') && !file.name.startsWith('karin-adapter-')) { return }
20
- if (!fs.existsSync(`${this.dir}/${file.name}/packageon`)) { return }
21
- list.push(file.name)
22
- })
23
- return list
8
+
9
+ /**
10
+ * 获取插件列表 拥有packageon才会被识别
11
+ * @returns {string[]}
12
+ */
13
+ getPlugins () {
14
+ const list = []
15
+ const files = fs.readdirSync(this.dir, { withFileTypes: true })
16
+ /** 忽略非文件夹、非karin-plugin-开头的文件夹或/karin-adapter-开头的文件夹 */
17
+ files.forEach(file => {
18
+ if (!file.isDirectory()) { return }
19
+ if (!file.name.startsWith('karin-plugin-') && !file.name.startsWith('karin-adapter-')) { return }
20
+ if (!fs.existsSync(`${this.dir}/${file.name}/packageon`)) { return }
21
+ list.push(file.name)
22
+ })
23
+ return list
24
24
  }
25
-
26
- /**
27
- * 更新框架或插件
28
- * @param path - 插件相对路径
29
- * @param cmd - 更新命令 默认git pull
30
- * @param time - 超时时间 默认120s
31
- */
32
- async update (path, cmd = 'git pull', time = 120) {
33
- /** 检查一下路径是否存在 */
34
- if (!fs.existsSync(path)) { return { status: 'failed', data: '路径不存在' } }
35
- /** 检查是否有.git文件夹 */
36
- if (!fs.existsSync(`${path}/.git`)) { return { status: 'failed', data: '该路径不是一个git仓库' } }
37
- /** 设置超时时间 */
38
- const timer = setTimeout(() => {
39
- return { status: 'failed', data: '执行超时' }
40
- }, time * 1000)
41
- const options = { env: process.env, cwd: path, encoding: 'utf-8' }
42
- /** 记录当前短哈希 */
43
- const hash = await this.getHash(path)
44
- /** 执行更新 */
45
- const { status, error } = await exec(cmd, true, options)
46
- /** 执行成功 */
47
- if (status === 'ok') {
48
- clearTimeout(timer)
49
- /** 再次获取短哈希 查看是否有更新 */
50
- const newHash = await this.getHash(path)
51
- if (hash === newHash) {
52
- const time = await this.getTime(path)
53
- return {
54
- status: 'ok',
55
- data: ['\n当前版本已是最新版本', `Hash: ${hash}`, `最后更新:${await this.getCommit({ path, count: 1 })}`, `最后提交时间:${time}`].join('\n'),
56
- }
57
- }
58
- const Commit = await this.getCommit({ path, hash })
59
- return {
60
- status: 'ok',
61
- data: ['\n更新成功', `当前Hash: ${newHash}`, `更新日志:\n${Commit}`].join('\n'),
62
- }
63
- }
64
- const msg = ['\n更新失败', `当前Hash: ${hash}`, `错误信息:${error?.message?.toString() || error?.stack?.toString() || error?.toString()}`, '请解决错误后重试或执行【#强制更新】']
65
- return { status: 'failed', data: msg.join('\n') }
25
+
26
+ /**
27
+ * 更新框架或插件
28
+ * @param path - 插件相对路径
29
+ * @param cmd - 更新命令 默认git pull
30
+ * @param time - 超时时间 默认120s
31
+ */
32
+ async update (path, cmd = 'git pull', time = 120) {
33
+ /** 检查一下路径是否存在 */
34
+ if (!fs.existsSync(path)) { return { status: 'failed', data: '路径不存在' } }
35
+ /** 检查是否有.git文件夹 */
36
+ if (!fs.existsSync(`${path}/.git`)) { return { status: 'failed', data: '该路径不是一个git仓库' } }
37
+ /** 设置超时时间 */
38
+ const timer = setTimeout(() => {
39
+ return { status: 'failed', data: '执行超时' }
40
+ }, time * 1000)
41
+ const options = { env: process.env, cwd: path, encoding: 'utf-8' }
42
+ /** 记录当前短哈希 */
43
+ const hash = await this.getHash(path)
44
+ /** 执行更新 */
45
+ const { status, error } = await exec(cmd, true, options)
46
+ /** 执行成功 */
47
+ if (status === 'ok') {
48
+ clearTimeout(timer)
49
+ /** 再次获取短哈希 查看是否有更新 */
50
+ const newHash = await this.getHash(path)
51
+ if (hash === newHash) {
52
+ const time = await this.getTime(path)
53
+ return {
54
+ status: 'ok',
55
+ data: ['\n当前版本已是最新版本', `Hash: ${hash}`, `最后更新:${await this.getCommit({ path, count: 1 })}`, `最后提交时间:${time}`].join('\n'),
56
+ }
57
+ }
58
+ const Commit = await this.getCommit({ path, hash })
59
+ return {
60
+ status: 'ok',
61
+ data: ['\n更新成功', `当前Hash: ${newHash}`, `更新日志:\n${Commit}`].join('\n'),
62
+ }
63
+ }
64
+ const msg = ['\n更新失败', `当前Hash: ${hash}`, `错误信息:${error?.message?.toString() || error?.stack?.toString() || error?.toString()}`, '请解决错误后重试或执行【#强制更新】']
65
+ return { status: 'failed', data: msg.join('\n') }
66
66
  }
67
-
68
- /**
69
- * 获取指定仓库最后一次提交时间日期
70
- * @param path - 插件相对路径
71
- */
72
- async getTime (path) {
73
- const cmd = 'git log -1 --format=%cd --date=format:"%Y-%m-%d %H:%M:%S"'
74
- const data = await exec(cmd, false, { cwd: path, encoding: 'utf-8' })
75
- if (data.status === 'failed') { return '获取时间失败,请重试或更新Git~' }
76
- return data.stdout.trim()
67
+
68
+ /**
69
+ * 获取指定仓库最后一次提交时间日期
70
+ * @param path - 插件相对路径
71
+ */
72
+ async getTime (path) {
73
+ const cmd = 'git log -1 --format=%cd --date=format:"%Y-%m-%d %H:%M:%S"'
74
+ const data = await exec(cmd, false, { cwd: path, encoding: 'utf-8' })
75
+ if (data.status === 'failed') { return '获取时间失败,请重试或更新Git~' }
76
+ return data.stdout.trim()
77
77
  }
78
-
79
- /**
80
- * 获取指定仓库最后一次提交哈希值
81
- * @param {string} path - 插件相对路径
82
- * @param {boolean} [short] - 是否获取短哈希 默认true
83
- * @returns {Promise<string>}
84
- */
85
- async getHash (path, short = true) {
86
- const cmd = short ? 'git rev-parse --short HEAD' : 'git rev-parse HEAD'
87
- const data = await exec(cmd, false, { cwd: path, encoding: 'utf-8' })
88
- if (data.status === 'failed') {
89
- const text = data.error
90
- throw new Error(text)
91
- }
92
- return data.stdout.trim()
78
+
79
+ /**
80
+ * 获取指定仓库最后一次提交哈希值
81
+ * @param {string} path - 插件相对路径
82
+ * @param {boolean} [short] - 是否获取短哈希 默认true
83
+ * @returns {Promise<string>}
84
+ */
85
+ async getHash (path, short = true) {
86
+ const cmd = short ? 'git rev-parse --short HEAD' : 'git rev-parse HEAD'
87
+ const data = await exec(cmd, false, { cwd: path, encoding: 'utf-8' })
88
+ if (data.status === 'failed') {
89
+ const text = data.error
90
+ throw new Error(text)
91
+ }
92
+ return data.stdout.trim()
93
93
  }
94
-
95
- /**
96
- * 获取指定仓库的提交记录
97
- * @param {{
98
- * path: string,
99
- * count?: number,
100
- * hash?: string
101
- * }} options - 参数
102
- * @param {string} options.path - 插件相对路径
103
- * @param {number} [options.count] - 获取日志条数 默认1条
104
- * @param {string} [options.hash] - 指定HEAD
105
- * @returns {Promise<string>}
106
- */
107
- async getCommit (options) {
108
- const { path, count = 1, hash, branch } = options
109
- let cmd = `git log -${count} --format="[%ad]%s %n" --date="format:%m-%d %H:%M"`
110
- /** 键入HEAD */
111
- if (hash) { cmd = `git log ${hash}..HEAD --format="[%ad] %s %n" --date="format:%m-%d %H:%M"` }
112
- /** 指定分支 */
113
- if (branch) { cmd = `git log -${count} ${branch} --format="[%ad] %s %n" --date="format:%m-%d %H:%M"` }
114
- const data = await exec(cmd, false, { cwd: path, encoding: 'utf-8' })
115
- if (data.status === 'failed') {
116
- const text = data.error
117
- throw new Error(text)
118
- }
119
- return data.stdout.trim()
94
+
95
+ /**
96
+ * 获取指定仓库的提交记录
97
+ * @param {{
98
+ * path: string,
99
+ * count?: number,
100
+ * hash?: string
101
+ * }} options - 参数
102
+ * @param {string} options.path - 插件相对路径
103
+ * @param {number} [options.count] - 获取日志条数 默认1条
104
+ * @param {string} [options.hash] - 指定HEAD
105
+ * @returns {Promise<string>}
106
+ */
107
+ async getCommit (options) {
108
+ const { path, count = 1, hash, branch } = options
109
+ let cmd = `git log -${count} --format="[%ad]%s %n" --date="format:%m-%d %H:%M"`
110
+ /** 键入HEAD */
111
+ if (hash) { cmd = `git log ${hash}..HEAD --format="[%ad] %s %n" --date="format:%m-%d %H:%M"` }
112
+ /** 指定分支 */
113
+ if (branch) { cmd = `git log -${count} ${branch} --format="[%ad] %s %n" --date="format:%m-%d %H:%M"` }
114
+ const data = await exec(cmd, false, { cwd: path, encoding: 'utf-8' })
115
+ if (data.status === 'failed') {
116
+ const text = data.error
117
+ throw new Error(text)
118
+ }
119
+ return data.stdout.trim()
120
120
  }
121
-
122
- /**
123
- * 检查插件是否有更新
124
- * @param {string} path - 插件相对路径
125
- * @param {number} [time] - 超时时间 默认120s
126
- * @returns {Promise<{status: 'ok'|'failed', data: string|boolean}>}
127
- */
128
- async checkUpdate (path, time = 120) {
129
- /** 检查一下路径是否存在 */
130
- if (!fs.existsSync(path)) { return { status: 'failed', data: '路径不存在' } }
131
- /** 检查是否有.git文件夹 */
132
- if (!fs.existsSync(`${path}/.git`)) { return { status: 'failed', data: '该路径不是一个git仓库' } }
133
- /** 设置超时时间 */
134
- const timer = setTimeout(() => {
135
- return { status: 'failed', data: '执行超时' }
136
- }, time * 1000)
137
- const options = { env: process.env, cwd: path, encoding: 'utf-8' }
138
- /** git fetch origin */
139
- const { status, error } = await exec('git fetch origin', false, options)
140
- if (status === 'failed') { return { status: 'failed', data: error?.message } }
141
- /** git status -uno */
142
- const { stdout } = await exec('git status -uno', false, options)
143
- clearTimeout(timer)
144
- /** 检查是否有更新 没更新直接返回 */
145
- if (stdout.includes('Your branch is up to date with')) { return { status: 'ok', data: false } }
146
- /** 获取落后几次更新 */
147
- const count = stdout.match(/Your branch is behind '.*' by (\d+) commits/)?.[1] || 1
148
- const data = await this.getCommit({ path, count, branch: 'origin' })
149
- return { status: 'ok', data, count }
150
- }
151
- })()
121
+
122
+ /**
123
+ * 检查插件是否有更新
124
+ * @param {string} path - 插件相对路径
125
+ * @param {number} [time] - 超时时间 默认120s
126
+ * @returns {Promise<{status: 'ok'|'failed', data: string|boolean}>}
127
+ */
128
+ async checkUpdate (path, time = 120) {
129
+ /** 检查一下路径是否存在 */
130
+ if (!fs.existsSync(path)) { return { status: 'failed', data: '路径不存在' } }
131
+ /** 检查是否有.git文件夹 */
132
+ if (!fs.existsSync(`${path}/.git`)) { return { status: 'failed', data: '该路径不是一个git仓库' } }
133
+ /** 设置超时时间 */
134
+ const timer = setTimeout(() => {
135
+ return { status: 'failed', data: '执行超时' }
136
+ }, time * 1000)
137
+ const options = { env: process.env, cwd: path, encoding: 'utf-8' }
138
+ /** git fetch origin */
139
+ const { status, error } = await exec('git fetch origin', false, options)
140
+ if (status === 'failed') { return { status: 'failed', data: error?.message } }
141
+ /** git status -uno */
142
+ const { stdout } = await exec('git status -uno', false, options)
143
+ clearTimeout(timer)
144
+ /** 检查是否有更新 没更新直接返回 */
145
+ if (stdout.includes('Your branch is up to date with')) { return { status: 'ok', data: false } }
146
+ /** 获取落后几次更新 */
147
+ const count = stdout.match(/Your branch is behind '.*' by (\d+) commits/)?.[1] || 1
148
+ const data = await this.getCommit({ path, count, branch: 'origin' })
149
+ return { status: 'ok', data, count }
150
+ }
151
+ })()
@@ -1,33 +1,33 @@
1
- export default class Version {
2
- path: string;
3
- packageDir: string;
4
- CHANGELOGDir: string;
5
- packageJson: any;
6
- version: string;
7
- commitsMap: {
8
- [key: string]: string[];
9
- };
10
- HEAD: string;
11
- cmd: string;
12
- stdout: string | string[];
13
- url: string;
14
- constructor(path: string);
15
- init(): Promise<void>;
16
- /**
17
- * 获取当前仓库最新的一个标签的HEAD
18
- */
19
- gitTag(): Promise<false | undefined>;
20
- /**
21
- * 获取当前仓库的远程地址
22
- */
23
- gitUrl(): Promise<void>;
24
- /**
25
- * 更新版本号 tag
26
- */
27
- updateVersion(): Promise<void>;
28
- /**
29
- * 封装exce方法
30
- * @param {string} cmd 执行的命令
31
- */
32
- exce(cmd: string): Promise<string>;
33
- }
1
+ export default class Version {
2
+ path: string;
3
+ packageDir: string;
4
+ CHANGELOGDir: string;
5
+ packageJson: any;
6
+ version: string;
7
+ commitsMap: {
8
+ [key: string]: string[];
9
+ };
10
+ HEAD: string;
11
+ cmd: string;
12
+ stdout: string | string[];
13
+ url: string;
14
+ constructor(path: string);
15
+ init(): Promise<void>;
16
+ /**
17
+ * 获取当前仓库最新的一个标签的HEAD
18
+ */
19
+ gitTag(): Promise<false | undefined>;
20
+ /**
21
+ * 获取当前仓库的远程地址
22
+ */
23
+ gitUrl(): Promise<void>;
24
+ /**
25
+ * 更新版本号 tag
26
+ */
27
+ updateVersion(): Promise<void>;
28
+ /**
29
+ * 封装exce方法
30
+ * @param {string} cmd 执行的命令
31
+ */
32
+ exce(cmd: string): Promise<string>;
33
+ }