@coana-tech/cli 14.12.41 → 14.12.42

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/cli.mjs CHANGED
@@ -207483,7 +207483,29 @@ import { existsSync as existsSync11 } from "fs";
207483
207483
  import { readFile as readFile16, writeFile as writeFile6 } from "fs/promises";
207484
207484
  function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
207485
207485
  let modifiedContent = packageJsonContent;
207486
- for (const upgrade of upgrades) {
207486
+ for (const upgrade of sortUpgradesByOffset(upgrades)) {
207487
+ if (upgrade.manifestRef?.start !== void 0 && upgrade.manifestRef?.end !== void 0) {
207488
+ const { start, end: end2 } = upgrade.manifestRef;
207489
+ const originalVersionString = modifiedContent.substring(start, end2);
207490
+ let newVersionString;
207491
+ if (rangeStyle === "pin") {
207492
+ const quotedContent = originalVersionString.slice(1, -1);
207493
+ if (quotedContent.startsWith("npm:") && quotedContent.includes("@")) {
207494
+ const atIndex = quotedContent.lastIndexOf("@");
207495
+ const packageRef = quotedContent.substring(0, atIndex + 1);
207496
+ newVersionString = `"${packageRef}${upgrade.upgradeVersion}"`;
207497
+ } else {
207498
+ newVersionString = `"${upgrade.upgradeVersion}"`;
207499
+ }
207500
+ } else {
207501
+ const quotedContent = originalVersionString.slice(1, -1);
207502
+ const specifierMatch = quotedContent.match(/^([^\d]*)/);
207503
+ const specifier = specifierMatch ? specifierMatch[1] : "";
207504
+ newVersionString = `"${specifier}${upgrade.upgradeVersion}"`;
207505
+ }
207506
+ modifiedContent = modifiedContent.substring(0, start) + newVersionString + modifiedContent.substring(end2);
207507
+ continue;
207508
+ }
207487
207509
  const escapedPackageName = upgrade.packageName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
207488
207510
  const depSection = upgrade.isDev ? "devDependencies" : "dependencies";
207489
207511
  const pattern = new RegExp(`("${escapedPackageName}"\\s*:\\s*")([^"]*)"`, "g");
@@ -207603,10 +207625,12 @@ var NpmSocketUpgradeManager = class {
207603
207625
  const upgradesWithPackageNames = upgradesToDirectDependencies.map(
207604
207626
  (upgrade) => {
207605
207627
  const artifact = artifacts[upgrade.idx];
207628
+ const manifestRef = artifact.manifestFiles?.find((manifest) => manifest.file === packageJsonPath);
207606
207629
  return {
207607
207630
  packageName: artifact.namespace ? `${artifact.namespace}/${artifact.name}` : artifact.name,
207608
207631
  upgradeVersion: upgrade.upgradeVersion,
207609
- isDev: artifact.dev ?? false
207632
+ isDev: artifact.dev ?? false,
207633
+ manifestRef
207610
207634
  };
207611
207635
  }
207612
207636
  );
@@ -207635,6 +207659,22 @@ function getPackageMangerForDirectory(directory) {
207635
207659
  }
207636
207660
  throw new Error("Upgrading packages is currently only supported for NPM projects using a lock file.");
207637
207661
  }
207662
+ function sortUpgradesByOffset(upgrades) {
207663
+ return [...upgrades].sort((a4, b) => {
207664
+ const aStart = a4.manifestRef?.start;
207665
+ const bStart = b.manifestRef?.start;
207666
+ if (aStart !== void 0 && bStart !== void 0) {
207667
+ return bStart - aStart;
207668
+ }
207669
+ if (aStart !== void 0 && bStart === void 0) {
207670
+ return -1;
207671
+ }
207672
+ if (aStart === void 0 && bStart !== void 0) {
207673
+ return 1;
207674
+ }
207675
+ return 0;
207676
+ });
207677
+ }
207638
207678
 
207639
207679
  // ../fixing-management/src/fixing-management/npm/rush-fixing-manager.ts
207640
207680
  var RushFixingManager = class {
@@ -228319,7 +228359,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
228319
228359
  }
228320
228360
 
228321
228361
  // dist/version.js
228322
- var version2 = "14.12.41";
228362
+ var version2 = "14.12.42";
228323
228363
 
228324
228364
  // dist/cli-core.js
228325
228365
  var { mapValues, omit, partition, pick } = import_lodash15.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.41",
3
+ "version": "14.12.42",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {