@xylabs/ts-scripts-yarn3 6.5.0 → 6.5.1

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 +256 -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 +17 -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 +256 -0
  16. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -0
  17. package/dist/actions/deplint/deplint.mjs +316 -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} +160 -87
  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 +235 -160
  35. package/dist/actions/index.mjs.map +1 -1
  36. package/dist/actions/lint.mjs.map +1 -1
  37. package/dist/bin/xy.mjs +239 -155
  38. package/dist/bin/xy.mjs.map +1 -1
  39. package/dist/index.d.ts +5 -1
  40. package/dist/index.mjs +282 -198
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/xy/index.mjs +239 -155
  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 +239 -155
  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 +212 -107
  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
826
  if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !devDependencies.includes(imp) && !devDependencies.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,119 @@ 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 }, { devDependencies }, { devImportPaths, externalDevImports }) {
847
+ let unlistedDevDependencies = 0;
848
+ for (const imp of externalDevImports) {
849
+ if (!devDependencies.includes(imp)) {
850
+ unlistedDevDependencies++;
851
+ console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
852
+ console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
853
+ }
854
+ }
855
+ return unlistedDevDependencies;
856
+ }
857
+
858
+ // src/actions/deplint/checkPackage/getUnusedDependencies.ts
859
+ import chalk15 from "chalk";
860
+ function getUnusedDependencies({ name, location }, { dependencies }, {
861
+ externalProdImports,
862
+ externalProdTypeImports
863
+ }) {
864
+ let unusedDependencies = 0;
815
865
  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)}`);
866
+ if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
867
+ unusedDependencies++;
868
+ console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
819
869
  console.log(` ${location}/package.json
820
870
  `);
821
871
  console.log("");
822
872
  }
823
- if (!externalProdImports.includes(dep)) {
873
+ }
874
+ return unusedDependencies;
875
+ }
876
+
877
+ // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
878
+ import chalk16 from "chalk";
879
+ function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
880
+ let unusedDependencies = 0;
881
+ for (const dep of peerDependencies) {
882
+ if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
824
883
  unusedDependencies++;
825
- console.log(`[${chalk12.blue(name)}] Unused dependency in package.json: ${chalk12.red(dep)}`);
884
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
826
885
  console.log(` ${location}/package.json
