@harvey0379/vite-ts-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/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @harvey0379/vite-ts-cli
2
+
3
+ 基于 **Vite + TypeScript** 的简单 CLI 模板,包含:
4
+
5
+ - CLI 源码与构建配置
6
+ - GitHub Release 自动发布
7
+ - GitHub Actions 自动发布 npm(`@harvey0379` 命名空间)
8
+
9
+ ## 使用
10
+
11
+ ### 本地开发
12
+
13
+ ```bash
14
+ pnpm install
15
+ pnpm run build
16
+ node dist/index.js --name=Harvey
17
+ ```
18
+
19
+ 或通过 bin 名称执行(全局安装或 npm link 后):
20
+
21
+ ```bash
22
+ harvey-cli --name=Harvey
23
+ ```
24
+
25
+ ## 发布流程
26
+
27
+ ### 1) GitHub Release
28
+
29
+ 推送 tag 后会自动创建 release:
30
+
31
+ ```bash
32
+ git tag v0.1.0
33
+ git push origin v0.1.0
34
+ ```
35
+
36
+ ### 2) GitHub Actions 发布 npm
37
+
38
+ 当发布 release(`published`)时,会自动执行 `pnpm publish --access public --no-git-checks`。
39
+
40
+ 支持两种认证方式,满足其一即可:
41
+
42
+ 1. `NPM_TOKEN`(兼容现有配置)
43
+ - 在仓库 `Settings > Secrets and variables > Actions` 中添加
44
+ - 值为 npm access token,且需要有 publish 权限
45
+
46
+ 2. npm trusted publishing(推荐)
47
+ - 在 npm 包页面的 `Settings -> Trusted publishing` 中配置 GitHub Actions
48
+ - workflow filename 填写:`npm-publish.yml`
49
+ - repository 填写当前仓库:`Huauauaa/ai-ts-cli`
50
+ - workflow 已开启 `id-token: write`,并使用 Node.js 24 以支持 OIDC 发布
51
+
52
+ 包名当前为:
53
+
54
+ - `@harvey0379/vite-ts-cli`
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ //#region src/index.ts
3
+ function run() {
4
+ const args = process.argv.slice(2);
5
+ const nameArg = args.find((arg) => arg.startsWith("--name="));
6
+ const name = nameArg ? nameArg.split("=")[1] : "world";
7
+ if (args.includes("--help") || args.includes("-h")) {
8
+ console.log("Usage: harvey-cli [--name=<name>]");
9
+ return;
10
+ }
11
+ console.log(`Hello, ${name}! This CLI is built with Vite + TypeScript.`);
12
+ }
13
+ run();
14
+ //#endregion
15
+ export {};
16
+
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["function run(): void {\n const args = process.argv.slice(2);\n const nameArg = args.find((arg) => arg.startsWith(\"--name=\"));\n const name = nameArg ? nameArg.split(\"=\")[1] : \"world\";\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n console.log(\"Usage: harvey-cli [--name=<name>]\");\n return;\n }\n\n console.log(`Hello, ${name}! This CLI is built with Vite + TypeScript.`);\n}\n\nrun();\n"],"mappings":";;AAAA,SAAS,MAAY;CACnB,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAClC,MAAM,UAAU,KAAK,MAAM,QAAQ,IAAI,WAAW,UAAU,CAAC;CAC7D,MAAM,OAAO,UAAU,QAAQ,MAAM,IAAI,CAAC,KAAK;AAE/C,KAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,KAAK,EAAE;AAClD,UAAQ,IAAI,oCAAoC;AAChD;;AAGF,SAAQ,IAAI,UAAU,KAAK,6CAA6C;;AAG1E,KAAK"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@harvey0379/vite-ts-cli",
3
+ "version": "0.1.0",
4
+ "description": "A CLI tool built with Vite + TypeScript",
5
+ "type": "module",
6
+ "bin": {
7
+ "harvey-cli": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "main": "./dist/index.js",
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "provenance": true
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Huauauaa/ai-ts-cli.git"
20
+ },
21
+ "keywords": [
22
+ "cli",
23
+ "typescript",
24
+ "vite"
25
+ ],
26
+ "author": "",
27
+ "license": "ISC",
28
+ "bugs": {
29
+ "url": "https://github.com/Huauauaa/ai-ts-cli/issues"
30
+ },
31
+ "homepage": "https://github.com/Huauauaa/ai-ts-cli#readme",
32
+ "devDependencies": {
33
+ "@types/node": "^25.5.0",
34
+ "typescript": "^6.0.2",
35
+ "vite": "^8.0.2"
36
+ },
37
+ "scripts": {
38
+ "build": "vite build && chmod +x dist/index.js",
39
+ "dev": "vite build --watch",
40
+ "typecheck": "tsc --noEmit",
41
+ "test": "pnpm run typecheck"
42
+ }
43
+ }