@opentiny/tiny-robot-cli 0.4.1-alpha.1 → 0.4.1-alpha.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.
@@ -20,7 +20,7 @@ import {
20
20
  } from '../utils.js'
21
21
 
22
22
  const DEP_NAME = '@opentiny/tiny-robot'
23
- const TARGET_VERSION = '0.4.2-alpha.5'
23
+ const TARGET_VERSION = '0.4.2-alpha.6'
24
24
  const STYLE_IMPORT = "import '@opentiny/tiny-robot/dist/style.css'"
25
25
 
26
26
  function logUnavailable(label) {
@@ -154,17 +154,20 @@ function ensureDependency(pkg, name, targetVersion) {
154
154
 
155
155
  const currentVersion = pkg.dependencies[name]
156
156
 
157
+ // 1. 不存在 => 新增(使用 ordered insert)
157
158
  if (!currentVersion) {
158
159
  pkg.dependencies = insertDependencyOrdered(pkg.dependencies, name, targetVersion)
159
160
 
160
161
  return {
161
162
  type: 'added',
163
+ to: targetVersion,
162
164
  }
163
165
  }
164
166
 
165
- const validVersion = semver.minVersion(currentVersion)
167
+ // 2. 已存在 => 只更新版本,不调整顺序
168
+ const current = semver.valid(semver.coerce(currentVersion)?.version)
166
169
 
167
- if (validVersion && semver.lt(validVersion.version, targetVersion)) {
170
+ if (current && current !== targetVersion) {
168
171
  pkg.dependencies[name] = targetVersion
169
172
 
170
173
  return {
@@ -174,6 +177,7 @@ function ensureDependency(pkg, name, targetVersion) {
174
177
  }
175
178
  }
176
179
 
180
+ // 3. 完全一致 => 跳过
177
181
  return {
178
182
  type: 'skipped',
179
183
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-robot-cli",
3
- "version": "0.4.1-alpha.1",
3
+ "version": "0.4.1-alpha.2",
4
4
  "description": "CLI to scaffold TinyRobot product projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,5 +24,5 @@
24
24
  "picocolors": "^1.1.1",
25
25
  "semver": "^7.8.1"
26
26
  },
27
- "gitHead": "4edea25856dc8514a7fe06ea49b18d3672085521"
27
+ "gitHead": "a68e9109e840fdf6f37d1dab835ac58546e7cdcb"
28
28
  }