bw-frontend-sdk 1.2.9 → 1.2.71
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 +40 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -557,4 +557,43 @@ axiosInstance.defaults.timeout = 15000
|
|
|
557
557
|
|
|
558
558
|
## 许可证
|
|
559
559
|
|
|
560
|
-
MIT
|
|
560
|
+
MIT
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## 会话记录 - 2026-04-28
|
|
565
|
+
- **背景**:发布 `bw-frontend-sdk` 时遇到 `401 Unauthorized`,并调整曝光逻辑与查看 git 暂存区/工作区差异。
|
|
566
|
+
- **现象**:
|
|
567
|
+
- `npm publish` 指向 `https://registry.npmmirror.com/` 导致未登录报 401
|
|
568
|
+
- 曝光逻辑在 `data-product-id` 为空时仍可能产生曝光
|
|
569
|
+
- 需要区分 git 暂存区与本地工作区的真实改动(忽略样式/空白)
|
|
570
|
+
- **根因**:
|
|
571
|
+
- 发布到了镜像源而非实际发布 registry
|
|
572
|
+
- 曝光逻辑对缺失 `data-product-id` 的元素未做硬性过滤(会退化用 elementKey 去重/上报)
|
|
573
|
+
- 工作区存在大量空白变化,掩盖真实逻辑差异
|
|
574
|
+
- **最终方案**:
|
|
575
|
+
- 发布时切换到正确的 registry 并登录后再发布
|
|
576
|
+
- 曝光上报增加 `data-product-id` 非空校验,空/空白时不触发曝光
|
|
577
|
+
- 使用 `git diff --cached -w` 与 `git diff -w` 分别查看暂存区/工作区差异并忽略空白
|
|
578
|
+
- **过程踩坑与修复**:
|
|
579
|
+
- `git diff` 看到大量空白变化时,改用 `-w` 过滤“样式类”差异以聚焦逻辑变更
|
|
580
|
+
- **涉及文件**:
|
|
581
|
+
- `exposureTracker.js`
|
|
582
|
+
- `README.md`
|
|
583
|
+
- **注意事项**:
|
|
584
|
+
- `registry.npmmirror.com` 通常用于安装加速,不建议用于发布;发布需使用 npm 官方或公司私有 registry
|
|
585
|
+
- 曝光数据强依赖 `data-product-id` 时,业务侧需保证元素上该属性在可见前已写入
|
|
586
|
+
|
|
587
|
+
## 简单问题处理
|
|
588
|
+
|
|
589
|
+
## 会话记录 - 2026-04-28(npm publish 404)
|
|
590
|
+
- **目的**:说明 `E404 Not Found - PUT https://registry.npmjs.org/bw-frontend-sdk` 的含义与处理
|
|
591
|
+
- **任务**:用户执行 `npm publish` 报错,提示包「不在 registry」
|
|
592
|
+
- **决策**:该错误多为**未以该包维护者身份登录**或 **token 失效**;npm 对无权限操作有时返回 404 而非 403,文案易误解。包名 `bw-frontend-sdk` 在官方源已存在(如 `latest` 为 `1.3.6`),维护者需用有权限的账号 `npm login` 后再发。若发新版本,一般应高于线上 `latest`(例如 `1.3.7`),避免用低于已发布主线的旧号补发(除非团队明确要补历史版本且该版本号从未被占用)
|
|
593
|
+
- **文件**:`README.md`
|
|
594
|
+
|
|
595
|
+
## 会话记录 - 2026-04-28(npm publish 403 2FA)
|
|
596
|
+
- **目的**:解决 `Two-factor authentication ... is required to publish packages` 导致的发布失败
|
|
597
|
+
- **任务**:用户已能登录,但 `npm publish` / `npm login` 触发 403,提示发布需要 2FA 或带 bypass 2FA 的 granular token
|
|
598
|
+
- **决策**:优先采用 **OTP 发布**(账号开启 2FA 后 `npm publish --otp=xxxxxx`);如用于 CI/自动化,改用 npm 官网生成的 **Granular Access Token(Automation / bypass 2FA enabled)** 写入 `~/.npmrc`
|
|
599
|
+
- **文件**:`README.md`
|