@xylabs/ts-scripts-yarn3 6.3.2 → 6.3.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/build.mjs +0 -11
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/cycle.mjs +42 -44
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/index.mjs +106 -119
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +4 -4
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/index.mjs +4 -4
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +4 -4
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/xy.mjs +87 -100
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +119 -132
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +87 -100
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +87 -100
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +0 -11
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +62 -64
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -566,17 +566,6 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
|
|
|
566
566
|
"tsup"
|
|
567
567
|
]
|
|
568
568
|
],
|
|
569
|
-
[
|
|
570
|
-
"yarn",
|
|
571
|
-
[
|
|
572
|
-
"xy",
|
|
573
|
-
"cycle",
|
|
574
|
-
...pkgOptions,
|
|
575
|
-
...verboseOptions,
|
|
576
|
-
...jobsOptions,
|
|
577
|
-
...incrementalOptions
|
|
578
|
-
]
|
|
579
|
-
],
|
|
580
569
|
[
|
|
581
570
|
"yarn",
|
|
582
571
|
[
|
|
@@ -881,15 +870,13 @@ var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
|
|
|
881
870
|
}, "copyAssets");
|
|
882
871
|
|
|
883
872
|
// src/actions/cycle.ts
|
|
884
|
-
import
|
|
885
|
-
var cycle = /* @__PURE__ */ __name(({ verbose, pkg
|
|
873
|
+
import { cruise } from "dependency-cruiser";
|
|
874
|
+
var cycle = /* @__PURE__ */ __name(async ({ verbose, pkg } = {}) => {
|
|
886
875
|
return pkg ? cyclePackage({
|
|
887
876
|
pkg,
|
|
888
877
|
verbose
|
|
889
|
-
}) : cycleAll({
|
|
890
|
-
|
|
891
|
-
verbose,
|
|
892
|
-
jobs
|
|
878
|
+
}) : await cycleAll({
|
|
879
|
+
verbose
|
|
893
880
|
});
|
|
894
881
|
}, "cycle");
|
|
895
882
|
var cyclePackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
|
|
@@ -911,45 +898,45 @@ var cyclePackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
|
|
|
911
898
|
]
|
|
912
899
|
]);
|
|
913
900
|
}, "cyclePackage");
|
|
914
|
-
var cycleAll = /* @__PURE__ */ __name(({
|
|
915
|
-
const
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
];
|
|
929
|
-
const jobsOptions = jobs ? [
|
|
930
|
-
"-j",
|
|
931
|
-
`${jobs}`
|
|
932
|
-
] : [];
|
|
933
|
-
if (jobs) {
|
|
934
|
-
console.log(chalk14.blue(`Jobs set to [${jobs}]`));
|
|
935
|
-
}
|
|
936
|
-
const result = runSteps(`Cycle${incremental ? "-Incremental" : ""} [All]`, [
|
|
937
|
-
[
|
|
938
|
-
"yarn",
|
|
939
|
-
[
|
|
940
|
-
"workspaces",
|
|
941
|
-
"foreach",
|
|
942
|
-
...incrementalOptions,
|
|
943
|
-
...jobsOptions,
|
|
944
|
-
...verboseOptions,
|
|
945
|
-
"run",
|
|
946
|
-
"package-cycle",
|
|
947
|
-
...verboseOptions
|
|
901
|
+
var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
902
|
+
const pkgName = process.env.npm_package_name;
|
|
903
|
+
const cruiseOptions = {
|
|
904
|
+
ruleSet: {
|
|
905
|
+
forbidden: [
|
|
906
|
+
{
|
|
907
|
+
name: "no-circular",
|
|
908
|
+
severity: "error",
|
|
909
|
+
comment: "This dependency creates a circular reference",
|
|
910
|
+
from: {},
|
|
911
|
+
to: {
|
|
912
|
+
circular: true
|
|
913
|
+
}
|
|
914
|
+
}
|
|
948
915
|
]
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
916
|
+
},
|
|
917
|
+
exclude: "node_modules|packages/.*/packages",
|
|
918
|
+
validate: true,
|
|
919
|
+
doNotFollow: {
|
|
920
|
+
path: "node_modules|packages/.*/packages"
|
|
921
|
+
},
|
|
922
|
+
tsPreCompilationDeps: false,
|
|
923
|
+
combinedDependencies: true,
|
|
924
|
+
outputType: verbose ? "text" : "err"
|
|
925
|
+
};
|
|
926
|
+
const target = "**/src";
|
|
927
|
+
console.log(`Checking for circular dependencies in ${target}...`);
|
|
928
|
+
const result = await cruise([
|
|
929
|
+
target
|
|
930
|
+
], cruiseOptions);
|
|
931
|
+
if (result.output) {
|
|
932
|
+
console.log(result.output);
|
|
933
|
+
}
|
|
934
|
+
if (result.exitCode === 0) {
|
|
935
|
+
console.log(`${pkgName} \u2705 No dependency violations`);
|
|
936
|
+
} else {
|
|
937
|
+
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
938
|
+
}
|
|
939
|
+
return result.exitCode;
|
|
953
940
|
}, "cycleAll");
|
|
954
941
|
|
|
955
942
|
// src/actions/dead.ts
|
|
@@ -1071,18 +1058,18 @@ var deployNext = /* @__PURE__ */ __name(() => {
|
|
|
1071
1058
|
}, "deployNext");
|
|
1072
1059
|
|
|
1073
1060
|
// src/actions/dupdeps.ts
|
|
1074
|
-
import
|
|
1061
|
+
import chalk14 from "chalk";
|
|
1075
1062
|
var dupdeps = /* @__PURE__ */ __name(() => {
|
|
1076
|
-
console.log(
|
|
1063
|
+
console.log(chalk14.green("Checking all Dependencies for Duplicates"));
|
|
1077
1064
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1078
1065
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1079
1066
|
return detectDuplicateDependencies(dependencies);
|
|
1080
1067
|
}, "dupdeps");
|
|
1081
1068
|
|
|
1082
1069
|
// src/actions/lint.ts
|
|
1083
|
-
import
|
|
1070
|
+
import chalk15 from "chalk";
|
|
1084
1071
|
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
1085
|
-
console.log(
|
|
1072
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1086
1073
|
const start = Date.now();
|
|
1087
1074
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1088
1075
|
[
|
|
@@ -1095,7 +1082,7 @@ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
|
1095
1082
|
]
|
|
1096
1083
|
]
|
|
1097
1084
|
]);
|
|
1098
|
-
console.log(
|
|
1085
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1099
1086
|
return result;
|
|
1100
1087
|
}, "lintPackage");
|
|
1101
1088
|
var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
@@ -1109,7 +1096,7 @@ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}
|
|
|
1109
1096
|
});
|
|
1110
1097
|
}, "lint");
|
|
1111
1098
|
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
|
|
1112
|
-
console.log(
|
|
1099
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1113
1100
|
const start = Date.now();
|
|
1114
1101
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1115
1102
|
[
|
|
@@ -1119,7 +1106,7 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
|
|
|
1119
1106
|
]
|
|
1120
1107
|
]
|
|
1121
1108
|
]);
|
|
1122
|
-
console.log(
|
|
1109
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1123
1110
|
return result;
|
|
1124
1111
|
}, "lintAllPackages");
|
|
1125
1112
|
|
|
@@ -1184,7 +1171,7 @@ var filename = ".gitignore";
|
|
|
1184
1171
|
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
1185
1172
|
|
|
1186
1173
|
// src/actions/gitlint.ts
|
|
1187
|
-
import
|
|
1174
|
+
import chalk16 from "chalk";
|
|
1188
1175
|
import ParseGitConfig from "parse-git-config";
|
|
1189
1176
|
var gitlint = /* @__PURE__ */ __name(() => {
|
|
1190
1177
|
console.log(`
|
|
@@ -1195,7 +1182,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1195
1182
|
const errors = 0;
|
|
1196
1183
|
const gitConfig = ParseGitConfig.sync();
|
|
1197
1184
|
const warn = /* @__PURE__ */ __name((message) => {
|
|
1198
|
-
console.warn(
|
|
1185
|
+
console.warn(chalk16.yellow(`Warning: ${message}`));
|
|
1199
1186
|
warnings++;
|
|
1200
1187
|
}, "warn");
|
|
1201
1188
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1215,13 +1202,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1215
1202
|
}
|
|
1216
1203
|
const resultMessages = [];
|
|
1217
1204
|
if (valid > 0) {
|
|
1218
|
-
resultMessages.push(
|
|
1205
|
+
resultMessages.push(chalk16.green(`Passed: ${valid}`));
|
|
1219
1206
|
}
|
|
1220
1207
|
if (warnings > 0) {
|
|
1221
|
-
resultMessages.push(
|
|
1208
|
+
resultMessages.push(chalk16.yellow(`Warnings: ${warnings}`));
|
|
1222
1209
|
}
|
|
1223
1210
|
if (errors > 0) {
|
|
1224
|
-
resultMessages.push(
|
|
1211
|
+
resultMessages.push(chalk16.red(` Errors: ${errors}`));
|
|
1225
1212
|
}
|
|
1226
1213
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1227
1214
|
`);
|
|
@@ -1230,7 +1217,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1230
1217
|
|
|
1231
1218
|
// src/actions/gitlint-fix.ts
|
|
1232
1219
|
import { execSync as execSync2 } from "node:child_process";
|
|
1233
|
-
import
|
|
1220
|
+
import chalk17 from "chalk";
|
|
1234
1221
|
import ParseGitConfig2 from "parse-git-config";
|
|
1235
1222
|
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1236
1223
|
console.log(`
|
|
@@ -1241,19 +1228,19 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1241
1228
|
execSync2("git config core.ignorecase false", {
|
|
1242
1229
|
stdio: "inherit"
|
|
1243
1230
|
});
|
|
1244
|
-
console.warn(
|
|
1231
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1245
1232
|
}
|
|
1246
1233
|
if (gitConfig.core.autocrlf !== false) {
|
|
1247
1234
|
execSync2("git config core.autocrlf false", {
|
|
1248
1235
|
stdio: "inherit"
|
|
1249
1236
|
});
|
|
1250
|
-
console.warn(
|
|
1237
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1251
1238
|
}
|
|
1252
1239
|
if (gitConfig.core.eol !== "lf") {
|
|
1253
1240
|
execSync2("git config core.eol lf", {
|
|
1254
1241
|
stdio: "inherit"
|
|
1255
1242
|
});
|
|
1256
|
-
console.warn(
|
|
1243
|
+
console.warn(chalk17.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1257
1244
|
}
|
|
1258
1245
|
return 1;
|
|
1259
1246
|
}, "gitlintFix");
|
|
@@ -1273,7 +1260,7 @@ var knip = /* @__PURE__ */ __name(() => {
|
|
|
1273
1260
|
}, "knip");
|
|
1274
1261
|
|
|
1275
1262
|
// src/actions/license.ts
|
|
1276
|
-
import
|
|
1263
|
+
import chalk18 from "chalk";
|
|
1277
1264
|
import { init } from "license-checker";
|
|
1278
1265
|
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1279
1266
|
const workspaces = yarnWorkspaces();
|
|
@@ -1298,7 +1285,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1298
1285
|
"LGPL-3.0-or-later",
|
|
1299
1286
|
"Python-2.0"
|
|
1300
1287
|
]);
|
|
1301
|
-
console.log(
|
|
1288
|
+
console.log(chalk18.green("License Checker"));
|
|
1302
1289
|
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1303
1290
|
return new Promise((resolve) => {
|
|
1304
1291
|
init({
|
|
@@ -1306,12 +1293,12 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1306
1293
|
start: location
|
|
1307
1294
|
}, (error, packages) => {
|
|
1308
1295
|
if (error) {
|
|
1309
|
-
console.error(
|
|
1310
|
-
console.error(
|
|
1296
|
+
console.error(chalk18.red(`License Checker [${name}] Error`));
|
|
1297
|
+
console.error(chalk18.gray(error));
|
|
1311
1298
|
console.log("\n");
|
|
1312
1299
|
resolve(1);
|
|
1313
1300
|
} else {
|
|
1314
|
-
console.log(
|
|
1301
|
+
console.log(chalk18.green(`License Checker [${name}]`));
|
|
1315
1302
|
let count = 0;
|
|
1316
1303
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1317
1304
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
@@ -1329,7 +1316,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1329
1316
|
}
|
|
1330
1317
|
if (!orLicenseFound) {
|
|
1331
1318
|
count++;
|
|
1332
|
-
console.warn(
|
|
1319
|
+
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1333
1320
|
}
|
|
1334
1321
|
}
|
|
1335
1322
|
}
|
|
@@ -1348,7 +1335,7 @@ var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2
|
|
|
1348
1335
|
|
|
1349
1336
|
// src/actions/package/clean-outputs.ts
|
|
1350
1337
|
import path3 from "node:path";
|
|
1351
|
-
import
|
|
1338
|
+
import chalk19 from "chalk";
|
|
1352
1339
|
var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
1353
1340
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1354
1341
|
const pkgName = process.env.npm_package_name;
|
|
@@ -1357,7 +1344,7 @@ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
|
1357
1344
|
path3.join(pkg, "build"),
|
|
1358
1345
|
path3.join(pkg, "docs")
|
|
1359
1346
|
];
|
|
1360
|
-
console.log(
|
|
1347
|
+
console.log(chalk19.green(`Cleaning Outputs [${pkgName}]`));
|
|
1361
1348
|
for (let folder of folders) {
|
|
1362
1349
|
deleteGlob(folder);
|
|
1363
1350
|
}
|
|
@@ -1366,11 +1353,11 @@ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
|
1366
1353
|
|
|
1367
1354
|
// src/actions/package/clean-typescript.ts
|
|
1368
1355
|
import path4 from "node:path";
|
|
1369
|
-
import
|
|
1356
|
+
import chalk20 from "chalk";
|
|
1370
1357
|
var packageCleanTypescript = /* @__PURE__ */ __name(() => {
|
|
1371
1358
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1372
1359
|
const pkgName = process.env.npm_package_name;
|
|
1373
|
-
console.log(
|
|
1360
|
+
console.log(chalk20.green(`Cleaning Typescript [${pkgName}]`));
|
|
1374
1361
|
const files = [
|
|
1375
1362
|
path4.join(pkg, "*.tsbuildinfo"),
|
|
1376
1363
|
path4.join(pkg, ".tsconfig.*"),
|
|
@@ -1391,19 +1378,19 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
1391
1378
|
}, "packageClean");
|
|
1392
1379
|
|
|
1393
1380
|
// src/actions/package/compile/compile.ts
|
|
1394
|
-
import
|
|
1381
|
+
import chalk24 from "chalk";
|
|
1395
1382
|
|
|
1396
1383
|
// src/actions/package/publint.ts
|
|
1397
1384
|
import { promises as fs2 } from "node:fs";
|
|
1398
|
-
import
|
|
1385
|
+
import chalk21 from "chalk";
|
|
1399
1386
|
import sortPackageJson from "sort-package-json";
|
|
1400
1387
|
var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
1401
1388
|
const pkgDir = process.env.INIT_CWD;
|
|
1402
1389
|
const sortedPkg = sortPackageJson(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1403
1390
|
await fs2.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1404
1391
|
const pkg = JSON.parse(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1405
|
-
console.log(
|
|
1406
|
-
console.log(
|
|
1392
|
+
console.log(chalk21.green(`Publint: ${pkg.name}`));
|
|
1393
|
+
console.log(chalk21.gray(pkgDir));
|
|
1407
1394
|
const { publint: publint2 } = await import("publint");
|
|
1408
1395
|
const { messages } = await publint2({
|
|
1409
1396
|
level: "suggestion",
|
|
@@ -1418,21 +1405,21 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1418
1405
|
for (const message of validMessages) {
|
|
1419
1406
|
switch (message.type) {
|
|
1420
1407
|
case "error": {
|
|
1421
|
-
console.error(
|
|
1408
|
+
console.error(chalk21.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1422
1409
|
break;
|
|
1423
1410
|
}
|
|
1424
1411
|
case "warning": {
|
|
1425
|
-
console.warn(
|
|
1412
|
+
console.warn(chalk21.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1426
1413
|
break;
|
|
1427
1414
|
}
|
|
1428
1415
|
default: {
|
|
1429
|
-
console.log(
|
|
1416
|
+
console.log(chalk21.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1430
1417
|
break;
|
|
1431
1418
|
}
|
|
1432
1419
|
}
|
|
1433
1420
|
}
|
|
1434
1421
|
if (params?.verbose) {
|
|
1435
|
-
console.log(
|
|
1422
|
+
console.log(chalk21.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1436
1423
|
}
|
|
1437
1424
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1438
1425
|
}, "packagePublint");
|
|
@@ -1476,7 +1463,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1476
1463
|
|
|
1477
1464
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1478
1465
|
import { cwd } from "node:process";
|
|
1479
|
-
import
|
|
1466
|
+
import chalk22 from "chalk";
|
|
1480
1467
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1481
1468
|
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
1482
1469
|
|
|
@@ -1533,7 +1520,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1533
1520
|
".spec."
|
|
1534
1521
|
];
|
|
1535
1522
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1536
|
-
console.log(
|
|
1523
|
+
console.log(chalk22.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1537
1524
|
if (files.length > 0) {
|
|
1538
1525
|
const program = createProgramFromConfig({
|
|
1539
1526
|
basePath: pkg ?? cwd(),
|
|
@@ -1595,7 +1582,7 @@ __name(deepMergeObjects, "deepMergeObjects");
|
|
|
1595
1582
|
|
|
1596
1583
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1597
1584
|
import { cwd as cwd2 } from "node:process";
|
|
1598
|
-
import
|
|
1585
|
+
import chalk23 from "chalk";
|
|
1599
1586
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1600
1587
|
import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2, getPreEmitDiagnostics as getPreEmitDiagnostics2, sys as sys3 } from "typescript";
|
|
1601
1588
|
var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
@@ -1630,7 +1617,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1630
1617
|
".d.mts"
|
|
1631
1618
|
];
|
|
1632
1619
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1633
|
-
console.log(
|
|
1620
|
+
console.log(chalk23.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1634
1621
|
if (files.length > 0) {
|
|
1635
1622
|
const program = createProgramFromConfig2({
|
|
1636
1623
|
basePath: pkg ?? cwd2(),
|
|
@@ -1790,7 +1777,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1790
1777
|
// src/actions/package/compile/compile.ts
|
|
1791
1778
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1792
1779
|
const pkg = process.env.INIT_CWD;
|
|
1793
|
-
console.log(
|
|
1780
|
+
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1794
1781
|
const config2 = await loadConfig(inConfig);
|
|
1795
1782
|
const publint2 = config2.publint;
|
|
1796
1783
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1802,7 +1789,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1802
1789
|
|
|
1803
1790
|
// src/actions/package/copy-assets.ts
|
|
1804
1791
|
import path5 from "node:path/posix";
|
|
1805
|
-
import
|
|
1792
|
+
import chalk25 from "chalk";
|
|
1806
1793
|
import cpy2 from "cpy";
|
|
1807
1794
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1808
1795
|
try {
|
|
@@ -1821,7 +1808,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1821
1808
|
flat: false
|
|
1822
1809
|
});
|
|
1823
1810
|
if (values.length > 0) {
|
|
1824
|
-
console.log(
|
|
1811
|
+
console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1825
1812
|
}
|
|
1826
1813
|
for (const value of values) {
|
|
1827
1814
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1850,7 +1837,7 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1850
1837
|
}, "packageCopyAssets");
|
|
1851
1838
|
|
|
1852
1839
|
// src/actions/package/cycle.ts
|
|
1853
|
-
import { cruise } from "dependency-cruiser";
|
|
1840
|
+
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1854
1841
|
var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
1855
1842
|
const pkg = process.env.INIT_CWD;
|
|
1856
1843
|
const pkgName = process.env.npm_package_name;
|
|
@@ -1868,18 +1855,18 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1868
1855
|
}
|
|
1869
1856
|
]
|
|
1870
1857
|
},
|
|
1858
|
+
exclude: "node_modules|packages/.*/packages",
|
|
1871
1859
|
validate: true,
|
|
1872
|
-
doNotFollow:
|
|
1873
|
-
"node_modules"
|
|
1874
|
-
|
|
1875
|
-
],
|
|
1860
|
+
doNotFollow: {
|
|
1861
|
+
path: "node_modules|packages/.*/packages"
|
|
1862
|
+
},
|
|
1876
1863
|
tsPreCompilationDeps: false,
|
|
1877
1864
|
combinedDependencies: true,
|
|
1878
1865
|
outputType: verbose ? "text" : "err"
|
|
1879
1866
|
};
|
|
1880
1867
|
const target = `${pkg}/src`;
|
|
1881
1868
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1882
|
-
const result = await
|
|
1869
|
+
const result = await cruise2([
|
|
1883
1870
|
target
|
|
1884
1871
|
], cruiseOptions);
|
|
1885
1872
|
if (result.output) {
|
|
@@ -1896,7 +1883,7 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1896
1883
|
// src/actions/package/gen-docs.ts
|
|
1897
1884
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1898
1885
|
import path6 from "node:path";
|
|
1899
|
-
import
|
|
1886
|
+
import chalk26 from "chalk";
|
|
1900
1887
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1901
1888
|
var ExitCodes = {
|
|
1902
1889
|
CompileError: 3,
|
|
@@ -1998,7 +1985,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1998
1985
|
return ExitCodes.OutputError;
|
|
1999
1986
|
}
|
|
2000
1987
|
}
|
|
2001
|
-
console.log(
|
|
1988
|
+
console.log(chalk26.green(`${pkgName} - Ok`));
|
|
2002
1989
|
return ExitCodes.Ok;
|
|
2003
1990
|
}, "runTypeDoc");
|
|
2004
1991
|
|
|
@@ -2007,7 +1994,7 @@ import { readdirSync } from "node:fs";
|
|
|
2007
1994
|
import path7 from "node:path";
|
|
2008
1995
|
import { cwd as cwd3 } from "node:process";
|
|
2009
1996
|
import { pathToFileURL } from "node:url";
|
|
2010
|
-
import
|
|
1997
|
+
import chalk27 from "chalk";
|
|
2011
1998
|
import { ESLint } from "eslint";
|
|
2012
1999
|
import { findUp } from "find-up";
|
|
2013
2000
|
import picomatch from "picomatch";
|
|
@@ -2024,10 +2011,10 @@ var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
|
2024
2011
|
];
|
|
2025
2012
|
for (const lintResult of lintResults) {
|
|
2026
2013
|
if (lintResult.messages.length > 0) {
|
|
2027
|
-
console.log(
|
|
2014
|
+
console.log(chalk27.gray(`
|
|
2028
2015
|
${lintResult.filePath}`));
|
|
2029
2016
|
for (const message of lintResult.messages) {
|
|
2030
|
-
console.log(
|
|
2017
|
+
console.log(chalk27.gray(` ${message.line}:${message.column}`), chalk27[colors[message.severity]](` ${severity[message.severity]}`), chalk27.white(` ${message.message}`), chalk27.gray(` ${message.ruleId}`));
|
|
2031
2018
|
}
|
|
2032
2019
|
}
|
|
2033
2020
|
}
|
|
@@ -2082,7 +2069,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2082
2069
|
});
|
|
2083
2070
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2084
2071
|
if (verbose) {
|
|
2085
|
-
console.log(
|
|
2072
|
+
console.log(chalk27.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2086
2073
|
}
|
|
2087
2074
|
const lintResults = await engine.lintFiles(files);
|
|
2088
2075
|
dumpMessages(lintResults);
|
|
@@ -2092,7 +2079,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2092
2079
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2093
2080
|
const lintTime = Date.now() - start;
|
|
2094
2081
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2095
|
-
console.log(
|
|
2082
|
+
console.log(chalk27.white(`Linted ${chalk27[filesCountColor](files.length)} files in ${chalk27[lintTimeColor](lintTime)}ms`));
|
|
2096
2083
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2097
2084
|
}, "packageLint");
|
|
2098
2085
|
|
|
@@ -2159,7 +2146,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2159
2146
|
}, "rebuild");
|
|
2160
2147
|
|
|
2161
2148
|
// src/actions/recompile.ts
|
|
2162
|
-
import
|
|
2149
|
+
import chalk28 from "chalk";
|
|
2163
2150
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2164
2151
|
return pkg ? await recompilePackage({
|
|
2165
2152
|
pkg,
|
|
@@ -2214,7 +2201,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2214
2201
|
`${jobs}`
|
|
2215
2202
|
] : [];
|
|
2216
2203
|
if (jobs) {
|
|
2217
|
-
console.log(
|
|
2204
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2218
2205
|
}
|
|
2219
2206
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2220
2207
|
[
|
|
@@ -2244,7 +2231,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2244
2231
|
]
|
|
2245
2232
|
]
|
|
2246
2233
|
]);
|
|
2247
|
-
console.log(`${
|
|
2234
|
+
console.log(`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`);
|
|
2248
2235
|
return result;
|
|
2249
2236
|
}, "recompileAll");
|
|
2250
2237
|
|
|
@@ -2278,9 +2265,9 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2278
2265
|
}, "reinstall");
|
|
2279
2266
|
|
|
2280
2267
|
// src/actions/relint.ts
|
|
2281
|
-
import
|
|
2268
|
+
import chalk29 from "chalk";
|
|
2282
2269
|
var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
2283
|
-
console.log(
|
|
2270
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2284
2271
|
const start = Date.now();
|
|
2285
2272
|
const result = runSteps("Relint [All-Packages]", [
|
|
2286
2273
|
[
|
|
@@ -2293,7 +2280,7 @@ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
|
2293
2280
|
]
|
|
2294
2281
|
]
|
|
2295
2282
|
]);
|
|
2296
|
-
console.log(
|
|
2283
|
+
console.log(chalk29.gray(`${"Relinted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2297
2284
|
return result;
|
|
2298
2285
|
}, "relintPackage");
|
|
2299
2286
|
var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
@@ -2305,7 +2292,7 @@ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
|
2305
2292
|
});
|
|
2306
2293
|
}, "relint");
|
|
2307
2294
|
var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
|
|
2308
|
-
console.log(
|
|
2295
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2309
2296
|
const start = Date.now();
|
|
2310
2297
|
const verboseOptions = verbose ? [
|
|
2311
2298
|
"--verbose"
|
|
@@ -2332,7 +2319,7 @@ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental }
|
|
|
2332
2319
|
]
|
|
2333
2320
|
]
|
|
2334
2321
|
]);
|
|
2335
|
-
console.log(
|
|
2322
|
+
console.log(chalk29.gray(`Relinted in [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2336
2323
|
return result;
|
|
2337
2324
|
}, "relintAllPackages");
|
|
2338
2325
|
|
|
@@ -2372,7 +2359,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2372
2359
|
}, "sonar");
|
|
2373
2360
|
|
|
2374
2361
|
// src/actions/statics.ts
|
|
2375
|
-
import
|
|
2362
|
+
import chalk30 from "chalk";
|
|
2376
2363
|
var DefaultDependencies = [
|
|
2377
2364
|
"axios",
|
|
2378
2365
|
"@xylabs/pixel",
|
|
@@ -2383,7 +2370,7 @@ var DefaultDependencies = [
|
|
|
2383
2370
|
"@mui/system"
|
|
2384
2371
|
];
|
|
2385
2372
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2386
|
-
console.log(
|
|
2373
|
+
console.log(chalk30.green("Check Required Static Dependencies"));
|
|
2387
2374
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2388
2375
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2389
2376
|
}, "statics");
|
|
@@ -2501,7 +2488,7 @@ var loadPackageConfig = /* @__PURE__ */ __name(async () => {
|
|
|
2501
2488
|
}, "loadPackageConfig");
|
|
2502
2489
|
|
|
2503
2490
|
// src/xy/xy.ts
|
|
2504
|
-
import
|
|
2491
|
+
import chalk32 from "chalk";
|
|
2505
2492
|
|
|
2506
2493
|
// src/xy/xyBuildCommands.ts
|
|
2507
2494
|
var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
@@ -2742,17 +2729,17 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2742
2729
|
}, "xyInstallCommands");
|
|
2743
2730
|
|
|
2744
2731
|
// src/xy/xyLintCommands.ts
|
|
2745
|
-
import
|
|
2732
|
+
import chalk31 from "chalk";
|
|
2746
2733
|
var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
2747
2734
|
return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
|
|
2748
2735
|
return packagePositionalParam(yargs2);
|
|
2749
|
-
}, (argv) => {
|
|
2736
|
+
}, async (argv) => {
|
|
2750
2737
|
const start = Date.now();
|
|
2751
2738
|
if (argv.verbose) console.log("Cycle");
|
|
2752
|
-
process.exitCode = cycle({
|
|
2739
|
+
process.exitCode = await cycle({
|
|
2753
2740
|
pkg: argv.package
|
|
2754
2741
|
});
|
|
2755
|
-
console.log(
|
|
2742
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2756
2743
|
}).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
|
|
2757
2744
|
return packagePositionalParam(yargs2);
|
|
2758
2745
|
}, (argv) => {
|
|
@@ -2763,21 +2750,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2763
2750
|
}) : lint({
|
|
2764
2751
|
pkg: argv.package
|
|
2765
2752
|
});
|
|
2766
|
-
console.log(
|
|
2753
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2767
2754
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
2768
2755
|
return packagePositionalParam(yargs2);
|
|
2769
2756
|
}, (argv) => {
|
|
2770
2757
|
const start = Date.now();
|
|
2771
2758
|
if (argv.verbose) console.log("Fix");
|
|
2772
2759
|
process.exitCode = fix();
|
|
2773
|
-
console.log(
|
|
2760
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2774
2761
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
2775
2762
|
return packagePositionalParam(yargs2);
|
|
2776
2763
|
}, (argv) => {
|
|
2777
2764
|
if (argv.verbose) console.log("Relinting");
|
|
2778
2765
|
const start = Date.now();
|
|
2779
2766
|
process.exitCode = relint();
|
|
2780
|
-
console.log(
|
|
2767
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2781
2768
|
}).command("publint [package]", "Publint - Run Publint", (yargs2) => {
|
|
2782
2769
|
return packagePositionalParam(yargs2);
|
|
2783
2770
|
}, async (argv) => {
|
|
@@ -2787,21 +2774,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2787
2774
|
pkg: argv.package,
|
|
2788
2775
|
verbose: !!argv.verbose
|
|
2789
2776
|
});
|
|
2790
|
-
console.log(
|
|
2777
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2791
2778
|
}).command("knip", "Knip - Run Knip", (yargs2) => {
|
|
2792
2779
|
return packagePositionalParam(yargs2);
|
|
2793
2780
|
}, (argv) => {
|
|
2794
2781
|
if (argv.verbose) console.log("Knip");
|
|
2795
2782
|
const start = Date.now();
|
|
2796
2783
|
process.exitCode = knip();
|
|
2797
|
-
console.log(
|
|
2784
|
+
console.log(chalk31.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2798
2785
|
}).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
|
|
2799
2786
|
return packagePositionalParam(yargs2);
|
|
2800
2787
|
}, (argv) => {
|
|
2801
2788
|
const start = Date.now();
|
|
2802
2789
|
if (argv.verbose) console.log("Sonar Check");
|
|
2803
2790
|
process.exitCode = sonar();
|
|
2804
|
-
console.log(
|
|
2791
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2805
2792
|
});
|
|
2806
2793
|
}, "xyLintCommands");
|
|
2807
2794
|
|
|
@@ -2863,8 +2850,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2863
2850
|
var xy = /* @__PURE__ */ __name(async () => {
|
|
2864
2851
|
const options = xyParseOptions();
|
|
2865
2852
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2866
|
-
console.error(
|
|
2867
|
-
console.log(
|
|
2853
|
+
console.error(chalk32.yellow(`Command not found [${chalk32.magenta(process.argv[2])}]`));
|
|
2854
|
+
console.log(chalk32.gray("Try 'yarn xy --help' for list of commands"));
|
|
2868
2855
|
}).version().help().argv;
|
|
2869
2856
|
}, "xy");
|
|
2870
2857
|
export {
|