@done-coding/cli 0.15.20-alpha.0 → 0.15.20-alpha.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/es/cli.mjs CHANGED
@@ -10,7 +10,7 @@ import { crateAsSubcommand as t } from "@done-coding/cli-config";
10
10
  import { getRootScriptName as d, createMainCommand as i } from "@done-coding/cli-utils";
11
11
  const m = {
12
12
  name: "@done-coding/cli",
13
- version: "0.15.20-alpha.0",
13
+ version: "0.15.20-alpha.1",
14
14
  description: "done-coding命令行工具",
15
15
  bin: {
16
16
  DC: "es/cli.mjs",
package/es/dc-cli.mjs CHANGED
@@ -10,7 +10,7 @@ import { crateAsSubcommand as t } from "@done-coding/cli-config";
10
10
  import { getRootScriptName as d, createMainCommand as i } from "@done-coding/cli-utils";
11
11
  const m = {
12
12
  name: "@done-coding/cli",
13
- version: "0.15.20-alpha.0",
13
+ version: "0.15.20-alpha.1",
14
14
  description: "done-coding命令行工具",
15
15
  bin: {
16
16
  DC: "es/cli.mjs",
@@ -10,7 +10,7 @@ import { crateAsSubcommand as t } from "@done-coding/cli-config";
10
10
  import { getRootScriptName as d, createMainCommand as i } from "@done-coding/cli-utils";
11
11
  const m = {
12
12
  name: "@done-coding/cli",
13
- version: "0.15.20-alpha.0",
13
+ version: "0.15.20-alpha.1",
14
14
  description: "done-coding命令行工具",
15
15
  bin: {
16
16
  DC: "es/cli.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli",
3
- "version": "0.15.20-alpha.0",
3
+ "version": "0.15.20-alpha.1",
4
4
  "description": "done-coding命令行工具",
5
5
  "private": false,
6
6
  "module": "es/cli.mjs",
@@ -20,7 +20,8 @@
20
20
  "files": [
21
21
  "es",
22
22
  "lib",
23
- "types"
23
+ "types",
24
+ "scripts/postinstall.mjs"
24
25
  ],
25
26
  "scripts": {
26
27
  "clean": "rimraf es lib types",
@@ -29,7 +30,7 @@
29
30
  "dev": "vite build --watch",
30
31
  "prebuild": "pnpm run clean",
31
32
  "build": "vite build && pnpm run moreCli",
32
- "postinstall": "node es/postinstall.mjs",
33
+ "postinstall": "node scripts/postinstall.mjs",
33
34
  "prepack": "pnpm build"
34
35
  },
35
36
  "repository": {
@@ -55,15 +56,15 @@
55
56
  "node": ">=18.0.0"
56
57
  },
57
58
  "dependencies": {
58
- "@done-coding/cli-component": "0.4.10-alpha.0",
59
- "@done-coding/cli-config": "0.1.13-alpha.0",
60
- "@done-coding/cli-extract": "0.1.21-alpha.0",
61
- "@done-coding/cli-git": "0.6.13-alpha.0",
62
- "@done-coding/cli-inject": "0.5.21-alpha.0",
63
- "@done-coding/cli-publish": "0.7.14-alpha.0",
64
- "@done-coding/cli-template": "0.8.8-alpha.0",
65
- "@done-coding/cli-utils": "0.8.2-alpha.0",
66
- "create-done-coding": "0.11.23-alpha.0"
59
+ "@done-coding/cli-component": "0.4.10-alpha.1",
60
+ "@done-coding/cli-config": "0.1.13-alpha.1",
61
+ "@done-coding/cli-extract": "0.1.21-alpha.1",
62
+ "@done-coding/cli-git": "0.6.13-alpha.1",
63
+ "@done-coding/cli-inject": "0.5.21-alpha.1",
64
+ "@done-coding/cli-publish": "0.7.14-alpha.1",
65
+ "@done-coding/cli-template": "0.8.8-alpha.1",
66
+ "@done-coding/cli-utils": "0.8.2-alpha.1",
67
+ "create-done-coding": "0.11.23-alpha.1"
67
68
  },
68
- "gitHead": "b09dd794f69ba2dafe22a3519d712d059c2eb376"
69
+ "gitHead": "660e39fc523e4eba1ea621e3c59122f98015a2de"
69
70
  }
@@ -0,0 +1,53 @@
1
+ import path from 'node:path';
2
+
3
+ /**
4
+ * 自身应该跳过
5
+ * ---
6
+ * 检测是自身为宿主安装依赖时
7
+ */
8
+ const shouldSkip = () => {
9
+ const initCwd = process.env.INIT_CWD;
10
+ const cwd = process.cwd();
11
+
12
+ // 1. 尝试 INIT_CWD 比对(覆盖 90% 简单场景)
13
+ if (initCwd && path.resolve(initCwd) === path.resolve(cwd)) return true;
14
+
15
+ // 2. 特征路径扫描(覆盖 Monorepo 和 符号链接场景)
16
+ // 只要路径里没出现 node_modules,就判定为是在自己家开发
17
+ if (!cwd.split(path.sep).includes('node_modules')) return true;
18
+
19
+ return false;
20
+ }
21
+
22
+ /** 使用提示 */
23
+ const usageTips = () => {
24
+ /** 自身是否为依赖包 */
25
+ if (shouldSkip()) {
26
+ return process.exit(0);
27
+ }
28
+
29
+ const isWindows = process.platform === "win32";
30
+
31
+ console.log(`
32
+ 🎉 安装成功! 使用方式:
33
+
34
+ ${isWindows ? "在 CMD/PowerShell 中输入:" : "在终端中输入:"}
35
+
36
+ ${isWindows
37
+ ? " dc 或 dc-cli 或 done-coding [命令]"
38
+ : " DC 或 dc-cli 或 done-coding [命令]"
39
+ }
40
+
41
+ ${!isWindows
42
+ ? `
43
+ ⚠️ 注意:
44
+ 不要使用小写 "dc",会调用系统计算器
45
+ `
46
+ : ""
47
+ }
48
+ `);
49
+ }
50
+
51
+
52
+ usageTips()
53
+
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- const o = process.platform === "win32";
3
- console.log(`
4
- 🎉 安装成功! 使用方式:
5
-
6
- ${o ? "在 CMD/PowerShell 中输入:" : "在终端中输入:"}
7
-
8
- ${o ? " dc 或 dc-cli 或 done-coding [命令]" : " DC 或 dc-cli 或 done-coding [命令]"}
9
-
10
- ${o ? "" : `
11
- ⚠️ 注意:
12
- 不要使用小写 "dc",会调用系统计算器
13
- `}
14
- `);
@@ -1 +0,0 @@
1
- export { }