luo-image-annotator 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. package/README.md +56 -0
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -36,6 +36,62 @@
36
36
 
37
37
  构建产物将输出到 `dist` 目录。
38
38
 
39
+ ## 发布到 npm
40
+
41
+ 如果你想更新并发布这个组件库到 npm,请按照以下步骤操作:
42
+
43
+ ### 1. 构建项目
44
+
45
+ 首先确保代码已经构建为最新的发布版本:
46
+
47
+ ```bash
48
+ npm run build
49
+ ```
50
+
51
+ 这会在 `dist` 目录下生成打包好的文件。
52
+
53
+ ### 2. 更新版本号
54
+
55
+ 在发布之前,必须更新 `package.json` 中的版本号,否则 npm 会拒绝发布。
56
+
57
+ ```bash
58
+ # 自动更新补丁版本 (例如从 0.0.1 -> 0.0.2)
59
+ npm version patch
60
+ ```
61
+
62
+ 或者手动修改 `package.json` 文件中的 `version` 字段。
63
+
64
+ ### 3. 登录 npm (如果未登录)
65
+
66
+ 如果你还没有登录 npm,或者登录已过期:
67
+
68
+ ```bash
69
+ npm login
70
+ ```
71
+ 按提示输入你的用户名、密码和邮箱。如果开启了双重验证 (2FA),还需要输入一次性验证码。
72
+
73
+ ### 4. 发布
74
+
75
+ 执行发布命令:
76
+
77
+ ```bash
78
+ npm publish
79
+ ```
80
+
81
+ **注意:**
82
+ 由于 npm 强制要求开启双重验证 (2FA),发布时可能需要提供验证码。
83
+ 请在命令后加上 `--otp` 参数,填入你手机验证器 App (如 Google Authenticator) 上的 6 位数字,或者使用 npm 提供的恢复码 (Recovery Code):
84
+
85
+ ```bash
86
+ # 示例:使用手机验证码
87
+ npm publish --otp=123456
88
+
89
+ # 示例:使用恢复码 (如果你无法使用手机 App)
90
+ npm publish --otp=你的恢复码字符串
91
+ ```
92
+
93
+ 发布成功后,你就可以在其他项目中通过 `npm update luo-image-annotator` 来获取最新版本了。
94
+
39
95
  ## 在其他项目中使用
40
96
 
41
97
  ### 1. 安装
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luo-image-annotator",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A simple image annotation component for Vue 3",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -20,7 +20,8 @@
20
20
  "import": "./dist/luo-image-annotator.es.js",
21
21
  "require": "./dist/luo-image-annotator.umd.js"
22
22
  },
23
- "./style.css": "./dist/style.css"
23
+ "./dist/style.css": "./dist/luo-image-annotator.css",
24
+ "./style.css": "./dist/luo-image-annotator.css"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "vue": "^3.2.0",