@xylabs/ts-scripts-yarn3 6.5.0 → 6.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.
Files changed (55) hide show
  1. package/dist/actions/deplint/checkPackage/checkPackage.mjs +260 -0
  2. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -0
  3. package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs +1 -0
  4. package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs.map +1 -0
  5. package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs +19 -0
  6. package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs.map +1 -0
  7. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +35 -0
  8. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -0
  9. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +21 -0
  10. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -0
  11. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +22 -0
  12. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -0
  13. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +19 -0
  14. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -0
  15. package/dist/actions/deplint/checkPackage/index.mjs +260 -0
  16. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -0
  17. package/dist/actions/deplint/deplint.mjs +320 -0
  18. package/dist/actions/deplint/deplint.mjs.map +1 -0
  19. package/dist/actions/deplint/findFiles.mjs +24 -0
  20. package/dist/actions/deplint/findFiles.mjs.map +1 -0
  21. package/dist/actions/deplint/findFilesByGlob.mjs +9 -0
  22. package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -0
  23. package/dist/actions/deplint/getBasePackageName.mjs +12 -0
  24. package/dist/actions/deplint/getBasePackageName.mjs.map +1 -0
  25. package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +20 -0
  26. package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -0
  27. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +98 -0
  28. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -0
  29. package/dist/actions/deplint/getImportsFromFile.mjs +65 -0
  30. package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -0
  31. package/dist/actions/{deplint.mjs → deplint/index.mjs} +165 -88
  32. package/dist/actions/deplint/index.mjs.map +1 -0
  33. package/dist/actions/fix.mjs.map +1 -1
  34. package/dist/actions/index.mjs +240 -161
  35. package/dist/actions/index.mjs.map +1 -1
  36. package/dist/actions/lint.mjs.map +1 -1
  37. package/dist/bin/xy.mjs +244 -156
  38. package/dist/bin/xy.mjs.map +1 -1
  39. package/dist/index.d.ts +5 -1
  40. package/dist/index.mjs +287 -199
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/xy/index.mjs +244 -156
  43. package/dist/xy/index.mjs.map +1 -1
  44. package/dist/xy/param.mjs +1 -1
  45. package/dist/xy/param.mjs.map +1 -1
  46. package/dist/xy/xy.mjs +244 -156
  47. package/dist/xy/xy.mjs.map +1 -1
  48. package/dist/xy/xyCommonCommands.mjs +1 -1
  49. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  50. package/dist/xy/xyLintCommands.mjs +217 -108
  51. package/dist/xy/xyLintCommands.mjs.map +1 -1
  52. package/dist/xy/xyParseOptions.mjs +0 -21
  53. package/dist/xy/xyParseOptions.mjs.map +1 -1
  54. package/package.json +3 -3
  55. package/dist/actions/deplint.mjs.map +0 -1
package/dist/bin/xy.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/xy/xy.ts
4
- import chalk22 from "chalk";
4
+ import chalk27 from "chalk";
5
5
 
6
6
  // src/actions/build.ts
7
7
  import chalk7 from "chalk";
