@xylabs/ts-scripts-yarn3 6.5.2 → 6.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +37 -40
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +1 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +37 -40
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +40 -43
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +6 -2
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +10 -5
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +40 -43
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +101 -104
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +84 -87
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +113 -116
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +84 -87
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +84 -87
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +59 -62
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +3 -3
package/dist/xy/xy.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/xy/xy.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk26 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/actions/build.ts
|
|
5
5
|
import chalk7 from "chalk";
|
|
@@ -656,7 +656,7 @@ var dead = () => {
|
|
|
656
656
|
};
|
|
657
657
|
|
|
658
658
|
// src/actions/deplint/deplint.ts
|
|
659
|
-
import
|
|
659
|
+
import chalk16 from "chalk";
|
|
660
660
|
|
|
661
661
|
// src/actions/deplint/findFilesByGlob.ts
|
|
662
662
|
import { globSync } from "glob";
|
|
@@ -666,16 +666,20 @@ function findFilesByGlob(cwd, pattern) {
|
|
|
666
666
|
|
|
667
667
|
// src/actions/deplint/findFiles.ts
|
|
668
668
|
function findFiles(path5) {
|
|
669
|
-
const allSourceInclude = ["./src/**/*.{ts,tsx}"
|
|
669
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
670
|
+
const allDistInclude = ["./dist/**/*.d.ts"];
|
|
670
671
|
const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
|
|
671
672
|
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
672
673
|
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
|
|
674
|
+
const allDistFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
|
|
673
675
|
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
676
|
+
const prodDistFiles = allDistFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
674
677
|
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
675
678
|
return {
|
|
676
679
|
allSourceFiles,
|
|
677
680
|
prodSourceFiles,
|
|
678
|
-
devSourceFiles
|
|
681
|
+
devSourceFiles,
|
|
682
|
+
prodDistFiles
|
|
679
683
|
};
|
|
680
684
|
}
|
|
681
685
|
|
|
@@ -728,7 +732,7 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
728
732
|
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
|
|
729
733
|
if (moduleSpecifier) {
|
|
730
734
|
const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
|
|
731
|
-
if (isTypeImport
|
|
735
|
+
if (isTypeImport || isDeclarationFile) {
|
|
732
736
|
typeImports.push(trimmed);
|
|
733
737
|
} else {
|
|
734
738
|
imports.push(trimmed);
|
|
@@ -763,19 +767,24 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
763
767
|
var removeInternalImports = (imports) => {
|
|
764
768
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
765
769
|
};
|
|
766
|
-
function getExternalImportsFromFiles({
|
|
770
|
+
function getExternalImportsFromFiles({
|
|
771
|
+
prodSourceFiles,
|
|
772
|
+
devSourceFiles,
|
|
773
|
+
prodDistFiles
|
|
774
|
+
}) {
|
|
767
775
|
const prodImportPaths = {};
|
|
768
776
|
const prodTypeImportPaths = {};
|
|
769
777
|
const prodImportPairs = prodSourceFiles.map((path5) => getImportsFromFile(path5, prodImportPaths, prodTypeImportPaths));
|
|
778
|
+
const prodDistImportPairs = prodDistFiles.map((path5) => getImportsFromFile(path5, prodImportPaths, prodTypeImportPaths));
|
|
770
779
|
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
771
|
-
const
|
|
780
|
+
const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
|
|
772
781
|
const devImportPaths = {};
|
|
773
782
|
const devTypeImportPaths = {};
|
|
774
783
|
const devImportPairs = devSourceFiles.map((path5) => getImportsFromFile(path5, devImportPaths, devTypeImportPaths));
|
|
775
784
|
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
776
785
|
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
777
786
|
const externalProdImports = removeInternalImports(prodImports);
|
|
778
|
-
const externalProdTypeImports = removeInternalImports(
|
|
787
|
+
const externalProdTypeImports = removeInternalImports(prodDistImports);
|
|
779
788
|
const externalDevImports = removeInternalImports(devImports);
|
|
780
789
|
return {
|
|
781
790
|
prodImports,
|
|
@@ -785,35 +794,15 @@ function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
|
785
794
|
devImportPaths,
|
|
786
795
|
externalProdImports,
|
|
787
796
|
externalDevImports,
|
|
788
|
-
|
|
797
|
+
prodDistImports,
|
|
789
798
|
devTypeImports,
|
|
790
799
|
externalProdTypeImports
|
|
791
800
|
};
|
|
792
801
|
}
|
|
793
802
|
|
|
794
|
-
// src/actions/deplint/checkPackage/getTypesInDependencies.ts
|
|
795
|
-
import chalk12 from "chalk";
|
|
796
|
-
function getTypesInDependencies({ name, location }, { dependencies }, {}) {
|
|
797
|
-
let typesInDependencies = 0;
|
|
798
|
-
for (const dep of dependencies) {
|
|
799
|
-
if (dep.startsWith("@types/")) {
|
|
800
|
-
typesInDependencies++;
|
|
801
|
-
console.log(`[${chalk12.blue(name)}] @types in dependencies in package.json: ${chalk12.red(dep)}`);
|
|
802
|
-
console.log(` ${location}/package.json
|
|
803
|
-
`);
|
|
804
|
-
console.log("");
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
return typesInDependencies;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
803
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
811
|
-
import
|
|
812
|
-
function getUnlistedDependencies({ name }, {
|
|
813
|
-
dependencies,
|
|
814
|
-
devDependencies,
|
|
815
|
-
peerDependencies
|
|
816
|
-
}, {
|
|
804
|
+
import chalk12 from "chalk";
|
|
805
|
+
function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
817
806
|
externalProdTypeImports,
|
|
818
807
|
prodTypeImportPaths,
|
|
819
808
|
externalProdImports,
|
|
@@ -823,7 +812,7 @@ function getUnlistedDependencies({ name }, {
|
|
|
823
812
|
for (const imp of externalProdTypeImports) {
|
|
824
813
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
825
814
|
unlistedDependencies++;
|
|
826
|
-
console.log(`[${
|
|
815
|
+
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
827
816
|
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
828
817
|
console.log("");
|
|
829
818
|
}
|
|
@@ -831,7 +820,7 @@ function getUnlistedDependencies({ name }, {
|
|
|
831
820
|
for (const imp of externalProdImports) {
|
|
832
821
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
833
822
|
unlistedDependencies++;
|
|
834
|
-
console.log(`[${
|
|
823
|
+
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
835
824
|
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
836
825
|
console.log("");
|
|
837
826
|
}
|
|
@@ -840,7 +829,7 @@ function getUnlistedDependencies({ name }, {
|
|
|
840
829
|
}
|
|
841
830
|
|
|
842
831
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
843
|
-
import
|
|
832
|
+
import chalk13 from "chalk";
|
|
844
833
|
function getUnlistedDevDependencies({ name }, {
|
|
845
834
|
devDependencies,
|
|
846
835
|
dependencies,
|
|
@@ -850,7 +839,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
850
839
|
for (const imp of externalDevImports) {
|
|
851
840
|
if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
852
841
|
unlistedDevDependencies++;
|
|
853
|
-
console.log(`[${
|
|
842
|
+
console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
|
|
854
843
|
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
855
844
|
}
|
|
856
845
|
}
|
|
@@ -858,7 +847,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
858
847
|
}
|
|
859
848
|
|
|
860
849
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
861
|
-
import
|
|
850
|
+
import chalk14 from "chalk";
|
|
862
851
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
863
852
|
externalProdImports,
|
|
864
853
|
externalProdTypeImports
|
|
@@ -867,7 +856,7 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
867
856
|
for (const dep of dependencies) {
|
|
868
857
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
869
858
|
unusedDependencies++;
|
|
870
|
-
console.log(`[${
|
|
859
|
+
console.log(`[${chalk14.blue(name)}] Unused dependency in package.json: ${chalk14.red(dep)}`);
|
|
871
860
|
console.log(` ${location}/package.json
|
|
872
861
|
`);
|
|
873
862
|
console.log("");
|
|
@@ -877,13 +866,13 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
877
866
|
}
|
|
878
867
|
|
|
879
868
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
880
|
-
import
|
|
869
|
+
import chalk15 from "chalk";
|
|
881
870
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
|
|
882
871
|
let unusedDependencies = 0;
|
|
883
872
|
for (const dep of peerDependencies) {
|
|
884
873
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
885
874
|
unusedDependencies++;
|
|
886
|
-
console.log(`[${
|
|
875
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
|
|
887
876
|
console.log(` ${location}/package.json
|
|
888
877
|
`);
|
|
889
878
|
console.log("");
|
|
@@ -900,15 +889,23 @@ function checkPackage({
|
|
|
900
889
|
devDeps = false,
|
|
901
890
|
peerDeps = false
|
|
902
891
|
}) {
|
|
903
|
-
const {
|
|
892
|
+
const {
|
|
893
|
+
prodSourceFiles,
|
|
894
|
+
devSourceFiles,
|
|
895
|
+
prodDistFiles
|
|
896
|
+
} = findFiles(location);
|
|
904
897
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
905
898
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
906
899
|
const checkPeerDeps = peerDeps || !(deps || devDeps || peerDeps);
|
|
907
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
900
|
+
const sourceParams = getExternalImportsFromFiles({
|
|
901
|
+
prodSourceFiles,
|
|
902
|
+
devSourceFiles,
|
|
903
|
+
prodDistFiles
|
|
904
|
+
});
|
|
908
905
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
909
906
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
910
907
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
911
|
-
const typesInDependencies =
|
|
908
|
+
const typesInDependencies = 0;
|
|
912
909
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
913
910
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
914
911
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
|
|
@@ -945,9 +942,9 @@ var deplint = ({
|
|
|
945
942
|
});
|
|
946
943
|
}
|
|
947
944
|
if (totalErrors > 0) {
|
|
948
|
-
console.log(`Deplint: Found ${
|
|
945
|
+
console.log(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
|
|
949
946
|
} else {
|
|
950
|
-
console.log(`Deplint: Found no dependency problems. ${
|
|
947
|
+
console.log(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
|
|
951
948
|
}
|
|
952
949
|
}
|
|
953
950
|
return 0;
|
|
@@ -1054,18 +1051,18 @@ var deployNext = () => {
|
|
|
1054
1051
|
};
|
|
1055
1052
|
|
|
1056
1053
|
// src/actions/dupdeps.ts
|
|
1057
|
-
import
|
|
1054
|
+
import chalk17 from "chalk";
|
|
1058
1055
|
var dupdeps = () => {
|
|
1059
|
-
console.log(
|
|
1056
|
+
console.log(chalk17.green("Checking all Dependencies for Duplicates"));
|
|
1060
1057
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1061
1058
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1062
1059
|
return detectDuplicateDependencies(dependencies);
|
|
1063
1060
|
};
|
|
1064
1061
|
|
|
1065
1062
|
// src/actions/lint.ts
|
|
1066
|
-
import
|
|
1063
|
+
import chalk18 from "chalk";
|
|
1067
1064
|
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1068
|
-
console.log(
|
|
1065
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1069
1066
|
const start = Date.now();
|
|
1070
1067
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1071
1068
|
["yarn", [
|
|
@@ -1075,7 +1072,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
|
1075
1072
|
fix2 ? "package-fix" : "package-lint"
|
|
1076
1073
|
]]
|
|
1077
1074
|
]);
|
|
1078
|
-
console.log(
|
|
1075
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1079
1076
|
return result;
|
|
1080
1077
|
};
|
|
1081
1078
|
var lint = ({
|
|
@@ -1091,13 +1088,13 @@ var lint = ({
|
|
|
1091
1088
|
});
|
|
1092
1089
|
};
|
|
1093
1090
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1094
|
-
console.log(
|
|
1091
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1095
1092
|
const start = Date.now();
|
|
1096
1093
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1097
1094
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1098
1095
|
["yarn", ["eslint", ...fixOptions]]
|
|
1099
1096
|
]);
|
|
1100
|
-
console.log(
|
|
1097
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1101
1098
|
return result;
|
|
1102
1099
|
};
|
|
1103
1100
|
|
|
@@ -1125,7 +1122,7 @@ var filename = ".gitignore";
|
|
|
1125
1122
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1126
1123
|
|
|
1127
1124
|
// src/actions/gitlint.ts
|
|
1128
|
-
import
|
|
1125
|
+
import chalk19 from "chalk";
|
|
1129
1126
|
import ParseGitConfig from "parse-git-config";
|
|
1130
1127
|
var gitlint = () => {
|
|
1131
1128
|
console.log(`
|
|
@@ -1136,7 +1133,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1136
1133
|
const errors = 0;
|
|
1137
1134
|
const gitConfig = ParseGitConfig.sync();
|
|
1138
1135
|
const warn = (message) => {
|
|
1139
|
-
console.warn(
|
|
1136
|
+
console.warn(chalk19.yellow(`Warning: ${message}`));
|
|
1140
1137
|
warnings++;
|
|
1141
1138
|
};
|
|
1142
1139
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1156,13 +1153,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1156
1153
|
}
|
|
1157
1154
|
const resultMessages = [];
|
|
1158
1155
|
if (valid > 0) {
|
|
1159
|
-
resultMessages.push(
|
|
1156
|
+
resultMessages.push(chalk19.green(`Passed: ${valid}`));
|
|
1160
1157
|
}
|
|
1161
1158
|
if (warnings > 0) {
|
|
1162
|
-
resultMessages.push(
|
|
1159
|
+
resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
|
|
1163
1160
|
}
|
|
1164
1161
|
if (errors > 0) {
|
|
1165
|
-
resultMessages.push(
|
|
1162
|
+
resultMessages.push(chalk19.red(` Errors: ${errors}`));
|
|
1166
1163
|
}
|
|
1167
1164
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1168
1165
|
`);
|
|
@@ -1171,7 +1168,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1171
1168
|
|
|
1172
1169
|
// src/actions/gitlint-fix.ts
|
|
1173
1170
|
import { execSync as execSync2 } from "node:child_process";
|
|
1174
|
-
import
|
|
1171
|
+
import chalk20 from "chalk";
|
|
1175
1172
|
import ParseGitConfig2 from "parse-git-config";
|
|
1176
1173
|
var gitlintFix = () => {
|
|
1177
1174
|
console.log(`
|
|
@@ -1180,15 +1177,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1180
1177
|
const gitConfig = ParseGitConfig2.sync();
|
|
1181
1178
|
if (gitConfig.core.ignorecase) {
|
|
1182
1179
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1183
|
-
console.warn(
|
|
1180
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1184
1181
|
}
|
|
1185
1182
|
if (gitConfig.core.autocrlf !== false) {
|
|
1186
1183
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1187
|
-
console.warn(
|
|
1184
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1188
1185
|
}
|
|
1189
1186
|
if (gitConfig.core.eol !== "lf") {
|
|
1190
1187
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1191
|
-
console.warn(
|
|
1188
|
+
console.warn(chalk20.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1192
1189
|
}
|
|
1193
1190
|
return 1;
|
|
1194
1191
|
};
|
|
@@ -1199,7 +1196,7 @@ var knip = () => {
|
|
|
1199
1196
|
};
|
|
1200
1197
|
|
|
1201
1198
|
// src/actions/license.ts
|
|
1202
|
-
import
|
|
1199
|
+
import chalk21 from "chalk";
|
|
1203
1200
|
import { init } from "license-checker";
|
|
1204
1201
|
var license = async (pkg) => {
|
|
1205
1202
|
const workspaces = yarnWorkspaces();
|
|
@@ -1224,18 +1221,18 @@ var license = async (pkg) => {
|
|
|
1224
1221
|
"LGPL-3.0-or-later",
|
|
1225
1222
|
"Python-2.0"
|
|
1226
1223
|
]);
|
|
1227
|
-
console.log(
|
|
1224
|
+
console.log(chalk21.green("License Checker"));
|
|
1228
1225
|
return (await Promise.all(
|
|
1229
1226
|
workspaceList.map(({ location, name }) => {
|
|
1230
1227
|
return new Promise((resolve) => {
|
|
1231
1228
|
init({ production: true, start: location }, (error, packages) => {
|
|
1232
1229
|
if (error) {
|
|
1233
|
-
console.error(
|
|
1234
|
-
console.error(
|
|
1230
|
+
console.error(chalk21.red(`License Checker [${name}] Error`));
|
|
1231
|
+
console.error(chalk21.gray(error));
|
|
1235
1232
|
console.log("\n");
|
|
1236
1233
|
resolve(1);
|
|
1237
1234
|
} else {
|
|
1238
|
-
console.log(
|
|
1235
|
+
console.log(chalk21.green(`License Checker [${name}]`));
|
|
1239
1236
|
let count = 0;
|
|
1240
1237
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1241
1238
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1251,7 +1248,7 @@ var license = async (pkg) => {
|
|
|
1251
1248
|
}
|
|
1252
1249
|
if (!orLicenseFound) {
|
|
1253
1250
|
count++;
|
|
1254
|
-
console.warn(
|
|
1251
|
+
console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1255
1252
|
}
|
|
1256
1253
|
}
|
|
1257
1254
|
}
|
|
@@ -1290,7 +1287,7 @@ var rebuild = ({ target }) => {
|
|
|
1290
1287
|
};
|
|
1291
1288
|
|
|
1292
1289
|
// src/actions/recompile.ts
|
|
1293
|
-
import
|
|
1290
|
+
import chalk22 from "chalk";
|
|
1294
1291
|
var recompile = async ({
|
|
1295
1292
|
verbose,
|
|
1296
1293
|
target,
|
|
@@ -1326,7 +1323,7 @@ var recompileAll = async ({
|
|
|
1326
1323
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1327
1324
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1328
1325
|
if (jobs) {
|
|
1329
|
-
console.log(
|
|
1326
|
+
console.log(chalk22.blue(`Jobs set to [${jobs}]`));
|
|
1330
1327
|
}
|
|
1331
1328
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1332
1329
|
[
|
|
@@ -1357,7 +1354,7 @@ var recompileAll = async ({
|
|
|
1357
1354
|
]
|
|
1358
1355
|
]);
|
|
1359
1356
|
console.log(
|
|
1360
|
-
`${
|
|
1357
|
+
`${chalk22.gray("Recompiled in")} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`
|
|
1361
1358
|
);
|
|
1362
1359
|
return result;
|
|
1363
1360
|
};
|
|
@@ -1388,9 +1385,9 @@ var reinstall = () => {
|
|
|
1388
1385
|
};
|
|
1389
1386
|
|
|
1390
1387
|
// src/actions/relint.ts
|
|
1391
|
-
import
|
|
1388
|
+
import chalk23 from "chalk";
|
|
1392
1389
|
var relintPackage = ({ pkg }) => {
|
|
1393
|
-
console.log(
|
|
1390
|
+
console.log(chalk23.gray(`${"Relint"} [All-Packages]`));
|
|
1394
1391
|
const start = Date.now();
|
|
1395
1392
|
const result = runSteps("Relint [All-Packages]", [
|
|
1396
1393
|
["yarn", [
|
|
@@ -1400,7 +1397,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
1400
1397
|
"package-relint"
|
|
1401
1398
|
]]
|
|
1402
1399
|
]);
|
|
1403
|
-
console.log(
|
|
1400
|
+
console.log(chalk23.gray(`${"Relinted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1404
1401
|
return result;
|
|
1405
1402
|
};
|
|
1406
1403
|
var relint = ({
|
|
@@ -1411,7 +1408,7 @@ var relint = ({
|
|
|
1411
1408
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
1412
1409
|
};
|
|
1413
1410
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
1414
|
-
console.log(
|
|
1411
|
+
console.log(chalk23.gray(`${"Relint"} [All-Packages]`));
|
|
1415
1412
|
const start = Date.now();
|
|
1416
1413
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1417
1414
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -1425,7 +1422,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
1425
1422
|
"package-relint"
|
|
1426
1423
|
]]
|
|
1427
1424
|
]);
|
|
1428
|
-
console.log(
|
|
1425
|
+
console.log(chalk23.gray(`Relinted in [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1429
1426
|
return result;
|
|
1430
1427
|
};
|
|
1431
1428
|
|
|
@@ -1443,10 +1440,10 @@ var sonar = () => {
|
|
|
1443
1440
|
};
|
|
1444
1441
|
|
|
1445
1442
|
// src/actions/statics.ts
|
|
1446
|
-
import
|
|
1443
|
+
import chalk24 from "chalk";
|
|
1447
1444
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1448
1445
|
var statics = () => {
|
|
1449
|
-
console.log(
|
|
1446
|
+
console.log(chalk24.green("Check Required Static Dependencies"));
|
|
1450
1447
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
1451
1448
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
1452
1449
|
};
|
|
@@ -1853,7 +1850,7 @@ var xyInstallCommands = (args) => {
|
|
|
1853
1850
|
};
|
|
1854
1851
|
|
|
1855
1852
|
// src/xy/xyLintCommands.ts
|
|
1856
|
-
import
|
|
1853
|
+
import chalk25 from "chalk";
|
|
1857
1854
|
var xyLintCommands = (args) => {
|
|
1858
1855
|
return args.command(
|
|
1859
1856
|
"cycle [package]",
|
|
@@ -1865,7 +1862,7 @@ var xyLintCommands = (args) => {
|
|
|
1865
1862
|
const start = Date.now();
|
|
1866
1863
|
if (argv.verbose) console.log("Cycle");
|
|
1867
1864
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
1868
|
-
console.log(
|
|
1865
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1869
1866
|
}
|
|
1870
1867
|
).command(
|
|
1871
1868
|
"lint [package]",
|
|
@@ -1887,7 +1884,7 @@ var xyLintCommands = (args) => {
|
|
|
1887
1884
|
if (argv.verbose) console.log("Lint");
|
|
1888
1885
|
const start = Date.now();
|
|
1889
1886
|
process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
|
|
1890
|
-
console.log(
|
|
1887
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1891
1888
|
}
|
|
1892
1889
|
).command(
|
|
1893
1890
|
"deplint [package]",
|
|
@@ -1919,7 +1916,7 @@ var xyLintCommands = (args) => {
|
|
|
1919
1916
|
devDeps: !!argv.devDeps,
|
|
1920
1917
|
peerDeps: !!argv.peerDeps
|
|
1921
1918
|
});
|
|
1922
|
-
console.log(
|
|
1919
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1923
1920
|
}
|
|
1924
1921
|
).command(
|
|
1925
1922
|
"fix [package]",
|
|
@@ -1931,7 +1928,7 @@ var xyLintCommands = (args) => {
|
|
|
1931
1928
|
const start = Date.now();
|
|
1932
1929
|
if (argv.verbose) console.log("Fix");
|
|
1933
1930
|
process.exitCode = fix();
|
|
1934
|
-
console.log(
|
|
1931
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1935
1932
|
}
|
|
1936
1933
|
).command(
|
|
1937
1934
|
"relint [package]",
|
|
@@ -1943,7 +1940,7 @@ var xyLintCommands = (args) => {
|
|
|
1943
1940
|
if (argv.verbose) console.log("Relinting");
|
|
1944
1941
|
const start = Date.now();
|
|
1945
1942
|
process.exitCode = relint();
|
|
1946
|
-
console.log(
|
|
1943
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1947
1944
|
}
|
|
1948
1945
|
).command(
|
|
1949
1946
|
"publint [package]",
|
|
@@ -1955,7 +1952,7 @@ var xyLintCommands = (args) => {
|
|
|
1955
1952
|
if (argv.verbose) console.log("Publint");
|
|
1956
1953
|
const start = Date.now();
|
|
1957
1954
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
1958
|
-
console.log(
|
|
1955
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1959
1956
|
}
|
|
1960
1957
|
).command(
|
|
1961
1958
|
"knip",
|
|
@@ -1967,7 +1964,7 @@ var xyLintCommands = (args) => {
|
|
|
1967
1964
|
if (argv.verbose) console.log("Knip");
|
|
1968
1965
|
const start = Date.now();
|
|
1969
1966
|
process.exitCode = knip();
|
|
1970
|
-
console.log(
|
|
1967
|
+
console.log(chalk25.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
1971
1968
|
}
|
|
1972
1969
|
).command(
|
|
1973
1970
|
"sonar",
|
|
@@ -1979,7 +1976,7 @@ var xyLintCommands = (args) => {
|
|
|
1979
1976
|
const start = Date.now();
|
|
1980
1977
|
if (argv.verbose) console.log("Sonar Check");
|
|
1981
1978
|
process.exitCode = sonar();
|
|
1982
|
-
console.log(
|
|
1979
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1983
1980
|
}
|
|
1984
1981
|
);
|
|
1985
1982
|
};
|
|
@@ -2015,8 +2012,8 @@ var xyParseOptions = () => {
|
|
|
2015
2012
|
var xy = async () => {
|
|
2016
2013
|
const options = xyParseOptions();
|
|
2017
2014
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2018
|
-
console.error(
|
|
2019
|
-
console.log(
|
|
2015
|
+
console.error(chalk26.yellow(`Command not found [${chalk26.magenta(process.argv[2])}]`));
|
|
2016
|
+
console.log(chalk26.gray("Try 'yarn xy --help' for list of commands"));
|
|
2020
2017
|
}).version().help().argv;
|
|
2021
2018
|
};
|
|
2022
2019
|
export {
|