magpie-plugin-loomy-auth 0.1.18 → 0.1.21

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "magpie-plugin-loomy-auth",
3
- "version": "0.1.18",
4
- "description": "Loomy (iFlytek) for magpie: desktop-session import / SMS / session sign-in, live model catalog with reasoning efforts, chat with tools and images, and the two credit pools reported as the host routes them — the daily pool counts, the permanent one is shown aside.",
3
+ "version": "0.1.21",
4
+ "description": "讯飞 Loomy (iFlytek) for magpie: desktop-session import / SMS / session sign-in, live model catalog with reasoning efforts, chat with tools and images, and the two credit pools reported as the host routes them — the daily pool counts, the permanent one is shown aside.",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
7
7
  "exports": "./index.mjs",
@@ -39,12 +39,13 @@
39
39
  "node": "^22.19.0 || >=24.0.0"
40
40
  },
41
41
  "scripts": {
42
- "test": "node --test tests/",
42
+ "test": "node --test tests/*.test.mjs",
43
43
  "publish:npm": "node publish-npm.mjs"
44
44
  },
45
45
  "magpie": {
46
46
  "icon": "https://raw.githubusercontent.com/MYCF711/magpie-loomy-auth/main/assets/icon.png",
47
- "maxConcurrency": 4
47
+ "maxConcurrency": 4,
48
+ "name": "讯飞 Loomy"
48
49
  },
49
50
  "bugs": {
50
51
  "url": "https://github.com/MYCF711/magpie-loomy-auth/issues"
package/publish-npm.mjs CHANGED
@@ -1,40 +1,33 @@
1
- // 发布到 npm 的包装器 —— 用 `npm run publish:npm`,不要裸跑 `npm publish`。
1
+ // 发布到 npm 的包装器 —— 用 `npm run publish:npm`。
2
2
  //
3
- // 为什么要有它:两个读者开的是**同一个** package.json。
3
+ // package.json 的 name 现在是 ASCII slug(magpie-plugin-loomy-auth),也就是 npm 包名;
4
+ // 卡片标题改用 magpie.name(讯飞 Loomy)。所以发布时不需要再临时换 name。
4
5
  //
5
- // bun(magpie 的 git 安装)读它 → 决定插件卡片上的标题(依赖键 = name)
6
- // npm publish 读它 → 决定包名
7
- //
8
- // npm 不允许**新**包名含大写(registry 会拒:name can no longer contain capital
9
- // letters),而卡片标题想要供应商自己的写法。所以发布这一下把 name 换成 npm 上的
10
- // 包名,发完立刻还原 —— 仓库里永远留着好看的那个名字。
11
- //
12
- // ⚠ 从此不要裸跑 `npm publish`:那会拿 "Loomy" 去发,被 registry 拒绝。
13
- // ⚠ 机制说明见 magpie-plugin-scaffold 的 UPDATING.md。
6
+ // 保留这个包装器是为了旧分支/旧文档仍走同一条命令;它只在 name 与 PUBLISH_AS
7
+ // 不一致时才临时换名,发布后无论成败都恢复。
14
8
 
15
9
  import fs from "node:fs"
16
10
  import { fileURLToPath } from "node:url"
17
11
  import { execSync } from "node:child_process"
18
12
 
19
- /** npm 上的包名。与仓库里的 name 不同是**故意的** —— 已装的用户按这个名收更新。 */
13
+ /** npm 上的包名。与仓库里的 name 相同是正常的。 */
20
14
  const PUBLISH_AS = "magpie-plugin-loomy-auth"
21
15
 
22
16
  const FILE = fileURLToPath(new URL("./package.json", import.meta.url))
23
-
24
17
  const orig = fs.readFileSync(FILE, "utf8")
25
18
  const pkg = JSON.parse(orig)
26
19
 
27
- if (pkg.name === PUBLISH_AS) {
28
- console.error(`package.json 的 name 已经是 ${PUBLISH_AS} —— 没有可换的,停。`)
29
- process.exit(1)
20
+ const renamed = pkg.name !== PUBLISH_AS
21
+ if (renamed) {
22
+ pkg.name = PUBLISH_AS
23
+ fs.writeFileSync(FILE, JSON.stringify(pkg, null, 2) + "\n")
30
24
  }
31
25
 
32
- pkg.name = PUBLISH_AS
33
- fs.writeFileSync(FILE, JSON.stringify(pkg, null, 2) + "\n")
34
-
35
26
  try {
36
- execSync(process.argv[2] || "npm publish", { stdio: "inherit" })
27
+ execSync(process.argv[2] || "npm publish --access public", { stdio: "inherit" })
37
28
  } finally {
38
- fs.writeFileSync(FILE, orig)
39
- console.log(`name 已还原为 ${JSON.parse(orig).name}`)
29
+ if (renamed) {
30
+ fs.writeFileSync(FILE, orig)
31
+ console.log("name 已还原为 " + JSON.parse(orig).name)
32
+ }
40
33
  }