gamegold 6.5.5 → 6.7.2
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/docs/2026.05.25.md +86 -0
- package/lib/gamegold-worker.js +173 -668
- package/lib/gamegold.js +322 -1299
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# npm 版本发布冲突记录
|
|
2
|
+
|
|
3
|
+
## 问题描述
|
|
4
|
+
|
|
5
|
+
发布 `v4.9.4` 版本时,因 `latest` 标签已指向更高版本 `6.5.6`,npm 拒绝发布:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm error Cannot implicitly apply the "latest" tag because previously published version 6.5.6
|
|
9
|
+
is higher than the new version 4.9.4. You must specify a tag using --tag.
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## 核心规则
|
|
13
|
+
|
|
14
|
+
| 情况 | 结果 | 是否需要 --tag |
|
|
15
|
+
|------|------|:---:|
|
|
16
|
+
| 新版本 **高于** 当前 `latest` | 自动成为新的 `latest` | ❌ 不需要 |
|
|
17
|
+
| 新版本 **低于** 当前 `latest` | npm 拒绝(报错) | ✅ **必须** 用 `--tag` |
|
|
18
|
+
|
|
19
|
+
## 标签 vs 版本号
|
|
20
|
+
|
|
21
|
+
| 概念 | 示例 | 说明 |
|
|
22
|
+
|------|------|:---:|
|
|
23
|
+
| **版本号** | `4.9.4` | 写在 `package.json` 里,**唯一标识**一个发布 |
|
|
24
|
+
| **标签名** | `latest`, `legacy`, `beta` | 一个**别名/指针**,指向某个版本号 |
|
|
25
|
+
|
|
26
|
+
**关键理解**:`--tag` 只影响默认安装版本,不影响用户按版本号安装。用户始终可以通过 `npm install <包名>@4.9.4` 安装到指定版本。
|
|
27
|
+
|
|
28
|
+
## 解决方案
|
|
29
|
+
|
|
30
|
+
### 方案一:使用 `--tag` 指定自定义标签(推荐)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm publish --tag legacy
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
标签名不能是有效的 SemVer 格式,例如 `v4.9.4` 是不允许的。推荐标签:`legacy`、`old-stable`、`archive`、`v4` 等。
|
|
37
|
+
|
|
38
|
+
安装方式:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install <包名>@4.9.4 # 通过版本号安装(推荐)
|
|
42
|
+
npm install <包名>@legacy # 通过标签安装
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 方案二:发布后调整 `latest` 标签(需谨慎)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 先以自定义标签发布
|
|
49
|
+
npm publish --tag legacy
|
|
50
|
+
|
|
51
|
+
# 再将 latest 标签指向 4.9.4
|
|
52
|
+
npm dist-tag add <包名>@4.9.4 latest
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**注意**:方案二会让所有执行 `npm install <包名>` 的用户安装到 `4.9.4`,即使已有更高的版本。
|
|
56
|
+
|
|
57
|
+
### 方案三:补加更清晰的标签
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# 发布
|
|
61
|
+
npm publish --tag legacy
|
|
62
|
+
|
|
63
|
+
# 补加语义化标签
|
|
64
|
+
npm dist-tag add <包名>@4.9.4 v4
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 常见错误
|
|
68
|
+
|
|
69
|
+
| 错误信息 | 原因 |
|
|
70
|
+
|----------|------|
|
|
71
|
+
| `Tag name must not be a valid SemVer range: v4.9.4` | 标签名不能是合法的版本号格式 |
|
|
72
|
+
| `Cannot implicitly apply the "latest" tag because previously published version X is higher than the new version Y` | 新版本低于当前 `latest` 指向的版本 |
|
|
73
|
+
|
|
74
|
+
## 版本发布顺序分析示例
|
|
75
|
+
|
|
76
|
+
假设已发布的版本序列:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
4.9.2 ← 发布时 latest = 4.9.2 ✅ 正常发布
|
|
80
|
+
5.6.12 ← 比 4.9.2 更高 → latest 自动变成 5.6.12 ✅ 正常发布
|
|
81
|
+
4.9.3 ← 比 5.6.12 更低 → 必须用 --tag
|
|
82
|
+
5.7.1 ← 比 4.9.3 更高 → latest 自动变成 5.7.1 ✅ 正常发布
|
|
83
|
+
5.7.3 ← 比 5.7.1 更高 → latest 自动变成 5.7.3 ✅ 正常发布
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**规律**:发布低版本的人没有一个是有特殊权限的,他们只是正确使用了 `--tag` 而已。
|