@zjex/git-workflow 0.2.6 → 0.2.7
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/dist/index.js +23 -9
- package/package.json +2 -2
- package/src/update-notifier.ts +25 -11
package/dist/index.js
CHANGED
|
@@ -1876,11 +1876,11 @@ async function performUpdate(packageName) {
|
|
|
1876
1876
|
}).start();
|
|
1877
1877
|
try {
|
|
1878
1878
|
try {
|
|
1879
|
-
execSync6(
|
|
1879
|
+
execSync6(`npm uninstall -g ${packageName}`, {
|
|
1880
1880
|
encoding: "utf-8",
|
|
1881
1881
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1882
1882
|
});
|
|
1883
|
-
spinner.text = "\
|
|
1883
|
+
spinner.text = "\u6B63\u5728\u5B89\u88C5\u65B0\u7248\u672C...";
|
|
1884
1884
|
} catch {
|
|
1885
1885
|
}
|
|
1886
1886
|
execSync6(`npm install -g ${packageName}`, {
|
|
@@ -1889,17 +1889,31 @@ async function performUpdate(packageName) {
|
|
|
1889
1889
|
});
|
|
1890
1890
|
spinner.succeed(colors.green("\u66F4\u65B0\u6210\u529F\uFF01"));
|
|
1891
1891
|
console.log("");
|
|
1892
|
-
console.log(
|
|
1893
|
-
|
|
1892
|
+
console.log(
|
|
1893
|
+
boxen(
|
|
1894
|
+
[
|
|
1895
|
+
colors.bold("\u2728 \u66F4\u65B0\u5B8C\u6210\uFF01"),
|
|
1896
|
+
"",
|
|
1897
|
+
colors.dim("\u8BF7\u8FD0\u884C\u4EE5\u4E0B\u547D\u4EE4\u5237\u65B0\u5E76\u4F7F\u7528\u65B0\u7248\u672C:"),
|
|
1898
|
+
"",
|
|
1899
|
+
colors.yellow(" hash -r && gw --version"),
|
|
1900
|
+
"",
|
|
1901
|
+
colors.dim("\u6216\u8005\u91CD\u65B0\u6253\u5F00\u7EC8\u7AEF")
|
|
1902
|
+
].join("\n"),
|
|
1903
|
+
{
|
|
1904
|
+
padding: 1,
|
|
1905
|
+
margin: { top: 0, bottom: 1, left: 2, right: 2 },
|
|
1906
|
+
borderStyle: "round",
|
|
1907
|
+
borderColor: "green",
|
|
1908
|
+
align: "left"
|
|
1909
|
+
}
|
|
1910
|
+
)
|
|
1911
|
+
);
|
|
1894
1912
|
process.exit(0);
|
|
1895
1913
|
} catch (error) {
|
|
1896
1914
|
spinner.fail(colors.red("\u66F4\u65B0\u5931\u8D25"));
|
|
1897
1915
|
console.log("");
|
|
1898
1916
|
console.log(colors.dim(" \u4F60\u53EF\u4EE5\u624B\u52A8\u8FD0\u884C\u4EE5\u4E0B\u547D\u4EE4\u66F4\u65B0:"));
|
|
1899
|
-
console.log(colors.yellow(" # \u5982\u679C\u4E4B\u524D\u5B89\u88C5\u8FC7\u65E7\u7248\u672C\uFF0C\u5148\u5378\u8F7D:"));
|
|
1900
|
-
console.log(colors.cyan(" npm uninstall -g git-workflow"));
|
|
1901
|
-
console.log("");
|
|
1902
|
-
console.log(colors.yellow(" # \u7136\u540E\u5B89\u88C5\u65B0\u7248\u672C:"));
|
|
1903
1917
|
console.log(colors.cyan(` npm install -g ${packageName}`));
|
|
1904
1918
|
console.log("");
|
|
1905
1919
|
}
|
|
@@ -1949,7 +1963,7 @@ process.on("SIGTERM", () => {
|
|
|
1949
1963
|
console.log("");
|
|
1950
1964
|
process.exit(0);
|
|
1951
1965
|
});
|
|
1952
|
-
var version = true ? "0.2.
|
|
1966
|
+
var version = true ? "0.2.7" : "0.0.0-dev";
|
|
1953
1967
|
async function mainMenu() {
|
|
1954
1968
|
await checkForUpdates(version, "@zjex/git-workflow");
|
|
1955
1969
|
console.log(
|
package/package.json
CHANGED
package/src/update-notifier.ts
CHANGED
|
@@ -145,18 +145,18 @@ async function performUpdate(packageName: string): Promise<void> {
|
|
|
145
145
|
}).start();
|
|
146
146
|
|
|
147
147
|
try {
|
|
148
|
-
//
|
|
148
|
+
// 先卸载当前版本,确保干净安装
|
|
149
149
|
try {
|
|
150
|
-
execSync(
|
|
150
|
+
execSync(`npm uninstall -g ${packageName}`, {
|
|
151
151
|
encoding: "utf-8",
|
|
152
152
|
stdio: ["pipe", "pipe", "pipe"],
|
|
153
153
|
});
|
|
154
|
-
spinner.text = "
|
|
154
|
+
spinner.text = "正在安装新版本...";
|
|
155
155
|
} catch {
|
|
156
|
-
//
|
|
156
|
+
// 当前版本不存在,忽略错误
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
//
|
|
159
|
+
// 执行安装命令
|
|
160
160
|
execSync(`npm install -g ${packageName}`, {
|
|
161
161
|
encoding: "utf-8",
|
|
162
162
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -164,8 +164,26 @@ async function performUpdate(packageName: string): Promise<void> {
|
|
|
164
164
|
|
|
165
165
|
spinner.succeed(colors.green("更新成功!"));
|
|
166
166
|
console.log("");
|
|
167
|
-
console.log(
|
|
168
|
-
|
|
167
|
+
console.log(
|
|
168
|
+
boxen(
|
|
169
|
+
[
|
|
170
|
+
colors.bold("✨ 更新完成!"),
|
|
171
|
+
"",
|
|
172
|
+
colors.dim("请运行以下命令刷新并使用新版本:"),
|
|
173
|
+
"",
|
|
174
|
+
colors.yellow(" hash -r && gw --version"),
|
|
175
|
+
"",
|
|
176
|
+
colors.dim("或者重新打开终端"),
|
|
177
|
+
].join("\n"),
|
|
178
|
+
{
|
|
179
|
+
padding: 1,
|
|
180
|
+
margin: { top: 0, bottom: 1, left: 2, right: 2 },
|
|
181
|
+
borderStyle: "round",
|
|
182
|
+
borderColor: "green",
|
|
183
|
+
align: "left",
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
);
|
|
169
187
|
|
|
170
188
|
// 更新成功后退出,让用户重新运行
|
|
171
189
|
process.exit(0);
|
|
@@ -173,10 +191,6 @@ async function performUpdate(packageName: string): Promise<void> {
|
|
|
173
191
|
spinner.fail(colors.red("更新失败"));
|
|
174
192
|
console.log("");
|
|
175
193
|
console.log(colors.dim(" 你可以手动运行以下命令更新:"));
|
|
176
|
-
console.log(colors.yellow(" # 如果之前安装过旧版本,先卸载:"));
|
|
177
|
-
console.log(colors.cyan(" npm uninstall -g git-workflow"));
|
|
178
|
-
console.log("");
|
|
179
|
-
console.log(colors.yellow(" # 然后安装新版本:"));
|
|
180
194
|
console.log(colors.cyan(` npm install -g ${packageName}`));
|
|
181
195
|
console.log("");
|
|
182
196
|
}
|