@zjex/git-workflow 0.2.2 → 0.2.4

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 CHANGED
@@ -1,10 +1,4 @@
1
- #!/usr/bin/env node
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
1
+ #!/usr/bin/env -S node --no-warnings=ExperimentalWarning
8
2
 
9
3
  // src/index.ts
10
4
  import { cac } from "cac";
@@ -1345,6 +1339,9 @@ Commit \u547D\u4EE4:
1345
1339
 
1346
1340
  // src/update-notifier.ts
1347
1341
  import { execSync as execSync6 } from "child_process";
1342
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3 } from "fs";
1343
+ import { homedir } from "os";
1344
+ import { join as join2 } from "path";
1348
1345
  import boxen from "boxen";
1349
1346
  import { select as select7 } from "@inquirer/prompts";
1350
1347
  import ora5 from "ora";
@@ -1467,14 +1464,11 @@ async function performUpdate(packageName) {
1467
1464
  }
1468
1465
  function readCache() {
1469
1466
  try {
1470
- const fs = __require("fs");
1471
- const os = __require("os");
1472
- const path = __require("path");
1473
- const cacheFile = path.join(os.homedir(), CACHE_FILE);
1474
- if (!fs.existsSync(cacheFile)) {
1467
+ const cacheFile = join2(homedir(), CACHE_FILE);
1468
+ if (!existsSync3(cacheFile)) {
1475
1469
  return null;
1476
1470
  }
1477
- const content = fs.readFileSync(cacheFile, "utf-8");
1471
+ const content = readFileSync3(cacheFile, "utf-8");
1478
1472
  return JSON.parse(content);
1479
1473
  } catch {
1480
1474
  return null;
@@ -1482,11 +1476,8 @@ function readCache() {
1482
1476
  }
1483
1477
  function writeCache(cache) {
1484
1478
  try {
1485
- const fs = __require("fs");
1486
- const os = __require("os");
1487
- const path = __require("path");
1488
- const cacheFile = path.join(os.homedir(), CACHE_FILE);
1489
- fs.writeFileSync(cacheFile, JSON.stringify(cache), "utf-8");
1479
+ const cacheFile = join2(homedir(), CACHE_FILE);
1480
+ writeFileSync3(cacheFile, JSON.stringify(cache), "utf-8");
1490
1481
  } catch {
1491
1482
  }
1492
1483
  }
@@ -1499,7 +1490,7 @@ process.on("uncaughtException", (err) => {
1499
1490
  console.error(err);
1500
1491
  process.exit(1);
1501
1492
  });
1502
- var version = true ? "0.2.2" : (await null).default.version;
1493
+ var version = true ? "0.2.4" : "0.0.0-dev";
1503
1494
  async function mainMenu() {
1504
1495
  checkForUpdates(version, "@zjex/git-workflow").catch(() => {
1505
1496
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjex/git-workflow",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "个人常用的 Git 工作流工具,快速创建规范的开发分支和管理 Tag",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ import { stash } from "./commands/stash.js";
12
12
  import { commit } from "./commands/commit.js";
13
13
  import { showHelp } from "./commands/help.js";
14
14
  import { checkForUpdates } from "./update-notifier.js";
15
+ import { checkForUpdates } from "./update-notifier.js";
15
16
 
16
17
  // 捕获 Ctrl+C 退出,静默处理
17
18
  process.on("uncaughtException", (err) => {
@@ -26,10 +27,9 @@ declare const __VERSION__: string | undefined;
26
27
 
27
28
  // 开发环境下从 package.json 读取版本号
28
29
  const version: string =
29
- typeof __VERSION__ !== "undefined"
30
+ typeof __VERSION__ !== "undefined" && __VERSION__ !== ""
30
31
  ? __VERSION__
31
- : (await import("../package.json", { with: { type: "json" } })).default
32
- .version;
32
+ : "0.0.0-dev";
33
33
 
34
34
  // 交互式主菜单
35
35
  async function mainMenu(): Promise<void> {
@@ -1,4 +1,7 @@
1
1
  import { execSync } from "child_process";
2
+ import { readFileSync, writeFileSync, existsSync } from "fs";
3
+ import { homedir } from "os";
4
+ import { join } from "path";
2
5
  import boxen from "boxen";
3
6
  import { select } from "@inquirer/prompts";
4
7
  import ora from "ora";
@@ -180,16 +183,13 @@ async function performUpdate(packageName: string): Promise<void> {
180
183
  */
181
184
  function readCache(): UpdateCache | null {
182
185
  try {
183
- const fs = require("fs");
184
- const os = require("os");
185
- const path = require("path");
186
- const cacheFile = path.join(os.homedir(), CACHE_FILE);
186
+ const cacheFile = join(homedir(), CACHE_FILE);
187
187
 
188
- if (!fs.existsSync(cacheFile)) {
188
+ if (!existsSync(cacheFile)) {
189
189
  return null;
190
190
  }
191
191
 
192
- const content = fs.readFileSync(cacheFile, "utf-8");
192
+ const content = readFileSync(cacheFile, "utf-8");
193
193
  return JSON.parse(content);
194
194
  } catch {
195
195
  return null;
@@ -201,12 +201,9 @@ function readCache(): UpdateCache | null {
201
201
  */
202
202
  function writeCache(cache: UpdateCache): void {
203
203
  try {
204
- const fs = require("fs");
205
- const os = require("os");
206
- const path = require("path");
207
- const cacheFile = path.join(os.homedir(), CACHE_FILE);
204
+ const cacheFile = join(homedir(), CACHE_FILE);
208
205
 
209
- fs.writeFileSync(cacheFile, JSON.stringify(cache), "utf-8");
206
+ writeFileSync(cacheFile, JSON.stringify(cache), "utf-8");
210
207
  } catch {
211
208
  // 静默失败
212
209
  }
package/tsup.config.ts CHANGED
@@ -20,7 +20,7 @@ export default defineConfig({
20
20
  "cac",
21
21
  ],
22
22
  banner: {
23
- js: "#!/usr/bin/env node",
23
+ js: "#!/usr/bin/env -S node --no-warnings=ExperimentalWarning",
24
24
  },
25
25
  define: {
26
26
  __VERSION__: JSON.stringify(pkg.version),