827
886
  `);
828
887
  console.log("");
829
888
  }
830
889
  }
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;
890
+ return unusedDependencies;
891
+ }
892
+
893
+ // src/actions/deplint/checkPackage/checkPackage.ts
894
+ function checkPackage({
895
+ name,
896
+ location,
897
+ deps = false,
898
+ devDeps = false,
899
+ peerDeps = false
900
+ }) {
901
+ const { prodSourceFiles, devSourceFiles } = findFiles(location);
902
+ const checkDeps = deps || !(deps || devDeps || peerDeps);
903
+ const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
904
+ const checkPeerDeps = peerDeps || !(deps || devDeps || peerDeps);
905
+ const sourceParams = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
906
+ const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
907
+ const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
908
+ const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
909
+ const typesInDependencies = checkDeps ? getTypesInDependencies({ name, location }, packageParams, sourceParams) : 0;
910
+ const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
911
+ const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
912
+ const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
852
913
  return totalErrors;
853
914
  }
854
- var deplint = ({ pkg }) => {
915
+
916
+ // src/actions/deplint/deplint.ts
917
+ var deplint = ({
918
+ pkg,
919
+ deps,
920
+ devDeps,
921
+ peerDeps
922
+ }) => {
855
923
  if (pkg) {
856
924
  const { location, name } = yarnWorkspace(pkg);
857
925
  console.log(`Running Deplint for ${name}`);
858
- check({
926
+ checkPackage({
859
927
  name,
860
928
  location,
861
- devDeps: true
929
+ devDeps,
930
+ deps,
931
+ peerDeps
862
932
  });
863
933
  } else {
864
934
  const workspaces = yarnWorkspaces();
865
935
  console.log("Deplint Started...");
866
936
  let totalErrors = 0;
867
937
  for (const workspace of workspaces) {
868
- totalErrors += check(workspace);
938
+ totalErrors += checkPackage({
939
+ ...workspace,
940
+ deps,
941
+ devDeps,
942
+ peerDeps
943
+ });
869
944
  }
870
945
  if (totalErrors > 0) {
871
- console.log(`Found ${chalk12.red(totalErrors)} unlisted imports.`);
946
+ console.log(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
872
947
  } else {
873
- console.log(`No unlisted imports found. ${chalk12.green("\u2714")}`);
948
+ console.log(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
874
949
  }
875
950
  }
876
951
  return 0;
@@ -977,18 +1052,18 @@ var deployNext = () => {
977
1052
  };
978
1053
 
979
1054
  // src/actions/dupdeps.ts
980
- import chalk13 from "chalk";
1055
+ import chalk18 from "chalk";
981
1056
  var dupdeps = () => {
982
- console.log(chalk13.green("Checking all Dependencies for Duplicates"));
1057
+ console.log(chalk18.green("Checking all Dependencies for Duplicates"));
983
1058
  const allDependencies = parsedPackageJSON()?.dependencies;
984
1059
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
985
1060
  return detectDuplicateDependencies(dependencies);
986
1061
  };
987
1062
 
988
1063
  // src/actions/lint.ts
989
- import chalk14 from "chalk";
1064
+ import chalk19 from "chalk";
990
1065
  var lintPackage = ({ pkg, fix: fix2 }) => {
991
- console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1066
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
992
1067
  const start = Date.now();
993
1068
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
994
1069
  ["yarn", [
@@ -998,7 +1073,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
998
1073
  fix2 ? "package-fix" : "package-lint"
999
1074
  ]]
1000
1075
  ]);
1001
- console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
1076
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1002
1077
  return result;
1003
1078
  };
1004
1079
  var lint = ({
@@ -1014,13 +1089,13 @@ var lint = ({
1014
1089
  });
1015
1090
  };
1016
1091
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1017
- console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1092
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1018
1093
  const start = Date.now();
1019
1094
  const fixOptions = fix2 ? ["--fix"] : [];
1020
1095
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1021
1096
  ["yarn", ["eslint", ...fixOptions]]
1022
1097
  ]);
1023
- console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
1098
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1024
1099
  return result;
1025
1100
  };
1026
1101
 
@@ -1048,7 +1123,7 @@ var filename = ".gitignore";
1048
1123
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1049
1124
 
1050
1125
  // src/actions/gitlint.ts
1051
- import chalk15 from "chalk";
1126
+ import chalk20 from "chalk";
1052
1127
  import ParseGitConfig from "parse-git-config";
1053
1128
  var gitlint = () => {
1054
1129
  console.log(`
@@ -1059,7 +1134,7 @@ Gitlint Start [${process.cwd()}]
1059
1134
  const errors = 0;
1060
1135
  const gitConfig = ParseGitConfig.sync();
1061
1136
  const warn = (message) => {
1062
- console.warn(chalk15.yellow(`Warning: ${message}`));
1137
+ console.warn(chalk20.yellow(`Warning: ${message}`));
1063
1138
  warnings++;
1064
1139
  };
1065
1140
  if (gitConfig.core.ignorecase) {
@@ -1079,13 +1154,13 @@ Gitlint Start [${process.cwd()}]
1079
1154
  }
1080
1155
  const resultMessages = [];
1081
1156
  if (valid > 0) {
1082
- resultMessages.push(chalk15.green(`Passed: ${valid}`));
1157
+ resultMessages.push(chalk20.green(`Passed: ${valid}`));
1083
1158
  }
1084
1159
  if (warnings > 0) {
1085
- resultMessages.push(chalk15.yellow(`Warnings: ${warnings}`));
1160
+ resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
1086
1161
  }
1087
1162
  if (errors > 0) {
1088
- resultMessages.push(chalk15.red(` Errors: ${errors}`));
1163
+ resultMessages.push(chalk20.red(` Errors: ${errors}`));
1089
1164
  }
1090
1165
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1091
1166
  `);
@@ -1094,7 +1169,7 @@ Gitlint Start [${process.cwd()}]
1094
1169
 
1095
1170
  // src/actions/gitlint-fix.ts
1096
1171
  import { execSync as execSync2 } from "node:child_process";
1097
- import chalk16 from "chalk";
1172
+ import chalk21 from "chalk";
1098
1173
  import ParseGitConfig2 from "parse-git-config";
1099
1174
  var gitlintFix = () => {
1100
1175
  console.log(`
