@houser/edus-plugin 1.0.5 → 1.0.7

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.
Files changed (3) hide show
  1. package/README.md +49 -3
  2. package/lib/client.js +67 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ npm run dev
34
34
  │ ├── Brand.tsx # 品牌名称与 Logo React 组件
35
35
  │ └── logo.png # 裁切、缩放后的透明 Logo 源文件
36
36
  ├── scripts/
37
- │ └── embed-logo.mjs # 构建时将 PNG 内联为 data URL
37
+ │ └── generate-typert.mjs # 构建时生成 typert 协议桥接代码
38
38
  └── lib/ # 构建产物(自动生成,不提交)
39
39
  ├── index.js
40
40
  ├── client.js
@@ -70,6 +70,52 @@ npm run build # 清理后依次执行以上两步
70
70
 
71
71
  ## 发布版本
72
72
 
73
- 发布版本的时候必须指定 tag,tag 会关联 deepseek harness 版本(一般就是当前分支的名称)
73
+ ### 必须先构建
74
74
 
75
- 示例 `npm publish --registry=https://registry.npmjs.org --tag dsh-v0.1.6-alpha.2`
75
+ `package.json` 中没有 `prepare` / `prepublishOnly` / `prepack` 钩子,`npm publish` **不会**自动构建。而 `files` 字段声明的全部是 `lib/` 下的产物,且 `lib/` 已被 `.gitignore` 忽略。因此发布前必须手动执行构建,否则会把上一次遗留的旧产物发出去,或发出一个缺少入口文件的空包。
76
+
77
+ ### 发布步骤
78
+
79
+ ```bash
80
+ # 1. 同步依赖(切换分支或改过 peerDependencies 后必做)
81
+ pnpm install
82
+
83
+ # 2. 构建 + 测试:clean → build:host → build:client → vitest
84
+ npm run check
85
+
86
+ # 3. 确认打包内容:应包含 lib/index.js、lib/client.js、
87
+ # lib/typert.*.js、lib/types/**/*.d.ts、cordis.yml
88
+ npm run pack:dry
89
+
90
+ # 4. 升版本号(会自动创建 git commit 和 tag)
91
+ npm version patch
92
+
93
+ # 5. 发布,必须带 --tag
94
+ npm publish --registry=https://registry.npmjs.org --tag dsh-v0.1.6-alpha.2
95
+
96
+ # 6. 推送版本提交
97
+ git push && git push --tags
98
+
99
+ # npm 需要登录
100
+ npm login --registry=https://registry.npmjs.org/
101
+ ```
102
+
103
+ ### 关于 `--tag`
104
+
105
+ 发布必须指定 npm dist-tag,用于关联对应的 DeepSeek Harness 版本(一般就是当前分支名称)。**不要**使用默认的 `latest`:不同 Harness 版本的 peerDependencies 不兼容,混用 `latest` 会让安装方拿到与自己 Harness 版本不匹配的插件。
106
+
107
+ dist-tag 取值与 `peerDependencies` 中 `@deepseek-ai/dsh-*` 的版本保持一致,例如当前 peer 版本为 `0.1.6-alpha.2`,则 tag 为 `dsh-v0.1.6-alpha.2`。
108
+
109
+ 安装方按 tag 取包:
110
+
111
+ ```bash
112
+ npm install @houser/edus-plugin@dsh-v0.1.6-alpha.2
113
+ ```
114
+
115
+ ### 发布前检查清单
116
+
117
+ - [ ] `peerDependencies` 中的 `@deepseek-ai/dsh-*` 版本与目标 Harness 版本一致
118
+ - [ ] `npm run check` 通过(构建 + 测试)
119
+ - [ ] `npm run pack:dry` 的文件列表完整,且不含 `src/`、`node_modules/` 等多余内容
120
+ - [ ] 替换过 `src/client/logo.png` 的话,已重新构建(data URL 在构建时生成)
121
+ - [ ] `--tag` 与目标 Harness 版本对应,且不是 `latest`
package/lib/client.js CHANGED
@@ -6351,9 +6351,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6351
6351
  ...base.error,
6352
6352
  ...theme.error
6353
6353
  };
6354
+ const busyRef = (0, react.useRef)(busy);
6355
+ const busyChangeRef = (0, react.useRef)(onBusyChange);
6356
+ busyRef.current = busy;
6357
+ busyChangeRef.current = onBusyChange;
6354
6358
  (0, react.useEffect)(() => {
6355
6359
  onBusyChange?.(busy);
6356
6360
  }, [busy, onBusyChange]);
