@xylabs/ts-scripts-yarn3 6.3.3 → 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/cycle.mjs +42 -44
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/index.mjs +102 -104
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +87 -89
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +115 -117
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +87 -89
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +87 -89
- package/dist/xy/xy.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.d.ts
CHANGED
|
@@ -77,9 +77,11 @@ interface CyclePackageParams {
|
|
|
77
77
|
pkg: string;
|
|
78
78
|
verbose?: boolean;
|
|
79
79
|
}
|
|
80
|
-
declare const cycle: ({ verbose, pkg
|
|
80
|
+
declare const cycle: ({ verbose, pkg }?: CycleParams) => Promise<number>;
|
|
81
81
|
declare const cyclePackage: ({ pkg, verbose }: CyclePackageParams) => number;
|
|
82
|
-
declare const cycleAll: ({
|
|
82
|
+
declare const cycleAll: ({ verbose }: {
|
|
83
|
+
verbose?: boolean;
|
|
84
|
+
}) => Promise<number>;
|
|
83
85
|
|
|
84
86
|
declare const dead: () => number;
|
|
85
87
|
|
package/dist/index.mjs
CHANGED
|
@@ -870,15 +870,13 @@ var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
|
|
|
870
870
|
}, "copyAssets");
|
|
871
871
|
|
|
872
872
|
// src/actions/cycle.ts
|
|
873
|
-
import
|
|
874
|
-
var cycle = /* @__PURE__ */ __name(({ verbose, pkg
|
|
873
|
+
import { cruise } from "dependency-cruiser";
|
|
874
|
+
var cycle = /* @__PURE__ */ __name(async ({ verbose, pkg } = {}) => {
|
|
875
875
|
return pkg ? cyclePackage({
|
|
876
876
|
pkg,
|
|
877
877
|
verbose
|
|
878
|
-
}) : cycleAll({
|
|
879
|
-
|
|
880
|
-
verbose,
|
|
881
|
-
jobs
|
|
878
|
+
}) : await cycleAll({
|
|
879
|
+
verbose
|
|
882
880
|
});
|
|
883
881
|
}, "cycle");
|
|
884
882
|
var cyclePackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
|
|
@@ -900,45 +898,45 @@ var cyclePackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
|
|
|
900
898
|
]
|
|
901
899
|
]);
|
|
902
900
|
}, "cyclePackage");
|
|
903
|
-
var cycleAll = /* @__PURE__ */ __name(({
|
|
904
|
-
const
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
];
|
|
918
|
-
const jobsOptions = jobs ? [
|
|
919
|
-
"-j",
|
|
920
|
-
`${jobs}`
|
|
921
|
-
] : [];
|
|
922
|
-
if (jobs) {
|
|
923
|
-
console.log(chalk14.blue(`Jobs set to [${jobs}]`));
|
|
924
|
-
}
|
|
925
|
-
const result = runSteps(`Cycle${incremental ? "-Incremental" : ""} [All]`, [
|
|
926
|
-
[
|
|
927
|
-
"yarn",
|
|
928
|
-
[
|
|
929
|
-
"workspaces",
|
|
930
|
-
"foreach",
|
|
931
|
-
...incrementalOptions,
|
|
932
|
-
...jobsOptions,
|
|
933
|
-
...verboseOptions,
|
|
934
|
-
"run",
|
|
935
|
-
"package-cycle",
|
|
936
|
-
...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
|
+
}
|
|
937
915
|
]
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
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;
|
|
942
940
|
}, "cycleAll");
|
|
943
941
|
|
|
944
942
|
// src/actions/dead.ts
|
|
@@ -1060,18 +1058,18 @@ var deployNext = /* @__PURE__ */ __name(() => {
|
|
|
1060
1058
|
}, "deployNext");
|
|
1061
1059
|
|
|
1062
1060
|
// src/actions/dupdeps.ts
|
|
1063
|
-
import
|
|
1061
|
+
import chalk14 from "chalk";
|
|
1064
1062
|
var dupdeps = /* @__PURE__ */ __name(() => {
|
|
1065
|
-
console.log(
|
|
1063
|
+
console.log(chalk14.green("Checking all Dependencies for Duplicates"));
|
|
1066
1064
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1067
1065
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1068
1066
|
return detectDuplicateDependencies(dependencies);
|
|
1069
1067
|
}, "dupdeps");
|
|
1070
1068
|
|
|
1071
1069
|
// src/actions/lint.ts
|
|
1072
|
-
import
|
|
1070
|
+
import chalk15 from "chalk";
|
|
1073
1071
|
var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
1074
|
-
console.log(
|
|
1072
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1075
1073
|
const start = Date.now();
|
|
1076
1074
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1077
1075
|
[
|
|
@@ -1084,7 +1082,7 @@ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
|
|
|
1084
1082
|
]
|
|
1085
1083
|
]
|
|
1086
1084
|
]);
|
|
1087
|
-
console.log(
|
|
1085
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1088
1086
|
return result;
|
|
1089
1087
|
}, "lintPackage");
|
|
1090
1088
|
var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
@@ -1098,7 +1096,7 @@ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}
|
|
|
1098
1096
|
});
|
|
1099
1097
|
}, "lint");
|
|
1100
1098
|
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
|
|
1101
|
-
console.log(
|
|
1099
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1102
1100
|
const start = Date.now();
|
|
1103
1101
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1104
1102
|
[
|
|
@@ -1108,7 +1106,7 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
|
|
|
1108
1106
|
]
|
|
1109
1107
|
]
|
|
1110
1108
|
]);
|
|
1111
|
-
console.log(
|
|
1109
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1112
1110
|
return result;
|
|
1113
1111
|
}, "lintAllPackages");
|
|
1114
1112
|
|
|
@@ -1173,7 +1171,7 @@ var filename = ".gitignore";
|
|
|
1173
1171
|
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
1174
1172
|
|
|
1175
1173
|
// src/actions/gitlint.ts
|
|
1176
|
-
import
|
|
1174
|
+
import chalk16 from "chalk";
|
|
1177
1175
|
import ParseGitConfig from "parse-git-config";
|
|
1178
1176
|
var gitlint = /* @__PURE__ */ __name(() => {
|
|
1179
1177
|
console.log(`
|
|
@@ -1184,7 +1182,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1184
1182
|
const errors = 0;
|
|
1185
1183
|
const gitConfig = ParseGitConfig.sync();
|
|
1186
1184
|
const warn = /* @__PURE__ */ __name((message) => {
|
|
1187
|
-
console.warn(
|
|
1185
|
+
console.warn(chalk16.yellow(`Warning: ${message}`));
|
|
1188
1186
|
warnings++;
|
|
1189
1187
|
}, "warn");
|
|
1190
1188
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1204,13 +1202,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1204
1202
|
}
|
|
1205
1203
|
const resultMessages = [];
|
|
1206
1204
|
if (valid > 0) {
|
|
1207
|
-
resultMessages.push(
|
|
1205
|
+
resultMessages.push(chalk16.green(`Passed: ${valid}`));
|
|
1208
1206
|
}
|
|
1209
1207
|
if (warnings > 0) {
|
|
1210
|
-
resultMessages.push(
|
|
1208
|
+
resultMessages.push(chalk16.yellow(`Warnings: ${warnings}`));
|
|
1211
1209
|
}
|
|
1212
1210
|
if (errors > 0) {
|
|
1213
|
-
resultMessages.push(
|
|
1211
|
+
resultMessages.push(chalk16.red(` Errors: ${errors}`));
|
|
1214
1212
|
}
|
|
1215
1213
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1216
1214
|
`);
|
|
@@ -1219,7 +1217,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1219
1217
|
|
|
1220
1218
|
// src/actions/gitlint-fix.ts
|
|
1221
1219
|
import { execSync as execSync2 } from "node:child_process";
|
|
1222
|
-
import
|
|
1220
|
+
import chalk17 from "chalk";
|
|
1223
1221
|
import ParseGitConfig2 from "parse-git-config";
|
|
1224
1222
|
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1225
1223
|
console.log(`
|
|
@@ -1230,19 +1228,19 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1230
1228
|
execSync2("git config core.ignorecase false", {
|
|
1231
1229
|
stdio: "inherit"
|
|
1232
1230
|
});
|
|
1233
|
-
console.warn(
|
|
1231
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1234
1232
|
}
|
|
1235
1233
|
if (gitConfig.core.autocrlf !== false) {
|
|
1236
1234
|
execSync2("git config core.autocrlf false", {
|
|
1237
1235
|
stdio: "inherit"
|
|
1238
1236
|
});
|
|
1239
|
-
console.warn(
|
|
1237
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1240
1238
|
}
|
|
1241
1239
|
if (gitConfig.core.eol !== "lf") {
|
|
1242
1240
|
execSync2("git config core.eol lf", {
|
|
1243
1241
|
stdio: "inherit"
|
|
1244
1242
|
});
|
|
1245
|
-
console.warn(
|
|
1243
|
+
console.warn(chalk17.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1246
1244
|
}
|
|
1247
1245
|
return 1;
|
|
1248
1246
|
}, "gitlintFix");
|
|
@@ -1262,7 +1260,7 @@ var knip = /* @__PURE__ */ __name(() => {
|
|
|
1262
1260
|
}, "knip");
|
|
1263
1261
|
|
|
1264
1262
|
// src/actions/license.ts
|
|
1265
|
-
import
|
|
1263
|
+
import chalk18 from "chalk";
|
|
1266
1264
|
import { init } from "license-checker";
|
|
1267
1265
|
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1268
1266
|
const workspaces = yarnWorkspaces();
|
|
@@ -1287,7 +1285,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1287
1285
|
"LGPL-3.0-or-later",
|
|
1288
1286
|
"Python-2.0"
|
|
1289
1287
|
]);
|
|
1290
|
-
console.log(
|
|
1288
|
+
console.log(chalk18.green("License Checker"));
|
|
1291
1289
|
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1292
1290
|
return new Promise((resolve) => {
|
|
1293
1291
|
init({
|
|
@@ -1295,12 +1293,12 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1295
1293
|
start: location
|
|
1296
1294
|
}, (error, packages) => {
|
|
1297
1295
|
if (error) {
|
|
1298
|
-
console.error(
|
|
1299
|
-
console.error(
|
|
1296
|
+
console.error(chalk18.red(`License Checker [${name}] Error`));
|
|
1297
|
+
console.error(chalk18.gray(error));
|
|
1300
1298
|
console.log("\n");
|
|
1301
1299
|
resolve(1);
|
|
1302
1300
|
} else {
|
|
1303
|
-
console.log(
|
|
1301
|
+
console.log(chalk18.green(`License Checker [${name}]`));
|
|
1304
1302
|
let count = 0;
|
|
1305
1303
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1306
1304
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
@@ -1318,7 +1316,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1318
1316
|
}
|
|
1319
1317
|
if (!orLicenseFound) {
|
|
1320
1318
|
count++;
|
|
1321
|
-
console.warn(
|
|
1319
|
+
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1322
1320
|
}
|
|
1323
1321
|
}
|
|
1324
1322
|
}
|
|
@@ -1337,7 +1335,7 @@ var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2
|
|
|
1337
1335
|
|
|
1338
1336
|
// src/actions/package/clean-outputs.ts
|
|
1339
1337
|
import path3 from "node:path";
|
|
1340
|
-
import
|
|
1338
|
+
import chalk19 from "chalk";
|
|
1341
1339
|
var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
1342
1340
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1343
1341
|
const pkgName = process.env.npm_package_name;
|
|
@@ -1346,7 +1344,7 @@ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
|
1346
1344
|
path3.join(pkg, "build"),
|
|
1347
1345
|
path3.join(pkg, "docs")
|
|
1348
1346
|
];
|
|
1349
|
-
console.log(
|
|
1347
|
+
console.log(chalk19.green(`Cleaning Outputs [${pkgName}]`));
|
|
1350
1348
|
for (let folder of folders) {
|
|
1351
1349
|
deleteGlob(folder);
|
|
1352
1350
|
}
|
|
@@ -1355,11 +1353,11 @@ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
|
1355
1353
|
|
|
1356
1354
|
// src/actions/package/clean-typescript.ts
|
|
1357
1355
|
import path4 from "node:path";
|
|
1358
|
-
import
|
|
1356
|
+
import chalk20 from "chalk";
|
|
1359
1357
|
var packageCleanTypescript = /* @__PURE__ */ __name(() => {
|
|
1360
1358
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1361
1359
|
const pkgName = process.env.npm_package_name;
|
|
1362
|
-
console.log(
|
|
1360
|
+
console.log(chalk20.green(`Cleaning Typescript [${pkgName}]`));
|
|
1363
1361
|
const files = [
|
|
1364
1362
|
path4.join(pkg, "*.tsbuildinfo"),
|
|
1365
1363
|
path4.join(pkg, ".tsconfig.*"),
|
|
@@ -1380,19 +1378,19 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
1380
1378
|
}, "packageClean");
|
|
1381
1379
|
|
|
1382
1380
|
// src/actions/package/compile/compile.ts
|
|
1383
|
-
import
|
|
1381
|
+
import chalk24 from "chalk";
|
|
1384
1382
|
|
|
1385
1383
|
// src/actions/package/publint.ts
|
|
1386
1384
|
import { promises as fs2 } from "node:fs";
|
|
1387
|
-
import
|
|
1385
|
+
import chalk21 from "chalk";
|
|
1388
1386
|
import sortPackageJson from "sort-package-json";
|
|
1389
1387
|
var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
1390
1388
|
const pkgDir = process.env.INIT_CWD;
|
|
1391
1389
|
const sortedPkg = sortPackageJson(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1392
1390
|
await fs2.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1393
1391
|
const pkg = JSON.parse(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1394
|
-
console.log(
|
|
1395
|
-
console.log(
|
|
1392
|
+
console.log(chalk21.green(`Publint: ${pkg.name}`));
|
|
1393
|
+
console.log(chalk21.gray(pkgDir));
|
|
1396
1394
|
const { publint: publint2 } = await import("publint");
|
|
1397
1395
|
const { messages } = await publint2({
|
|
1398
1396
|
level: "suggestion",
|
|
@@ -1407,21 +1405,21 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1407
1405
|
for (const message of validMessages) {
|
|
1408
1406
|
switch (message.type) {
|
|
1409
1407
|
case "error": {
|
|
1410
|
-
console.error(
|
|
1408
|
+
console.error(chalk21.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1411
1409
|
break;
|
|
1412
1410
|
}
|
|
1413
1411
|
case "warning": {
|
|
1414
|
-
console.warn(
|
|
1412
|
+
console.warn(chalk21.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1415
1413
|
break;
|
|
1416
1414
|
}
|
|
1417
1415
|
default: {
|
|
1418
|
-
console.log(
|
|
1416
|
+
console.log(chalk21.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1419
1417
|
break;
|
|
1420
1418
|
}
|
|
1421
1419
|
}
|
|
1422
1420
|
}
|
|
1423
1421
|
if (params?.verbose) {
|
|
1424
|
-
console.log(
|
|
1422
|
+
console.log(chalk21.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1425
1423
|
}
|
|
1426
1424
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1427
1425
|
}, "packagePublint");
|
|
@@ -1465,7 +1463,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1465
1463
|
|
|
1466
1464
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1467
1465
|
import { cwd } from "node:process";
|
|
1468
|
-
import
|
|
1466
|
+
import chalk22 from "chalk";
|
|
1469
1467
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1470
1468
|
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
1471
1469
|
|
|
@@ -1522,7 +1520,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1522
1520
|
".spec."
|
|
1523
1521
|
];
|
|
1524
1522
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1525
|
-
console.log(
|
|
1523
|
+
console.log(chalk22.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1526
1524
|
if (files.length > 0) {
|
|
1527
1525
|
const program = createProgramFromConfig({
|
|
1528
1526
|
basePath: pkg ?? cwd(),
|
|
@@ -1584,7 +1582,7 @@ __name(deepMergeObjects, "deepMergeObjects");
|
|
|
1584
1582
|
|
|
1585
1583
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1586
1584
|
import { cwd as cwd2 } from "node:process";
|
|
1587
|
-
import
|
|
1585
|
+
import chalk23 from "chalk";
|
|
1588
1586
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1589
1587
|
import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2, getPreEmitDiagnostics as getPreEmitDiagnostics2, sys as sys3 } from "typescript";
|
|
1590
1588
|
var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
@@ -1619,7 +1617,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1619
1617
|
".d.mts"
|
|
1620
1618
|
];
|
|
1621
1619
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1622
|
-
console.log(
|
|
1620
|
+
console.log(chalk23.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1623
1621
|
if (files.length > 0) {
|
|
1624
1622
|
const program = createProgramFromConfig2({
|
|
1625
1623
|
basePath: pkg ?? cwd2(),
|
|
@@ -1779,7 +1777,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1779
1777
|
// src/actions/package/compile/compile.ts
|
|
1780
1778
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1781
1779
|
const pkg = process.env.INIT_CWD;
|
|
1782
|
-
console.log(
|
|
1780
|
+
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1783
1781
|
const config2 = await loadConfig(inConfig);
|
|
1784
1782
|
const publint2 = config2.publint;
|
|
1785
1783
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1791,7 +1789,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1791
1789
|
|
|
1792
1790
|
// src/actions/package/copy-assets.ts
|
|
1793
1791
|
import path5 from "node:path/posix";
|
|
1794
|
-
import
|
|
1792
|
+
import chalk25 from "chalk";
|
|
1795
1793
|
import cpy2 from "cpy";
|
|
1796
1794
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1797
1795
|
try {
|
|
@@ -1810,7 +1808,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1810
1808
|
flat: false
|
|
1811
1809
|
});
|
|
1812
1810
|
if (values.length > 0) {
|
|
1813
|
-
console.log(
|
|
1811
|
+
console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1814
1812
|
}
|
|
1815
1813
|
for (const value of values) {
|
|
1816
1814
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1839,7 +1837,7 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1839
1837
|
}, "packageCopyAssets");
|
|
1840
1838
|
|
|
1841
1839
|
// src/actions/package/cycle.ts
|
|
1842
|
-
import { cruise } from "dependency-cruiser";
|
|
1840
|
+
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1843
1841
|
var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
1844
1842
|
const pkg = process.env.INIT_CWD;
|
|
1845
1843
|
const pkgName = process.env.npm_package_name;
|
|
@@ -1868,7 +1866,7 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1868
1866
|
};
|
|
1869
1867
|
const target = `${pkg}/src`;
|
|
1870
1868
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1871
|
-
const result = await
|
|
1869
|
+
const result = await cruise2([
|
|
1872
1870
|
target
|
|
1873
1871
|
], cruiseOptions);
|
|
1874
1872
|
if (result.output) {
|
|
@@ -1885,7 +1883,7 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1885
1883
|
// src/actions/package/gen-docs.ts
|
|
1886
1884
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1887
1885
|
import path6 from "node:path";
|
|
1888
|
-
import
|
|
1886
|
+
import chalk26 from "chalk";
|
|
1889
1887
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1890
1888
|
var ExitCodes = {
|
|
1891
1889
|
CompileError: 3,
|
|
@@ -1987,7 +1985,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1987
1985
|
return ExitCodes.OutputError;
|
|
1988
1986
|
}
|
|
1989
1987
|
}
|
|
1990
|
-
console.log(
|
|
1988
|
+
console.log(chalk26.green(`${pkgName} - Ok`));
|
|
1991
1989
|
return ExitCodes.Ok;
|
|
1992
1990
|
}, "runTypeDoc");
|
|
1993
1991
|
|
|
@@ -1996,7 +1994,7 @@ import { readdirSync } from "node:fs";
|
|
|
1996
1994
|
import path7 from "node:path";
|
|
1997
1995
|
import { cwd as cwd3 } from "node:process";
|
|
1998
1996
|
import { pathToFileURL } from "node:url";
|
|
1999
|
-
import
|
|
1997
|
+
import chalk27 from "chalk";
|
|
2000
1998
|
import { ESLint } from "eslint";
|
|
2001
1999
|
import { findUp } from "find-up";
|
|
2002
2000
|
import picomatch from "picomatch";
|
|
@@ -2013,10 +2011,10 @@ var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
|
2013
2011
|
];
|
|
2014
2012
|
for (const lintResult of lintResults) {
|
|
2015
2013
|
if (lintResult.messages.length > 0) {
|
|
2016
|
-
console.log(
|
|
2014
|
+
console.log(chalk27.gray(`
|
|
2017
2015
|
${lintResult.filePath}`));
|
|
2018
2016
|
for (const message of lintResult.messages) {
|
|
2019
|
-
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}`));
|
|
2020
2018
|
}
|
|
2021
2019
|
}
|
|
2022
2020
|
}
|
|
@@ -2071,7 +2069,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2071
2069
|
});
|
|
2072
2070
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2073
2071
|
if (verbose) {
|
|
2074
|
-
console.log(
|
|
2072
|
+
console.log(chalk27.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2075
2073
|
}
|
|
2076
2074
|
const lintResults = await engine.lintFiles(files);
|
|
2077
2075
|
dumpMessages(lintResults);
|
|
@@ -2081,7 +2079,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2081
2079
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2082
2080
|
const lintTime = Date.now() - start;
|
|
2083
2081
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2084
|
-
console.log(
|
|
2082
|
+
console.log(chalk27.white(`Linted ${chalk27[filesCountColor](files.length)} files in ${chalk27[lintTimeColor](lintTime)}ms`));
|
|
2085
2083
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2086
2084
|
}, "packageLint");
|
|
2087
2085
|
|
|
@@ -2148,7 +2146,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2148
2146
|
}, "rebuild");
|
|
2149
2147
|
|
|
2150
2148
|
// src/actions/recompile.ts
|
|
2151
|
-
import
|
|
2149
|
+
import chalk28 from "chalk";
|
|
2152
2150
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2153
2151
|
return pkg ? await recompilePackage({
|
|
2154
2152
|
pkg,
|
|
@@ -2203,7 +2201,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2203
2201
|
`${jobs}`
|
|
2204
2202
|
] : [];
|
|
2205
2203
|
if (jobs) {
|
|
2206
|
-
console.log(
|
|
2204
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2207
2205
|
}
|
|
2208
2206
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2209
2207
|
[
|
|
@@ -2233,7 +2231,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2233
2231
|
]
|
|
2234
2232
|
]
|
|
2235
2233
|
]);
|
|
2236
|
-
console.log(`${
|
|
2234
|
+
console.log(`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`);
|
|
2237
2235
|
return result;
|
|
2238
2236
|
}, "recompileAll");
|
|
2239
2237
|
|
|
@@ -2267,9 +2265,9 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2267
2265
|
}, "reinstall");
|
|
2268
2266
|
|
|
2269
2267
|
// src/actions/relint.ts
|
|
2270
|
-
import
|
|
2268
|
+
import chalk29 from "chalk";
|
|
2271
2269
|
var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
2272
|
-
console.log(
|
|
2270
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2273
2271
|
const start = Date.now();
|
|
2274
2272
|
const result = runSteps("Relint [All-Packages]", [
|
|
2275
2273
|
[
|
|
@@ -2282,7 +2280,7 @@ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
|
2282
2280
|
]
|
|
2283
2281
|
]
|
|
2284
2282
|
]);
|
|
2285
|
-
console.log(
|
|
2283
|
+
console.log(chalk29.gray(`${"Relinted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2286
2284
|
return result;
|
|
2287
2285
|
}, "relintPackage");
|
|
2288
2286
|
var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
@@ -2294,7 +2292,7 @@ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
|
2294
2292
|
});
|
|
2295
2293
|
}, "relint");
|
|
2296
2294
|
var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
|
|
2297
|
-
console.log(
|
|
2295
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2298
2296
|
const start = Date.now();
|
|
2299
2297
|
const verboseOptions = verbose ? [
|
|
2300
2298
|
"--verbose"
|
|
@@ -2321,7 +2319,7 @@ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental }
|
|
|
2321
2319
|
]
|
|
2322
2320
|
]
|
|
2323
2321
|
]);
|
|
2324
|
-
console.log(
|
|
2322
|
+
console.log(chalk29.gray(`Relinted in [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2325
2323
|
return result;
|
|
2326
2324
|
}, "relintAllPackages");
|
|
2327
2325
|
|
|
@@ -2361,7 +2359,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2361
2359
|
}, "sonar");
|
|
2362
2360
|
|
|
2363
2361
|
// src/actions/statics.ts
|
|
2364
|
-
import
|
|
2362
|
+
import chalk30 from "chalk";
|
|
2365
2363
|
var DefaultDependencies = [
|
|
2366
2364
|
"axios",
|
|
2367
2365
|
"@xylabs/pixel",
|
|
@@ -2372,7 +2370,7 @@ var DefaultDependencies = [
|
|
|
2372
2370
|
"@mui/system"
|
|
2373
2371
|
];
|
|
2374
2372
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2375
|
-
console.log(
|
|
2373
|
+
console.log(chalk30.green("Check Required Static Dependencies"));
|
|
2376
2374
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2377
2375
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2378
2376
|
}, "statics");
|
|
@@ -2490,7 +2488,7 @@ var loadPackageConfig = /* @__PURE__ */ __name(async () => {
|
|
|
2490
2488
|
}, "loadPackageConfig");
|
|
2491
2489
|
|
|
2492
2490
|
// src/xy/xy.ts
|
|
2493
|
-
import
|
|
2491
|
+
import chalk32 from "chalk";
|
|
2494
2492
|
|
|
2495
2493
|
// src/xy/xyBuildCommands.ts
|
|
2496
2494
|
var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
@@ -2731,17 +2729,17 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2731
2729
|
}, "xyInstallCommands");
|
|
2732
2730
|
|
|
2733
2731
|
// src/xy/xyLintCommands.ts
|
|
2734
|
-
import
|
|
2732
|
+
import chalk31 from "chalk";
|
|
2735
2733
|
var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
2736
2734
|
return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
|
|
2737
2735
|
return packagePositionalParam(yargs2);
|
|
2738
|
-
}, (argv) => {
|
|
2736
|
+
}, async (argv) => {
|
|
2739
2737
|
const start = Date.now();
|
|
2740
2738
|
if (argv.verbose) console.log("Cycle");
|
|
2741
|
-
process.exitCode = cycle({
|
|
2739
|
+
process.exitCode = await cycle({
|
|
2742
2740
|
pkg: argv.package
|
|
2743
2741
|
});
|
|
2744
|
-
console.log(
|
|
2742
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2745
2743
|
}).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
|
|
2746
2744
|
return packagePositionalParam(yargs2);
|
|
2747
2745
|
}, (argv) => {
|
|
@@ -2752,21 +2750,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2752
2750
|
}) : lint({
|
|
2753
2751
|
pkg: argv.package
|
|
2754
2752
|
});
|
|
2755
|
-
console.log(
|
|
2753
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2756
2754
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
2757
2755
|
return packagePositionalParam(yargs2);
|
|
2758
2756
|
}, (argv) => {
|
|
2759
2757
|
const start = Date.now();
|
|
2760
2758
|
if (argv.verbose) console.log("Fix");
|
|
2761
2759
|
process.exitCode = fix();
|
|
2762
|
-
console.log(
|
|
2760
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2763
2761
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
2764
2762
|
return packagePositionalParam(yargs2);
|
|
2765
2763
|
}, (argv) => {
|
|
2766
2764
|
if (argv.verbose) console.log("Relinting");
|
|
2767
2765
|
const start = Date.now();
|
|
2768
2766
|
process.exitCode = relint();
|
|
2769
|
-
console.log(
|
|
2767
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2770
2768
|
}).command("publint [package]", "Publint - Run Publint", (yargs2) => {
|
|
2771
2769
|
return packagePositionalParam(yargs2);
|
|
2772
2770
|
}, async (argv) => {
|
|
@@ -2776,21 +2774,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2776
2774
|
pkg: argv.package,
|
|
2777
2775
|
verbose: !!argv.verbose
|
|
2778
2776
|
});
|
|
2779
|
-
console.log(
|
|
2777
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2780
2778
|
}).command("knip", "Knip - Run Knip", (yargs2) => {
|
|
2781
2779
|
return packagePositionalParam(yargs2);
|
|
2782
2780
|
}, (argv) => {
|
|
2783
2781
|
if (argv.verbose) console.log("Knip");
|
|
2784
2782
|
const start = Date.now();
|
|
2785
2783
|
process.exitCode = knip();
|
|
2786
|
-
console.log(
|
|
2784
|
+
console.log(chalk31.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2787
2785
|
}).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
|
|
2788
2786
|
return packagePositionalParam(yargs2);
|
|
2789
2787
|
}, (argv) => {
|
|
2790
2788
|
const start = Date.now();
|
|
2791
2789
|
if (argv.verbose) console.log("Sonar Check");
|
|
2792
2790
|
process.exitCode = sonar();
|
|
2793
|
-
console.log(
|
|
2791
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2794
2792
|
});
|
|
2795
2793
|
}, "xyLintCommands");
|
|
2796
2794
|
|
|
@@ -2852,8 +2850,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2852
2850
|
var xy = /* @__PURE__ */ __name(async () => {
|
|
2853
2851
|
const options = xyParseOptions();
|
|
2854
2852
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2855
|
-
console.error(
|
|
2856
|
-
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"));
|
|
2857
2855
|
}).version().help().argv;
|
|
2858
2856
|
}, "xy");
|
|
2859
2857
|
export {
|