@@ -299,8 +299,8 @@ var generateIgnoreFiles = (filename3, pkg) => {
299
299
 
300
300
  // src/lib/parsedPackageJSON.ts
301
301
  import { readFileSync as readFileSync2 } from "node:fs";
302
- var parsedPackageJSON = (path4) => {
303
- const pathToPackageJSON = path4 ?? process.env.npm_package_json ?? "";
302
+ var parsedPackageJSON = (path5) => {
303
+ const pathToPackageJSON = path5 ?? process.env.npm_package_json ?? "";
304
304
  const packageJSON = readFileSync2(pathToPackageJSON).toString();
305
305
  return JSON.parse(packageJSON);
306
306
  };
@@ -657,12 +657,33 @@ var dead = () => {
657
657
  return runSteps("Dead", [["yarn", ["ts-prune", "-p", "tsconfig.json"]]]);
658
658
  };
659
659
 
660
- // src/actions/deplint.ts
660
+ // src/actions/deplint/deplint.ts
661
+ import chalk17 from "chalk";
662
+
663
+ // src/actions/deplint/findFilesByGlob.ts
664
+ import { globSync } from "glob";
665
+ function findFilesByGlob(cwd, pattern) {
666
+ return globSync(pattern, { cwd, absolute: true });
667
+ }
668
+
669
+ // src/actions/deplint/findFiles.ts
670
+ function findFiles(path5) {
671
+ const allSourceInclude = ["./src/**/*.{ts,tsx}", "./dist/**/*.d.ts"];
672
+ const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
673
+ const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
674
+ const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
675
+ const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
676
+ const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
677
+ return {
678
+ allSourceFiles,
679
+ prodSourceFiles,
680
+ devSourceFiles
681
+ };
682
+ }
683
+
684
+ // src/actions/deplint/getDependenciesFromPackageJson.ts
661
685
  import fs2 from "node:fs";
662
686
  import path3 from "node:path";
663
- import chalk12 from "chalk";
664
- import { globSync } from "glob";
665
- import ts from "typescript";
666
687
  function getDependenciesFromPackageJson(packageJsonPath) {
667
688
  const packageJsonFullPath = path3.resolve(packageJsonPath);
668
689
  const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
@@ -676,6 +697,13 @@ function getDependenciesFromPackageJson(packageJsonPath) {
676
697
  peerDependencies
677
698
  };
678
699
  }
700
+
701
+ // src/actions/deplint/getImportsFromFile.ts
702
+ import fs3 from "node:fs";
703
+ import path4 from "node:path";
704
+ import ts from "typescript";
705
+
706
+ // src/actions/deplint/getBasePackageName.ts
679
707
  function getBasePackageName(importName) {
680
708
  if (importName.startsWith("@")) {
681
709
  const parts = importName.split("/");
@@ -683,10 +711,12 @@ function getBasePackageName(importName) {
683
711
  }
684
712
  return importName.split("/")[0];
685
713
  }
714
+
715
+ // src/actions/deplint/getImportsFromFile.ts
686
716
  function getImportsFromFile(filePath, importPaths, typeImportPaths) {
687
- const sourceCode = fs2.readFileSync(filePath, "utf8");
717
+ const sourceCode = fs3.readFileSync(filePath, "utf8");
688
718
  const sourceFile = ts.createSourceFile(
689
- path3.basename(filePath),
719
+ path4.basename(filePath),
690
720
  sourceCode,
691
721
  ts.ScriptTarget.Latest,
692
722
  true
@@ -729,36 +759,26 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
729
759
  }
730
760
  return [cleanedImports, cleanedTypeImports];
731
761
  }
732
- function findFilesByGlob(cwd, pattern) {
733
- return globSync(pattern, { cwd, absolute: true });
734
- }
735
- function findFiles(path4) {
736
- const allSourceInclude = ["./src/**/*.{ts,tsx}", "./dist/**/*.d.ts"];
737
- const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
738
- const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
739
- const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path4, pattern));
740
- const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
741
- const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
742
- return {
743
- allSourceFiles,
744
- prodSourceFiles,
745
- devSourceFiles
746
- };
747
- }
762
+
763
+ // src/actions/deplint/getExternalImportsFromFiles.ts
764
+ var internalImportPrefixes = [".", "#", "node:"];
765
+ var removeInternalImports = (imports) => {
766
+ return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
767
+ };
748
768
  function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
749
769
  const prodImportPaths = {};
750
770
  const prodTypeImportPaths = {};
751
- const prodImportPairs = prodSourceFiles.map((path4) => getImportsFromFile(path4, prodImportPaths, prodTypeImportPaths));
771
+ const prodImportPairs = prodSourceFiles.map((path5) => getImportsFromFile(path5, prodImportPaths, prodTypeImportPaths));
752
772
  const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
753
773
  const prodTypeImports = prodImportPairs.flatMap((pair) => pair[1]);
754
774
  const devImportPaths = {};
755
775
  const devTypeImportPaths = {};
756
- const devImportPairs = devSourceFiles.map((path4) => getImportsFromFile(path4, devImportPaths, devTypeImportPaths));
776
+ const devImportPairs = devSourceFiles.map((path5) => getImportsFromFile(path5, devImportPaths, devTypeImportPaths));
757
777
  const devImports = devImportPairs.flatMap((pair) => pair[0]);
758
778
  const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
759
- const externalProdImports = prodImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
760
- const externalProdTypeImports = prodTypeImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
761
- const externalDevImports = devImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
779
+ const externalProdImports = removeInternalImports(prodImports);
780
+ const externalProdTypeImports = removeInternalImports(prodTypeImports);
781
+ const externalDevImports = removeInternalImports(devImports);
762
782
  return {
763
783
  prodImports,
764
784
  devImports,
@@ -772,34 +792,40 @@ function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
772
792
  externalProdTypeImports
773
793
  };
774
794
  }
