@xylabs/ts-scripts-yarn3 6.5.3 → 6.5.5
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 +16 -32
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +16 -32
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +19 -35
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +5 -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 +19 -35
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +80 -96
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +63 -79
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +92 -108
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +63 -79
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +63 -79
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +38 -54
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
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";
|
|
@@ -748,7 +748,7 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
748
748
|
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
|
|
749
749
|
if (moduleSpecifier) {
|
|
750
750
|
const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
|
|
751
|
-
if (isTypeImport
|
|
751
|
+
if (isTypeImport || isDeclarationFile) {
|
|
752
752
|
typeImports.push(trimmed);
|
|
753
753
|
} else {
|
|
754
754
|
imports.push(trimmed);
|
|
@@ -791,16 +791,16 @@ function getExternalImportsFromFiles({
|
|
|
791
791
|
const prodImportPaths = {};
|
|
792
792
|
const prodTypeImportPaths = {};
|
|
793
793
|
const prodImportPairs = prodSourceFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
794
|
-
const
|
|
794
|
+
const prodDistImportPairs = prodDistFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
795
795
|
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
796
|
-
const
|
|
796
|
+
const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
|
|
797
797
|
const devImportPaths = {};
|
|
798
798
|
const devTypeImportPaths = {};
|
|
799
799
|
const devImportPairs = devSourceFiles.map((path10) => getImportsFromFile(path10, devImportPaths, devTypeImportPaths));
|
|
800
800
|
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
801
801
|
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
802
802
|
const externalProdImports = removeInternalImports(prodImports);
|
|
803
|
-
const externalProdTypeImports = removeInternalImports(
|
|
803
|
+
const externalProdTypeImports = removeInternalImports(prodDistImports);
|
|
804
804
|
const externalDevImports = removeInternalImports(devImports);
|
|
805
805
|
return {
|
|
806
806
|
prodImports,
|
|
@@ -810,30 +810,14 @@ function getExternalImportsFromFiles({
|
|
|
810
810
|
devImportPaths,
|
|
811
811
|
externalProdImports,
|
|
812
812
|
externalDevImports,
|
|
813
|
-
|
|
813
|
+
prodDistImports,
|
|
814
814
|
devTypeImports,
|
|
815
815
|
externalProdTypeImports
|
|
816
816
|
};
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
-
// src/actions/deplint/checkPackage/getTypesInDependencies.ts
|
|
820
|
-
import chalk13 from "chalk";
|
|
821
|
-
function getTypesInDependencies({ name, location }, { dependencies }, {}) {
|
|
822
|
-
let typesInDependencies = 0;
|
|
823
|
-
for (const dep of dependencies) {
|
|
824
|
-
if (dep.startsWith("@types/")) {
|
|
825
|
-
typesInDependencies++;
|
|
826
|
-
console.log(`[${chalk13.blue(name)}] @types in dependencies in package.json: ${chalk13.red(dep)}`);
|
|
827
|
-
console.log(` ${location}/package.json
|
|
828
|
-
`);
|
|
829
|
-
console.log("");
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return typesInDependencies;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
819
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
836
|
-
import
|
|
820
|
+
import chalk13 from "chalk";
|
|
837
821
|
function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
838
822
|
externalProdTypeImports,
|
|
839
823
|
prodTypeImportPaths,
|
|
@@ -844,7 +828,7 @@ function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
|
844
828
|
for (const imp of externalProdTypeImports) {
|
|
845
829
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
846
830
|
unlistedDependencies++;
|
|
847
|
-
console.log(`[${
|
|
831
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
848
832
|
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
849
833
|
console.log("");
|
|
850
834
|
}
|
|
@@ -852,7 +836,7 @@ function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
|
852
836
|
for (const imp of externalProdImports) {
|
|
853
837
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
854
838
|
unlistedDependencies++;
|
|
855
|
-
console.log(`[${
|
|
839
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
856
840
|
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
857
841
|
console.log("");
|
|
858
842
|
}
|
|
@@ -861,7 +845,7 @@ function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
|
861
845
|
}
|
|
862
846
|
|
|
863
847
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
864
|
-
import
|
|
848
|
+
import chalk14 from "chalk";
|
|
865
849
|
function getUnlistedDevDependencies({ name }, {
|
|
866
850
|
devDependencies,
|
|
867
851
|
dependencies,
|
|
@@ -871,7 +855,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
871
855
|
for (const imp of externalDevImports) {
|
|
872
856
|
if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
873
857
|
unlistedDevDependencies++;
|
|
874
|
-
console.log(`[${
|
|
858
|
+
console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
|
|
875
859
|
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
876
860
|
}
|
|
877
861
|
}
|
|
@@ -879,7 +863,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
879
863
|
}
|
|
880
864
|
|
|
881
865
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
882
|
-
import
|
|
866
|
+
import chalk15 from "chalk";
|
|
883
867
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
884
868
|
externalProdImports,
|
|
885
869
|
externalProdTypeImports
|
|
@@ -888,7 +872,7 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
888
872
|
for (const dep of dependencies) {
|
|
889
873
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
890
874
|
unusedDependencies++;
|
|
891
|
-
console.log(`[${
|
|
875
|
+
console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
|
|
892
876
|
console.log(` ${location}/package.json
|
|
893
877
|
`);
|
|
894
878
|
console.log("");
|
|
@@ -898,13 +882,13 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
898
882
|
}
|
|
899
883
|
|
|
900
884
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
901
|
-
import
|
|
885
|
+
import chalk16 from "chalk";
|
|
902
886
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
|
|
903
887
|
let unusedDependencies = 0;
|
|
904
888
|
for (const dep of peerDependencies) {
|
|
905
889
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
906
890
|
unusedDependencies++;
|
|
907
|
-
console.log(`[${
|
|
891
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
|
|
908
892
|
console.log(` ${location}/package.json
|
|
909
893
|
`);
|
|
910
894
|
console.log("");
|
|
@@ -928,7 +912,7 @@ function checkPackage({
|
|
|
928
912
|
} = findFiles(location);
|
|
929
913
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
930
914
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
931
|
-
const checkPeerDeps = peerDeps
|
|
915
|
+
const checkPeerDeps = peerDeps;
|
|
932
916
|
const sourceParams = getExternalImportsFromFiles({
|
|
933
917
|
prodSourceFiles,
|
|
934
918
|
devSourceFiles,
|
|
@@ -937,7 +921,7 @@ function checkPackage({
|
|
|
937
921
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
938
922
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
939
923
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
940
|
-
const typesInDependencies =
|
|
924
|
+
const typesInDependencies = 0;
|
|
941
925
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
942
926
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
943
927
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
|
|
@@ -974,9 +958,9 @@ var deplint = ({
|
|
|
974
958
|
});
|
|
975
959
|
}
|
|
976
960
|
if (totalErrors > 0) {
|
|
977
|
-
console.log(`Deplint: Found ${
|
|
961
|
+
console.log(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
|
|
978
962
|
} else {
|
|
979
|
-
console.log(`Deplint: Found no dependency problems. ${
|
|
963
|
+
console.log(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
|
|
980
964
|
}
|
|
981
965
|
}
|
|
982
966
|
return 0;
|
|
@@ -1083,18 +1067,18 @@ var deployNext = () => {
|
|
|
1083
1067
|
};
|
|
1084
1068
|
|
|
1085
1069
|
// src/actions/dupdeps.ts
|
|
1086
|
-
import
|
|
1070
|
+
import chalk18 from "chalk";
|
|
1087
1071
|
var dupdeps = () => {
|
|
1088
|
-
console.log(
|
|
1072
|
+
console.log(chalk18.green("Checking all Dependencies for Duplicates"));
|
|
1089
1073
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1090
1074
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1091
1075
|
return detectDuplicateDependencies(dependencies);
|
|
1092
1076
|
};
|
|
1093
1077
|
|
|
1094
1078
|
// src/actions/lint.ts
|
|
1095
|
-
import
|
|
1079
|
+
import chalk19 from "chalk";
|
|
1096
1080
|
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1097
|
-
console.log(
|
|
1081
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1098
1082
|
const start = Date.now();
|
|
1099
1083
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1100
1084
|
["yarn", [
|
|
@@ -1104,7 +1088,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
|
1104
1088
|
fix2 ? "package-fix" : "package-lint"
|
|
1105
1089
|
]]
|
|
1106
1090
|
]);
|
|
1107
|
-
console.log(
|
|
1091
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1108
1092
|
return result;
|
|
1109
1093
|
};
|
|
1110
1094
|
var lint = ({
|
|
@@ -1120,13 +1104,13 @@ var lint = ({
|
|
|
1120
1104
|
});
|
|
1121
1105
|
};
|
|
1122
1106
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1123
|
-
console.log(
|
|
1107
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1124
1108
|
const start = Date.now();
|
|
1125
1109
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1126
1110
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1127
1111
|
["yarn", ["eslint", ...fixOptions]]
|
|
1128
1112
|
]);
|
|
1129
|
-
console.log(
|
|
1113
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1130
1114
|
return result;
|
|
1131
1115
|
};
|
|
1132
1116
|
|
|
@@ -1154,7 +1138,7 @@ var filename = ".gitignore";
|
|
|
1154
1138
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1155
1139
|
|
|
1156
1140
|
// src/actions/gitlint.ts
|
|
1157
|
-
import
|
|
1141
|
+
import chalk20 from "chalk";
|
|
1158
1142
|
import ParseGitConfig from "parse-git-config";
|
|
1159
1143
|
var gitlint = () => {
|
|
1160
1144
|
console.log(`
|
|
@@ -1165,7 +1149,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1165
1149
|
const errors = 0;
|
|
1166
1150
|
const gitConfig = ParseGitConfig.sync();
|
|
1167
1151
|
const warn = (message) => {
|
|
1168
|
-
console.warn(
|
|
1152
|
+
console.warn(chalk20.yellow(`Warning: ${message}`));
|
|
1169
1153
|
warnings++;
|
|
1170
1154
|
};
|
|
1171
1155
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1185,13 +1169,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1185
1169
|
}
|
|
1186
1170
|
const resultMessages = [];
|
|
1187
1171
|
if (valid > 0) {
|
|
1188
|
-
resultMessages.push(
|
|
1172
|
+
resultMessages.push(chalk20.green(`Passed: ${valid}`));
|
|
1189
1173
|
}
|
|
1190
1174
|
if (warnings > 0) {
|
|
1191
|
-
resultMessages.push(
|
|
1175
|
+
resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
|
|
1192
1176
|
}
|
|
1193
1177
|
if (errors > 0) {
|
|
1194
|
-
resultMessages.push(
|
|
1178
|
+
resultMessages.push(chalk20.red(` Errors: ${errors}`));
|
|
1195
1179
|
}
|
|
1196
1180
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1197
1181
|
`);
|
|
@@ -1200,7 +1184,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1200
1184
|
|
|
1201
1185
|
// src/actions/gitlint-fix.ts
|
|
1202
1186
|
import { execSync as execSync2 } from "node:child_process";
|
|
1203
|
-
import
|
|
1187
|
+
import chalk21 from "chalk";
|
|
1204
1188
|
import ParseGitConfig2 from "parse-git-config";
|
|
1205
1189
|
var gitlintFix = () => {
|
|
1206
1190
|
console.log(`
|
|
@@ -1209,15 +1193,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1209
1193
|
const gitConfig = ParseGitConfig2.sync();
|
|
1210
1194
|
if (gitConfig.core.ignorecase) {
|
|
1211
1195
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1212
|
-
console.warn(
|
|
1196
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1213
1197
|
}
|
|
1214
1198
|
if (gitConfig.core.autocrlf !== false) {
|
|
1215
1199
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1216
|
-
console.warn(
|
|
1200
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1217
1201
|
}
|
|
1218
1202
|
if (gitConfig.core.eol !== "lf") {
|
|
1219
1203
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1220
|
-
console.warn(
|
|
1204
|
+
console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1221
1205
|
}
|
|
1222
1206
|
return 1;
|
|
1223
1207
|
};
|
|
@@ -1228,7 +1212,7 @@ var knip = () => {
|
|
|
1228
1212
|
};
|
|
1229
1213
|
|
|
1230
1214
|
// src/actions/license.ts
|
|
1231
|
-
import
|
|
1215
|
+
import chalk22 from "chalk";
|
|
1232
1216
|
import { init } from "license-checker";
|
|
1233
1217
|
var license = async (pkg) => {
|
|
1234
1218
|
const workspaces = yarnWorkspaces();
|
|
@@ -1253,18 +1237,18 @@ var license = async (pkg) => {
|
|
|
1253
1237
|
"LGPL-3.0-or-later",
|
|
1254
1238
|
"Python-2.0"
|
|
1255
1239
|
]);
|
|
1256
|
-
console.log(
|
|
1240
|
+
console.log(chalk22.green("License Checker"));
|
|
1257
1241
|
return (await Promise.all(
|
|
1258
1242
|
workspaceList.map(({ location, name }) => {
|
|
1259
1243
|
return new Promise((resolve) => {
|
|
1260
1244
|
init({ production: true, start: location }, (error, packages) => {
|
|
1261
1245
|
if (error) {
|
|
1262
|
-
console.error(
|
|
1263
|
-
console.error(
|
|
1246
|
+
console.error(chalk22.red(`License Checker [${name}] Error`));
|
|
1247
|
+
console.error(chalk22.gray(error));
|
|
1264
1248
|
console.log("\n");
|
|
1265
1249
|
resolve(1);
|
|
1266
1250
|
} else {
|
|
1267
|
-
console.log(
|
|
1251
|
+
console.log(chalk22.green(`License Checker [${name}]`));
|
|
1268
1252
|
let count = 0;
|
|
1269
1253
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1270
1254
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1280,7 +1264,7 @@ var license = async (pkg) => {
|
|
|
1280
1264
|
}
|
|
1281
1265
|
if (!orLicenseFound) {
|
|
1282
1266
|
count++;
|
|
1283
|
-
console.warn(
|
|
1267
|
+
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1284
1268
|
}
|
|
1285
1269
|
}
|
|
1286
1270
|
}
|
|
@@ -1300,12 +1284,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1300
1284
|
|
|
1301
1285
|
// src/actions/package/clean-outputs.ts
|
|
1302
1286
|
import path5 from "node:path";
|
|
1303
|
-
import
|
|
1287
|
+
import chalk23 from "chalk";
|
|
1304
1288
|
var packageCleanOutputs = () => {
|
|
1305
1289
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1306
1290
|
const pkgName = process.env.npm_package_name;
|
|
1307
1291
|
const folders = [path5.join(pkg, "dist"), path5.join(pkg, "build"), path5.join(pkg, "docs")];
|
|
1308
|
-
console.log(
|
|
1292
|
+
console.log(chalk23.green(`Cleaning Outputs [${pkgName}]`));
|
|
1309
1293
|
for (let folder of folders) {
|
|
1310
1294
|
deleteGlob(folder);
|
|
1311
1295
|
}
|
|
@@ -1314,11 +1298,11 @@ var packageCleanOutputs = () => {
|
|
|
1314
1298
|
|
|
1315
1299
|
// src/actions/package/clean-typescript.ts
|
|
1316
1300
|
import path6 from "node:path";
|
|
1317
|
-
import
|
|
1301
|
+
import chalk24 from "chalk";
|
|
1318
1302
|
var packageCleanTypescript = () => {
|
|
1319
1303
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1320
1304
|
const pkgName = process.env.npm_package_name;
|
|
1321
|
-
console.log(
|
|
1305
|
+
console.log(chalk24.green(`Cleaning Typescript [${pkgName}]`));
|
|
1322
1306
|
const files = [path6.join(pkg, "*.tsbuildinfo"), path6.join(pkg, ".tsconfig.*"), path6.join(pkg, ".eslintcache")];
|
|
1323
1307
|
for (let file of files) {
|
|
1324
1308
|
deleteGlob(file);
|
|
@@ -1332,19 +1316,19 @@ var packageClean = async () => {
|
|
|
1332
1316
|
};
|
|
1333
1317
|
|
|
1334
1318
|
// src/actions/package/compile/compile.ts
|
|
1335
|
-
import
|
|
1319
|
+
import chalk28 from "chalk";
|
|
1336
1320
|
|
|
1337
1321
|
// src/actions/package/publint.ts
|
|
1338
1322
|
import { promises as fs4 } from "node:fs";
|
|
1339
|
-
import
|
|
1323
|
+
import chalk25 from "chalk";
|
|
1340
1324
|
import sortPackageJson from "sort-package-json";
|
|
1341
1325
|
var packagePublint = async (params) => {
|
|
1342
1326
|
const pkgDir = process.env.INIT_CWD;
|
|
1343
1327
|
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1344
1328
|
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1345
1329
|
const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1346
|
-
console.log(
|
|
1347
|
-
console.log(
|
|
1330
|
+
console.log(chalk25.green(`Publint: ${pkg.name}`));
|
|
1331
|
+
console.log(chalk25.gray(pkgDir));
|
|
1348
1332
|
const { publint: publint2 } = await import("publint");
|
|
1349
1333
|
const { messages } = await publint2({
|
|
1350
1334
|
level: "suggestion",
|
|
@@ -1359,21 +1343,21 @@ var packagePublint = async (params) => {
|
|
|
1359
1343
|
for (const message of validMessages) {
|
|
1360
1344
|
switch (message.type) {
|
|
1361
1345
|
case "error": {
|
|
1362
|
-
console.error(
|
|
1346
|
+
console.error(chalk25.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1363
1347
|
break;
|
|
1364
1348
|
}
|
|
1365
1349
|
case "warning": {
|
|
1366
|
-
console.warn(
|
|
1350
|
+
console.warn(chalk25.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1367
1351
|
break;
|
|
1368
1352
|
}
|
|
1369
1353
|
default: {
|
|
1370
|
-
console.log(
|
|
1354
|
+
console.log(chalk25.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1371
1355
|
break;
|
|
1372
1356
|
}
|
|
1373
1357
|
}
|
|
1374
1358
|
}
|
|
1375
1359
|
if (params?.verbose) {
|
|
1376
|
-
console.log(
|
|
1360
|
+
console.log(chalk25.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1377
1361
|
}
|
|
1378
1362
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1379
1363
|
};
|
|
@@ -1410,7 +1394,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
1410
1394
|
|
|
1411
1395
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1412
1396
|
import { cwd } from "node:process";
|
|
1413
|
-
import
|
|
1397
|
+
import chalk26 from "chalk";
|
|
1414
1398
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1415
1399
|
import {
|
|
1416
1400
|
DiagnosticCategory,
|
|
@@ -1465,7 +1449,7 @@ var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam
|
|
|
1465
1449
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1466
1450
|
const excludes = [".stories.", ".spec."];
|
|
1467
1451
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1468
|
-
console.log(
|
|
1452
|
+
console.log(chalk26.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1469
1453
|
if (files.length > 0) {
|
|
1470
1454
|
const program = createProgramFromConfig({
|
|
1471
1455
|
basePath: pkg ?? cwd(),
|
|
@@ -1522,7 +1506,7 @@ function deepMergeObjects(objects) {
|
|
|
1522
1506
|
|
|
1523
1507
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1524
1508
|
import { cwd as cwd2 } from "node:process";
|
|
1525
|
-
import
|
|
1509
|
+
import chalk27 from "chalk";
|
|
1526
1510
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1527
1511
|
import {
|
|
1528
1512
|
DiagnosticCategory as DiagnosticCategory2,
|
|
@@ -1548,7 +1532,7 @@ var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) =>
|
|
|
1548
1532
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1549
1533
|
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1550
1534
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1551
|
-
console.log(
|
|
1535
|
+
console.log(chalk27.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1552
1536
|
if (files.length > 0) {
|
|
1553
1537
|
const program = createProgramFromConfig2({
|
|
1554
1538
|
basePath: pkg ?? cwd2(),
|
|
@@ -1699,7 +1683,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1699
1683
|
// src/actions/package/compile/compile.ts
|
|
1700
1684
|
var packageCompile = async (inConfig = {}) => {
|
|
1701
1685
|
const pkg = process.env.INIT_CWD;
|
|
1702
|
-
console.log(
|
|
1686
|
+
console.log(chalk28.green(`Compiling ${pkg}`));
|
|
1703
1687
|
const config2 = await loadConfig(inConfig);
|
|
1704
1688
|
const publint2 = config2.publint;
|
|
1705
1689
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1711,7 +1695,7 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1711
1695
|
|
|
1712
1696
|
// src/actions/package/copy-assets.ts
|
|
1713
1697
|
import path7 from "node:path/posix";
|
|
1714
|
-
import
|
|
1698
|
+
import chalk29 from "chalk";
|
|
1715
1699
|
import cpy2 from "cpy";
|
|
1716
1700
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1717
1701
|
try {
|
|
@@ -1724,7 +1708,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1724
1708
|
}
|
|
1725
1709
|
);
|
|
1726
1710
|
if (values.length > 0) {
|
|
1727
|
-
console.log(
|
|
1711
|
+
console.log(chalk29.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1728
1712
|
}
|
|
1729
1713
|
for (const value of values) {
|
|
1730
1714
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1793,7 +1777,7 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1793
1777
|
// src/actions/package/gen-docs.ts
|
|
1794
1778
|
import { existsSync as existsSync4 } from "node:fs";
|
|
1795
1779
|
import path8 from "node:path";
|
|
1796
|
-
import
|
|
1780
|
+
import chalk30 from "chalk";
|
|
1797
1781
|
import {
|
|
1798
1782
|
Application,
|
|
1799
1783
|
ArgumentsReader,
|
|
@@ -1897,7 +1881,7 @@ var runTypeDoc = async (app) => {
|
|
|
1897
1881
|
return ExitCodes.OutputError;
|
|
1898
1882
|
}
|
|
1899
1883
|
}
|
|
1900
|
-
console.log(
|
|
1884
|
+
console.log(chalk30.green(`${pkgName} - Ok`));
|
|
1901
1885
|
return ExitCodes.Ok;
|
|
1902
1886
|
};
|
|
1903
1887
|
|
|
@@ -1906,7 +1890,7 @@ import { readdirSync } from "node:fs";
|
|
|
1906
1890
|
import path9 from "node:path";
|
|
1907
1891
|
import { cwd as cwd3 } from "node:process";
|
|
1908
1892
|
import { pathToFileURL } from "node:url";
|
|
1909
|
-
import
|
|
1893
|
+
import chalk31 from "chalk";
|
|
1910
1894
|
import { ESLint } from "eslint";
|
|
1911
1895
|
import { findUp } from "find-up";
|
|
1912
1896
|
import picomatch from "picomatch";
|
|
@@ -1915,14 +1899,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1915
1899
|
const severity = ["none", "warning", "error"];
|
|
1916
1900
|
for (const lintResult of lintResults) {
|
|
1917
1901
|
if (lintResult.messages.length > 0) {
|
|
1918
|
-
console.log(
|
|
1902
|
+
console.log(chalk31.gray(`
|
|
1919
1903
|
${lintResult.filePath}`));
|
|
1920
1904
|
for (const message of lintResult.messages) {
|
|
1921
1905
|
console.log(
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
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}`)
|
|
1926
1910
|
);
|
|
1927
1911
|
}
|
|
1928
1912
|
}
|
|
@@ -1961,7 +1945,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1961
1945
|
});
|
|
1962
1946
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
1963
1947
|
if (verbose) {
|
|
1964
|
-
console.log(
|
|
1948
|
+
console.log(chalk31.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1965
1949
|
}
|
|
1966
1950
|
const lintResults = await engine.lintFiles(files);
|
|
1967
1951
|
dumpMessages(lintResults);
|
|
@@ -1971,7 +1955,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1971
1955
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1972
1956
|
const lintTime = Date.now() - start;
|
|
1973
1957
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1974
|
-
console.log(
|
|
1958
|
+
console.log(chalk31.white(`Linted ${chalk31[filesCountColor](files.length)} files in ${chalk31[lintTimeColor](lintTime)}ms`));
|
|
1975
1959
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1976
1960
|
};
|
|
1977
1961
|
|
|
@@ -2001,7 +1985,7 @@ var rebuild = ({ target }) => {
|
|
|
2001
1985
|
};
|
|
2002
1986
|
|
|
2003
1987
|
// src/actions/recompile.ts
|
|
2004
|
-
import
|
|
1988
|
+
import chalk32 from "chalk";
|
|
2005
1989
|
var recompile = async ({
|
|
2006
1990
|
verbose,
|
|
2007
1991
|
target,
|
|
@@ -2037,7 +2021,7 @@ var recompileAll = async ({
|
|
|
2037
2021
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2038
2022
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2039
2023
|
if (jobs) {
|
|
2040
|
-
console.log(
|
|
2024
|
+
console.log(chalk32.blue(`Jobs set to [${jobs}]`));
|
|
2041
2025
|
}
|
|
2042
2026
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2043
2027
|
[
|
|
@@ -2068,7 +2052,7 @@ var recompileAll = async ({
|
|
|
2068
2052
|
]
|
|
2069
2053
|
]);
|
|
2070
2054
|
console.log(
|
|
2071
|
-
`${
|
|
2055
|
+
`${chalk32.gray("Recompiled in")} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`
|
|
2072
2056
|
);
|
|
2073
2057
|
return result;
|
|
2074
2058
|
};
|
|
@@ -2099,9 +2083,9 @@ var reinstall = () => {
|
|
|
2099
2083
|
};
|
|
2100
2084
|
|
|
2101
2085
|
// src/actions/relint.ts
|
|
2102
|
-
import
|
|
2086
|
+
import chalk33 from "chalk";
|
|
2103
2087
|
var relintPackage = ({ pkg }) => {
|
|
2104
|
-
console.log(
|
|
2088
|
+
console.log(chalk33.gray(`${"Relint"} [All-Packages]`));
|
|
2105
2089
|
const start = Date.now();
|
|
2106
2090
|
const result = runSteps("Relint [All-Packages]", [
|
|
2107
2091
|
["yarn", [
|
|
@@ -2111,7 +2095,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
2111
2095
|
"package-relint"
|
|
2112
2096
|
]]
|
|
2113
2097
|
]);
|
|
2114
|
-
console.log(
|
|
2098
|
+
console.log(chalk33.gray(`${"Relinted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2115
2099
|
return result;
|
|
2116
2100
|
};
|
|
2117
2101
|
var relint = ({
|
|
@@ -2122,7 +2106,7 @@ var relint = ({
|
|
|
2122
2106
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2123
2107
|
};
|
|
2124
2108
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2125
|
-
console.log(
|
|
2109
|
+
console.log(chalk33.gray(`${"Relint"} [All-Packages]`));
|
|
2126
2110
|
const start = Date.now();
|
|
2127
2111
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2128
2112
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -2136,7 +2120,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
2136
2120
|
"package-relint"
|
|
2137
2121
|
]]
|
|
2138
2122
|
]);
|
|
2139
|
-
console.log(
|
|
2123
|
+
console.log(chalk33.gray(`Relinted in [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2140
2124
|
return result;
|
|
2141
2125
|
};
|
|
2142
2126
|
|
|
@@ -2154,10 +2138,10 @@ var sonar = () => {
|
|
|
2154
2138
|
};
|
|
2155
2139
|
|
|
2156
2140
|
// src/actions/statics.ts
|
|
2157
|
-
import
|
|
2141
|
+
import chalk34 from "chalk";
|
|
2158
2142
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2159
2143
|
var statics = () => {
|
|
2160
|
-
console.log(
|
|
2144
|
+
console.log(chalk34.green("Check Required Static Dependencies"));
|
|
2161
2145
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2162
2146
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2163
2147
|
};
|