@xylabs/ts-scripts-common 7.5.1 → 7.5.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.
@@ -1142,24 +1142,24 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1142
1142
 
1143
1143
  // src/actions/packman/convert.ts
1144
1144
  import {
1145
- existsSync as existsSync11,
1145
+ existsSync as existsSync12,
1146
1146
  readdirSync as readdirSync6,
1147
- readFileSync as readFileSync10,
1147
+ readFileSync as readFileSync11,
1148
1148
  statSync as statSync3
1149
1149
  } from "fs";
1150
- import PATH11 from "path";
1151
- import chalk19 from "chalk";
1150
+ import PATH12 from "path";
1151
+ import chalk20 from "chalk";
1152
1152
 
1153
1153
  // src/actions/packman/convertToPnpm.ts
1154
1154
  import {
1155
- existsSync as existsSync9,
1155
+ existsSync as existsSync10,
1156
1156
  mkdirSync as mkdirSync5,
1157
- readFileSync as readFileSync8,
1157
+ readFileSync as readFileSync9,
1158
1158
  rmSync as rmSync3,
1159
- writeFileSync as writeFileSync6
1159
+ writeFileSync as writeFileSync7
1160
1160
  } from "fs";
1161
- import PATH9 from "path";
1162
- import chalk17 from "chalk";
1161
+ import PATH10 from "path";
1162
+ import chalk18 from "chalk";
1163
1163
 
1164
1164
  // src/actions/packman/rewriteScripts.ts
