@wenyan-md/cli 1.0.0 → 1.0.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/README.md
CHANGED
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
npm install -g @wenyan-md/cli
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
---
|
|
30
|
+
|
|
29
31
|
## 基本用法
|
|
30
32
|
|
|
31
33
|
主命令为:
|
|
@@ -34,7 +36,45 @@ npm install -g @wenyan-md/cli
|
|
|
34
36
|
wenyan <command> [options]
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 环境变量
|
|
42
|
+
|
|
43
|
+
某些功能(如发布到微信公众号)需要配置以下环境变量:
|
|
44
|
+
|
|
45
|
+
* `WECHAT_APP_ID`
|
|
46
|
+
* `WECHAT_APP_SECRET`
|
|
47
|
+
|
|
48
|
+
### macOS / Linux
|
|
49
|
+
|
|
50
|
+
可在命令前临时设置:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
WECHAT_APP_ID=xxx WECHAT_APP_SECRET=yyy wenyan publish "your markdown"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
或在 `~/.bashrc` / `~/.zshrc` 中永久添加:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export WECHAT_APP_ID=xxx
|
|
60
|
+
export WECHAT_APP_SECRET=yyy
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Windows (PowerShell)
|
|
64
|
+
|
|
65
|
+
临时设置:
|
|
66
|
+
|
|
67
|
+
```powershell
|
|
68
|
+
$env:WECHAT_APP_ID="xxx"; $env:WECHAT_APP_SECRET="yyy"; wenyan publish "your markdown"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
永久设置(在环境变量里添加):
|
|
72
|
+
|
|
73
|
+
控制面板 → 系统和安全 → 系统 → 高级系统设置 → 环境变量 → 添加 `WECHAT_APP_ID` 和 `WECHAT_APP_SECRET`。
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 子命令
|
|
38
78
|
|
|
39
79
|
`publish`
|
|
40
80
|
|
|
@@ -50,7 +90,9 @@ wenyan <command> [options]
|
|
|
50
90
|
- `-h`,代码高亮主题,默认`solarized-light`
|
|
51
91
|
- `-m`,使用 Mac 风格的代码块,默认启用,如要关闭:`--no-mac-style`
|
|
52
92
|
|
|
53
|
-
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 示例
|
|
54
96
|
|
|
55
97
|
直接传入内容:
|
|
56
98
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,iBAiChF"}
|
package/dist/commands/publish.js
CHANGED
|
@@ -28,8 +28,13 @@ export async function publishCommand(inputContent, options) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
console.error("An unexpected error occurred during publishing:");
|
|
33
|
+
console.error(error.message);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.error("An unexpected error occurred:", error);
|
|
37
|
+
}
|
|
33
38
|
process.exit(1);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,aAAa,iBAqB3F"}
|
package/dist/commands/render.js
CHANGED
|
@@ -14,8 +14,13 @@ export async function renderCommand(inputContent, options) {
|
|
|
14
14
|
// process.exit(0);
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
if (error instanceof Error) {
|
|
18
|
+
console.error("An unexpected error occurred during publishing:");
|
|
19
|
+
console.error(error.message);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.error("An unexpected error occurred:", error);
|
|
23
|
+
}
|
|
19
24
|
process.exit(1);
|
|
20
25
|
}
|
|
21
26
|
}
|
package/package.json
CHANGED