Răsfoiți Sursa

移除 hermes-yaoyao 命令别名,仅保留 yaoyao

Samien 1 lună în urmă
părinte
comite
8253a27eb2
4 a modificat fișierele cu 11 adăugiri și 15 ștergeri
  1. 1 1
      docs/npm-install.md
  2. 0 1
      package-lock.json
  3. 0 1
      package.json
  4. 10 12
      tests/serviceCli.test.ts

+ 1 - 1
docs/npm-install.md

@@ -36,7 +36,7 @@ yaoyao service uninstall  # 卸载服务(数据保留)
 yaoyao --version          # 查看已安装的 npm 包版本
 ```
 
-版本查询也支持 `yaoyao version` 和 `yaoyao -v`,无需安装或启动服务。`hermes-yaoyao` 是同一命令的别名,支持上述全部用法。
+版本查询也支持 `yaoyao version` 和 `yaoyao -v`,无需安装或启动服务。
 
 ## 配置
 

+ 0 - 1
package-lock.json

@@ -52,7 +52,6 @@
         "zod": "^4.1.12"
       },
       "bin": {
-        "hermes-yaoyao": "bin/hermes-yaoyao.mjs",
         "yaoyao": "bin/hermes-yaoyao.mjs"
       },
       "devDependencies": {

+ 0 - 1
package.json

@@ -9,7 +9,6 @@
     "node": ">=24.0.0"
   },
   "bin": {
-    "hermes-yaoyao": "./bin/hermes-yaoyao.mjs",
     "yaoyao": "./bin/hermes-yaoyao.mjs"
   },
   "scripts": {

+ 10 - 12
tests/serviceCli.test.ts

@@ -20,7 +20,7 @@ describe('npm-installed CLI commands', () => {
     const launchAgents = join(root, 'Library', 'LaunchAgents')
     mkdirSync(launchAgents, { recursive: true })
     plist = join(launchAgents, `${label}.plist`)
-    for (const name of ['yaoyao', 'hermes-yaoyao']) symlinkSync(entry, join(bin, name))
+    symlinkSync(entry, join(bin, 'yaoyao'))
     writeFileSync(join(bin, 'launchctl'), `#!${process.execPath}
 import { appendFileSync } from 'node:fs'
 const args = process.argv.slice(2)
@@ -35,8 +35,8 @@ if (args[0] === 'print' && process.env.YAOYAO_CLI_TEST_LOADED !== '1') process.e
 
   afterEach(() => { rmSync(root, { recursive: true, force: true }) })
 
-  function runCli(args: string[], env: NodeJS.ProcessEnv = {}, name = 'yaoyao') {
-    return spawnSync(process.execPath, [join(root, 'bin', name), ...args], {
+  function runCli(args: string[], env: NodeJS.ProcessEnv = {}) {
+    return spawnSync(process.execPath, [join(root, 'bin', 'yaoyao'), ...args], {
       cwd: root,
       encoding: 'utf8',
       timeout: 5_000,
@@ -57,24 +57,22 @@ if (args[0] === 'print' && process.env.YAOYAO_CLI_TEST_LOADED !== '1') process.e
     return existsSync(log) ? readFileSync(log, 'utf8').trim().split('\n').map(line => JSON.parse(line)) : []
   }
 
-  it.each(['version', '--version', '-v'])('queries the package version through both npm bin aliases: %s', command => {
-    for (const name of ['yaoyao', 'hermes-yaoyao']) {
-      const result = runCli([command], {}, name)
-      expect(result.status).toBe(0)
-      expect(result.stdout).toBe(`${version}\n`)
-      expect(result.stderr).toBe('')
-    }
+  it.each(['version', '--version', '-v'])('queries the package version through yaoyao: %s', command => {
+    const result = runCli([command])
+    expect(result.status).toBe(0)
+    expect(result.stdout).toBe(`${version}\n`)
+    expect(result.stderr).toBe('')
     expect(calls()).toEqual([])
     expect(existsSync(join(root, 'data'))).toBe(false)
   })
 
-  it.each(['yaoyao', 'hermes-yaoyao'])('restarts the installed service through %s while preserving its configuration and data', name => {
+  it('restarts the installed service while preserving its configuration and data', () => {
     writeFileSync(plist, 'saved service configuration')
     mkdirSync(join(root, 'data'))
     const data = join(root, 'data', 'keep.txt')
     writeFileSync(data, 'saved user data')
 
-    const result = runCli(['service', 'restart'], { YAOYAO_CLI_TEST_LOADED: '1' }, name)
+    const result = runCli(['service', 'restart'], { YAOYAO_CLI_TEST_LOADED: '1' })
 
     expect(result.status).toBe(0)
     expect(result.stdout).toBe(`已重启 ${label}\n`)