@@ -1103,15 +1178,15 @@ Gitlint Fix Start [${process.cwd()}]
1103
1178
  const gitConfig = ParseGitConfig2.sync();
1104
1179
  if (gitConfig.core.ignorecase) {
1105
1180
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1106
- console.warn(chalk16.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1181
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1107
1182
  }
1108
1183
  if (gitConfig.core.autocrlf !== false) {
1109
1184
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1110
- console.warn(chalk16.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1185
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1111
1186
  }
1112
1187
  if (gitConfig.core.eol !== "lf") {
1113
1188
  execSync2("git config core.eol lf", { stdio: "inherit" });
1114
- console.warn(chalk16.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1189
+ console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1115
1190
  }
1116
1191
  return 1;
1117
1192
  };
@@ -1122,7 +1197,7 @@ var knip = () => {
1122
1197
  };
1123
1198
 
1124
1199
  // src/actions/license.ts
1125
- import chalk17 from "chalk";
1200
+ import chalk22 from "chalk";
1126
1201
  import { init } from "license-checker";
1127
1202
  var license = async (pkg) => {
1128
1203
  const workspaces = yarnWorkspaces();
@@ -1147,18 +1222,18 @@ var license = async (pkg) => {
1147
1222
  "LGPL-3.0-or-later",
1148
1223
  "Python-2.0"
1149
1224
  ]);
1150
- console.log(chalk17.green("License Checker"));
1225
+ console.log(chalk22.green("License Checker"));
1151
1226
  return (await Promise.all(
1152
1227
  workspaceList.map(({ location, name }) => {
1153
1228
  return new Promise((resolve) => {
1154
1229
  init({ production: true, start: location }, (error, packages) => {
1155
1230
  if (error) {
1156
- console.error(chalk17.red(`License Checker [${name}] Error`));
1157
- console.error(chalk17.gray(error));
1231
+ console.error(chalk22.red(`License Checker [${name}] Error`));
1232
+ console.error(chalk22.gray(error));
1158
1233
  console.log("\n");
1159
1234
  resolve(1);
1160
1235
  } else {
1161
- console.log(chalk17.green(`License Checker [${name}]`));
1236
+ console.log(chalk22.green(`License Checker [${name}]`));
1162
1237
  let count = 0;
1163
1238
  for (const [name2, info] of Object.entries(packages)) {
1164
1239
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1174,7 +1249,7 @@ var license = async (pkg) => {
1174
1249
  }
1175
1250
  if (!orLicenseFound) {
1176
1251
  count++;
1177
- console.warn(chalk17.yellow(`${name2}: Package License not allowed [${license2}]`));
1252
+ console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
1178
1253
  }
1179
1254
  }
1180
1255
  }
@@ -1213,7 +1288,7 @@ var rebuild = ({ target }) => {
1213
1288
  };
1214
1289
 
1215
1290
  // src/actions/recompile.ts
1216
- import chalk18 from "chalk";
1291
+ import chalk23 from "chalk";
1217
1292
  var recompile = async ({
1218
1293
  verbose,
1219
1294
  target,
@@ -1249,7 +1324,7 @@ var recompileAll = async ({
1249
1324
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1250
1325
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1251
1326
  if (jobs) {
1252
- console.log(chalk18.blue(`Jobs set to [${jobs}]`));
1327
+ console.log(chalk23.blue(`Jobs set to [${jobs}]`));
1253
1328
  }
1254
1329
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1255
1330
  [
@@ -1280,7 +1355,7 @@ var recompileAll = async ({
1280
1355
  ]
1281
1356
  ]);
1282
1357
  console.log(
1283
- `${chalk18.gray("Recompiled in")} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`
1358
+ `${chalk23.gray("Recompiled in")} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`
1284
1359
  );
1285
1360
  return result;
1286
1361
  };
@@ -1311,9 +1386,9 @@ var reinstall = () => {
1311
1386
  };
1312
1387
 
1313
1388
  // src/actions/relint.ts
1314
- import chalk19 from "chalk";
1389
+ import chalk24 from "chalk";
1315
1390
  var relintPackage = ({ pkg }) => {
1316
- console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1391
+ console.log(chalk24.gray(`${"Relint"} [All-Packages]`));
1317
1392
  const start = Date.now();
1318
1393
  const result = runSteps("Relint [All-Packages]", [
1319
1394
  ["yarn", [
@@ -1323,7 +1398,7 @@ var relintPackage = ({ pkg }) => {
1323
1398
  "package-relint"
1324
1399
  ]]
1325
1400
  ]);
1326
- console.log(chalk19.gray(`${"Relinted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1401
+ console.log(chalk24.gray(`${"Relinted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
1327
1402
  return result;
1328
1403
  };
1329
1404
  var relint = ({
@@ -1334,7 +1409,7 @@ var relint = ({
1334
1409
  return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
1335
1410
  };
1336
1411
  var relintAllPackages = ({ verbose = true, incremental } = {}) => {
1337
- console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1412
+ console.log(chalk24.gray(`${"Relint"} [All-Packages]`));
1338
1413
  const start = Date.now();
1339
1414
  const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
1340
1415
  const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
@@ -1348,7 +1423,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
1348
1423
  "package-relint"
1349
1424
  ]]
1350
1425
  ]);
1351
- console.log(chalk19.gray(`Relinted in [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1426
+ console.log(chalk24.gray(`Relinted in [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
1352
1427
  return result;
1353
1428
  };
1354
1429
 
@@ -1366,10 +1441,10 @@ var sonar = () => {
1366
1441
  };
1367
1442
 
1368
1443
  // src/actions/statics.ts
1369
- import chalk20 from "chalk";
1444
+ import chalk25 from "chalk";
1370
1445
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1371
1446
  var statics = () => {
1372
- console.log(chalk20.green("Check Required Static Dependencies"));
1447
+ console.log(chalk25.green("Check Required Static Dependencies"));
1373
1448
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1374
1449
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1375
1450
  };
@@ -1534,7 +1609,7 @@ var xyBuildCommands = (args) => {
1534
1609
 
1535
1610
  // src/xy/param.ts
1536
1611
  var packagePositionalParam = (yargs2) => {
1537
- return yargs2.positional("package", { describe: "Specific package to target" });
1612
+ return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
1538
1613
  };
1539
1614
 
1540
1615
  // src/xy/xyCommonCommands.ts
@@ -1776,7 +1851,7 @@ var xyInstallCommands = (args) => {
1776
1851
  };
1777
1852
 
1778
1853
  // src/xy/xyLintCommands.ts
1779
- import chalk21 from "chalk";
1854
+ import chalk26 from "chalk";
1780
1855
  var xyLintCommands = (args) => {
1781
1856
  return args.command(
1782
1857
  "cycle [package]",
@@ -1788,31 +1863,61 @@ var xyLintCommands = (args) => {
1788
1863
  const start = Date.now();
1789
1864
  if (argv.verbose) console.log("Cycle");
1790
1865
  process.exitCode = await cycle({ pkg: argv.package });
1791
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1866
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1792
1867
  }
1793
1868
  ).command(
1794
1869
  "lint [package]",
1795
1870
  "Lint - Run Eslint",
1796
1871
  (yargs2) => {
1797
- return packagePositionalParam(yargs2);
1872
+ return packagePositionalParam(yargs2).option("fix", {
1873
+ alias: "f",
1874
+ default: false,
1875
+ description: "Fix fixable issues",
1876
+ type: "boolean"
1877
+ }).option("cache", {
1878
+ alias: "c",
1879
+ default: false,
1880
+ description: "Use caching for performance",
1881
+ type: "boolean"
1882
+ });
1798
1883
  },
1799
1884
  (argv) => {
1800
1885
  if (argv.verbose) console.log("Lint");
1801
1886
  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`));
1887
+ process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
1888
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1804
1889
  }
1805
1890
  ).command(
1806
1891
  "deplint [package]",
1807
1892
  "Deplint - Run Deplint",
1808
1893
  (yargs2) => {
1809
- return packagePositionalParam(yargs2);
1894
+ return packagePositionalParam(yargs2).option("deps", {
1895
+ alias: "d",
1896
+ default: false,
1897
+ description: "Check dependencies",
1898
+ type: "boolean"
1899
+ }).option("devDeps", {
1900
+ alias: "v",
1901
+ default: false,
1902
+ description: "Check devDependencies",
1903
+ type: "boolean"
1904
+ }).option("peerDeps", {
1905
+ alias: "p",
1906
+ default: false,
1907
+ description: "Check peerDependencies",
1908
+ type: "boolean"
1909
+ });
1810
1910
  },
1811
1911
  (argv) => {
1812
1912
  if (argv.verbose) console.log("Deplint");
1813
1913
  const start = Date.now();
1814
- process.exitCode = deplint({ pkg: argv.package });
1815
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1914
+ process.exitCode = deplint({
1915
+ pkg: argv.package,
1916
+ deps: !!argv.deps,
1917
+ devDeps: !!argv.devDeps,
1918
+ peerDeps: !!argv.peerDeps
1919
+ });
1920
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1816
1921
  }
1817
1922
  ).command(
1818
1923
  "fix [package]",
@@ -1824,7 +1929,7 @@ var xyLintCommands = (args) => {
1824
1929
  const start = Date.now();
1825
1930
  if (argv.verbose) console.log("Fix");
1826
1931
  process.exitCode = fix();
1827
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1932
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1828
1933
  }
1829
1934
  ).command(
1830
1935
  "relint [package]",
@@ -1836,7 +1941,7 @@ var xyLintCommands = (args) => {
1836
1941
  if (argv.verbose) console.log("Relinting");
1837
1942
  const start = Date.now();
1838
1943
  process.exitCode = relint();
1839
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1944
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1840
1945
  }
1841
1946
  ).command(
1842
1947
  "publint [package]",
@@ -1848,7 +1953,7 @@ var xyLintCommands = (args) => {
1848
1953
  if (argv.verbose) console.log("Publint");
1849
1954
  const start = Date.now();
1850
1955
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
1851
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1956
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1852
1957
  }
1853
1958
  ).command(
1854
1959
  "knip",
@@ -1860,7 +1965,7 @@ var xyLintCommands = (args) => {
1860
1965
  if (argv.verbose) console.log("Knip");
1861
1966
  const start = Date.now();
1862
1967
  process.exitCode = knip();
1863
- console.log(chalk21.blue(`Knip finished in ${Date.now() - start}ms`));
1968
+ console.log(chalk26.blue(`Knip finished in ${Date.now() - start}ms`));
1864
1969
  }
1865
1970
  ).command(
1866
1971
  "sonar",
@@ -1872,7 +1977,7 @@ var xyLintCommands = (args) => {
1872
1977
  const start = Date.now();
1873
1978
  if (argv.verbose) console.log("Sonar Check");
1874
1979
  process.exitCode = sonar();
1875
- console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1980
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
1876
1981
  }
1877
1982
  );
1878
1983
  };
@@ -1891,37 +1996,16 @@ var xyParseOptions = () => {
1891
1996
  default: false,
1892
1997
  description: "Run with verbose logging",
1893
1998
  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
1999
  }).option("incremental", {
1901
2000
  alias: "i",
1902
2001
  default: false,
1903
2002
  description: "Attempt to perform the action only on changed packages",
1904
2003
  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
2004
  }).option("profile", {
1916
2005
  alias: "p",
1917
2006
  default: false,
1918
2007
  description: "Profile action",
1919
2008
  type: "boolean"
1920
- }).option("types", {
1921
- default: "tsc",
1922
- choices: ["tsc", "tsup"],
1923
- description: "Tool to generate Typescript types",
1924
- type: "string"
1925
2009
  });
1926
2010
  };
1927
2011
 
@@ -1929,8 +2013,8 @@ var xyParseOptions = () => {
1929
2013
  var xy = async () => {
1930
2014
  const options = xyParseOptions();
1931
2015
  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"));
2016
+ console.error(chalk27.yellow(`Command not found [${chalk27.magenta(process.argv[2])}]`));
2017
+ console.log(chalk27.gray("Try 'yarn xy --help' for list of commands"));
1934
2018
  }).version().help().argv;
1935
2019
  };
1936
2020