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