6361
+ (0, react.useEffect)(() => () => {
6362
+ if (busyRef.current) busyChangeRef.current?.(false);
6363
+ }, []);
6357
6364
  const switchMode = (next) => {
6358
6365
  setMode(next);
6359
6366
  setError("");
@@ -6495,6 +6502,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6495
6502
  function basename(path) {
6496
6503
  return path.split("/").at(-1) ?? path;
6497
6504
  }
6505
+ /** 后端在未开通会员时返回的提示里带有这个字眼,此时改为引导扫码联系客服。 */
6506
+ const MEMBERSHIP_HINT = "需要开通会员";
6507
+ const SERVICE_QR = "https://cdn.juzhenai.cn/ai-edu/assets/wechat.webp";
6498
6508
  const styles$1 = {
6499
6509
  root: {
6500
6510
  display: "flex",
@@ -6668,6 +6678,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6668
6678
  fontSize: 18,
6669
6679
  fontWeight: 700
6670
6680
  },
6681
+ memberCard: {
6682
+ display: "flex",
6683
+ gap: 14,
6684
+ alignItems: "center",
6685
+ margin: "14px 0 0",
6686
+ padding: 13,
6687
+ border: "1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 35%, var(--dsw-alias-border-l2))",
6688
+ borderRadius: 11,
6689
+ background: "var(--dsw-alias-bg-layer-1)"
6690
+ },
6691
+ memberQr: {
6692
+ flex: "none",
6693
+ width: 96,
6694
+ height: 96,
6695
+ borderRadius: 8,
6696
+ background: "#fff",
6697
+ objectFit: "contain"
6698
+ },
6699
+ memberTitle: {
6700
+ margin: 0,
6701
+ color: "var(--dsw-alias-label-primary)",
6702
+ fontSize: 13,
6703
+ fontWeight: 650
6704
+ },
6705
+ memberText: {
6706
+ margin: "5px 0 0",
6707
+ color: "var(--dsw-alias-label-secondary)",
6708
+ fontSize: 12,
6709
+ lineHeight: 1.55
6710
+ },
6671
6711
  accountCard: {
6672
6712
  margin: "0 0 15px",
6673
6713
  padding: "9px 11px",
@@ -6679,6 +6719,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6679
6719
  lineHeight: 1.5
6680
6720
  }
6681
6721
  };
6722
+ /** 普通报错直接展示文案;会员相关的报错额外给出客服二维码。 */
6723
+ function PublishError({ message }) {
6724
+ if (message === "") return null;
6725
+ if (!message.includes(MEMBERSHIP_HINT)) return (0, react_jsx_runtime.jsx)("p", {
6726
+ style: styles$1.error,
6727
+ children: message
6728
+ });
6729
+ return (0, react_jsx_runtime.jsxs)("div", {
6730
+ style: styles$1.memberCard,
6731
+ children: [(0, react_jsx_runtime.jsx)("img", {
6732
+ alt: "客服微信二维码",
6733
+ src: SERVICE_QR,
6734
+ style: styles$1.memberQr
6735
+ }), (0, react_jsx_runtime.jsxs)("div", {
6736
+ style: { minWidth: 0 },
6737
+ children: [(0, react_jsx_runtime.jsx)("p", {
6738
+ style: styles$1.memberTitle,
6739
+ children: message
6740
+ }), (0, react_jsx_runtime.jsx)("p", {
6741
+ style: styles$1.memberText,
6742
+ children: "该功能需要开通会员后使用。请用微信扫描左侧二维码添加客服咨询开通。"
6743
+ })]
6744
+ })]
6745
+ });
6746
+ }
6682
6747
  /** An extension-priority document body: native right-preview ergonomics plus a complete edus publishing flow. */
6683
6748
  function HtmlPublishPreview({ content, resourceAddress, remote }) {
6684
6749
  const account = useEdusLogin();
@@ -6727,6 +6792,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6727
6792
  const afterLogin = (0, react.useCallback)((result) => {
6728
6793
  EdusAuthStore.set(result);
6729
6794
  setError("");
6795
+ setBusy(false);
6730
6796
  setDestination(marker !== null && marker.owner === result.phone ? "current" : "new");
6731
6797
  setStage("destination");
6732
6798
  }, [marker]);
@@ -6909,10 +6975,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6909
6975
  onChange: (event) => setTitle(event.target.value)
6910
6976
  })]
6911
6977
  }),
6912
- error !== "" && (0, react_jsx_runtime.jsx)("p", {
6913
- style: styles$1.error,
6914
- children: error
6915
- }),
6978
+ (0, react_jsx_runtime.jsx)(PublishError, { message: error }),
6916
6979
  (0, react_jsx_runtime.jsxs)("div", {
6917
6980
  style: styles$1.actions,
6918
6981
  children: [(0, react_jsx_runtime.jsx)("button", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@houser/edus-plugin",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",