@icebreakers/monorepo 2.1.1 → 2.1.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.
@@ -589,7 +589,7 @@ async function cleanProjects(cwd) {
589
589
 
590
590
  // package.json
591
591
  var name = "@icebreakers/monorepo";
592
- var version = "2.1.1";
592
+ var version = "2.1.2";
593
593
 
594
594
  // src/constants.ts
595
595
  init_esm_shims();
@@ -1195,17 +1195,22 @@ var scripts = {
1195
1195
  var scriptsEntries = Object.entries(scripts);
1196
1196
 
1197
1197
  // src/commands/upgrade/pkg-json.ts
1198
- function isWorkspace(version2) {
1199
- if (typeof version2 === "string") {
1200
- return version2.startsWith("workspace:");
1201
- }
1202
- return false;
1203
- }
1198
+ var NON_OVERRIDABLE_PREFIXES = ["workspace:", "catalog:"];
1204
1199
  function parseVersion(input) {
1205
1200
  if (typeof input !== "string" || input.trim().length === 0) {
1206
1201
  return null;
1207
1202
  }
1208
- return minVersion(input) ?? coerce(input);
1203
+ try {
1204
+ return minVersion(input) ?? coerce(input);
1205
+ } catch {
1206
+ return null;
1207
+ }
1208
+ }
1209
+ function hasNonOverridablePrefix(version2) {
1210
+ if (typeof version2 !== "string") {
1211
+ return false;
1212
+ }
1213
+ return NON_OVERRIDABLE_PREFIXES.some((prefix) => version2.startsWith(prefix));
1209
1214
  }
1210
1215
  function shouldAssignVersion(currentVersion, nextVersion) {
1211
1216
  if (typeof currentVersion !== "string" || currentVersion.trim().length === 0) {
@@ -1235,7 +1240,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1235
1240
  continue;
1236
1241
  }
1237
1242
  const targetVersion = targetDeps[depName];
1238
- if (isWorkspace(targetVersion)) {
1243
+ if (hasNonOverridablePrefix(targetVersion)) {
1239
1244
  continue;
1240
1245
  }
1241
1246
  if (shouldAssignVersion(targetVersion, depVersion)) {
@@ -1252,12 +1257,12 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1252
1257
  if (depName === name) {
1253
1258
  const nextVersion = `^${version}`;
1254
1259
  const targetVersion = targetDevDeps[depName];
1255
- if (!isWorkspace(targetVersion) && shouldAssignVersion(targetVersion, nextVersion)) {
1260
+ if (!hasNonOverridablePrefix(targetVersion) && shouldAssignVersion(targetVersion, nextVersion)) {
1256
1261
  targetDevDeps[depName] = nextVersion;
1257
1262
  }
1258
1263
  } else {
1259
1264
  const targetVersion = targetDevDeps[depName];
1260
- if (isWorkspace(targetVersion)) {
1265
+ if (hasNonOverridablePrefix(targetVersion)) {
1261
1266
  continue;
1262
1267
  }
1263
1268
  if (shouldAssignVersion(targetVersion, depVersion)) {
package/dist/cli.cjs CHANGED
@@ -616,7 +616,7 @@ var import_node_url = require("url");
616
616
 
617
617
  // package.json
618
618
  var name = "@icebreakers/monorepo";
619
- var version = "2.1.1";
619
+ var version = "2.1.2";
620
620
 
621
621
  // src/constants.ts
622
622
  var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
@@ -1207,17 +1207,22 @@ var scripts = {
1207
1207
  var scriptsEntries = Object.entries(scripts);
1208
1208
 
1209
1209
  // src/commands/upgrade/pkg-json.ts
1210
- function isWorkspace(version2) {
1211
- if (typeof version2 === "string") {
1212
- return version2.startsWith("workspace:");
1213
- }
1214
- return false;
1215
- }
1210
+ var NON_OVERRIDABLE_PREFIXES = ["workspace:", "catalog:"];
1216
1211
  function parseVersion(input2) {
1217
1212
  if (typeof input2 !== "string" || input2.trim().length === 0) {
1218
1213
  return null;
1219
1214
  }
1220
- return (0, import_semver.minVersion)(input2) ?? (0, import_semver.coerce)(input2);
1215
+ try {
1216
+ return (0, import_semver.minVersion)(input2) ?? (0, import_semver.coerce)(input2);
1217
+ } catch {
1218
+ return null;
1219
+ }
1220
+ }
1221
+ function hasNonOverridablePrefix(version2) {
1222
+ if (typeof version2 !== "string") {
1223
+ return false;
1224
+ }
1225
+ return NON_OVERRIDABLE_PREFIXES.some((prefix) => version2.startsWith(prefix));
1221
1226
  }
1222
1227
  function shouldAssignVersion(currentVersion, nextVersion) {
1223
1228
  if (typeof currentVersion !== "string" || currentVersion.trim().length === 0) {
@@ -1247,7 +1252,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1247
1252
  continue;
1248
1253
  }
1249
1254
  const targetVersion = targetDeps[depName];
1250
- if (isWorkspace(targetVersion)) {
1255
+ if (hasNonOverridablePrefix(targetVersion)) {
1251
1256
  continue;
1252
1257
  }
1253
1258
  if (shouldAssignVersion(targetVersion, depVersion)) {
@@ -1264,12 +1269,12 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1264
1269
  if (depName === name) {
1265
1270
  const nextVersion = `^${version}`;
1266
1271
  const targetVersion = targetDevDeps[depName];
1267
- if (!isWorkspace(targetVersion) && shouldAssignVersion(targetVersion, nextVersion)) {
1272
+ if (!hasNonOverridablePrefix(targetVersion) && shouldAssignVersion(targetVersion, nextVersion)) {
1268
1273
  targetDevDeps[depName] = nextVersion;
1269
1274
  }
1270
1275
  } else {
1271
1276
  const targetVersion = targetDevDeps[depName];
1272
- if (isWorkspace(targetVersion)) {
1277
+ if (hasNonOverridablePrefix(targetVersion)) {
1273
1278
  continue;
1274
1279
  }
1275
1280
  if (shouldAssignVersion(targetVersion, depVersion)) {
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  syncNpmMirror,
13
13
  upgradeMonorepo,
14
14
  version
15
- } from "./chunk-WWFO7A5T.js";
15
+ } from "./chunk-3XNFYA6S.js";
16
16
 
17
17
  // src/cli.ts
18
18
  init_esm_shims();
package/dist/index.cjs CHANGED
@@ -652,7 +652,7 @@ var import_node_url = require("url");
652
652
 
653
653
  // package.json
654
654
  var name = "@icebreakers/monorepo";
655
- var version = "2.1.1";
655
+ var version = "2.1.2";
656
656
 
657
657
  // src/constants.ts
658
658
  var packageJsonPath = (0, import_node_url.fileURLToPath)(new URL("../package.json", importMetaUrl));
@@ -1249,17 +1249,22 @@ var scripts = {
1249
1249
  var scriptsEntries = Object.entries(scripts);
1250
1250
 
1251
1251
  // src/commands/upgrade/pkg-json.ts
1252
- function isWorkspace(version2) {
1253
- if (typeof version2 === "string") {
1254
- return version2.startsWith("workspace:");
1255
- }
1256
- return false;
1257
- }
1252
+ var NON_OVERRIDABLE_PREFIXES = ["workspace:", "catalog:"];
1258
1253
  function parseVersion(input) {
1259
1254
  if (typeof input !== "string" || input.trim().length === 0) {
1260
1255
  return null;
1261
1256
  }
1262
- return (0, import_semver.minVersion)(input) ?? (0, import_semver.coerce)(input);
1257
+ try {
1258
+ return (0, import_semver.minVersion)(input) ?? (0, import_semver.coerce)(input);
1259
+ } catch {
1260
+ return null;
1261
+ }
1262
+ }
1263
+ function hasNonOverridablePrefix(version2) {
1264
+ if (typeof version2 !== "string") {
1265
+ return false;
1266
+ }
1267
+ return NON_OVERRIDABLE_PREFIXES.some((prefix) => version2.startsWith(prefix));
1263
1268
  }
1264
1269
  function shouldAssignVersion(currentVersion, nextVersion) {
1265
1270
  if (typeof currentVersion !== "string" || currentVersion.trim().length === 0) {
@@ -1289,7 +1294,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1289
1294
  continue;
1290
1295
  }
1291
1296
  const targetVersion = targetDeps[depName];
1292
- if (isWorkspace(targetVersion)) {
1297
+ if (hasNonOverridablePrefix(targetVersion)) {
1293
1298
  continue;
1294
1299
  }
1295
1300
  if (shouldAssignVersion(targetVersion, depVersion)) {
@@ -1306,12 +1311,12 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
1306
1311
  if (depName === name) {
1307
1312
  const nextVersion = `^${version}`;
1308
1313
  const targetVersion = targetDevDeps[depName];
1309
- if (!isWorkspace(targetVersion) && shouldAssignVersion(targetVersion, nextVersion)) {
1314
+ if (!hasNonOverridablePrefix(targetVersion) && shouldAssignVersion(targetVersion, nextVersion)) {
1310
1315
  targetDevDeps[depName] = nextVersion;
1311
1316
  }
1312
1317
  } else {
1313
1318
  const targetVersion = targetDevDeps[depName];
1314
- if (isWorkspace(targetVersion)) {
1319
+ if (hasNonOverridablePrefix(targetVersion)) {
1315
1320
  continue;
1316
1321
  }
1317
1322
  if (shouldAssignVersion(targetVersion, depVersion)) {
package/dist/index.d.cts CHANGED
@@ -277,7 +277,7 @@ declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOption
277
277
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
278
278
 
279
279
  var name = "@icebreakers/monorepo";
280
- var version = "2.1.1";
280
+ var version = "2.1.2";
281
281
 
282
282
  /**
283
283
  * @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
package/dist/index.d.ts CHANGED
@@ -277,7 +277,7 @@ declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOption
277
277
  declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
278
278
 
279
279
  var name = "@icebreakers/monorepo";
280
- var version = "2.1.1";
280
+ var version = "2.1.2";
281
281
 
282
282
  /**
283
283
  * @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  toWorkspaceGitignorePath,
32
32
  upgradeMonorepo,
33
33
  version
34
- } from "./chunk-WWFO7A5T.js";
34
+ } from "./chunk-3XNFYA6S.js";
35
35
 
36
36
  // src/index.ts
37
37
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "2.1.1",
4
+ "version": "2.1.2",
5
5
  "description": "The icebreaker's monorepo manager",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",