1165
1165
  function rewriteYarnToPnpm(script) {
@@ -1209,6 +1209,60 @@ function rewriteScriptsInPackageJson(pkg, direction) {
1209
1209
  return { ...pkg, scripts: rewritten };
1210
1210
  }
1211
1211
 
1212
+ // src/actions/packman/swapTsScriptsDependency.ts
1213
+ import {
1214
+ existsSync as existsSync9,
1215
+ readFileSync as readFileSync8,
1216
+ writeFileSync as writeFileSync6
1217
+ } from "fs";
1218
+ import PATH9 from "path";
1219
+ import chalk17 from "chalk";
1220
+ var SWAP_MAP = {
1221
+ "yarn-to-pnpm": [
1222
+ ["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"]
1223
+ ],
1224
+ "pnpm-to-yarn": [
1225
+ ["@xylabs/ts-scripts-pnpm", "@xylabs/ts-scripts-yarn3"]
1226
+ ]
1227
+ };
1228
+ function swapInPackageJson(pkgPath, direction) {
1229
+ if (!existsSync9(pkgPath)) return false;
1230
+ const raw = readFileSync8(pkgPath, "utf8");
1231
+ const pkg = JSON.parse(raw);
1232
+ let changed = false;
1233
+ for (const depField of ["dependencies", "devDependencies"]) {
1234
+ const deps = pkg[depField];
1235
+ if (!deps) continue;
1236
+ for (const [from, to] of SWAP_MAP[direction]) {
1237
+ if (deps[from]) {
1238
+ deps[to] = deps[from];
1239
+ delete deps[from];
1240
+ changed = true;
1241
+ }
1242
+ }
1243
+ }
1244
+ if (changed) {
1245
+ writeFileSync6(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
1246
+ }
1247
+ return changed;
1248
+ }
1249
+ function swapTsScriptsDependency(cwd, workspacePackageJsonPaths, direction) {
1250
+ let count = 0;
1251
+ if (swapInPackageJson(PATH9.join(cwd, "package.json"), direction)) {
1252
+ count++;
1253
+ }
1254
+ for (const pkgPath of workspacePackageJsonPaths) {
1255
+ const fullPath = PATH9.resolve(cwd, pkgPath, "package.json");
1256
+ if (swapInPackageJson(fullPath, direction)) {
1257
+ count++;
1258
+ }
1259
+ }
1260
+ if (count > 0) {
1261
+ const target = direction === "yarn-to-pnpm" ? "@xylabs/ts-scripts-pnpm" : "@xylabs/ts-scripts-yarn3";
1262
+ console.log(chalk17.green(` Swapped ts-scripts dependency to ${target} in ${count} package(s)`));
1263
+ }
1264
+ }
1265
+
1212
1266
  // src/actions/packman/convertToPnpm.ts
1213
1267
  var PNPM_VERSION = "10.12.1";
1214
1268
  function createPnpmWorkspaceYaml(cwd, workspacePatterns) {
@@ -1216,24 +1270,45 @@ function createPnpmWorkspaceYaml(cwd, workspacePatterns) {
1216
1270
  for (const pattern of workspacePatterns) {
1217
1271
  lines.push(` - '${pattern}'`);
1218
1272
  }
1219
- writeFileSync6(PATH9.join(cwd, "pnpm-workspace.yaml"), lines.join("\n") + "\n", "utf8");
1220
- console.log(chalk17.green(" Created pnpm-workspace.yaml"));
1273
+ writeFileSync7(PATH10.join(cwd, "pnpm-workspace.yaml"), lines.join("\n") + "\n", "utf8");
1274
+ console.log(chalk18.green(" Created pnpm-workspace.yaml"));
1275
+ }
1276
+ function readPnpmWorkspacePatterns(cwd) {
1277
+ const wsPath = PATH10.join(cwd, "pnpm-workspace.yaml");
1278
+ if (!existsSync10(wsPath)) return [];
1279
+ const content = readFileSync9(wsPath, "utf8");
1280
+ const patterns = [];
1281
+ const lines = content.split("\n");
1282
+ let inPackages = false;
1283
+ for (const line of lines) {
1284
+ if (line.trim() === "packages:") {
1285
+ inPackages = true;
1286
+ continue;
1287
+ }
1288
+ if (inPackages && /^\s+-\s+/.test(line)) {
1289
+ const pattern = line.replace(/^\s+-\s+/, "").replaceAll(/['"]/g, "").trim();
1290
+ if (pattern) patterns.push(pattern);
1291
+ } else if (inPackages && !/^\s/.test(line) && line.trim()) {
1292
+ inPackages = false;
1293
+ }
1294
+ }
1295
+ return patterns;
1221
1296
  }
1222
1297
  function updateRootPackageJson(cwd) {
1223
- const pkgPath = PATH9.join(cwd, "package.json");
1224
- const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
1225
- const workspacePatterns = pkg.workspaces ?? [];
1298
+ const pkgPath = PATH10.join(cwd, "package.json");
1299
+ const pkg = JSON.parse(readFileSync9(pkgPath, "utf8"));
1300
+ const workspacePatterns = pkg.workspaces ?? readPnpmWorkspacePatterns(cwd);
1226
1301
  delete pkg.workspaces;
1227
1302
  pkg.packageManager = `pnpm@${PNPM_VERSION}`;
1228
1303
  const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
1229
- writeFileSync6(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1230
- console.log(chalk17.green(" Updated root package.json"));
1304
+ writeFileSync7(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1305
+ console.log(chalk18.green(" Updated root package.json"));
1231
1306
  return workspacePatterns;
1232
1307
  }
1233
1308
  function updateGitignore(cwd) {
1234
- const gitignorePath = PATH9.join(cwd, ".gitignore");
1235
- if (!existsSync9(gitignorePath)) return;
1236
- let content = readFileSync8(gitignorePath, "utf8");
1309
+ const gitignorePath = PATH10.join(cwd, ".gitignore");
1310
+ if (!existsSync10(gitignorePath)) return;
1311
+ let content = readFileSync9(gitignorePath, "utf8");
1237
1312
  const yarnLines = [
1238
1313
  ".pnp.*",
1239
1314
  ".pnp",
@@ -1248,63 +1323,64 @@ function updateGitignore(cwd) {
1248
1323
  content = content.replaceAll(new RegExp(String.raw`^${line.replaceAll(".", String.raw`\.`).replaceAll("*", String.raw`\*`).replaceAll("!", String.raw`\!`)}\s*$`, "gm"), "");
1249
1324
  }
1250
1325
  content = content.replaceAll(/\n{3,}/g, "\n\n");
1251
- writeFileSync6(gitignorePath, content, "utf8");
1252
- console.log(chalk17.green(" Updated .gitignore"));
1326
+ writeFileSync7(gitignorePath, content, "utf8");
1327
+ console.log(chalk18.green(" Updated .gitignore"));
1253
1328
  }
1254
1329
  function deleteYarnArtifacts(cwd) {
1255
- const yarnLock = PATH9.join(cwd, "yarn.lock");
1256
- const yarnrc = PATH9.join(cwd, ".yarnrc.yml");
1257
- const yarnDir = PATH9.join(cwd, ".yarn");
1258
- if (existsSync9(yarnLock)) {
1330
+ const yarnLock = PATH10.join(cwd, "yarn.lock");
1331
+ const yarnrc = PATH10.join(cwd, ".yarnrc.yml");
1332
+ const yarnDir = PATH10.join(cwd, ".yarn");
1333
+ if (existsSync10(yarnLock)) {
1259
1334
  rmSync3(yarnLock);
1260
- console.log(chalk17.gray(" Deleted yarn.lock"));
1335
+ console.log(chalk18.gray(" Deleted yarn.lock"));
1261
1336
  }
1262
- if (existsSync9(yarnrc)) {
1337
+ if (existsSync10(yarnrc)) {
1263
1338
  rmSync3(yarnrc);
1264
- console.log(chalk17.gray(" Deleted .yarnrc.yml"));
1339
+ console.log(chalk18.gray(" Deleted .yarnrc.yml"));
1265
1340
  }
1266
- if (existsSync9(yarnDir)) {
1341
+ if (existsSync10(yarnDir)) {
1267
1342
  rmSync3(yarnDir, { force: true, recursive: true });
1268
- console.log(chalk17.gray(" Deleted .yarn/"));
1343
+ console.log(chalk18.gray(" Deleted .yarn/"));
1269
1344
  }
1270
1345
  }
1271
1346
  function createNpmrc(cwd) {
1272
- const npmrcPath = PATH9.join(cwd, ".npmrc");
1273
- if (existsSync9(npmrcPath)) return;
1274
- mkdirSync5(PATH9.dirname(npmrcPath), { recursive: true });
1275
- writeFileSync6(npmrcPath, "", "utf8");
1276
- console.log(chalk17.green(" Created .npmrc"));
1347
+ const npmrcPath = PATH10.join(cwd, ".npmrc");
1348
+ if (existsSync10(npmrcPath)) return;
1349
+ mkdirSync5(PATH10.dirname(npmrcPath), { recursive: true });
1350
+ writeFileSync7(npmrcPath, "", "utf8");
1351
+ console.log(chalk18.green(" Created .npmrc"));
1277
1352
  }
1278
1353
  function convertToPnpm(cwd, workspacePackageJsonPaths) {
1279
- console.log(chalk17.blue("\nConverting to pnpm...\n"));
1354
+ console.log(chalk18.blue("\nConverting to pnpm...\n"));
1280
1355
  const workspacePatterns = updateRootPackageJson(cwd);
1281
1356
  createPnpmWorkspaceYaml(cwd, workspacePatterns);
1282
1357
  for (const pkgPath of workspacePackageJsonPaths) {
1283
- const fullPath = PATH9.resolve(cwd, pkgPath, "package.json");
1284
- if (!existsSync9(fullPath)) continue;
1285
- const pkg = JSON.parse(readFileSync8(fullPath, "utf8"));
1358
+ const fullPath = PATH10.resolve(cwd, pkgPath, "package.json");
1359
+ if (!existsSync10(fullPath)) continue;
1360
+ const pkg = JSON.parse(readFileSync9(fullPath, "utf8"));
1286
1361
  const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
1287
1362
  if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
1288
- writeFileSync6(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1363
+ writeFileSync7(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1289
1364
  }
1290
1365
  }
1291
- console.log(chalk17.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
1366
+ console.log(chalk18.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
1292
1367
  updateGitignore(cwd);
1293
1368
  createNpmrc(cwd);
1369
+ swapTsScriptsDependency(cwd, workspacePackageJsonPaths, "yarn-to-pnpm");
1294
1370
  deleteYarnArtifacts(cwd);
1295
- console.log(chalk17.blue("\nConversion complete. Run `pnpm install` to generate pnpm-lock.yaml.\n"));
1371
+ console.log(chalk18.blue("\nConversion complete. Run `pnpm install` to generate pnpm-lock.yaml.\n"));
1296
1372
  return 0;
1297
1373
  }
1298
1374
 
1299
1375
  // src/actions/packman/convertToYarn.ts
1300
1376
  import {
1301
- existsSync as existsSync10,
1302
- readFileSync as readFileSync9,
1377
+ existsSync as existsSync11,
1378
+ readFileSync as readFileSync10,
1303
1379
  rmSync as rmSync4,
1304
- writeFileSync as writeFileSync7
1380
+ writeFileSync as writeFileSync8
1305
1381
  } from "fs";
1306
- import PATH10 from "path";
1307
- import chalk18 from "chalk";
1382
+ import PATH11 from "path";
1383
+ import chalk19 from "chalk";
1308
1384
  var YARN_VERSION = "4.13.0";
1309
1385
  var YARNRC_TEMPLATE = `compressionLevel: mixed
1310
1386
 
@@ -1325,10 +1401,10 @@ var YARN_GITIGNORE_ENTRIES = `
1325
1401
  !.yarn/sdks
1326
1402
  !.yarn/versions
1327
1403
  `;
1328
- function readPnpmWorkspacePatterns(cwd) {
1329
- const wsPath = PATH10.join(cwd, "pnpm-workspace.yaml");
1330
- if (!existsSync10(wsPath)) return [];
1331
- const content = readFileSync9(wsPath, "utf8");
1404
+ function readPnpmWorkspacePatterns2(cwd) {
1405
+ const wsPath = PATH11.join(cwd, "pnpm-workspace.yaml");
1406
+ if (!existsSync11(wsPath)) return [];
1407
+ const content = readFileSync10(wsPath, "utf8");
1332
1408
  const patterns = [];
1333
1409
  const lines = content.split("\n");
1334
1410
  let inPackages = false;
@@ -1347,91 +1423,103 @@ function readPnpmWorkspacePatterns(cwd) {
1347
1423
  return patterns;
1348
1424
  }
1349
1425
  function updateRootPackageJson2(cwd, workspacePatterns) {
1350
- const pkgPath = PATH10.join(cwd, "package.json");
1351
- const pkg = JSON.parse(readFileSync9(pkgPath, "utf8"));
1426
+ const pkgPath = PATH11.join(cwd, "package.json");
1427
+ const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
1352
1428
  pkg.workspaces = workspacePatterns;
1353
1429
  pkg.packageManager = `yarn@${YARN_VERSION}`;
1354
1430
  const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
1355
- writeFileSync7(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1356
- console.log(chalk18.green(" Updated root package.json"));
1431
+ writeFileSync8(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1432
+ console.log(chalk19.green(" Updated root package.json"));
1357
1433
  }
1358
1434
  function updateGitignore2(cwd) {
1359
- const gitignorePath = PATH10.join(cwd, ".gitignore");
1360
- let content = existsSync10(gitignorePath) ? readFileSync9(gitignorePath, "utf8") : "";
1435
+ const gitignorePath = PATH11.join(cwd, ".gitignore");
1436
+ let content = existsSync11(gitignorePath) ? readFileSync10(gitignorePath, "utf8") : "";
1361
1437
  if (!content.includes(".yarn/*")) {
1362
1438
  content = content.trimEnd() + "\n" + YARN_GITIGNORE_ENTRIES;
1363
1439
  }
1364
- writeFileSync7(gitignorePath, content, "utf8");
1365
- console.log(chalk18.green(" Updated .gitignore"));
1440
+ writeFileSync8(gitignorePath, content, "utf8");
1441
+ console.log(chalk19.green(" Updated .gitignore"));
1366
1442
  }
1367
1443
  function deletePnpmArtifacts(cwd) {
1368
- const lockfile = PATH10.join(cwd, "pnpm-lock.yaml");
1369
- const workspaceYaml = PATH10.join(cwd, "pnpm-workspace.yaml");
1370
- const npmrc = PATH10.join(cwd, ".npmrc");
1371
- if (existsSync10(lockfile)) {
1444
+ const lockfile = PATH11.join(cwd, "pnpm-lock.yaml");
1445
+ const workspaceYaml = PATH11.join(cwd, "pnpm-workspace.yaml");
1446
+ const npmrc = PATH11.join(cwd, ".npmrc");
1447
+ if (existsSync11(lockfile)) {
1372
1448
  rmSync4(lockfile);
1373
- console.log(chalk18.gray(" Deleted pnpm-lock.yaml"));
1449
+ console.log(chalk19.gray(" Deleted pnpm-lock.yaml"));
1374
1450
  }
1375
- if (existsSync10(workspaceYaml)) {
1451
+ if (existsSync11(workspaceYaml)) {
1376
1452
  rmSync4(workspaceYaml);
1377
- console.log(chalk18.gray(" Deleted pnpm-workspace.yaml"));
1453
+ console.log(chalk19.gray(" Deleted pnpm-workspace.yaml"));
1378
1454
  }
1379
- if (existsSync10(npmrc)) {
1380
- const content = readFileSync9(npmrc, "utf8");
1455
+ if (existsSync11(npmrc)) {
1456
+ const content = readFileSync10(npmrc, "utf8");
1381
1457
  if (content.trim() === "" || content.includes("shamefully-hoist") || content.includes("node-linker")) {
1382
1458
  rmSync4(npmrc);
1383
- console.log(chalk18.gray(" Deleted .npmrc"));
1459
+ console.log(chalk19.gray(" Deleted .npmrc"));
1384
1460
  }
1385
1461
  }
1386
1462
  }
1387
1463
  function createYarnrc(cwd) {
1388
- const yarnrcPath = PATH10.join(cwd, ".yarnrc.yml");
1389
- if (existsSync10(yarnrcPath)) return;
1390
- writeFileSync7(yarnrcPath, YARNRC_TEMPLATE, "utf8");
1391
- console.log(chalk18.green(" Created .yarnrc.yml"));
1464
+ const yarnrcPath = PATH11.join(cwd, ".yarnrc.yml");
1465
+ if (existsSync11(yarnrcPath)) return;
1466
+ writeFileSync8(yarnrcPath, YARNRC_TEMPLATE, "utf8");
1467
+ console.log(chalk19.green(" Created .yarnrc.yml"));
1468
+ }
1469
+ function readWorkspacePatternsFromPackageJson(cwd) {
1470
+ const pkgPath = PATH11.join(cwd, "package.json");
1471
+ if (!existsSync11(pkgPath)) return [];
1472
+ const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
1473
+ return pkg.workspaces ?? [];
1392
1474
  }
1393
1475
  function convertToYarn(cwd, workspacePackageJsonPaths) {
1394
- console.log(chalk18.blue("\nConverting to yarn...\n"));
1395
- const workspacePatterns = readPnpmWorkspacePatterns(cwd);
1476
+ console.log(chalk19.blue("\nConverting to yarn...\n"));
1477
+ const workspacePatterns = readPnpmWorkspacePatterns2(cwd);
1396
1478
  if (workspacePatterns.length === 0) {
1397
- console.warn(chalk18.yellow(" No workspace patterns found in pnpm-workspace.yaml"));
1479
+ const fromPkg = readWorkspacePatternsFromPackageJson(cwd);
1480
+ if (fromPkg.length > 0) {
1481
+ workspacePatterns.push(...fromPkg);
1482
+ } else {
1483
+ console.warn(chalk19.yellow(" No workspace patterns found"));
1484
+ }
1398
1485
  }
1399
1486
  updateRootPackageJson2(cwd, workspacePatterns);
1400
1487
  for (const pkgPath of workspacePackageJsonPaths) {
1401
- const fullPath = PATH10.resolve(cwd, pkgPath, "package.json");
1402
- if (!existsSync10(fullPath)) continue;
1403
- const pkg = JSON.parse(readFileSync9(fullPath, "utf8"));
1488
+ const fullPath = PATH11.resolve(cwd, pkgPath, "package.json");
1489
+ if (!existsSync11(fullPath)) continue;
1490
+ const pkg = JSON.parse(readFileSync10(fullPath, "utf8"));
1404
1491
  const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
1405
1492
  if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
1406
- writeFileSync7(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1493
+ writeFileSync8(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
1407
1494
  }
1408
1495
  }
1409
- console.log(chalk18.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
1496
+ console.log(chalk19.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
1410
1497
  updateGitignore2(cwd);
1411
1498
  createYarnrc(cwd);
1499
+ swapTsScriptsDependency(cwd, workspacePackageJsonPaths, "pnpm-to-yarn");
1412
1500
  deletePnpmArtifacts(cwd);
1413
- console.log(chalk18.blue("\nConversion complete. Run `corepack enable yarn && yarn set version stable && yarn install` to finish setup.\n"));
1501
+ console.log(chalk19.blue("\nConversion complete. Run `corepack enable yarn && yarn set version stable && yarn install` to finish setup.\n"));
1414
1502
  return 0;
1415
1503
  }
1416
1504
 
1417
1505
  // src/actions/packman/convert.ts
1418
1506
  function detectCurrentPM(cwd) {
1419
- if (existsSync11(PATH11.join(cwd, "pnpm-lock.yaml")) || existsSync11(PATH11.join(cwd, "pnpm-workspace.yaml"))) {
1507
+ if (existsSync12(PATH12.join(cwd, "pnpm-lock.yaml")) || existsSync12(PATH12.join(cwd, "pnpm-workspace.yaml"))) {
1420
1508
  return "pnpm";
1421
1509
  }
1422
- if (existsSync11(PATH11.join(cwd, "yarn.lock")) || existsSync11(PATH11.join(cwd, ".yarnrc.yml"))) {
1510
+ if (existsSync12(PATH12.join(cwd, "yarn.lock")) || existsSync12(PATH12.join(cwd, ".yarnrc.yml"))) {
1423
1511
  return "yarn";
1424
1512
  }
1425
1513
  return "unknown";
1426
1514
  }
1427
1515
  function findWorkspacePackagePaths(cwd) {
1428
- const pkgPath = PATH11.join(cwd, "package.json");
1429
- const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
1516
+ const pkgPath = PATH12.join(cwd, "package.json");
1517
+ const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
1430
1518
  let patterns = pkg.workspaces ?? [];
1431
1519
  if (patterns.length === 0) {
1432
- const wsPath = PATH11.join(cwd, "pnpm-workspace.yaml");
1433
- if (existsSync11(wsPath)) {
1434
- const content = readFileSync10(wsPath, "utf8");
1520
+ const wsPath = PATH12.join(cwd, "pnpm-workspace.yaml");
1521
+ if (existsSync12(wsPath)) {
1522
+ const content = readFileSync11(wsPath, "utf8");
1435
1523
  const lines = content.split("\n");
1436
1524
  let inPackages = false;
1437
1525
  for (const line of lines) {
@@ -1461,15 +1549,15 @@ function resolveWorkspaceGlob(cwd, pattern) {
1461
1549
  }
1462
1550
  function walkGlob(basePath, parts, currentPath) {
1463
1551
  if (parts.length === 0) {
1464
- const fullPath = PATH11.join(basePath, currentPath);
1465
- if (existsSync11(PATH11.join(fullPath, "package.json"))) {
1552
+ const fullPath = PATH12.join(basePath, currentPath);
1553
+ if (existsSync12(PATH12.join(fullPath, "package.json"))) {
1466
1554
  return [currentPath];
1467
1555
  }
1468
1556
  return [];
1469
1557
  }
1470
1558
  const [part, ...rest] = parts;
1471
- const dirPath = PATH11.join(basePath, currentPath);
1472
- if (!existsSync11(dirPath) || !statSync3(dirPath).isDirectory()) {
1559
+ const dirPath = PATH12.join(basePath, currentPath);
1560
+ if (!existsSync12(dirPath) || !statSync3(dirPath).isDirectory()) {
1473
1561
  return [];
1474
1562
  }
1475
1563
  if (part === "*" || part === "**") {
@@ -1497,26 +1585,25 @@ function walkGlob(basePath, parts, currentPath) {
1497
1585
  function convert({ target, verbose }) {
1498
1586
  const validTargets = ["pnpm", "yarn"];
1499
1587
  if (!validTargets.includes(target)) {
1500
- console.error(chalk19.red(`Invalid target "${target}". Must be one of: ${validTargets.join(", ")}`));
1588
+ console.error(chalk20.red(`Invalid target "${target}". Must be one of: ${validTargets.join(", ")}`));
1501
1589
  return 1;
1502
1590
  }
1503
1591
  const cwd = process.cwd();
1504
1592
  const currentPM = detectCurrentPM(cwd);
1505
1593
  if (verbose) {
1506
- console.log(chalk19.gray(`Current package manager: ${currentPM}`));
1507
- console.log(chalk19.gray(`Target package manager: ${target}`));
1594
+ console.log(chalk20.gray(`Current package manager: ${currentPM}`));
1595
+ console.log(chalk20.gray(`Target package manager: ${target}`));
1508
1596
  }
1509
1597
  if (currentPM === target) {
1510
- console.error(chalk19.red(`Already using ${target}. No conversion needed.`));
1511
- return 1;
1598
+ console.log(chalk20.yellow(`Already using ${target}. Re-applying conversion to fix any incomplete steps...`));
1512
1599
  }
1513
1600
  if (currentPM === "unknown") {
1514
- console.error(chalk19.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
1601
+ console.error(chalk20.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
1515
1602
  return 1;
1516
1603
  }
1517
1604
  const workspacePaths = findWorkspacePackagePaths(cwd);
1518
1605
  if (verbose) {
1519
- console.log(chalk19.gray(`Found ${workspacePaths.length} workspace packages`));
1606
+ console.log(chalk20.gray(`Found ${workspacePaths.length} workspace packages`));
1520
1607
  }
1521
1608
  if (target === "pnpm") {
1522
1609
  return convertToPnpm(cwd, workspacePaths);