775
- function check({
776
- name,
777
- location,
778
- devDeps = false,
779
- peerDeps = false
795
+
796
+ // src/actions/deplint/checkPackage/getTypesInDependencies.ts
797
+ import chalk12 from "chalk";
798
+ function getTypesInDependencies({ name, location }, { dependencies }, {}) {
799
+ let typesInDependencies = 0;
800
+ for (const dep of dependencies) {
801
+ if (dep.startsWith("@types/")) {
802
+ typesInDependencies++;
803
+ console.log(`[${chalk12.blue(name)}] @types in dependencies in package.json: ${chalk12.red(dep)}`);
804
+ console.log(` ${location}/package.json
805
+ `);
806
+ console.log("");
807
+ }
808
+ }
809
+ return typesInDependencies;
810
+ }
811
+
812
+ // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
813
+ import chalk13 from "chalk";
814
+ function getUnlistedDependencies({ name }, {
815
+ dependencies,
816
+ devDependencies,
817
+ peerDependencies
818
+ }, {
819
+ externalProdTypeImports,
820
+ prodTypeImportPaths,
821
+ externalProdImports,
822
+ prodImportPaths
780
823
  }) {
781
- const { prodSourceFiles, devSourceFiles } = findFiles(location);
782
- const {
783
- prodTypeImportPaths,
784
- prodImportPaths,
785
- externalProdTypeImports,
786
- devImportPaths,
787
- externalProdImports,
788
- externalDevImports
789
- } = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
790
- const {
791
- dependencies,
792
- devDependencies,
793
- peerDependencies
794
- } = getDependenciesFromPackageJson(`${location}/package.json`);
795
824
  let unlistedDependencies = 0;
796
- let unlistedDevDependencies = 0;
797
- let unusedDependencies = 0;
798
- let typesInDependencies = 0;
799
825
  for (const imp of externalProdTypeImports) {
800
- if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`)) {
826
+ if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
801
827
  unlistedDependencies++;
802
- console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
828
+ console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
803
829
  console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
804
830
  console.log("");
805
831
  }
@@ -807,70 +833,123 @@ function check({
807
833
  for (const imp of externalProdImports) {
808
834
  if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
809
835
  unlistedDependencies++;
810
- console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
836
+ console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
811
837
  console.log(` ${prodImportPaths[imp].join("\n")}`);
812
838
  console.log("");
813
839
  }
814
840
  }
841
+ return unlistedDependencies;
842
+ }
843
+
844
+ // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
845
+ import chalk14 from "chalk";
846
+ function getUnlistedDevDependencies({ name }, {
847
+ devDependencies,
848
+ dependencies,
849
+ peerDependencies
850
+ }, { devImportPaths, externalDevImports }) {
851
+ let unlistedDevDependencies = 0;
852
+ for (const imp of externalDevImports) {
853
+ if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
854
+ unlistedDevDependencies++;
855
+ console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
856
+ console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
857
+ }
858
+ }
859
+ return unlistedDevDependencies;
860
+ }
861
+
862
+ // src/actions/deplint/checkPackage/getUnusedDependencies.ts
863
+ import chalk15 from "chalk";
864
+ function getUnusedDependencies({ name, location }, { dependencies }, {
865
+ externalProdImports,
866
+ externalProdTypeImports
867
+ }) {
868
+ let unusedDependencies = 0;
815
869
  for (const dep of dependencies) {
816
- if (dep.startsWith("@types/")) {
817
- typesInDependencies++;
818
- console.log(`[${chalk12.blue(name)}] @types in dependencies in package.json: ${chalk12.red(dep)}`);
870
+ if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
871
+ unusedDependencies++;
872
+ console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
819
873
  console.log(` ${location}/package.json
820
874
  `);
821
875
  console.log("");
822
876
  }
823
- if (!externalProdImports.includes(dep)) {
877
+ }
878
+ return unusedDependencies;
879
+ }
880
+
881
+ // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
882
+ import chalk16 from "chalk";
883
+ function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
884
+ let unusedDependencies = 0;
885
+ for (const dep of peerDependencies) {
886
+ if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
824
887
  unusedDependencies++;
825
- console.log(`[${chalk12.blue(name)}] Unused dependency in package.json: ${chalk12.red(dep)}`);
888
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
826
889
  console.log(` ${location}/package.json
827
890
  `);
828
891
  console.log("");
829
892
  }
830
893
  }
831
- if (peerDeps) {
832
- for (const dep of peerDependencies) {
833
- if (!externalProdImports.includes(dep)) {
834
- unusedDependencies++;
835
- console.log(`[${chalk12.blue(name)}] Unused peerDependency in package.json: ${chalk12.red(dep)}`);
836
- console.log(` ${location}/package.json
837
- `);
838
- console.log("");
839
- }
840
- }
841
- }
842
- if (devDeps) {
843
- for (const imp of externalDevImports) {
844
- if (!devDependencies.includes(imp)) {
845
- unlistedDevDependencies++;
846
- console.log(`[${chalk12.blue(name)}] Missing devDependency in package.json: ${chalk12.red(imp)}`);
847
- console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
848
- }
849
- }
850
- }
851
- const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies;
894
+ return unusedDependencies;
895
+ }
896
+
897
+ // src/actions/deplint/checkPackage/checkPackage.ts
898
+ function checkPackage({
899
+ name,
900
+ location,
901
+ deps = false,
902
+ devDeps = false,
903
+ peerDeps = false
904
+ }) {
905
+ const { prodSourceFiles, devSourceFiles } = findFiles(location);
906
+ const checkDeps = deps || !(deps || devDeps || peerDeps);
907
+ const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
908
+ const checkPeerDeps = peerDeps || !(deps || devDeps || peerDeps);
909
+ const sourceParams = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
910
+ const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
911
+ const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
912
+ const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
913
+ const typesInDependencies = checkDeps ? getTypesInDependencies({ name, location }, packageParams, sourceParams) : 0;
914
+ const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
915
+ const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
916
+ const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
852
917
  return totalErrors;
853
918
  }
854
- var deplint = ({ pkg }) => {
919
+
920
+ // src/actions/deplint/deplint.ts
921
+ var deplint = ({
922
+ pkg,
923
+ deps,
924
+ devDeps,
925
+ peerDeps
926
+ }) => {
855
927
  if (pkg) {
856
928
  const { location, name } = yarnWorkspace(pkg);
857
929
  console.log(`Running Deplint for ${name}`);
858
- check({
930
+ checkPackage({
859
931
  name,
860
932
  location,
861
- devDeps: true
933
+ devDeps,
934
+ deps,
935
+ peerDeps
862
936
  });
863
937
  } else {
864
938
  const workspaces = yarnWorkspaces();
865
939
  console.log("Deplint Started...");
866
940
  let totalErrors = 0;
867
941
  for (const workspace of workspaces) {
868
- totalErrors += check(workspace);
942
+ totalErrors += checkPackage({
943
+ ...workspace,
944
+ deps,
945
+ devDeps,
946
+ peerDeps
947
+ });
869
948
  }
870
949
  if (totalErrors > 0) {
871
- console.log(`Found ${chalk12.red(totalErrors)} unlisted imports.`);
950
+ console.log(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
872
951
  } else {
873
- console.log(`No unlisted imports found. ${chalk12.green("\u2714")}`);
952
+ console.log(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
874
953
  }
875
954
  }
876
955
  return 0;
@@ -977,18 +1056,18 @@ var deployNext = () => {
977
1056
  };
978
1057
 
979
1058
  // src/actions/dupdeps.ts
980
- import chalk13 from "chalk";
1059
+ import chalk18 from "chalk";
981
1060
  var dupdeps = () => {
982
- console.log(chalk13.green("Checking all Dependencies for Duplicates"));
1061
+ console.log(chalk18.green("Checking all Dependencies for Duplicates"));
983
1062
  const allDependencies = parsedPackageJSON()?.dependencies;
984
1063
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
985
1064
  return detectDuplicateDependencies(dependencies);
986
1065
  };
987
1066
 
988
1067
  // src/actions/lint.ts
989
- import chalk14 from "chalk";
1068
+ import chalk19 from "chalk";
990
1069
  var lintPackage = ({ pkg, fix: fix2 }) => {
991
- console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1070
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
992
1071
  const start = Date.now();
993
1072
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
994
1073
  ["yarn", [
@@ -998,7 +1077,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
998
1077
  fix2 ? "package-fix" : "package-lint"
999
1078
  ]]
1000
1079
  ]);
1001
- console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
1080
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1002
1081
  return result;
1003
1082
  };
1004
1083
  var lint = ({
@@ -1014,13 +1093,13 @@ var lint = ({
1014
1093
  });
1015
1094
  };
1016
1095
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1017
- console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1096
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1018
1097
  const start = Date.now();
1019
1098
  const fixOptions = fix2 ? ["--fix"] : [];
1020
1099
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1021
1100
  ["yarn", ["eslint", ...fixOptions]]
1022
1101
  ]);
1023
- console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
1102
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1024
1103
  return result;
1025
1104
  };
1026
1105
 
@@ -1048,7 +1127,7 @@ var filename = ".gitignore";
1048
1127
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1049
1128
 
1050
1129
  // src/actions/gitlint.ts
1051
- import chalk15 from "chalk";
1130
+ import chalk20 from "chalk";
1052
1131
  import ParseGitConfig from "parse-git-config";
1053
1132
  var gitlint = () => {
1054
1133
  console.log(`
@@ -1059,7 +1138,7 @@ Gitlint Start [${process.cwd()}]
1059
1138
  const errors = 0;
1060
1139
  const gitConfig = ParseGitConfig.sync();
1061
1140
  const warn = (message) => {
1062
- console.warn(chalk15.yellow(`Warning: ${message}`));
1141
+ console.warn(chalk20.yellow(`Warning: ${message}`));
1063
1142
  warnings++;
1064
1143
  };
1065
1144
  if (gitConfig.core.ignorecase) {
@@ -1079,13 +1158,13 @@ Gitlint Start [${process.cwd()}]
1079
1158
  }
1080
1159
  const resultMessages = [];
1081
1160
  if (valid > 0) {
1082
- resultMessages.push(chalk15.green(`Passed: ${valid}`));
1161
+ resultMessages.push(chalk20.green(`Passed: ${valid}`));
1083
1162
  }
1084
1163
  if (warnings > 0) {
1085
- resultMessages.push(chalk15.yellow(`Warnings: ${warnings}`));
1164
+ resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
1086
1165
  }
1087
1166
  if (errors > 0) {
1088
- resultMessages.push(chalk15.red(` Errors: ${errors}`));
1167
+ resultMessages.push(chalk20.red(` Errors: ${errors}`));
1089
1168
  }
1090
1169
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1091
1170
  `);
@@ -1094,7 +1173,7 @@ Gitlint Start [${process.cwd()}]
1094
1173
 
1095
1174
  // src/actions/gitlint-fix.ts
1096
1175
  import { execSync as execSync2 } from "node:child_process";
1097
- import chalk16 from "chalk";
1176
+ import chalk21 from "chalk";
1098
1177
  import ParseGitConfig2 from "parse-git-config";
1099
1178
  var gitlintFix = () => {
1100
1179
  console.log(`
@@ -1103,15 +1182,15 @@ Gitlint Fix Start [${process.cwd()}]
1103
1182
  const gitConfig = ParseGitConfig2.sync();
1104
1183
  if (gitConfig.core.ignorecase) {
1105
1184
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1106
- console.warn(chalk16.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1185
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1107
1186
  }
1108
1187
  if (gitConfig.core.autocrlf !== false) {
1109
1188
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1110
- console.warn(chalk16.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1189
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1111
1190
  }
1112
1191
  if (gitConfig.core.eol !== "lf") {
1113
1192
  execSync2("git config core.eol lf", { stdio: "inherit" });
1114
- console.warn(chalk16.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1193
+ console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1115
1194
  }
1116
1195
  return 1;
1117
1196
  };
@@ -1122,7 +1201,7 @@ var knip = () => {
1122
1201
  };
1123
1202
 
1124
1203
  // src/actions/license.ts
1125
- import chalk17 from "chalk";
1204
+ import chalk22 from "chalk";
1126
1205
  import { init } from "license-checker";
1127
1206
  var license = async (pkg) => {
1128
1207
  const workspaces = yarnWorkspaces();
@@ -1147,18 +1226,18 @@ var license = async (pkg) => {
1147
1226
  "LGPL-3.0-or-later",
1148
1227
  "Python-2.0"
1149
1228
  ]);
1150
- console.log(chalk17.green("License Checker"));
1229
+ console.log(chalk22.green("License Checker"));
1151
1230
  return (await Promise.all(
1152
1231
  workspaceList.map(({ location, name }) => {
1153
1232
  return new Promise((resolve) => {
1154
1233
  init({ production: true, start: location }, (error, packages) => {
1155
1234
  if (error) {
1156
- console.error(chalk17.red(`License Checker [${name}] Error`));
1157
- console.error(chalk17.gray(error));
1235
+ console.error(chalk22.red(`License Checker [${name}] Error`));
1236
+ console.error(chalk22.gray(error));
1158
1237
  console.log("\n");
1159
1238
  resolve(1);
1160
1239
  } else {
1161
- console.log(chalk17.green(`License Checker [${name}]`));
1240
+ console.log(chalk22.green(`License Checker [${name}]`));
1162
1241
  let count = 0;
1163
1242
  for (const [name2, info] of Object.entries(packages)) {
1164
1243
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1174,7 +1253,7 @@ var license = async (pkg) => {
1174
1253
  }
1175
1254
  if (!orLicenseFound) {
1176
1255
  count++;
1177
- console.warn(chalk17.yellow(`${name2}: Package License not allowed [${license2}]`));
1256
+ console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
1178
1257
  }
1179
1258
  }
1180
1259
  }
@@ -1213,7 +1292,7 @@ var rebuild = ({ target }) => {
1213
1292
  };
1214
1293
 
1215
1294
  // src/actions/recompile.ts
1216
- import chalk18 from "chalk";
1295
+ import chalk23 from "chalk";
1217
1296
  var recompile = async ({
1218
1297
  verbose,
1219
1298
  target,
@@ -1249,7 +1328,7 @@ var recompileAll = async ({
1249
1328
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1250
1329
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1251
1330
  if (jobs) {
1252
- console.log(chalk18.blue(`Jobs set to [${jobs}]`));
1331
+ console.log(chalk23.blue(`Jobs set to [${jobs}]`));
1253
1332
  }
1254
1333
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1255
1334
  [
@@ -1280,7 +1359,7 @@ var recompileAll = async ({
1280
1359
  ]
1281
1360
  ]);
1282
1361
  console.log(
1283
- `${chalk18.gray("Recompiled in")} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`
1362
+ `${chalk23.gray("Recompiled in")} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`
1284
1363
  );
1285
1364
  return result;
1286
1365
  };
@@ -1311,9 +1390,9 @@ var reinstall = () => {
1311
1390
  };
1312
1391
 
1313
1392
  // src/actions/relint.ts
1314
- import chalk19 from "chalk";
1393
+ import chalk24 from "chalk";
1315
1394
  var relintPackage = ({ pkg }) => {
1316
- console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1395
+ console.log(chalk24.gray(`${"Relint"} [All-Packages]`));
1317
1396
  const start = Date.now();
1318
1397
  const result = runSteps("Relint [All-Packages]", [
1319
1398
  ["yarn", [
@@ -1323,7 +1402,7 @@ var relintPackage = ({ pkg }) => {
1323
1402
  "package-relint"
1324
1403
  ]]
1325
1404
  ]);
1326
- console.log(chalk19.gray(`${"Relinted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1405
+ console.log(chalk24.gray(`${"Relinted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
1327
1406
  return result;
1328
1407
  };
1329
1408
  var relint = ({
@@ -1334,7 +1413,7 @@ var relint = ({
1334
1413
  return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
1335
1414
  };
1336
1415
  var relintAllPackages = ({ verbose = true, incremental } = {}) => {
1337
- console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1416
+ console.log(chalk24.gray(`${"Relint"} [All-Packages]`));
1338
1417
  const start = Date.now();
1339
1418
  const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
1340
1419
  const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
@@ -1348,7 +1427,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
1348
1427
  "package-relint"
1349
1428
  ]]
1350
1429
  ]);
1351
- console.log(chalk19.gray(`Relinted in [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1430
+ console.log(chalk24.gray(`Relinted in [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
1352
1431
  return result;
1353
1432
  };
1354
1433
 
@@ -1366,10 +1445,10 @@ var sonar = () => {
1366
1445
  };
1367
1446
 
1368
1447
  // src/actions/statics.ts
1369
- import chalk20 from "chalk";
1448
+ import chalk25 from "chalk";
1370
1449
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1371
1450
  var statics = () => {
1372
- console.log(chalk20.green("Check Required Static Dependencies"));
1451
+ console.log(chalk25.green("Check Required Static Dependencies"));
1373
1452
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1374
1453
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1375
1454
  };
@@ -1534,7 +1613,7 @@ var xyBuildCommands = (args) => {
1534
1613
 
1535
1614
  // src/xy/param.ts
1536
1615
  var packagePositionalParam = (yargs2) => {
1537
- return yargs2.positional("package", { describe: "Specific package to target" });
1616
+ return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
1538
1617
  };
1539
1618
 
1540
1619
  // src/xy/xyCommonCommands.ts
@@ -1776,7 +1855,7 @@ var xyInstallCommands = (args) => {
1776
1855
  };
1777
1856
 
1778
1857
  // src/xy/xyLintCommands.ts
1779
- import chalk21 from "chalk";
1858
+ import chalk26 from "chalk";
1780
1859
  var xyLintCommands = (args) => {
1781
1860
  return args.command(
1782
1861
  "cycle [package]",
@@ -1788,31 +1867,61 @@ var xyLintCommands = (args) => {
1788
1867
  const start = Date.now();
1789
1868
  if (argv.verbose) console.log("Cycle");
1790
1869
  process.exitCode = await cycle({ pkg: argv.package });
1791
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1870
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1792
1871
  }
1793
1872
  ).command(
1794
1873
  "lint [package]",
1795
1874
  "Lint - Run Eslint",
1796
1875
  (yargs2) => {
1797
- return packagePositionalParam(yargs2);
1876
+ return packagePositionalParam(yargs2).option("fix", {
1877
+ alias: "f",
1878
+ default: false,
1879
+ description: "Fix fixable issues",
1880
+ type: "boolean"
1881
+ }).option("cache", {
1882
+ alias: "c",
1883
+ default: false,
1884
+ description: "Use caching for performance",
1885
+ type: "boolean"
1886
+ });
1798
1887
  },
1799
1888
  (argv) => {
1800
1889
  if (argv.verbose) console.log("Lint");
1801
1890
  const start = Date.now();
1802
- process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
1803
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1891
+ process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
1892
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1804
1893
  }
1805
1894
  ).command(
1806
1895
  "deplint [package]",
1807
1896
  "Deplint - Run Deplint",
1808
1897
  (yargs2) => {
1809
- return packagePositionalParam(yargs2);
1898
+ return packagePositionalParam(yargs2).option("deps", {
1899
+ alias: "d",
1900
+ default: false,
1901
+ description: "Check dependencies",
1902
+ type: "boolean"
1903
+ }).option("devDeps", {
1904
+ alias: "v",
1905
+ default: false,
1906
+ description: "Check devDependencies",
1907
+ type: "boolean"
1908
+ }).option("peerDeps", {
1909
+ alias: "p",
1910
+ default: false,
1911
+ description: "Check peerDependencies",
1912
+ type: "boolean"
1913
+ });
1810
1914
  },
1811
1915
  (argv) => {
1812
1916
  if (argv.verbose) console.log("Deplint");
1813
1917
  const start = Date.now();
1814
- process.exitCode = deplint({ pkg: argv.package });
1815
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1918
+ process.exitCode = deplint({
1919
+ pkg: argv.package,
1920
+ deps: !!argv.deps,
1921
+ devDeps: !!argv.devDeps,
1922
+ peerDeps: !!argv.peerDeps
1923
+ });
1924
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1816
1925
  }
1817
1926
  ).command(
1818
1927
  "fix [package]",
@@ -1824,7 +1933,7 @@ var xyLintCommands = (args) => {
1824
1933
  const start = Date.now();
1825
1934
  if (argv.verbose) console.log("Fix");
1826
1935
  process.exitCode = fix();
1827
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1936
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1828
1937
  }
1829
1938
  ).command(
1830
1939
  "relint [package]",
@@ -1836,7 +1945,7 @@ var xyLintCommands = (args) => {
1836
1945
  if (argv.verbose) console.log("Relinting");
1837
1946
  const start = Date.now();
1838
1947
  process.exitCode = relint();
1839
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1948
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1840
1949
  }
1841
1950
  ).command(
1842
1951
  "publint [package]",
@@ -1848,7 +1957,7 @@ var xyLintCommands = (args) => {
1848
1957
  if (argv.verbose) console.log("Publint");
1849
1958
  const start = Date.now();
1850
1959
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
1851
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1960
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1852
1961
  }
1853
1962
  ).command(
1854
1963
  "knip",
@@ -1860,7 +1969,7 @@ var xyLintCommands = (args) => {
1860
1969
  if (argv.verbose) console.log("Knip");
1861
1970
  const start = Date.now();
1862
1971
  process.exitCode = knip();
1863
- console.log(chalk21.blue(`Knip finished in ${Date.now() - start}ms`));
1972
+ console.log(chalk26.blue(`Knip finished in ${Date.now() - start}ms`));
1864
1973
  }
1865
1974
  ).command(
1866
1975
  "sonar",
@@ -1872,7 +1981,7 @@ var xyLintCommands = (args) => {
1872
1981
  const start = Date.now();
1873
1982
  if (argv.verbose) console.log("Sonar Check");
1874
1983
  process.exitCode = sonar();
1875
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1984
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1876
1985
  }
1877
1986
  );
1878
1987
  };
@@ -1891,37 +2000,16 @@ var xyParseOptions = () => {
1891
2000
  default: false,
1892
2001
  description: "Run with verbose logging",
1893
2002
  type: "boolean"
1894
- }).option("target", {
1895
- alias: "t",
1896
- default: "esm",
1897
- choices: ["esm", "cjs"],
1898
- description: "Limit output to specific target",
1899
- type: "string"
1900
2003
  }).option("incremental", {
1901
2004
  alias: "i",
1902
2005
  default: false,
1903
2006
  description: "Attempt to perform the action only on changed packages",
1904
2007
  type: "boolean"
1905
- }).option("fix", {
1906
- alias: "f",
1907
- default: false,
1908
- description: "Try to fix errors",
1909
- type: "boolean"
1910
- }).option("cache", {
1911
- alias: "c",
1912
- default: false,
1913
- description: "Use caching for performance",
1914
- type: "boolean"
1915
2008
  }).option("profile", {
1916
2009
  alias: "p",
1917
2010
  default: false,
1918
2011
  description: "Profile action",
1919
2012
  type: "boolean"
1920
- }).option("types", {
1921
- default: "tsc",
1922
- choices: ["tsc", "tsup"],
1923
- description: "Tool to generate Typescript types",
1924
- type: "string"
1925
2013
  });
1926
2014
  };
1927
2015
 
@@ -1929,8 +2017,8 @@ var xyParseOptions = () => {
1929
2017
  var xy = async () => {
1930
2018
  const options = xyParseOptions();
1931
2019
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
1932
- console.error(chalk22.yellow(`Command not found [${chalk22.magenta(process.argv[2])}]`));
1933
- console.log(chalk22.gray("Try 'yarn xy --help' for list of commands"));
2020
+ console.error(chalk27.yellow(`Command not found [${chalk27.magenta(process.argv[2])}]`));
2021
+ console.log(chalk27.gray("Try 'yarn xy --help' for list of commands"));
1934
2022
  }).version().help().argv;
1935
2023
  };
1936
2024