@xylabs/ts-scripts-yarn3 6.5.3 → 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 +15 -31
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +15 -31
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +18 -34
- 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 +18 -34
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +79 -95
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +62 -78
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +91 -107
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +62 -78
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +62 -78
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +37 -53
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -748,7 +748,7 @@ var dead = () => {
|
|
|
748
748
|
};
|
|
749
749
|
|
|
750
750
|
// src/actions/deplint/deplint.ts
|
|
751
|
-
import
|
|
751
|
+
import chalk18 from "chalk";
|
|
752
752
|
|
|
753
753
|
// src/actions/deplint/findFilesByGlob.ts
|
|
754
754
|
import { globSync } from "glob";
|
|
@@ -824,7 +824,7 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
824
824
|
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
|
|
825
825
|
if (moduleSpecifier) {
|
|
826
826
|
const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
|
|
827
|
-
if (isTypeImport
|
|
827
|
+
if (isTypeImport || isDeclarationFile) {
|
|
828
828
|
typeImports.push(trimmed);
|
|
829
829
|
} else {
|
|
830
830
|
imports.push(trimmed);
|
|
@@ -867,16 +867,16 @@ function getExternalImportsFromFiles({
|
|
|
867
867
|
const prodImportPaths = {};
|
|
868
868
|
const prodTypeImportPaths = {};
|
|
869
869
|
const prodImportPairs = prodSourceFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
870
|
-
const
|
|
870
|
+
const prodDistImportPairs = prodDistFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
871
871
|
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
872
|
-
const
|
|
872
|
+
const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
|
|
873
873
|
const devImportPaths = {};
|
|
874
874
|
const devTypeImportPaths = {};
|
|
875
875
|
const devImportPairs = devSourceFiles.map((path10) => getImportsFromFile(path10, devImportPaths, devTypeImportPaths));
|
|
876
876
|
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
877
877
|
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
878
878
|
const externalProdImports = removeInternalImports(prodImports);
|
|
879
|
-
const externalProdTypeImports = removeInternalImports(
|
|
879
|
+
const externalProdTypeImports = removeInternalImports(prodDistImports);
|
|
880
880
|
const externalDevImports = removeInternalImports(devImports);
|
|
881
881
|
return {
|
|
882
882
|
prodImports,
|
|
@@ -886,30 +886,14 @@ function getExternalImportsFromFiles({
|
|
|
886
886
|
devImportPaths,
|
|
887
887
|
externalProdImports,
|
|
888
888
|
externalDevImports,
|
|
889
|
-
|
|
889
|
+
prodDistImports,
|
|
890
890
|
devTypeImports,
|
|
891
891
|
externalProdTypeImports
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
894
|
|
|
895
|
-
// src/actions/deplint/checkPackage/getTypesInDependencies.ts
|
|
896
|
-
import chalk14 from "chalk";
|
|
897
|
-
function getTypesInDependencies({ name, location }, { dependencies }, {}) {
|
|
898
|
-
let typesInDependencies = 0;
|
|
899
|
-
for (const dep of dependencies) {
|
|
900
|
-
if (dep.startsWith("@types/")) {
|
|
901
|
-
typesInDependencies++;
|
|
902
|
-
console.log(`[${chalk14.blue(name)}] @types in dependencies in package.json: ${chalk14.red(dep)}`);
|
|
903
|
-
console.log(` ${location}/package.json
|
|
904
|
-
`);
|
|
905
|
-
console.log("");
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return typesInDependencies;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
895
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
912
|
-
import
|
|
896
|
+
import chalk14 from "chalk";
|
|
913
897
|
function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
914
898
|
externalProdTypeImports,
|
|
915
899
|
prodTypeImportPaths,
|
|
@@ -920,7 +904,7 @@ function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
|
920
904
|
for (const imp of externalProdTypeImports) {
|
|
921
905
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
922
906
|
unlistedDependencies++;
|
|
923
|
-
console.log(`[${
|
|
907
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
924
908
|
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
925
909
|
console.log("");
|
|
926
910
|
}
|
|
@@ -928,7 +912,7 @@ function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
|
928
912
|
for (const imp of externalProdImports) {
|
|
929
913
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
930
914
|
unlistedDependencies++;
|
|
931
|
-
console.log(`[${
|
|
915
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
932
916
|
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
933
917
|
console.log("");
|
|
934
918
|
}
|
|
@@ -937,7 +921,7 @@ function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
|
937
921
|
}
|
|
938
922
|
|
|
939
923
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
940
|
-
import
|
|
924
|
+
import chalk15 from "chalk";
|
|
941
925
|
function getUnlistedDevDependencies({ name }, {
|
|
942
926
|
devDependencies,
|
|
943
927
|
dependencies,
|
|
@@ -947,7 +931,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
947
931
|
for (const imp of externalDevImports) {
|
|
948
932
|
if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
949
933
|
unlistedDevDependencies++;
|
|
950
|
-
console.log(`[${
|
|
934
|
+
console.log(`[${chalk15.blue(name)}] Missing devDependency in package.json: ${chalk15.red(imp)}`);
|
|
951
935
|
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
952
936
|
}
|
|
953
937
|
}
|
|
@@ -955,7 +939,7 @@ function getUnlistedDevDependencies({ name }, {
|
|
|
955
939
|
}
|
|
956
940
|
|
|
957
941
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
958
|
-
import
|
|
942
|
+
import chalk16 from "chalk";
|
|
959
943
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
960
944
|
externalProdImports,
|
|
961
945
|
externalProdTypeImports
|
|
@@ -964,7 +948,7 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
964
948
|
for (const dep of dependencies) {
|
|
965
949
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
966
950
|
unusedDependencies++;
|
|
967
|
-
console.log(`[${
|
|
951
|
+
console.log(`[${chalk16.blue(name)}] Unused dependency in package.json: ${chalk16.red(dep)}`);
|
|
968
952
|
console.log(` ${location}/package.json
|
|
969
953
|
`);
|
|
970
954
|
console.log("");
|
|
@@ -974,13 +958,13 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
974
958
|
}
|
|
975
959
|
|
|
976
960
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
977
|
-
import
|
|
961
|
+
import chalk17 from "chalk";
|
|
978
962
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
|
|
979
963
|
let unusedDependencies = 0;
|
|
980
964
|
for (const dep of peerDependencies) {
|
|
981
965
|
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
982
966
|
unusedDependencies++;
|
|
983
|
-
console.log(`[${
|
|
967
|
+
console.log(`[${chalk17.blue(name)}] Unused peerDependency in package.json: ${chalk17.red(dep)}`);
|
|
984
968
|
console.log(` ${location}/package.json
|
|
985
969
|
`);
|
|
986
970
|
console.log("");
|
|
@@ -1013,7 +997,7 @@ function checkPackage({
|
|
|
1013
997
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
1014
998
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1015
999
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1016
|
-
const typesInDependencies =
|
|
1000
|
+
const typesInDependencies = 0;
|
|
1017
1001
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1018
1002
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1019
1003
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
|
|
@@ -1050,9 +1034,9 @@ var deplint = ({
|
|
|
1050
1034
|
});
|
|
1051
1035
|
}
|
|
1052
1036
|
if (totalErrors > 0) {
|
|
1053
|
-
console.log(`Deplint: Found ${
|
|
1037
|
+
console.log(`Deplint: Found ${chalk18.red(totalErrors)} dependency problems. ${chalk18.red("\u2716")}`);
|
|
1054
1038
|
} else {
|
|
1055
|
-
console.log(`Deplint: Found no dependency problems. ${
|
|
1039
|
+
console.log(`Deplint: Found no dependency problems. ${chalk18.green("\u2714")}`);
|
|
1056
1040
|
}
|
|
1057
1041
|
}
|
|
1058
1042
|
return 0;
|
|
@@ -1159,18 +1143,18 @@ var deployNext = () => {
|
|
|
1159
1143
|
};
|
|
1160
1144
|
|
|
1161
1145
|
// src/actions/dupdeps.ts
|
|
1162
|
-
import
|
|
1146
|
+
import chalk19 from "chalk";
|
|
1163
1147
|
var dupdeps = () => {
|
|
1164
|
-
console.log(
|
|
1148
|
+
console.log(chalk19.green("Checking all Dependencies for Duplicates"));
|
|
1165
1149
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1166
1150
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1167
1151
|
return detectDuplicateDependencies(dependencies);
|
|
1168
1152
|
};
|
|
1169
1153
|
|
|
1170
1154
|
// src/actions/lint.ts
|
|
1171
|
-
import
|
|
1155
|
+
import chalk20 from "chalk";
|
|
1172
1156
|
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1173
|
-
console.log(
|
|
1157
|
+
console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1174
1158
|
const start = Date.now();
|
|
1175
1159
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1176
1160
|
["yarn", [
|
|
@@ -1180,7 +1164,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
|
1180
1164
|
fix2 ? "package-fix" : "package-lint"
|
|
1181
1165
|
]]
|
|
1182
1166
|
]);
|
|
1183
|
-
console.log(
|
|
1167
|
+
console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
|
|
1184
1168
|
return result;
|
|
1185
1169
|
};
|
|
1186
1170
|
var lint = ({
|
|
@@ -1196,13 +1180,13 @@ var lint = ({
|
|
|
1196
1180
|
});
|
|
1197
1181
|
};
|
|
1198
1182
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1199
|
-
console.log(
|
|
1183
|
+
console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1200
1184
|
const start = Date.now();
|
|
1201
1185
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1202
1186
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1203
1187
|
["yarn", ["eslint", ...fixOptions]]
|
|
1204
1188
|
]);
|
|
1205
|
-
console.log(
|
|
1189
|
+
console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
|
|
1206
1190
|
return result;
|
|
1207
1191
|
};
|
|
1208
1192
|
|
|
@@ -1230,7 +1214,7 @@ var filename = ".gitignore";
|
|
|
1230
1214
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1231
1215
|
|
|
1232
1216
|
// src/actions/gitlint.ts
|
|
1233
|
-
import
|
|
1217
|
+
import chalk21 from "chalk";
|
|
1234
1218
|
import ParseGitConfig from "parse-git-config";
|
|
1235
1219
|
var gitlint = () => {
|
|
1236
1220
|
console.log(`
|
|
@@ -1241,7 +1225,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1241
1225
|
const errors = 0;
|
|
1242
1226
|
const gitConfig = ParseGitConfig.sync();
|
|
1243
1227
|
const warn = (message) => {
|
|
1244
|
-
console.warn(
|
|
1228
|
+
console.warn(chalk21.yellow(`Warning: ${message}`));
|
|
1245
1229
|
warnings++;
|
|
1246
1230
|
};
|
|
1247
1231
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1261,13 +1245,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1261
1245
|
}
|
|
1262
1246
|
const resultMessages = [];
|
|
1263
1247
|
if (valid > 0) {
|
|
1264
|
-
resultMessages.push(
|
|
1248
|
+
resultMessages.push(chalk21.green(`Passed: ${valid}`));
|
|
1265
1249
|
}
|
|
1266
1250
|
if (warnings > 0) {
|
|
1267
|
-
resultMessages.push(
|
|
1251
|
+
resultMessages.push(chalk21.yellow(`Warnings: ${warnings}`));
|
|
1268
1252
|
}
|
|
1269
1253
|
if (errors > 0) {
|
|
1270
|
-
resultMessages.push(
|
|
1254
|
+
resultMessages.push(chalk21.red(` Errors: ${errors}`));
|
|
1271
1255
|
}
|
|
1272
1256
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1273
1257
|
`);
|
|
@@ -1276,7 +1260,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1276
1260
|
|
|
1277
1261
|
// src/actions/gitlint-fix.ts
|
|
1278
1262
|
import { execSync as execSync2 } from "node:child_process";
|
|
1279
|
-
import
|
|
1263
|
+
import chalk22 from "chalk";
|
|
1280
1264
|
import ParseGitConfig2 from "parse-git-config";
|
|
1281
1265
|
var gitlintFix = () => {
|
|
1282
1266
|
console.log(`
|
|
@@ -1285,15 +1269,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1285
1269
|
const gitConfig = ParseGitConfig2.sync();
|
|
1286
1270
|
if (gitConfig.core.ignorecase) {
|
|
1287
1271
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1288
|
-
console.warn(
|
|
1272
|
+
console.warn(chalk22.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1289
1273
|
}
|
|
1290
1274
|
if (gitConfig.core.autocrlf !== false) {
|
|
1291
1275
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1292
|
-
console.warn(
|
|
1276
|
+
console.warn(chalk22.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1293
1277
|
}
|
|
1294
1278
|
if (gitConfig.core.eol !== "lf") {
|
|
1295
1279
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1296
|
-
console.warn(
|
|
1280
|
+
console.warn(chalk22.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1297
1281
|
}
|
|
1298
1282
|
return 1;
|
|
1299
1283
|
};
|
|
@@ -1304,7 +1288,7 @@ var knip = () => {
|
|
|
1304
1288
|
};
|
|
1305
1289
|
|
|
1306
1290
|
// src/actions/license.ts
|
|
1307
|
-
import
|
|
1291
|
+
import chalk23 from "chalk";
|
|
1308
1292
|
import { init } from "license-checker";
|
|
1309
1293
|
var license = async (pkg) => {
|
|
1310
1294
|
const workspaces = yarnWorkspaces();
|
|
@@ -1329,18 +1313,18 @@ var license = async (pkg) => {
|
|
|
1329
1313
|
"LGPL-3.0-or-later",
|
|
1330
1314
|
"Python-2.0"
|
|
1331
1315
|
]);
|
|
1332
|
-
console.log(
|
|
1316
|
+
console.log(chalk23.green("License Checker"));
|
|
1333
1317
|
return (await Promise.all(
|
|
1334
1318
|
workspaceList.map(({ location, name }) => {
|
|
1335
1319
|
return new Promise((resolve) => {
|
|
1336
1320
|
init({ production: true, start: location }, (error, packages) => {
|
|
1337
1321
|
if (error) {
|
|
1338
|
-
console.error(
|
|
1339
|
-
console.error(
|
|
1322
|
+
console.error(chalk23.red(`License Checker [${name}] Error`));
|
|
1323
|
+
console.error(chalk23.gray(error));
|
|
1340
1324
|
console.log("\n");
|
|
1341
1325
|
resolve(1);
|
|
1342
1326
|
} else {
|
|
1343
|
-
console.log(
|
|
1327
|
+
console.log(chalk23.green(`License Checker [${name}]`));
|
|
1344
1328
|
let count = 0;
|
|
1345
1329
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1346
1330
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1356,7 +1340,7 @@ var license = async (pkg) => {
|
|
|
1356
1340
|
}
|
|
1357
1341
|
if (!orLicenseFound) {
|
|
1358
1342
|
count++;
|
|
1359
|
-
console.warn(
|
|
1343
|
+
console.warn(chalk23.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1360
1344
|
}
|
|
1361
1345
|
}
|
|
1362
1346
|
}
|
|
@@ -1376,12 +1360,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
1376
1360
|
|
|
1377
1361
|
// src/actions/package/clean-outputs.ts
|
|
1378
1362
|
import path5 from "node:path";
|
|
1379
|
-
import
|
|
1363
|
+
import chalk24 from "chalk";
|
|
1380
1364
|
var packageCleanOutputs = () => {
|
|
1381
1365
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1382
1366
|
const pkgName = process.env.npm_package_name;
|
|
1383
1367
|
const folders = [path5.join(pkg, "dist"), path5.join(pkg, "build"), path5.join(pkg, "docs")];
|
|
1384
|
-
console.log(
|
|
1368
|
+
console.log(chalk24.green(`Cleaning Outputs [${pkgName}]`));
|
|
1385
1369
|
for (let folder of folders) {
|
|
1386
1370
|
deleteGlob(folder);
|
|
1387
1371
|
}
|
|
@@ -1390,11 +1374,11 @@ var packageCleanOutputs = () => {
|
|
|
1390
1374
|
|
|
1391
1375
|
// src/actions/package/clean-typescript.ts
|
|
1392
1376
|
import path6 from "node:path";
|
|
1393
|
-
import
|
|
1377
|
+
import chalk25 from "chalk";
|
|
1394
1378
|
var packageCleanTypescript = () => {
|
|
1395
1379
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1396
1380
|
const pkgName = process.env.npm_package_name;
|
|
1397
|
-
console.log(
|
|
1381
|
+
console.log(chalk25.green(`Cleaning Typescript [${pkgName}]`));
|
|
1398
1382
|
const files = [path6.join(pkg, "*.tsbuildinfo"), path6.join(pkg, ".tsconfig.*"), path6.join(pkg, ".eslintcache")];
|
|
1399
1383
|
for (let file of files) {
|
|
1400
1384
|
deleteGlob(file);
|
|
@@ -1408,19 +1392,19 @@ var packageClean = async () => {
|
|
|
1408
1392
|
};
|
|
1409
1393
|
|
|
1410
1394
|
// src/actions/package/compile/compile.ts
|
|
1411
|
-
import
|
|
1395
|
+
import chalk29 from "chalk";
|
|
1412
1396
|
|
|
1413
1397
|
// src/actions/package/publint.ts
|
|
1414
1398
|
import { promises as fs4 } from "node:fs";
|
|
1415
|
-
import
|
|
1399
|
+
import chalk26 from "chalk";
|
|
1416
1400
|
import sortPackageJson from "sort-package-json";
|
|
1417
1401
|
var packagePublint = async (params) => {
|
|
1418
1402
|
const pkgDir = process.env.INIT_CWD;
|
|
1419
1403
|
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1420
1404
|
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1421
1405
|
const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1422
|
-
console.log(
|
|
1423
|
-
console.log(
|
|
1406
|
+
console.log(chalk26.green(`Publint: ${pkg.name}`));
|
|
1407
|
+
console.log(chalk26.gray(pkgDir));
|
|
1424
1408
|
const { publint: publint2 } = await import("publint");
|
|
1425
1409
|
const { messages } = await publint2({
|
|
1426
1410
|
level: "suggestion",
|
|
@@ -1435,21 +1419,21 @@ var packagePublint = async (params) => {
|
|
|
1435
1419
|
for (const message of validMessages) {
|
|
1436
1420
|
switch (message.type) {
|
|
1437
1421
|
case "error": {
|
|
1438
|
-
console.error(
|
|
1422
|
+
console.error(chalk26.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1439
1423
|
break;
|
|
1440
1424
|
}
|
|
1441
1425
|
case "warning": {
|
|
1442
|
-
console.warn(
|
|
1426
|
+
console.warn(chalk26.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1443
1427
|
break;
|
|
1444
1428
|
}
|
|
1445
1429
|
default: {
|
|
1446
|
-
console.log(
|
|
1430
|
+
console.log(chalk26.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1447
1431
|
break;
|
|
1448
1432
|
}
|
|
1449
1433
|
}
|
|
1450
1434
|
}
|
|
1451
1435
|
if (params?.verbose) {
|
|
1452
|
-
console.log(
|
|
1436
|
+
console.log(chalk26.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1453
1437
|
}
|
|
1454
1438
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1455
1439
|
};
|
|
@@ -1486,7 +1470,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
1486
1470
|
|
|
1487
1471
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1488
1472
|
import { cwd } from "node:process";
|
|
1489
|
-
import
|
|
1473
|
+
import chalk27 from "chalk";
|
|
1490
1474
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1491
1475
|
import {
|
|
1492
1476
|
DiagnosticCategory,
|
|
@@ -1541,7 +1525,7 @@ var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam
|
|
|
1541
1525
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1542
1526
|
const excludes = [".stories.", ".spec."];
|
|
1543
1527
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1544
|
-
console.log(
|
|
1528
|
+
console.log(chalk27.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1545
1529
|
if (files.length > 0) {
|
|
1546
1530
|
const program = createProgramFromConfig({
|
|
1547
1531
|
basePath: pkg ?? cwd(),
|
|
@@ -1598,7 +1582,7 @@ function deepMergeObjects(objects) {
|
|
|
1598
1582
|
|
|
1599
1583
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1600
1584
|
import { cwd as cwd2 } from "node:process";
|
|
1601
|
-
import
|
|
1585
|
+
import chalk28 from "chalk";
|
|
1602
1586
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1603
1587
|
import {
|
|
1604
1588
|
DiagnosticCategory as DiagnosticCategory2,
|
|
@@ -1624,7 +1608,7 @@ var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) =>
|
|
|
1624
1608
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1625
1609
|
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1626
1610
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1627
|
-
console.log(
|
|
1611
|
+
console.log(chalk28.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1628
1612
|
if (files.length > 0) {
|
|
1629
1613
|
const program = createProgramFromConfig2({
|
|
1630
1614
|
basePath: pkg ?? cwd2(),
|
|
@@ -1775,7 +1759,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1775
1759
|
// src/actions/package/compile/compile.ts
|
|
1776
1760
|
var packageCompile = async (inConfig = {}) => {
|
|
1777
1761
|
const pkg = process.env.INIT_CWD;
|
|
1778
|
-
console.log(
|
|
1762
|
+
console.log(chalk29.green(`Compiling ${pkg}`));
|
|
1779
1763
|
const config2 = await loadConfig(inConfig);
|
|
1780
1764
|
const publint2 = config2.publint;
|
|
1781
1765
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1787,7 +1771,7 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1787
1771
|
|
|
1788
1772
|
// src/actions/package/copy-assets.ts
|
|
1789
1773
|
import path7 from "node:path/posix";
|
|
1790
|
-
import
|
|
1774
|
+
import chalk30 from "chalk";
|
|
1791
1775
|
import cpy2 from "cpy";
|
|
1792
1776
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1793
1777
|
try {
|
|
@@ -1800,7 +1784,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1800
1784
|
}
|
|
1801
1785
|
);
|
|
1802
1786
|
if (values.length > 0) {
|
|
1803
|
-
console.log(
|
|
1787
|
+
console.log(chalk30.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1804
1788
|
}
|
|
1805
1789
|
for (const value of values) {
|
|
1806
1790
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1869,7 +1853,7 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1869
1853
|
// src/actions/package/gen-docs.ts
|
|
1870
1854
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1871
1855
|
import path8 from "node:path";
|
|
1872
|
-
import
|
|
1856
|
+
import chalk31 from "chalk";
|
|
1873
1857
|
import {
|
|
1874
1858
|
Application,
|
|
1875
1859
|
ArgumentsReader,
|
|
@@ -1973,7 +1957,7 @@ var runTypeDoc = async (app) => {
|
|
|
1973
1957
|
return ExitCodes.OutputError;
|
|
1974
1958
|
}
|
|
1975
1959
|
}
|
|
1976
|
-
console.log(
|
|
1960
|
+
console.log(chalk31.green(`${pkgName} - Ok`));
|
|
1977
1961
|
return ExitCodes.Ok;
|
|
1978
1962
|
};
|
|
1979
1963
|
|
|
@@ -1982,7 +1966,7 @@ import { readdirSync } from "node:fs";
|
|
|
1982
1966
|
import path9 from "node:path";
|
|
1983
1967
|
import { cwd as cwd3 } from "node:process";
|
|
1984
1968
|
import { pathToFileURL } from "node:url";
|
|
1985
|
-
import
|
|
1969
|
+
import chalk32 from "chalk";
|
|
1986
1970
|
import { ESLint } from "eslint";
|
|
1987
1971
|
import { findUp } from "find-up";
|
|
1988
1972
|
import picomatch from "picomatch";
|
|
@@ -1991,14 +1975,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1991
1975
|
const severity = ["none", "warning", "error"];
|
|
1992
1976
|
for (const lintResult of lintResults) {
|
|
1993
1977
|
if (lintResult.messages.length > 0) {
|
|
1994
|
-
console.log(
|
|
1978
|
+
console.log(chalk32.gray(`
|
|
1995
1979
|
${lintResult.filePath}`));
|
|
1996
1980
|
for (const message of lintResult.messages) {
|
|
1997
1981
|
console.log(
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1982
|
+
chalk32.gray(` ${message.line}:${message.column}`),
|
|
1983
|
+
chalk32[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1984
|
+
chalk32.white(` ${message.message}`),
|
|
1985
|
+
chalk32.gray(` ${message.ruleId}`)
|
|
2002
1986
|
);
|
|
2003
1987
|
}
|
|
2004
1988
|
}
|
|
@@ -2037,7 +2021,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2037
2021
|
});
|
|
2038
2022
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2039
2023
|
if (verbose) {
|
|
2040
|
-
console.log(
|
|
2024
|
+
console.log(chalk32.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2041
2025
|
}
|
|
2042
2026
|
const lintResults = await engine.lintFiles(files);
|
|
2043
2027
|
dumpMessages(lintResults);
|
|
@@ -2047,7 +2031,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2047
2031
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2048
2032
|
const lintTime = Date.now() - start;
|
|
2049
2033
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2050
|
-
console.log(
|
|
2034
|
+
console.log(chalk32.white(`Linted ${chalk32[filesCountColor](files.length)} files in ${chalk32[lintTimeColor](lintTime)}ms`));
|
|
2051
2035
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2052
2036
|
};
|
|
2053
2037
|
|
|
@@ -2077,7 +2061,7 @@ var rebuild = ({ target }) => {
|
|
|
2077
2061
|
};
|
|
2078
2062
|
|
|
2079
2063
|
// src/actions/recompile.ts
|
|
2080
|
-
import
|
|
2064
|
+
import chalk33 from "chalk";
|
|
2081
2065
|
var recompile = async ({
|
|
2082
2066
|
verbose,
|
|
2083
2067
|
target,
|
|
@@ -2113,7 +2097,7 @@ var recompileAll = async ({
|
|
|
2113
2097
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2114
2098
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2115
2099
|
if (jobs) {
|
|
2116
|
-
console.log(
|
|
2100
|
+
console.log(chalk33.blue(`Jobs set to [${jobs}]`));
|
|
2117
2101
|
}
|
|
2118
2102
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2119
2103
|
[
|
|
@@ -2144,7 +2128,7 @@ var recompileAll = async ({
|
|
|
2144
2128
|
]
|
|
2145
2129
|
]);
|
|
2146
2130
|
console.log(
|
|
2147
|
-
`${
|
|
2131
|
+
`${chalk33.gray("Recompiled in")} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`
|
|
2148
2132
|
);
|
|
2149
2133
|
return result;
|
|
2150
2134
|
};
|
|
@@ -2175,9 +2159,9 @@ var reinstall = () => {
|
|
|
2175
2159
|
};
|
|
2176
2160
|
|
|
2177
2161
|
// src/actions/relint.ts
|
|
2178
|
-
import
|
|
2162
|
+
import chalk34 from "chalk";
|
|
2179
2163
|
var relintPackage = ({ pkg }) => {
|
|
2180
|
-
console.log(
|
|
2164
|
+
console.log(chalk34.gray(`${"Relint"} [All-Packages]`));
|
|
2181
2165
|
const start = Date.now();
|
|
2182
2166
|
const result = runSteps("Relint [All-Packages]", [
|
|
2183
2167
|
["yarn", [
|
|
@@ -2187,7 +2171,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
2187
2171
|
"package-relint"
|
|
2188
2172
|
]]
|
|
2189
2173
|
]);
|
|
2190
|
-
console.log(
|
|
2174
|
+
console.log(chalk34.gray(`${"Relinted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2191
2175
|
return result;
|
|
2192
2176
|
};
|
|
2193
2177
|
var relint = ({
|
|
@@ -2198,7 +2182,7 @@ var relint = ({
|
|
|
2198
2182
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2199
2183
|
};
|
|
2200
2184
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2201
|
-
console.log(
|
|
2185
|
+
console.log(chalk34.gray(`${"Relint"} [All-Packages]`));
|
|
2202
2186
|
const start = Date.now();
|
|
2203
2187
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2204
2188
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -2212,7 +2196,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
2212
2196
|
"package-relint"
|
|
2213
2197
|
]]
|
|
2214
2198
|
]);
|
|
2215
|
-
console.log(
|
|
2199
|
+
console.log(chalk34.gray(`Relinted in [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2216
2200
|
return result;
|
|
2217
2201
|
};
|
|
2218
2202
|
|
|
@@ -2230,10 +2214,10 @@ var sonar = () => {
|
|
|
2230
2214
|
};
|
|
2231
2215
|
|
|
2232
2216
|
// src/actions/statics.ts
|
|
2233
|
-
import
|
|
2217
|
+
import chalk35 from "chalk";
|
|
2234
2218
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2235
2219
|
var statics = () => {
|
|
2236
|
-
console.log(
|
|
2220
|
+
console.log(chalk35.green("Check Required Static Dependencies"));
|
|
2237
2221
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2238
2222
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2239
2223
|
};
|
|
@@ -2290,7 +2274,7 @@ var loadPackageConfig = async () => {
|
|
|
2290
2274
|
};
|
|
2291
2275
|
|
|
2292
2276
|
// src/xy/xy.ts
|
|
2293
|
-
import
|
|
2277
|
+
import chalk37 from "chalk";
|
|
2294
2278
|
|
|
2295
2279
|
// src/xy/xyBuildCommands.ts
|
|
2296
2280
|
var xyBuildCommands = (args) => {
|
|
@@ -2651,7 +2635,7 @@ var xyInstallCommands = (args) => {
|
|
|
2651
2635
|
};
|
|
2652
2636
|
|
|
2653
2637
|
// src/xy/xyLintCommands.ts
|
|
2654
|
-
import
|
|
2638
|
+
import chalk36 from "chalk";
|
|
2655
2639
|
var xyLintCommands = (args) => {
|
|
2656
2640
|
return args.command(
|
|
2657
2641
|
"cycle [package]",
|
|
@@ -2663,7 +2647,7 @@ var xyLintCommands = (args) => {
|
|
|
2663
2647
|
const start = Date.now();
|
|
2664
2648
|
if (argv.verbose) console.log("Cycle");
|
|
2665
2649
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2666
|
-
console.log(
|
|
2650
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2667
2651
|
}
|
|
2668
2652
|
).command(
|
|
2669
2653
|
"lint [package]",
|
|
@@ -2685,7 +2669,7 @@ var xyLintCommands = (args) => {
|
|
|
2685
2669
|
if (argv.verbose) console.log("Lint");
|
|
2686
2670
|
const start = Date.now();
|
|
2687
2671
|
process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
|
|
2688
|
-
console.log(
|
|
2672
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2689
2673
|
}
|
|
2690
2674
|
).command(
|
|
2691
2675
|
"deplint [package]",
|
|
@@ -2717,7 +2701,7 @@ var xyLintCommands = (args) => {
|
|
|
2717
2701
|
devDeps: !!argv.devDeps,
|
|
2718
2702
|
peerDeps: !!argv.peerDeps
|
|
2719
2703
|
});
|
|
2720
|
-
console.log(
|
|
2704
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2721
2705
|
}
|
|
2722
2706
|
).command(
|
|
2723
2707
|
"fix [package]",
|
|
@@ -2729,7 +2713,7 @@ var xyLintCommands = (args) => {
|
|
|
2729
2713
|
const start = Date.now();
|
|
2730
2714
|
if (argv.verbose) console.log("Fix");
|
|
2731
2715
|
process.exitCode = fix();
|
|
2732
|
-
console.log(
|
|
2716
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2733
2717
|
}
|
|
2734
2718
|
).command(
|
|
2735
2719
|
"relint [package]",
|
|
@@ -2741,7 +2725,7 @@ var xyLintCommands = (args) => {
|
|
|
2741
2725
|
if (argv.verbose) console.log("Relinting");
|
|
2742
2726
|
const start = Date.now();
|
|
2743
2727
|
process.exitCode = relint();
|
|
2744
|
-
console.log(
|
|
2728
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2745
2729
|
}
|
|
2746
2730
|
).command(
|
|
2747
2731
|
"publint [package]",
|
|
@@ -2753,7 +2737,7 @@ var xyLintCommands = (args) => {
|
|
|
2753
2737
|
if (argv.verbose) console.log("Publint");
|
|
2754
2738
|
const start = Date.now();
|
|
2755
2739
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2756
|
-
console.log(
|
|
2740
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2757
2741
|
}
|
|
2758
2742
|
).command(
|
|
2759
2743
|
"knip",
|
|
@@ -2765,7 +2749,7 @@ var xyLintCommands = (args) => {
|
|
|
2765
2749
|
if (argv.verbose) console.log("Knip");
|
|
2766
2750
|
const start = Date.now();
|
|
2767
2751
|
process.exitCode = knip();
|
|
2768
|
-
console.log(
|
|
2752
|
+
console.log(chalk36.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2769
2753
|
}
|
|
2770
2754
|
).command(
|
|
2771
2755
|
"sonar",
|
|
@@ -2777,7 +2761,7 @@ var xyLintCommands = (args) => {
|
|
|
2777
2761
|
const start = Date.now();
|
|
2778
2762
|
if (argv.verbose) console.log("Sonar Check");
|
|
2779
2763
|
process.exitCode = sonar();
|
|
2780
|
-
console.log(
|
|
2764
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
2781
2765
|
}
|
|
2782
2766
|
);
|
|
2783
2767
|
};
|
|
@@ -2813,8 +2797,8 @@ var xyParseOptions = () => {
|
|
|
2813
2797
|
var xy = async () => {
|
|
2814
2798
|
const options = xyParseOptions();
|
|
2815
2799
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2816
|
-
console.error(
|
|
2817
|
-
console.log(
|
|
2800
|
+
console.error(chalk37.yellow(`Command not found [${chalk37.magenta(process.argv[2])}]`));
|
|
2801
|
+
console.log(chalk37.gray("Try 'yarn xy --help' for list of commands"));
|
|
2818
2802
|
}).version().help().argv;
|
|
2819
2803
|
};
|
|
2820
2804
|
export {
|