@donxdone/aboutme-cli 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yieldone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # aboutme-cli
2
+
3
+ 东东's Blog 个人简介命令行版本。
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ npx @donxdone/aboutme-cli
9
+ ```
10
+
11
+ 安装后也可以使用更短的 bin 名称:
12
+
13
+ ```sh
14
+ npm install -g @donxdone/aboutme-cli
15
+ donxdone
16
+ ```
17
+
18
+ ## Development
19
+
20
+ ```sh
21
+ npm install
22
+ npm test
23
+ npm start
24
+ ```
25
+
26
+ ## Release
27
+
28
+ 这个仓库使用 GitHub Actions + npm Trusted Publishing 发布到 npm。
29
+
30
+ 首次发布前需要在 npm 上配置 Trusted Publisher:
31
+
32
+ 1. 打开 npm 包页面或创建包 `@donxdone/aboutme-cli`
33
+ 2. 进入 `Settings` -> `Publishing access`
34
+ 3. 添加 Trusted Publisher:
35
+ - Publisher: GitHub Actions
36
+ - Repository owner: `sincerefly`
37
+ - Repository name: `aboutme-cli`
38
+ - Workflow filename: `publish.yml`
39
+ - Environment name: 留空
40
+
41
+ 发版流程:
42
+
43
+ ```sh
44
+ npm version patch
45
+ git push --follow-tags
46
+ ```
47
+
48
+ 然后在 GitHub 根据新 tag 创建 Release,发布 Release 后会自动运行 `.github/workflows/publish.yml` 并发布到 npm。
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+
3
+ const ESC = "\x1b[";
4
+ const RESET = `${ESC}0m`;
5
+ const rgb = (red, green, blue) => `${ESC}38;2;${red};${green};${blue}m`;
6
+ const styles = {
7
+ title: `${ESC}1;38;2;199;67;80m`,
8
+ label: `${ESC}38;2;199;67;80m`,
9
+ accent: rgb(80, 134, 161),
10
+ muted: rgb(102, 102, 102),
11
+ subtle: rgb(153, 153, 153),
12
+ link: `${ESC}4;38;2;199;67;80m`,
13
+ success: rgb(39, 174, 96)
14
+ };
15
+
16
+ const profile = [
17
+ [{ text: "东东's Blog", style: "title" }],
18
+ [],
19
+ [{ text: "你好,我是东东。", style: "accent" }],
20
+ [
21
+ { text: "毕业后曾在" },
22
+ { text: "北京", style: "label" },
23
+ { text: "工作两三年,2017 年回到" },
24
+ { text: "哈尔滨", style: "label" },
25
+ { text: "继续做软件开发,2021 年又回到" },
26
+ { text: "北京", style: "label" },
27
+ { text: "。" }
28
+ ],
29
+ [],
30
+ [{ text: "现在会在博客里记录值得长期保留的实践、经验和日常片段。" }],
31
+ [
32
+ { text: "关注方向:", style: "label" },
33
+ { text: "Golang / CI/CD / Kubernetes", style: "accent" },
34
+ { text: " / 静态博客 / 自托管服务" }
35
+ ],
36
+ [],
37
+ [
38
+ { text: "Blog: ", style: "label" },
39
+ { text: "https://blog.yasking.org/", style: "link" }
40
+ ],
41
+ [
42
+ { text: "About: ", style: "label" },
43
+ { text: "https://blog.yasking.org/pages/about.html", style: "link" }
44
+ ],
45
+ [
46
+ { text: "GitHub: ", style: "label" },
47
+ { text: "https://github.com/sincerefly", style: "link" }
48
+ ],
49
+ [
50
+ { text: "npm: ", style: "label" },
51
+ { text: "https://www.npmjs.com/~donxdone", style: "link" }
52
+ ],
53
+ [],
54
+ [
55
+ { text: "本站使用 ", style: "muted" },
56
+ { text: "Pelican", style: "accent" },
57
+ { text: " 生成,", style: "muted" },
58
+ { text: "DNSPod", style: "subtle" },
59
+ { text: " 解析,海外走 ", style: "muted" },
60
+ { text: "Cloudflare Pages", style: "success" },
61
+ { text: ",国内托管在又拍云。", style: "muted" }
62
+ ]
63
+ ];
64
+
65
+ const delayMs = Number.parseInt(process.env.ABOUTME_CLI_DELAY ?? "18", 10);
66
+ const shouldColor = process.env.FORCE_COLOR !== undefined || process.env.NO_COLOR === undefined;
67
+
68
+ function colorize(text, style) {
69
+ if (!shouldColor || !style) {
70
+ return text;
71
+ }
72
+
73
+ return `${styles[style]}${text}${RESET}`;
74
+ }
75
+
76
+ function sleep(ms) {
77
+ return new Promise((resolve) => {
78
+ setTimeout(resolve, ms);
79
+ });
80
+ }
81
+
82
+ async function writeAnimated(text) {
83
+ if (delayMs <= 0) {
84
+ process.stdout.write(text);
85
+ return;
86
+ }
87
+
88
+ for (const char of text) {
89
+ process.stdout.write(char);
90
+ await sleep(delayMs);
91
+ }
92
+ }
93
+
94
+ for (const line of profile) {
95
+ for (const segment of line) {
96
+ await writeAnimated(colorize(segment.text, segment.style));
97
+ }
98
+
99
+ process.stdout.write("\n");
100
+ if (delayMs > 0 && line.length === 0) {
101
+ await sleep(delayMs * 8);
102
+ }
103
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@donxdone/aboutme-cli",
3
+ "version": "0.1.0",
4
+ "description": "东东's Blog 个人简介命令行版本",
5
+ "license": "MIT",
6
+ "author": "Yieldone",
7
+ "type": "module",
8
+ "bin": {
9
+ "aboutme-cli": "./bin/aboutme-cli.js",
10
+ "donxdone": "./bin/aboutme-cli.js"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "start": "node ./bin/aboutme-cli.js",
19
+ "test": "node --test && node --check ./bin/aboutme-cli.js"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/sincerefly/aboutme-cli.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/sincerefly/aboutme-cli/issues"
27
+ },
28
+ "homepage": "https://github.com/sincerefly/aboutme-cli#readme",
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "engines": {
33
+ "node": ">=18"
34
+ }
35
+ }