@xylabs/ts-scripts-common 7.5.2 → 7.5.3

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 (41) hide show
  1. package/dist/actions/deplint/checkPackage/checkPackage.mjs +27 -0
  2. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  3. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +27 -0
  4. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
  5. package/dist/actions/deplint/checkPackage/index.mjs +27 -0
  6. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  7. package/dist/actions/deplint/deplint.mjs +18 -0
  8. package/dist/actions/deplint/deplint.mjs.map +1 -1
  9. package/dist/actions/deplint/implicitDevDependencies.mjs +25 -0
  10. package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -1
  11. package/dist/actions/deplint/index.mjs +18 -0
  12. package/dist/actions/deplint/index.mjs.map +1 -1
  13. package/dist/actions/index.mjs +168 -95
  14. package/dist/actions/index.mjs.map +1 -1
  15. package/dist/actions/packman/convert.mjs +140 -85
  16. package/dist/actions/packman/convert.mjs.map +1 -1
  17. package/dist/actions/packman/convertToPnpm.mjs +92 -38
  18. package/dist/actions/packman/convertToPnpm.mjs.map +1 -1
  19. package/dist/actions/packman/convertToYarn.mjs +93 -39
  20. package/dist/actions/packman/convertToYarn.mjs.map +1 -1
  21. package/dist/actions/packman/index.mjs +140 -85
  22. package/dist/actions/packman/index.mjs.map +1 -1
  23. package/dist/actions/packman/rewriteSourceImports.mjs +56 -0
  24. package/dist/actions/packman/rewriteSourceImports.mjs.map +1 -0
  25. package/dist/bin/xy.mjs +185 -112
  26. package/dist/bin/xy.mjs.map +1 -1
  27. package/dist/index.mjs +187 -114
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/xy/common/index.mjs +140 -85
  30. package/dist/xy/common/index.mjs.map +1 -1
  31. package/dist/xy/common/packmanCommand.mjs +140 -85
  32. package/dist/xy/common/packmanCommand.mjs.map +1 -1
  33. package/dist/xy/index.mjs +185 -112
  34. package/dist/xy/index.mjs.map +1 -1
  35. package/dist/xy/lint/deplintCommand.mjs +18 -0
  36. package/dist/xy/lint/deplintCommand.mjs.map +1 -1
  37. package/dist/xy/lint/index.mjs +18 -0
  38. package/dist/xy/lint/index.mjs.map +1 -1
  39. package/dist/xy/xy.mjs +185 -112
  40. package/dist/xy/xy.mjs.map +1 -1
  41. package/package.json +2 -2
@@ -1813,6 +1813,8 @@ function hasImportPlugin({ location, allDependencies }) {
1813
1813
  return false;
1814
1814
  }
1815
1815
  var hasVitest = ({ allDependencies }) => allDependencies.includes("vitest");
