zen-gitsync 1.3.9 → 1.4.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/gitCommit.js +12 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-gitsync",
3
- "version": "1.3.9",
3
+ "version": "1.4.0",
4
4
  "description": "一个 git 自动查看差异并提交的工具",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/gitCommit.js CHANGED
@@ -92,21 +92,6 @@ const getCwd = () => {
92
92
  return process.cwd()
93
93
  }
94
94
 
95
- // 有时候有乱码呢123神奇
96
-
97
- const rl = readline.createInterface({
98
- input: process.stdin,
99
- output: process.stdout
100
- })
101
-
102
- function rlPromisify(fn) {
103
- return async (...args) => {
104
- return new Promise((resolve, reject) => fn(...args, resolve, reject))
105
- }
106
- }
107
-
108
- const question = rlPromisify(rl.question.bind(rl))
109
-
110
95
  class GitCommit {
111
96
  constructor(options) {
112
97
  this.statusOutput = null
@@ -169,6 +154,18 @@ class GitCommit {
169
154
 
170
155
  if (!autoCommit && !commitMessageArg) {
171
156
  // 如果没有 -y 参数,则等待用户输入提交信息
157
+ const rl = readline.createInterface({
158
+ input: process.stdin,
159
+ output: process.stdout
160
+ })
161
+
162
+ function rlPromisify(fn) {
163
+ return async (...args) => {
164
+ return new Promise((resolve, reject) => fn(...args, resolve, reject))
165
+ }
166
+ }
167
+
168
+ const question = rlPromisify(rl.question.bind(rl))
172
169
  this.commitMessage = await question('请输入提交信息:');
173
170
  }
174
171