@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/actions/index.mjs
CHANGED
|
@@ -672,7 +672,7 @@ var dead = () => {
|
|
|
672
672
|
};
|
|
673
673
|
|
|
674
674
|
// src/actions/deplint/deplint.ts
|
|
675
|
-
import
|
|
675
|
+
import chalk17 from "chalk";
|
|
676
676
|
|
|
677
677
|
// src/actions/deplint/findFilesByGlob.ts
|
|
678
678
|
import { globSync } from "glob";
|
|
@@ -682,16 +682,20 @@ function findFilesByGlob(cwd4, pattern) {
|
|
|
682
682
|
|
|
683
683
|
// src/actions/deplint/findFiles.ts
|
|
684
684
|
function findFiles(path10) {
|
|
685
|
-
const allSourceInclude = ["./src/**/*.{ts,tsx}"
|
|
685
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
686
|
+
const allDistInclude = ["./dist/**/*.d.ts"];
|
|
686
687
|
const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
|
|
687
688
|
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
688
689
|
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
|
|
690
|
+
const allDistFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
|
|
689
691
|
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
692
|
+
const prodDistFiles = allDistFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
690
693
|
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
691
694
|
return {
|
|
692
695
|
allSourceFiles,
|
|
693
696
|
prodSourceFiles,
|
|
694
|
-
devSourceFiles
|
|
697
|
+
devSourceFiles,
|
|
698
|
+
prodDistFiles
|
|
695
699
|
};
|
|
696
700
|
}
|
|
697
701
|
|
|
@@ -744,7 +748,7 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
744
748
|
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
|
|
745
749
|
if (moduleSpecifier) {
|
|
746
750
|
const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
|
|
747
|
-
if (isTypeImport
|
|
751
|
+
if (isTypeImport || isDeclarationFile) {
|
|
748
752
|
typeImports.push(trimmed);
|
|
749
753
|
} else {
|
|
750
754
|
imports.push(trimmed);
|
|
@@ -779,19 +783,24 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
779
783
|
var removeInternalImports = (imports) => {
|
|
780
784
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
781
785
|
};
|
|
782
|
-
function getExternalImportsFromFiles({
|
|
786
|
+
function getExternalImportsFromFiles({
|
|
787
|
+
prodSourceFiles,
|
|
788
|
+
devSourceFiles,
|
|
789
|
+
prodDistFiles
|
|
790
|
+
}) {
|
|
783
791
|
const prodImportPaths = {};
|
|
784
792
|
const prodTypeImportPaths = {};
|
|
785
793
|
const prodImportPairs = prodSourceFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
794
|
+
const prodDistImportPairs = prodDistFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
786
795
|
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
787
|
-
const
|
|
796
|
+
const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
|
|
788
797
|
const devImportPaths = {};
|
|
789
798
|
const devTypeImportPaths = {};
|
|
790
799
|
const devImportPairs = devSourceFiles.map((path10) => getImportsFromFile(path10, devImportPaths, devTypeImportPaths));
|
|
791
800
|
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
792
801
|
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
793
802
|
const externalProdImports = removeInternalImports(prodImports);
|
|
794
|
-
const externalProdTypeImports = removeInternalImports(
|
|
803
|
+
const externalProdTypeImports = removeInternalImports(prodDistImports);
|
|
795
804
|
const externalDevImports = removeInternalImports(devImports);
|
|
796
805
|
return {
|
|
797
806
|
prodImports,
|
|
@@ -801,35 +810,15 @@ function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
|
801
810
|
devImportPaths,
|
|
802
811
|
externalProdImports,
|
|
803
812
|
externalDevImports,
|
|
804
|
-
|
|
813
|
+
prodDistImports,
|
|
805
814
|
devTypeImports,
|
|
806
815
|
externalProdTypeImports
|
|
807
816
|
};
|
|
808
817
|
}
|
|
809
818
|
|
|
810
|
-
// src/actions/deplint/checkPackage/getTypesInDependencies.ts
|
|
811
|
-
import chalk13 from "chalk";
|
|
812
|
-
function getTypesInDependencies({ name, location }, { dependencies }, {}) {
|
|
813
|
-
let typesInDependencies = 0;
|
|
814
|
-
for (const dep of dependencies) {
|
|
815
|
-
if (dep.startsWith("@types/")) {
|
|
816
|
-
typesInDependencies++;
|
|
817
|
-
console.log(`[${chalk13.blue(name)}] @types in dependencies in package.json: ${chalk13.red(dep)}`);
|
|
818
|
-
console.log(` ${location}/package.json
|
|
819
|
-
`);
|
|
820
|
-
console.log("");
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
return typesInDependencies;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
819
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
827
|
-
import
|
|
828
|
-
function getUnlistedDependencies({ name }, {
|
|
829
|
-
dependencies,
|
|
830
|
-
devDependencies,
|
|
831
|
-
peerDependencies
|
|
832
|
-
}, {
|
|
820
|
+
import chalk13 from "chalk";
|
|
821
|
+
function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
833
822
|
externalProdTypeImports,
|
|
834
823
|
prodTypeImportPaths,
|
|
835
824
|
externalProdImports,
|
|
@@ -839,7 +828,7 @@ function getUnlistedDependencies({ name }, {
|
|
|
839
828
|
for (const imp of externalProdTypeImports) {
|
|
840
829
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
841
830
|
unlistedDependencies++;
|
|
842
|
-
console.log(`[${
|
|
831
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
843
832
|
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
844
833
|
console.log("");
|
|
845
834
|
}
|
|
@@ -847,7 +836,7 @@ function getUnlistedDependencies({ name }, {
|
|
|
847
836
|
for (const imp of externalProdImports) {
|
|
848
837
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
849
838
|
unlistedDependencies++;
|
|
850
|
-
console.log(`[${
|
|
839
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
851
840
|
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
852
841
|
console.log("");
|
|
853
842
|
}
|
|
@@ -856,7 +845,7 @@ function getUnlistedDependencies({ name }, {
|
|
|
856
845
|
}
|
|
857
846
|
|
|
858
847
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
859
|
-
import
|
|
848
|
+
import chalk14 from "chalk";
|
|
860
849
|
function getUnlistedDevDependencies({ name }, {
|
|
861
850
|
devDependencies,
|
|
862
851
|
dependencies,
|
|
@@ -866,7 +855,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
866
855
|
for (const imp of externalDevImports) {
|
|
867
856
|
if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
868
857
|
unlistedDevDependencies++;
|
|
869
|
-
console.log(`[${
|
|
858
|
+
console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
|
|
870
859
|
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
871
860
|
}
|
|
872
861
|
}
|
|
@@ -874,7 +863,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
874
863
|
}
|
|
875
864
|
|
|
876
865
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
877
|
-
import
|
|
866
|
+
import chalk15 from "chalk";
|
|
878
867
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
879
868
|
externalProdImports,
|
|
880
869
|
externalProdTypeImports
|
|
@@ -883,7 +872,7 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
883
872
|
for (const dep of dependencies) {
|
|
884
873
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
885
874
|
unusedDependencies++;
|
|
886
|
-
console.log(`[${
|
|
875
|
+
console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
|
|
887
876
|
console.log(` ${location}/package.json
|
|
888
877
|
`);
|
|
889
878
|
console.log("");
|
|
@@ -893,13 +882,13 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
893
882
|
}
|
|
894
883
|
|
|
895
884
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
896
|
-
import
|
|
885
|
+
import chalk16 from "chalk";
|
|
897
886
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
|
|
898
887
|
let unusedDependencies = 0;
|
|
899
888
|
for (const dep of peerDependencies) {
|
|
900
889
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
901
890
|
unusedDependencies++;
|
|
902
|
-
console.log(`[${
|
|
891
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
|
|
903
892
|
console.log(` ${location}/package.json
|
|
904
893
|
`);
|
|
905
894
|
console.log("");
|
|
@@ -916,15 +905,23 @@ function checkPackage({
|
|
|
916
905
|
devDeps = false,
|
|
917
906
|
peerDeps = false
|
|
918
907
|
}) {
|
|
919
|
-
const {
|
|
908
|
+
const {
|
|
909
|
+
prodSourceFiles,
|
|
910
|
+
devSourceFiles,
|
|
911
|
+
prodDistFiles
|
|
912
|
+
} = findFiles(location);
|
|
920
913
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
921
914
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
922
915
|
const checkPeerDeps = peerDeps || !(deps || devDeps || peerDeps);
|
|
923
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
916
|
+
const sourceParams = getExternalImportsFromFiles({
|
|
917
|
+
prodSourceFiles,
|
|
918
|
+
devSourceFiles,
|
|
919
|
+
prodDistFiles
|
|
920
|
+
});
|
|
924
921
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
925
922
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
926
923
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
927
|
-
const typesInDependencies =
|
|
924
|
+
const typesInDependencies = 0;
|
|
928
925
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
929
926
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
930
927
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
|
|
@@ -961,9 +958,9 @@ var deplint = ({
|
|
|
961
958
|
});
|
|
962
959
|
}
|
|
963
960
|
if (totalErrors > 0) {
|
|
964
|
-
console.log(`Deplint: Found ${
|
|
961
|
+
console.log(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
|
|
965
962
|
} else {
|
|
966
|
-
console.log(`Deplint: Found no dependency problems. ${
|
|
963
|
+
console.log(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
|
|
967
964
|
}
|
|
968
965
|
}
|
|
969
966
|
return 0;
|
|
@@ -1070,18 +1067,18 @@ var deployNext = () => {
|
|
|
1070
1067
|
};
|
|
1071
1068
|
|
|
1072
1069
|
// src/actions/dupdeps.ts
|
|
1073
|
-
import
|
|
1070
|
+
import chalk18 from "chalk";
|
|
1074
1071
|
var dupdeps = () => {
|
|
1075
|
-
console.log(
|
|
1072
|
+
console.log(chalk18.green("Checking all Dependencies for Duplicates"));
|
|
1076
1073
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1077
1074
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1078
1075
|
return detectDuplicateDependencies(dependencies);
|
|
1079
1076
|
};
|
|
1080
1077
|
|
|
1081
1078
|
// src/actions/lint.ts
|
|
1082
|
-
import
|
|
1079
|
+
import chalk19 from "chalk";
|
|
1083
1080
|
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1084
|
-
console.log(
|
|
1081
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1085
1082
|
const start = Date.now();
|
|
1086
1083
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1087
1084
|
["yarn", [
|
|
@@ -1091,7 +1088,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
|
1091
1088
|
fix2 ? "package-fix" : "package-lint"
|
|
1092
1089
|
]]
|
|
1093
1090
|
]);
|
|
1094
|
-
console.log(
|
|
1091
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1095
1092
|
return result;
|
|
1096
1093
|
};
|
|
1097
1094
|
var lint = ({
|
|
@@ -1107,13 +1104,13 @@ var lint = ({
|
|
|
1107
1104
|
});
|
|
1108
1105
|
};
|
|
1109
1106
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1110
|
-
console.log(
|
|
1107
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1111
1108
|
const start = Date.now();
|
|
1112
1109
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1113
1110
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1114
1111
|
["yarn", ["eslint", ...fixOptions]]
|
|
1115
1112
|
]);
|
|
1116
|
-
console.log(
|
|
1113
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1117
1114
|
return result;
|
|
1118
1115
|
};
|
|
1119
1116
|
|
|
@@ -1141,7 +1138,7 @@ var filename = ".gitignore";
|
|
|
1141
1138
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1142
1139
|
|
|
1143
1140
|
// src/actions/gitlint.ts
|
|
1144
|
-
import
|
|
1141
|
+
import chalk20 from "chalk";
|
|
1145
1142
|
import ParseGitConfig from "parse-git-config";
|
|
1146
1143
|
var gitlint = () => {
|
|
1147
1144
|
console.log(`
|
|
@@ -1152,7 +1149,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1152
1149
|
const errors = 0;
|
|
1153
1150
|
const gitConfig = ParseGitConfig.sync();
|
|
1154
1151
|
const warn = (message) => {
|
|
1155
|
-
console.warn(
|
|
1152
|
+
console.warn(chalk20.yellow(`Warning: ${message}`));
|
|
1156
1153
|
warnings++;
|
|
1157
1154
|
};
|
|
1158
1155
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1172,13 +1169,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1172
1169
|
}
|
|
1173
1170
|
const resultMessages = [];
|
|
1174
1171
|
if (valid > 0) {
|
|
1175
|
-
resultMessages.push(
|
|
1172
|
+
resultMessages.push(chalk20.green(`Passed: ${valid}`));
|
|
1176
1173
|
}
|
|
1177
1174
|
if (warnings > 0) {
|
|
1178
|
-
resultMessages.push(
|
|
1175
|
+
resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
|
|
1179
1176
|
}
|
|
1180
1177
|
if (errors > 0) {
|
|
1181
|
-
resultMessages.push(
|
|
1178
|
+
resultMessages.push(chalk20.red(` Errors: ${errors}`));
|
|
1182
1179
|
}
|
|
1183
1180
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1184
1181
|
`);
|
|
@@ -1187,7 +1184,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1187
1184
|
|
|
1188
1185
|
// src/actions/gitlint-fix.ts
|
|
1189
1186
|
import { execSync as execSync2 } from "node:child_process";
|
|
1190
|
-
import
|
|
1187
|
+
import chalk21 from "chalk";
|
|
1191
1188
|
import ParseGitConfig2 from "parse-git-config";
|
|
1192
1189
|
var gitlintFix = () => {
|
|
1193
1190
|
console.log(`
|
|
@@ -1196,15 +1193,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1196
1193
|
const gitConfig = ParseGitConfig2.sync();
|
|
1197
1194
|
if (gitConfig.core.ignorecase) {
|
|
1198
1195
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1199
|
-
console.warn(
|
|
1196
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1200
1197
|
}
|
|
1201
1198
|
if (gitConfig.core.autocrlf !== false) {
|
|
1202
1199
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1203
|
-
console.warn(
|
|
1200
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1204
1201
|
}
|
|
1205
1202
|
if (gitConfig.core.eol !== "lf") {
|
|
1206
1203
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1207
|
-
console.warn(
|
|
1204
|
+
console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1208
1205
|
}
|
|
1209
1206
|
return 1;
|
|
1210
1207
|
};
|
|
@@ -1215,7 +1212,7 @@ var knip = () => {
|
|
|
1215
1212
|
};
|
|
1216
1213
|
|
|
1217
1214
|
// src/actions/license.ts
|
|
1218
|
-
import
|
|
1215
|
+
import chalk22 from "chalk";
|
|
1219
1216
|
import { init } from "license-checker";
|
|
1220
1217
|
var license = async (pkg) => {
|
|
1221
1218
|
const workspaces = yarnWorkspaces();
|
|
@@ -1240,18 +1237,18 @@ var license = async (pkg) => {
|
|
|
1240
1237
|
"LGPL-3.0-or-later",
|
|
1241
1238
|
"Python-2.0"
|
|
1242
1239
|
]);
|
|
1243
|
-
console.log(
|
|
1240
|
+
console.log(chalk22.green("License Checker"));
|
|
1244
1241
|
return (await Promise.all(
|
|
1245
1242
|
workspaceList.map(({ location, name }) => {
|
|
1246
1243
|
return new Promise((resolve) => {
|
|
1247
1244
|
init({ production: true, start: location }, (error, packages) => {
|
|
1248
1245
|
if (error) {
|
|
1249
|
-
console.error(
|
|
1250
|
-
console.error(
|
|
1246
|
+
console.error(chalk22.red(`License Checker [${name}] Error`));
|
|
1247
|
+
console.error(chalk22.gray(error));
|
|
1251
1248
|
console.log("\n");
|
|
1252
1249
|
resolve(1);
|
|
1253
1250
|
} else {
|
|
1254
|
-
console.log(
|
|
1251
|
+
console.log(chalk22.green(`License Checker [${name}]`));
|
|
1255
1252
|
let count = 0;
|
|
1256
1253
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1257
1254
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1267,7 +1264,7 @@ var license = async (pkg) => {
|
|
|
1267
1264
|
}
|
|
1268
1265
|
if (!orLicenseFound) {
|
|
1269
1266
|
count++;
|
|
1270
|
-
console.warn(
|
|
1267
|
+
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1271
1268
|
}
|
|
1272
1269
|
}
|
|
1273
1270
|
}
|
|
@@ -1287,12 +1284,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1287
1284
|
|
|
1288
1285
|
// src/actions/package/clean-outputs.ts
|
|
1289
1286
|
import path5 from "node:path";
|
|
1290
|
-
import
|
|
1287
|
+
import chalk23 from "chalk";
|
|
1291
1288
|
var packageCleanOutputs = () => {
|
|
1292
1289
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1293
1290
|
const pkgName = process.env.npm_package_name;
|
|
1294
1291
|
const folders = [path5.join(pkg, "dist"), path5.join(pkg, "build"), path5.join(pkg, "docs")];
|
|
1295
|
-
console.log(
|
|
1292
|
+
console.log(chalk23.green(`Cleaning Outputs [${pkgName}]`));
|
|
1296
1293
|
for (let folder of folders) {
|
|
1297
1294
|
deleteGlob(folder);
|
|
1298
1295
|
}
|
|
@@ -1301,11 +1298,11 @@ var packageCleanOutputs = () => {
|
|
|
1301
1298
|
|
|
1302
1299
|
// src/actions/package/clean-typescript.ts
|
|
1303
1300
|
import path6 from "node:path";
|
|
1304
|
-
import
|
|
1301
|
+
import chalk24 from "chalk";
|
|
1305
1302
|
var packageCleanTypescript = () => {
|
|
1306
1303
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1307
1304
|
const pkgName = process.env.npm_package_name;
|
|
1308
|
-
console.log(
|
|
1305
|
+
console.log(chalk24.green(`Cleaning Typescript [${pkgName}]`));
|
|
1309
1306
|
const files = [path6.join(pkg, "*.tsbuildinfo"), path6.join(pkg, ".tsconfig.*"), path6.join(pkg, ".eslintcache")];
|
|
1310
1307
|
for (let file of files) {
|
|
1311
1308
|
deleteGlob(file);
|
|
@@ -1319,19 +1316,19 @@ var packageClean = async () => {
|
|
|
1319
1316
|
};
|
|
1320
1317
|
|
|
1321
1318
|
// src/actions/package/compile/compile.ts
|
|
1322
|
-
import
|
|
1319
|
+
import chalk28 from "chalk";
|
|
1323
1320
|
|
|
1324
1321
|
// src/actions/package/publint.ts
|
|
1325
1322
|
import { promises as fs4 } from "node:fs";
|
|
1326
|
-
import
|
|
1323
|
+
import chalk25 from "chalk";
|
|
1327
1324
|
import sortPackageJson from "sort-package-json";
|
|
1328
1325
|
var packagePublint = async (params) => {
|
|
1329
1326
|
const pkgDir = process.env.INIT_CWD;
|
|
1330
1327
|
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1331
1328
|
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1332
1329
|
const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1333
|
-
console.log(
|
|
1334
|
-
console.log(
|
|
1330
|
+
console.log(chalk25.green(`Publint: ${pkg.name}`));
|
|
1331
|
+
console.log(chalk25.gray(pkgDir));
|
|
1335
1332
|
const { publint: publint2 } = await import("publint");
|
|
1336
1333
|
const { messages } = await publint2({
|
|
1337
1334
|
level: "suggestion",
|
|
@@ -1346,21 +1343,21 @@ var packagePublint = async (params) => {
|
|
|
1346
1343
|
for (const message of validMessages) {
|
|
1347
1344
|
switch (message.type) {
|
|
1348
1345
|
case "error": {
|
|
1349
|
-
console.error(
|
|
1346
|
+
console.error(chalk25.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1350
1347
|
break;
|
|
1351
1348
|
}
|
|
1352
1349
|
case "warning": {
|
|
1353
|
-
console.warn(
|
|
1350
|
+
console.warn(chalk25.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1354
1351
|
break;
|
|
1355
1352
|
}
|
|
1356
1353
|
default: {
|
|
1357
|
-
console.log(
|
|
1354
|
+
console.log(chalk25.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1358
1355
|
break;
|
|
1359
1356
|
}
|
|
1360
1357
|
}
|
|
1361
1358
|
}
|
|
1362
1359
|
if (params?.verbose) {
|
|
1363
|
-
console.log(
|
|
1360
|
+
console.log(chalk25.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1364
1361
|
}
|
|
1365
1362
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1366
1363
|
};
|
|
@@ -1397,7 +1394,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
1397
1394
|
|
|
1398
1395
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1399
1396
|
import { cwd } from "node:process";
|
|
1400
|
-
import
|
|
1397
|
+
import chalk26 from "chalk";
|
|
1401
1398
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1402
1399
|
import {
|
|
1403
1400
|
DiagnosticCategory,
|
|
@@ -1452,7 +1449,7 @@ var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam
|
|
|
1452
1449
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1453
1450
|
const excludes = [".stories.", ".spec."];
|
|
1454
1451
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1455
|
-
console.log(
|
|
1452
|
+
console.log(chalk26.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1456
1453
|
if (files.length > 0) {
|
|
1457
1454
|
const program = createProgramFromConfig({
|
|
1458
1455
|
basePath: pkg ?? cwd(),
|
|
@@ -1509,7 +1506,7 @@ function deepMergeObjects(objects) {
|
|
|
1509
1506
|
|
|
1510
1507
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1511
1508
|
import { cwd as cwd2 } from "node:process";
|
|
1512
|
-
import
|
|
1509
|
+
import chalk27 from "chalk";
|
|
1513
1510
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1514
1511
|
import {
|
|
1515
1512
|
DiagnosticCategory as DiagnosticCategory2,
|
|
@@ -1535,7 +1532,7 @@ var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) =>
|
|
|
1535
1532
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1536
1533
|
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1537
1534
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1538
|
-
console.log(
|
|
1535
|
+
console.log(chalk27.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1539
1536
|
if (files.length > 0) {
|
|
1540
1537
|
const program = createProgramFromConfig2({
|
|
1541
1538
|
basePath: pkg ?? cwd2(),
|
|
@@ -1686,7 +1683,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1686
1683
|
// src/actions/package/compile/compile.ts
|
|
1687
1684
|
var packageCompile = async (inConfig = {}) => {
|
|
1688
1685
|
const pkg = process.env.INIT_CWD;
|
|
1689
|
-
console.log(
|
|
1686
|
+
console.log(chalk28.green(`Compiling ${pkg}`));
|
|
1690
1687
|
const config2 = await loadConfig(inConfig);
|
|
1691
1688
|
const publint2 = config2.publint;
|
|
1692
1689
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1698,7 +1695,7 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1698
1695
|
|
|
1699
1696
|
// src/actions/package/copy-assets.ts
|
|
1700
1697
|
import path7 from "node:path/posix";
|
|
1701
|
-
import
|
|
1698
|
+
import chalk29 from "chalk";
|
|
1702
1699
|
import cpy2 from "cpy";
|
|
1703
1700
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1704
1701
|
try {
|
|
@@ -1711,7 +1708,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1711
1708
|
}
|
|
1712
1709
|
);
|
|
1713
1710
|
if (values.length > 0) {
|
|
1714
|
-
console.log(
|
|
1711
|
+
console.log(chalk29.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1715
1712
|
}
|
|
1716
1713
|
for (const value of values) {
|
|
1717
1714
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1780,7 +1777,7 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1780
1777
|
// src/actions/package/gen-docs.ts
|
|
1781
1778
|
import { existsSync as existsSync4 } from "node:fs";
|
|
1782
1779
|
import path8 from "node:path";
|
|
1783
|
-
import
|
|
1780
|
+
import chalk30 from "chalk";
|
|
1784
1781
|
import {
|
|
1785
1782
|
Application,
|
|
1786
1783
|
ArgumentsReader,
|
|
@@ -1884,7 +1881,7 @@ var runTypeDoc = async (app) => {
|
|
|
1884
1881
|
return ExitCodes.OutputError;
|
|
1885
1882
|
}
|
|
1886
1883
|
}
|
|
1887
|
-
console.log(
|
|
1884
|
+
console.log(chalk30.green(`${pkgName} - Ok`));
|
|
1888
1885
|
return ExitCodes.Ok;
|
|
1889
1886
|
};
|
|
1890
1887
|
|
|
@@ -1893,7 +1890,7 @@ import { readdirSync } from "node:fs";
|
|
|
1893
1890
|
import path9 from "node:path";
|
|
1894
1891
|
import { cwd as cwd3 } from "node:process";
|
|
1895
1892
|
import { pathToFileURL } from "node:url";
|
|
1896
|
-
import
|
|
1893
|
+
import chalk31 from "chalk";
|
|
1897
1894
|
import { ESLint } from "eslint";
|
|
1898
1895
|
import { findUp } from "find-up";
|
|
1899
1896
|
import picomatch from "picomatch";
|
|
@@ -1902,14 +1899,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1902
1899
|
const severity = ["none", "warning", "error"];
|
|
1903
1900
|
for (const lintResult of lintResults) {
|
|
1904
1901
|
if (lintResult.messages.length > 0) {
|
|
1905
|
-
console.log(
|
|
1902
|
+
console.log(chalk31.gray(`
|
|
1906
1903
|
${lintResult.filePath}`));
|
|
1907
1904
|
for (const message of lintResult.messages) {
|
|
1908
1905
|
console.log(
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1906
|
+
chalk31.gray(` ${message.line}:${message.column}`),
|
|
1907
|
+
chalk31[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1908
|
+
chalk31.white(` ${message.message}`),
|
|
1909
|
+
chalk31.gray(` ${message.ruleId}`)
|
|
1913
1910
|
);
|
|
1914
1911
|
}
|
|
1915
1912
|
}
|
|
@@ -1948,7 +1945,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1948
1945
|
});
|
|
1949
1946
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
1950
1947
|
if (verbose) {
|
|
1951
|
-
console.log(
|
|
1948
|
+
console.log(chalk31.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1952
1949
|
}
|
|
1953
1950
|
const lintResults = await engine.lintFiles(files);
|
|
1954
1951
|
dumpMessages(lintResults);
|
|
@@ -1958,7 +1955,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1958
1955
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1959
1956
|
const lintTime = Date.now() - start;
|
|
1960
1957
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1961
|
-
console.log(
|
|
1958
|
+
console.log(chalk31.white(`Linted ${chalk31[filesCountColor](files.length)} files in ${chalk31[lintTimeColor](lintTime)}ms`));
|
|
1962
1959
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1963
1960
|
};
|
|
1964
1961
|
|
|
@@ -1988,7 +1985,7 @@ var rebuild = ({ target }) => {
|
|
|
1988
1985
|
};
|
|
1989
1986
|
|
|
1990
1987
|
// src/actions/recompile.ts
|
|
1991
|
-
import
|
|
1988
|
+
import chalk32 from "chalk";
|
|
1992
1989
|
var recompile = async ({
|
|
1993
1990
|
verbose,
|
|
1994
1991
|
target,
|
|
@@ -2024,7 +2021,7 @@ var recompileAll = async ({
|
|
|
2024
2021
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2025
2022
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2026
2023
|
if (jobs) {
|
|
2027
|
-
console.log(
|
|
2024
|
+
console.log(chalk32.blue(`Jobs set to [${jobs}]`));
|
|
2028
2025
|
}
|
|
2029
2026
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2030
2027
|
[
|
|
@@ -2055,7 +2052,7 @@ var recompileAll = async ({
|
|
|
2055
2052
|
]
|
|
2056
2053
|
]);
|
|
2057
2054
|
console.log(
|
|
2058
|
-
`${
|
|
2055
|
+
`${chalk32.gray("Recompiled in")} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`
|
|
2059
2056
|
);
|
|
2060
2057
|
return result;
|
|
2061
2058
|
};
|
|
@@ -2086,9 +2083,9 @@ var reinstall = () => {
|
|
|
2086
2083
|
};
|
|
2087
2084
|
|
|
2088
2085
|
// src/actions/relint.ts
|
|
2089
|
-
import
|
|
2086
|
+
import chalk33 from "chalk";
|
|
2090
2087
|
var relintPackage = ({ pkg }) => {
|
|
2091
|
-
console.log(
|
|
2088
|
+
console.log(chalk33.gray(`${"Relint"} [All-Packages]`));
|
|
2092
2089
|
const start = Date.now();
|
|
2093
2090
|
const result = runSteps("Relint [All-Packages]", [
|
|
2094
2091
|
["yarn", [
|
|
@@ -2098,7 +2095,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
2098
2095
|
"package-relint"
|
|
2099
2096
|
]]
|
|
2100
2097
|
]);
|
|
2101
|
-
console.log(
|
|
2098
|
+
console.log(chalk33.gray(`${"Relinted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2102
2099
|
return result;
|
|
2103
2100
|
};
|
|
2104
2101
|
var relint = ({
|
|
@@ -2109,7 +2106,7 @@ var relint = ({
|
|
|
2109
2106
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2110
2107
|
};
|
|
2111
2108
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2112
|
-
console.log(
|
|
2109
|
+
console.log(chalk33.gray(`${"Relint"} [All-Packages]`));
|
|
2113
2110
|
const start = Date.now();
|
|
2114
2111
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2115
2112
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -2123,7 +2120,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
2123
2120
|
"package-relint"
|
|
2124
2121
|
]]
|
|
2125
2122
|
]);
|
|
2126
|
-
console.log(
|
|
2123
|
+
console.log(chalk33.gray(`Relinted in [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2127
2124
|
return result;
|
|
2128
2125
|
};
|
|
2129
2126
|
|
|
@@ -2141,10 +2138,10 @@ var sonar = () => {
|
|
|
2141
2138
|
};
|
|
2142
2139
|
|
|
2143
2140
|
// src/actions/statics.ts
|
|
2144
|
-
import
|
|
2141
|
+
import chalk34 from "chalk";
|
|
2145
2142
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2146
2143
|
var statics = () => {
|
|
2147
|
-
console.log(
|
|
2144
|
+
console.log(chalk34.green("Check Required Static Dependencies"));
|
|
2148
2145
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2149
2146
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2150
2147
|
};
|