1816
+ var isYarnRepo = () => detectPackageManager() === "yarn";
1817
+ var isPnpmRepo = () => detectPackageManager() === "pnpm";
1816
1818
  var rules = [
1817
1819
  {
1818
1820
  package: "typescript",
@@ -1829,6 +1831,22 @@ var rules = [
1829
1831
  {
1830
1832
  package: "@vitest/coverage-v8",
1831
1833
  isNeeded: hasVitest
1834
+ },
1835
+ {
1836
+ package: "@xylabs/ts-scripts-yarn3",
1837
+ isNeeded: isYarnRepo
1838
+ },
1839
+ {
1840
+ package: "@xylabs/ts-scripts-react-yarn3",
1841
+ isNeeded: isYarnRepo
1842
+ },
1843
+ {
1844
+ package: "@xylabs/ts-scripts-pnpm",
1845
+ isNeeded: isPnpmRepo
1846
+ },
1847
+ {
1848
+ package: "@xylabs/ts-scripts-react-pnpm",
1849
+ isNeeded: isPnpmRepo
1832
1850
  }
1833
1851
  ];
1834
1852
  function getImplicitDevDependencies(context) {
@@ -3488,24 +3506,24 @@ function packageLintMonorepo(fix2 = false) {
3488
3506
 
3489
3507
  // src/actions/packman/convert.ts
3490
3508
  import {
3491
- existsSync as existsSync14,
3509
+ existsSync as existsSync15,
3492
3510
  readdirSync as readdirSync7,
3493
- readFileSync as readFileSync14,
3511
+ readFileSync as readFileSync15,
3494
3512
  statSync as statSync3
3495
3513
  } from "fs";
3496
3514
  import PATH14 from "path";
3497
- import chalk47 from "chalk";
3515
+ import chalk48 from "chalk";
3498
3516
 
3499
3517
  // src/actions/packman/convertToPnpm.ts
3500
3518
  import {
3501
- existsSync as existsSync12,
3519
+ existsSync as existsSync13,
3502
3520
  mkdirSync as mkdirSync5,
3503
- readFileSync as readFileSync12,
3521
+ readFileSync as readFileSync13,
3504
3522
  rmSync as rmSync3,
3505
- writeFileSync as writeFileSync9
3523
+ writeFileSync as writeFileSync10
3506
3524
  } from "fs";
3507
3525
  import PATH12 from "path";
3508
- import chalk45 from "chalk";
3526
+ import chalk46 from "chalk";
3509
3527
 
3510
3528
  // src/actions/packman/rewriteScripts.ts
3511
3529
  function rewriteYarnToPnpm(script) {
@@ -3555,14 +3573,67 @@ function rewriteScriptsInPackageJson(pkg, direction) {
3555
3573
  return { ...pkg, scripts: rewritten };
3556
3574
  }
3557
3575
 
3576
+ // src/actions/packman/rewriteSourceImports.ts
3577
+ import { existsSync as existsSync11, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "fs";
3578
+ import chalk44 from "chalk";
3579
+ import { globSync as globSync3 } from "glob";
3580
+ var IMPORT_SWAP_MAP = {
3581
+ "yarn-to-pnpm": [
3582
+ ["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"],
3583
+ ["@xylabs/ts-scripts-react-yarn3", "@xylabs/ts-scripts-react-pnpm"]
3584
+ ],
3585
+ "pnpm-to-yarn": [
3586
+ ["@xylabs/ts-scripts-pnpm", "@xylabs/ts-scripts-yarn3"],
3587
+ ["@xylabs/ts-scripts-react-pnpm", "@xylabs/ts-scripts-react-yarn3"]
3588
+ ]
3589
+ };
3590
+ var SOURCE_GLOBS = [
3591
+ "**/*.ts",
3592
+ "**/*.tsx",
3593
+ "**/*.mts",
3594
+ "**/*.cts",
3595
+ "**/*.js",
3596
+ "**/*.mjs"
3597
+ ];
3598
+ var IGNORE_PATTERNS = [
3599
+ "**/node_modules/**",
3600
+ "**/dist/**",
3601
+ "**/build/**",
3602
+ "**/.yarn/**"
3603
+ ];
3604
+ function rewriteSourceImports(cwd5, direction) {
3605
+ const swaps = IMPORT_SWAP_MAP[direction];
3606
+ const files = globSync3(SOURCE_GLOBS, {
3607
+ cwd: cwd5,
3608
+ absolute: true,
3609
+ ignore: IGNORE_PATTERNS
3610
+ });
3611
+ let count = 0;
3612
+ for (const file of files) {
3613
+ if (!existsSync11(file)) continue;
3614
+ const original = readFileSync11(file, "utf8");
3615
+ let content = original;
3616
+ for (const [from, to] of swaps) {
3617
+ content = content.replaceAll(from, to);
3618
+ }
3619
+ if (content !== original) {
3620
+ writeFileSync8(file, content, "utf8");
3621
+ count++;
3622
+ }
3623
+ }
3624
+ if (count > 0) {
3625
+ console.log(chalk44.green(` Rewrote ts-scripts imports in ${count} source file(s)`));
3626
+ }
3627
+ }
3628
+
3558
3629
  // src/actions/packman/swapTsScriptsDependency.ts
3559
3630
  import {
3560
- existsSync as existsSync11,
3561
- readFileSync as readFileSync11,
3562
- writeFileSync as writeFileSync8
3631
+ existsSync as existsSync12,
3632
+ readFileSync as readFileSync12,
3633
+ writeFileSync as writeFileSync9
3563
3634
  } from "fs";
3564
3635
  import PATH11 from "path";
3565
- import chalk44 from "chalk";
3636
+ import chalk45 from "chalk";
3566
3637
  var SWAP_MAP = {
3567
3638
  "yarn-to-pnpm": [
3568
3639
  ["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"]
@@ -3572,8 +3643,8 @@ var SWAP_MAP = {
3572
3643
  ]
3573
3644
  };
3574
3645
  function swapInPackageJson(pkgPath, direction) {
3575
- if (!existsSync11(pkgPath)) return false;
3576
- const raw = readFileSync11(pkgPath, "utf8");
3646
+ if (!existsSync12(pkgPath)) return false;
3647
+ const raw = readFileSync12(pkgPath, "utf8");
3577
3648
  const pkg = JSON.parse(raw);
3578
3649
  let changed = false;
3579
3650
  for (const depField of ["dependencies", "devDependencies"]) {
@@ -3588,7 +3659,7 @@ function swapInPackageJson(pkgPath, direction) {
3588
3659
  }
3589
3660
  }
3590
3661
  if (changed) {
3591
- writeFileSync8(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
3662
+ writeFileSync9(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
3592
3663
  }
3593
3664
  return changed;
3594
3665
  }
@@ -3605,7 +3676,7 @@ function swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, direction) {
3605
3676
  }
3606
3677
  if (count > 0) {
3607
3678
  const target = direction === "yarn-to-pnpm" ? "@xylabs/ts-scripts-pnpm" : "@xylabs/ts-scripts-yarn3";
3608
- console.log(chalk44.green(` Swapped ts-scripts dependency to ${target} in ${count} package(s)`));
3679
+ console.log(chalk45.green(` Swapped ts-scripts dependency to ${target} in ${count} package(s)`));
3609
3680
  }
3610
3681
  }
3611
3682
 
@@ -3616,13 +3687,13 @@ function createPnpmWorkspaceYaml(cwd5, workspacePatterns) {
3616
3687
  for (const pattern of workspacePatterns) {
3617
3688
  lines.push(` - '${pattern}'`);
3618
3689
  }
3619
- writeFileSync9(PATH12.join(cwd5, "pnpm-workspace.yaml"), lines.join("\n") + "\n", "utf8");
3620
- console.log(chalk45.green(" Created pnpm-workspace.yaml"));
3690
+ writeFileSync10(PATH12.join(cwd5, "pnpm-workspace.yaml"), lines.join("\n") + "\n", "utf8");
3691
+ console.log(chalk46.green(" Created pnpm-workspace.yaml"));
3621
3692
  }
3622
3693
  function readPnpmWorkspacePatterns(cwd5) {
3623
3694
  const wsPath = PATH12.join(cwd5, "pnpm-workspace.yaml");
3624
- if (!existsSync12(wsPath)) return [];
3625
- const content = readFileSync12(wsPath, "utf8");
3695
+ if (!existsSync13(wsPath)) return [];
3696
+ const content = readFileSync13(wsPath, "utf8");
3626
3697
  const patterns = [];
3627
3698
  const lines = content.split("\n");
3628
3699
  let inPackages = false;
@@ -3642,19 +3713,19 @@ function readPnpmWorkspacePatterns(cwd5) {
3642
3713
  }
3643
3714
  function updateRootPackageJson(cwd5) {
3644
3715
  const pkgPath = PATH12.join(cwd5, "package.json");
3645
- const pkg = JSON.parse(readFileSync12(pkgPath, "utf8"));
3716
+ const pkg = JSON.parse(readFileSync13(pkgPath, "utf8"));
3646
3717
  const workspacePatterns = pkg.workspaces ?? readPnpmWorkspacePatterns(cwd5);
3647
3718
  delete pkg.workspaces;
3648
3719
  pkg.packageManager = `pnpm@${PNPM_VERSION}`;
3649
3720
  const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
3650
- writeFileSync9(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3651
- console.log(chalk45.green(" Updated root package.json"));
3721
+ writeFileSync10(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3722
+ console.log(chalk46.green(" Updated root package.json"));
3652
3723
  return workspacePatterns;
3653
3724
  }
3654
3725
  function updateGitignore(cwd5) {
3655
3726
  const gitignorePath = PATH12.join(cwd5, ".gitignore");
3656
- if (!existsSync12(gitignorePath)) return;
3657
- let content = readFileSync12(gitignorePath, "utf8");
3727
+ if (!existsSync13(gitignorePath)) return;
3728
+ let content = readFileSync13(gitignorePath, "utf8");
3658
3729
  const yarnLines = [
3659
3730
  ".pnp.*",
3660
3731
  ".pnp",
@@ -3669,64 +3740,65 @@ function updateGitignore(cwd5) {
3669
3740
  content = content.replaceAll(new RegExp(String.raw`^${line.replaceAll(".", String.raw`\.`).replaceAll("*", String.raw`\*`).replaceAll("!", String.raw`\!`)}\s*$`, "gm"), "");
3670
3741
  }
3671
3742
  content = content.replaceAll(/\n{3,}/g, "\n\n");
3672
- writeFileSync9(gitignorePath, content, "utf8");
3673
- console.log(chalk45.green(" Updated .gitignore"));
3743
+ writeFileSync10(gitignorePath, content, "utf8");
3744
+ console.log(chalk46.green(" Updated .gitignore"));
3674
3745
  }
3675
3746
  function deleteYarnArtifacts(cwd5) {
3676
3747
  const yarnLock = PATH12.join(cwd5, "yarn.lock");
3677
3748
  const yarnrc = PATH12.join(cwd5, ".yarnrc.yml");
3678
3749
  const yarnDir = PATH12.join(cwd5, ".yarn");
3679
- if (existsSync12(yarnLock)) {
3750
+ if (existsSync13(yarnLock)) {
3680
3751
  rmSync3(yarnLock);
3681
- console.log(chalk45.gray(" Deleted yarn.lock"));
3752
+ console.log(chalk46.gray(" Deleted yarn.lock"));
3682
3753
  }
3683
- if (existsSync12(yarnrc)) {
3754
+ if (existsSync13(yarnrc)) {
3684
3755
  rmSync3(yarnrc);
3685
- console.log(chalk45.gray(" Deleted .yarnrc.yml"));
3756
+ console.log(chalk46.gray(" Deleted .yarnrc.yml"));
3686
3757
  }
3687
- if (existsSync12(yarnDir)) {
3758
+ if (existsSync13(yarnDir)) {
3688
3759
  rmSync3(yarnDir, { force: true, recursive: true });
3689
- console.log(chalk45.gray(" Deleted .yarn/"));
3760
+ console.log(chalk46.gray(" Deleted .yarn/"));
3690
3761
  }
3691
3762
  }
3692
3763
  function createNpmrc(cwd5) {
3693
3764
  const npmrcPath = PATH12.join(cwd5, ".npmrc");
3694
- if (existsSync12(npmrcPath)) return;
3765
+ if (existsSync13(npmrcPath)) return;
3695
3766
  mkdirSync5(PATH12.dirname(npmrcPath), { recursive: true });
3696
- writeFileSync9(npmrcPath, "", "utf8");
3697
- console.log(chalk45.green(" Created .npmrc"));
3767
+ writeFileSync10(npmrcPath, "", "utf8");
3768
+ console.log(chalk46.green(" Created .npmrc"));
3698
3769
  }
3699
3770
  function convertToPnpm(cwd5, workspacePackageJsonPaths) {
3700
- console.log(chalk45.blue("\nConverting to pnpm...\n"));
3771
+ console.log(chalk46.blue("\nConverting to pnpm...\n"));
3701
3772
  const workspacePatterns = updateRootPackageJson(cwd5);
3702
3773
  createPnpmWorkspaceYaml(cwd5, workspacePatterns);
3703
3774
  for (const pkgPath of workspacePackageJsonPaths) {
3704
3775
  const fullPath = PATH12.resolve(cwd5, pkgPath, "package.json");
3705
- if (!existsSync12(fullPath)) continue;
3706
- const pkg = JSON.parse(readFileSync12(fullPath, "utf8"));
3776
+ if (!existsSync13(fullPath)) continue;
3777
+ const pkg = JSON.parse(readFileSync13(fullPath, "utf8"));
3707
3778
  const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
3708
3779
  if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
3709
- writeFileSync9(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3780
+ writeFileSync10(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3710
3781
  }
3711
3782
  }
3712
- console.log(chalk45.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
3783
+ console.log(chalk46.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
3713
3784
  updateGitignore(cwd5);
3714
3785
  createNpmrc(cwd5);
3715
3786
  swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, "yarn-to-pnpm");
3787
+ rewriteSourceImports(cwd5, "yarn-to-pnpm");
3716
3788
  deleteYarnArtifacts(cwd5);
3717
- console.log(chalk45.blue("\nConversion complete. Run `pnpm install` to generate pnpm-lock.yaml.\n"));
3789
+ console.log(chalk46.blue("\nConversion complete. Run `pnpm install` to generate pnpm-lock.yaml.\n"));
3718
3790
  return 0;
3719
3791
  }
3720
3792
 
3721
3793
  // src/actions/packman/convertToYarn.ts
3722
3794
  import {
3723
- existsSync as existsSync13,
3724
- readFileSync as readFileSync13,
3795
+ existsSync as existsSync14,
3796
+ readFileSync as readFileSync14,
3725
3797
  rmSync as rmSync4,
3726
- writeFileSync as writeFileSync10
3798
+ writeFileSync as writeFileSync11
3727
3799
  } from "fs";
3728
3800
  import PATH13 from "path";
3729
- import chalk46 from "chalk";
3801
+ import chalk47 from "chalk";
3730
3802
  var YARN_VERSION = "4.13.0";
3731
3803
  var YARNRC_TEMPLATE = `compressionLevel: mixed
3732
3804
 
@@ -3749,8 +3821,8 @@ var YARN_GITIGNORE_ENTRIES = `
3749
3821
  `;
3750
3822
  function readPnpmWorkspacePatterns2(cwd5) {
3751
3823
  const wsPath = PATH13.join(cwd5, "pnpm-workspace.yaml");
3752
- if (!existsSync13(wsPath)) return [];
3753
- const content = readFileSync13(wsPath, "utf8");
3824
+ if (!existsSync14(wsPath)) return [];
3825
+ const content = readFileSync14(wsPath, "utf8");
3754
3826
  const patterns = [];
3755
3827
  const lines = content.split("\n");
3756
3828
  let inPackages = false;
@@ -3770,102 +3842,103 @@ function readPnpmWorkspacePatterns2(cwd5) {
3770
3842
  }
3771
3843
  function updateRootPackageJson2(cwd5, workspacePatterns) {
3772
3844
  const pkgPath = PATH13.join(cwd5, "package.json");
3773
- const pkg = JSON.parse(readFileSync13(pkgPath, "utf8"));
3845
+ const pkg = JSON.parse(readFileSync14(pkgPath, "utf8"));
3774
3846
  pkg.workspaces = workspacePatterns;
3775
3847
  pkg.packageManager = `yarn@${YARN_VERSION}`;
3776
3848
  const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
3777
- writeFileSync10(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3778
- console.log(chalk46.green(" Updated root package.json"));
3849
+ writeFileSync11(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3850
+ console.log(chalk47.green(" Updated root package.json"));
3779
3851
  }
3780
3852
  function updateGitignore2(cwd5) {
3781
3853
  const gitignorePath = PATH13.join(cwd5, ".gitignore");
3782
- let content = existsSync13(gitignorePath) ? readFileSync13(gitignorePath, "utf8") : "";
3854
+ let content = existsSync14(gitignorePath) ? readFileSync14(gitignorePath, "utf8") : "";
3783
3855
  if (!content.includes(".yarn/*")) {
3784
3856
  content = content.trimEnd() + "\n" + YARN_GITIGNORE_ENTRIES;
3785
3857
  }
3786
- writeFileSync10(gitignorePath, content, "utf8");
3787
- console.log(chalk46.green(" Updated .gitignore"));
3858
+ writeFileSync11(gitignorePath, content, "utf8");
3859
+ console.log(chalk47.green(" Updated .gitignore"));
3788
3860
  }
3789
3861
  function deletePnpmArtifacts(cwd5) {
3790
3862
  const lockfile = PATH13.join(cwd5, "pnpm-lock.yaml");
3791
3863
  const workspaceYaml = PATH13.join(cwd5, "pnpm-workspace.yaml");
3792
3864
  const npmrc = PATH13.join(cwd5, ".npmrc");
3793
- if (existsSync13(lockfile)) {
3865
+ if (existsSync14(lockfile)) {
3794
3866
  rmSync4(lockfile);
3795
- console.log(chalk46.gray(" Deleted pnpm-lock.yaml"));
3867
+ console.log(chalk47.gray(" Deleted pnpm-lock.yaml"));
3796
3868
  }
3797
- if (existsSync13(workspaceYaml)) {
3869
+ if (existsSync14(workspaceYaml)) {
3798
3870
  rmSync4(workspaceYaml);
3799
- console.log(chalk46.gray(" Deleted pnpm-workspace.yaml"));
3871
+ console.log(chalk47.gray(" Deleted pnpm-workspace.yaml"));
3800
3872
  }
3801
- if (existsSync13(npmrc)) {
3802
- const content = readFileSync13(npmrc, "utf8");
3873
+ if (existsSync14(npmrc)) {
3874
+ const content = readFileSync14(npmrc, "utf8");
3803
3875
  if (content.trim() === "" || content.includes("shamefully-hoist") || content.includes("node-linker")) {
3804
3876
  rmSync4(npmrc);
3805
- console.log(chalk46.gray(" Deleted .npmrc"));
3877
+ console.log(chalk47.gray(" Deleted .npmrc"));
3806
3878
  }
3807
3879
  }
3808
3880
  }
3809
3881
  function createYarnrc(cwd5) {
3810
3882
  const yarnrcPath = PATH13.join(cwd5, ".yarnrc.yml");
3811
- if (existsSync13(yarnrcPath)) return;
3812
- writeFileSync10(yarnrcPath, YARNRC_TEMPLATE, "utf8");
3813
- console.log(chalk46.green(" Created .yarnrc.yml"));
3883
+ if (existsSync14(yarnrcPath)) return;
3884
+ writeFileSync11(yarnrcPath, YARNRC_TEMPLATE, "utf8");
3885
+ console.log(chalk47.green(" Created .yarnrc.yml"));
3814
3886
  }
3815
3887
  function readWorkspacePatternsFromPackageJson(cwd5) {
3816
3888
  const pkgPath = PATH13.join(cwd5, "package.json");
3817
- if (!existsSync13(pkgPath)) return [];
3818
- const pkg = JSON.parse(readFileSync13(pkgPath, "utf8"));
3889
+ if (!existsSync14(pkgPath)) return [];
3890
+ const pkg = JSON.parse(readFileSync14(pkgPath, "utf8"));
3819
3891
  return pkg.workspaces ?? [];
3820
3892
  }
3821
3893
  function convertToYarn(cwd5, workspacePackageJsonPaths) {
3822
- console.log(chalk46.blue("\nConverting to yarn...\n"));
3894
+ console.log(chalk47.blue("\nConverting to yarn...\n"));
3823
3895
  const workspacePatterns = readPnpmWorkspacePatterns2(cwd5);
3824
3896
  if (workspacePatterns.length === 0) {
3825
3897
  const fromPkg = readWorkspacePatternsFromPackageJson(cwd5);
3826
3898
  if (fromPkg.length > 0) {
3827
3899
  workspacePatterns.push(...fromPkg);
3828
3900
  } else {
3829
- console.warn(chalk46.yellow(" No workspace patterns found"));
3901
+ console.warn(chalk47.yellow(" No workspace patterns found"));
3830
3902
  }
3831
3903
  }
3832
3904
  updateRootPackageJson2(cwd5, workspacePatterns);
3833
3905
  for (const pkgPath of workspacePackageJsonPaths) {
3834
3906
  const fullPath = PATH13.resolve(cwd5, pkgPath, "package.json");
3835
- if (!existsSync13(fullPath)) continue;
3836
- const pkg = JSON.parse(readFileSync13(fullPath, "utf8"));
3907
+ if (!existsSync14(fullPath)) continue;
3908
+ const pkg = JSON.parse(readFileSync14(fullPath, "utf8"));
3837
3909
  const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
3838
3910
  if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
3839
- writeFileSync10(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3911
+ writeFileSync11(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
3840
3912
  }
3841
3913
  }
3842
- console.log(chalk46.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
3914
+ console.log(chalk47.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
3843
3915
  updateGitignore2(cwd5);
3844
3916
  createYarnrc(cwd5);
3845
3917
  swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, "pnpm-to-yarn");
3918
+ rewriteSourceImports(cwd5, "pnpm-to-yarn");
3846
3919
  deletePnpmArtifacts(cwd5);
3847
- console.log(chalk46.blue("\nConversion complete. Run `corepack enable yarn && yarn set version stable && yarn install` to finish setup.\n"));
3920
+ console.log(chalk47.blue("\nConversion complete. Run `corepack enable yarn && yarn set version stable && yarn install` to finish setup.\n"));
3848
3921
  return 0;
3849
3922
  }
3850
3923
 
3851
3924
  // src/actions/packman/convert.ts
3852
3925
  function detectCurrentPM(cwd5) {
3853
- if (existsSync14(PATH14.join(cwd5, "pnpm-lock.yaml")) || existsSync14(PATH14.join(cwd5, "pnpm-workspace.yaml"))) {
3926
+ if (existsSync15(PATH14.join(cwd5, "pnpm-lock.yaml")) || existsSync15(PATH14.join(cwd5, "pnpm-workspace.yaml"))) {
3854
3927
  return "pnpm";
3855
3928
  }
3856
- if (existsSync14(PATH14.join(cwd5, "yarn.lock")) || existsSync14(PATH14.join(cwd5, ".yarnrc.yml"))) {
3929
+ if (existsSync15(PATH14.join(cwd5, "yarn.lock")) || existsSync15(PATH14.join(cwd5, ".yarnrc.yml"))) {
3857
3930
  return "yarn";
3858
3931
  }
3859
3932
  return "unknown";
3860
3933
  }
3861
3934
  function findWorkspacePackagePaths(cwd5) {
3862
3935
  const pkgPath = PATH14.join(cwd5, "package.json");
3863
- const pkg = JSON.parse(readFileSync14(pkgPath, "utf8"));
3936
+ const pkg = JSON.parse(readFileSync15(pkgPath, "utf8"));
3864
3937
  let patterns = pkg.workspaces ?? [];
3865
3938
  if (patterns.length === 0) {
3866
3939
  const wsPath = PATH14.join(cwd5, "pnpm-workspace.yaml");
3867
- if (existsSync14(wsPath)) {
3868
- const content = readFileSync14(wsPath, "utf8");
3940
+ if (existsSync15(wsPath)) {
3941
+ const content = readFileSync15(wsPath, "utf8");
3869
3942
  const lines = content.split("\n");
3870
3943
  let inPackages = false;
3871
3944
  for (const line of lines) {
@@ -3896,14 +3969,14 @@ function resolveWorkspaceGlob(cwd5, pattern) {
3896
3969
  function walkGlob(basePath, parts, currentPath) {
3897
3970
  if (parts.length === 0) {
3898
3971
  const fullPath = PATH14.join(basePath, currentPath);
3899
- if (existsSync14(PATH14.join(fullPath, "package.json"))) {
3972
+ if (existsSync15(PATH14.join(fullPath, "package.json"))) {
3900
3973
  return [currentPath];
3901
3974
  }
3902
3975
  return [];
3903
3976
  }
3904
3977
  const [part, ...rest] = parts;
3905
3978
  const dirPath = PATH14.join(basePath, currentPath);
3906
- if (!existsSync14(dirPath) || !statSync3(dirPath).isDirectory()) {
3979
+ if (!existsSync15(dirPath) || !statSync3(dirPath).isDirectory()) {
3907
3980
  return [];
3908
3981
  }
3909
3982
  if (part === "*" || part === "**") {
@@ -3931,25 +4004,25 @@ function walkGlob(basePath, parts, currentPath) {
3931
4004
  function convert({ target, verbose }) {
3932
4005
  const validTargets = ["pnpm", "yarn"];
3933
4006
  if (!validTargets.includes(target)) {
3934
- console.error(chalk47.red(`Invalid target "${target}". Must be one of: ${validTargets.join(", ")}`));
4007
+ console.error(chalk48.red(`Invalid target "${target}". Must be one of: ${validTargets.join(", ")}`));
3935
4008
  return 1;
3936
4009
  }
3937
4010
  const cwd5 = process.cwd();
3938
4011
  const currentPM = detectCurrentPM(cwd5);
3939
4012
  if (verbose) {
3940
- console.log(chalk47.gray(`Current package manager: ${currentPM}`));
3941
- console.log(chalk47.gray(`Target package manager: ${target}`));
4013
+ console.log(chalk48.gray(`Current package manager: ${currentPM}`));
4014
+ console.log(chalk48.gray(`Target package manager: ${target}`));
3942
4015
  }
3943
4016
  if (currentPM === target) {
3944
- console.log(chalk47.yellow(`Already using ${target}. Re-applying conversion to fix any incomplete steps...`));
4017
+ console.log(chalk48.yellow(`Already using ${target}. Re-applying conversion to fix any incomplete steps...`));
3945
4018
  }
3946
4019
  if (currentPM === "unknown") {
3947
- console.error(chalk47.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
4020
+ console.error(chalk48.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
3948
4021
  return 1;
3949
4022
  }
3950
4023
  const workspacePaths = findWorkspacePackagePaths(cwd5);
3951
4024
  if (verbose) {
3952
- console.log(chalk47.gray(`Found ${workspacePaths.length} workspace packages`));
4025
+ console.log(chalk48.gray(`Found ${workspacePaths.length} workspace packages`));
3953
4026
  }
3954
4027
  if (target === "pnpm") {
3955
4028
  return convertToPnpm(cwd5, workspacePaths);
@@ -4007,7 +4080,7 @@ var rebuild = ({ target }) => {
4007
4080
  };
4008
4081
 
4009
4082
  // src/actions/recompile.ts
4010
- import chalk48 from "chalk";
4083
+ import chalk49 from "chalk";
4011
4084
  var recompile = async ({
4012
4085
  verbose,
4013
4086
  target,
@@ -4042,7 +4115,7 @@ var recompileAll = async ({
4042
4115
  const start = Date.now();
4043
4116
  const targetOptions = target ? ["-t", target] : [];
4044
4117
  if (jobs) {
4045
- console.log(chalk48.blue(`Jobs set to [${jobs}]`));
4118
+ console.log(chalk49.blue(`Jobs set to [${jobs}]`));
4046
4119
  }
4047
4120
  const foreachOptions = {
4048
4121
  incremental,
@@ -4055,25 +4128,25 @@ var recompileAll = async ({
4055
4128
  pm.foreachWorkspace("package-compile", targetOptions, foreachOptions)
4056
4129
  ]);
4057
4130
  console.log(
4058
- `${chalk48.gray("Recompiled in")} [${chalk48.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk48.gray("seconds")}`
4131
+ `${chalk49.gray("Recompiled in")} [${chalk49.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk49.gray("seconds")}`
4059
4132
  );
4060
4133
  return result;
4061
4134
  };
4062
4135
 
4063
4136
  // src/actions/relint.ts
4064
- import chalk49 from "chalk";
4137
+ import chalk50 from "chalk";
4065
4138
  var relintPackage = ({
4066
4139
  pkg,
4067
4140
  fix: fix2,
4068
4141
  verbose
4069
4142
  }) => {
4070
- console.log(chalk49.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
4143
+ console.log(chalk50.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
4071
4144
  const start = Date.now();
4072
4145
  const pm = getPackageManager();
4073
4146
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
4074
4147
  pm.runInWorkspace(pkg, fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint")
4075
4148
  ]);
4076
- console.log(chalk49.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk49.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk49.gray("seconds")}`));
4149
+ console.log(chalk50.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk50.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk50.gray("seconds")}`));
4077
4150
  return result;
4078
4151
  };
4079
4152
  var relint = ({
@@ -4093,13 +4166,13 @@ var relint = ({
4093
4166
  });
4094
4167
  };
4095
4168
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
4096
- console.log(chalk49.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
4169
+ console.log(chalk50.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
4097
4170
  const start = Date.now();
4098
4171
  const fixOptions = fix2 ? ["--fix"] : [];
4099
4172
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
4100
4173
  ["eslint", fixOptions]
4101
4174
  ]);
4102
- console.log(chalk49.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk49.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk49.gray("seconds")}`));
4175
+ console.log(chalk50.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk50.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk50.gray("seconds")}`));
4103
4176
  return result;
4104
4177
  };
4105
4178
 
@@ -4125,10 +4198,10 @@ var sonar = () => {
4125
4198
  };
4126
4199
 
4127
4200
  // src/actions/statics.ts
4128
- import chalk50 from "chalk";
4201
+ import chalk51 from "chalk";
4129
4202
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
4130
4203
  var statics = () => {
4131
- console.log(chalk50.green("Check Required Static Dependencies"));
4204
+ console.log(chalk51.green("Check Required Static Dependencies"));
4132
4205
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
4133
4206
  return detectDuplicateDependencies(statics2, DefaultDependencies);
4134
4207
  };