@xylabs/ts-scripts-yarn3 6.3.3 → 6.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/cycle.mjs +42 -44
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/fix.mjs +5 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +107 -105
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint.mjs +5 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/bin/xy.mjs +92 -90
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +120 -118
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +92 -90
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +92 -90
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +67 -65
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +9 -9
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,17 +1096,21 @@ 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();
|
|
1101
|
+
const fixOptions = fix2 ? [
|
|
1102
|
+
"--fix"
|
|
1103
|
+
] : [];
|
|
1103
1104
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1104
1105
|
[
|
|
1105
1106
|
"yarn",
|
|
1106
1107
|
[
|
|
1107
|
-
"eslint"
|
|
1108
|
+
"eslint",
|
|
1109
|
+
...fixOptions
|
|
1108
1110
|
]
|
|
1109
1111
|
]
|
|
1110
1112
|
]);
|
|
1111
|
-
console.log(
|
|
1113
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1112
1114
|
return result;
|
|
1113
1115
|
}, "lintAllPackages");
|
|
1114
1116
|
|
|
@@ -1173,7 +1175,7 @@ var filename = ".gitignore";
|
|
|
1173
1175
|
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
1174
1176
|
|
|
1175
1177
|
// src/actions/gitlint.ts
|
|
1176
|
-
import
|
|
1178
|
+
import chalk16 from "chalk";
|
|
1177
1179
|
import ParseGitConfig from "parse-git-config";
|
|
1178
1180
|
var gitlint = /* @__PURE__ */ __name(() => {
|
|
1179
1181
|
console.log(`
|
|
@@ -1184,7 +1186,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1184
1186
|
const errors = 0;
|
|
1185
1187
|
const gitConfig = ParseGitConfig.sync();
|
|
1186
1188
|
const warn = /* @__PURE__ */ __name((message) => {
|
|
1187
|
-
console.warn(
|
|
1189
|
+
console.warn(chalk16.yellow(`Warning: ${message}`));
|
|
1188
1190
|
warnings++;
|
|
1189
1191
|
}, "warn");
|
|
1190
1192
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1204,13 +1206,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1204
1206
|
}
|
|
1205
1207
|
const resultMessages = [];
|
|
1206
1208
|
if (valid > 0) {
|
|
1207
|
-
resultMessages.push(
|
|
1209
|
+
resultMessages.push(chalk16.green(`Passed: ${valid}`));
|
|
1208
1210
|
}
|
|
1209
1211
|
if (warnings > 0) {
|
|
1210
|
-
resultMessages.push(
|
|
1212
|
+
resultMessages.push(chalk16.yellow(`Warnings: ${warnings}`));
|
|
1211
1213
|
}
|
|
1212
1214
|
if (errors > 0) {
|
|
1213
|
-
resultMessages.push(
|
|
1215
|
+
resultMessages.push(chalk16.red(` Errors: ${errors}`));
|
|
1214
1216
|
}
|
|
1215
1217
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1216
1218
|
`);
|
|
@@ -1219,7 +1221,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1219
1221
|
|
|
1220
1222
|
// src/actions/gitlint-fix.ts
|
|
1221
1223
|
import { execSync as execSync2 } from "node:child_process";
|
|
1222
|
-
import
|
|
1224
|
+
import chalk17 from "chalk";
|
|
1223
1225
|
import ParseGitConfig2 from "parse-git-config";
|
|
1224
1226
|
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1225
1227
|
console.log(`
|
|
@@ -1230,19 +1232,19 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1230
1232
|
execSync2("git config core.ignorecase false", {
|
|
1231
1233
|
stdio: "inherit"
|
|
1232
1234
|
});
|
|
1233
|
-
console.warn(
|
|
1235
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1234
1236
|
}
|
|
1235
1237
|
if (gitConfig.core.autocrlf !== false) {
|
|
1236
1238
|
execSync2("git config core.autocrlf false", {
|
|
1237
1239
|
stdio: "inherit"
|
|
1238
1240
|
});
|
|
1239
|
-
console.warn(
|
|
1241
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1240
1242
|
}
|
|
1241
1243
|
if (gitConfig.core.eol !== "lf") {
|
|
1242
1244
|
execSync2("git config core.eol lf", {
|
|
1243
1245
|
stdio: "inherit"
|
|
1244
1246
|
});
|
|
1245
|
-
console.warn(
|
|
1247
|
+
console.warn(chalk17.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1246
1248
|
}
|
|
1247
1249
|
return 1;
|
|
1248
1250
|
}, "gitlintFix");
|
|
@@ -1262,7 +1264,7 @@ var knip = /* @__PURE__ */ __name(() => {
|
|
|
1262
1264
|
}, "knip");
|
|
1263
1265
|
|
|
1264
1266
|
// src/actions/license.ts
|
|
1265
|
-
import
|
|
1267
|
+
import chalk18 from "chalk";
|
|
1266
1268
|
import { init } from "license-checker";
|
|
1267
1269
|
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1268
1270
|
const workspaces = yarnWorkspaces();
|
|
@@ -1287,7 +1289,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1287
1289
|
"LGPL-3.0-or-later",
|
|
1288
1290
|
"Python-2.0"
|
|
1289
1291
|
]);
|
|
1290
|
-
console.log(
|
|
1292
|
+
console.log(chalk18.green("License Checker"));
|
|
1291
1293
|
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1292
1294
|
return new Promise((resolve) => {
|
|
1293
1295
|
init({
|
|
@@ -1295,12 +1297,12 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1295
1297
|
start: location
|
|
1296
1298
|
}, (error, packages) => {
|
|
1297
1299
|
if (error) {
|
|
1298
|
-
console.error(
|
|
1299
|
-
console.error(
|
|
1300
|
+
console.error(chalk18.red(`License Checker [${name}] Error`));
|
|
1301
|
+
console.error(chalk18.gray(error));
|
|
1300
1302
|
console.log("\n");
|
|
1301
1303
|
resolve(1);
|
|
1302
1304
|
} else {
|
|
1303
|
-
console.log(
|
|
1305
|
+
console.log(chalk18.green(`License Checker [${name}]`));
|
|
1304
1306
|
let count = 0;
|
|
1305
1307
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1306
1308
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
@@ -1318,7 +1320,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1318
1320
|
}
|
|
1319
1321
|
if (!orLicenseFound) {
|
|
1320
1322
|
count++;
|
|
1321
|
-
console.warn(
|
|
1323
|
+
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1322
1324
|
}
|
|
1323
1325
|
}
|
|
1324
1326
|
}
|
|
@@ -1337,7 +1339,7 @@ var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2
|
|
|
1337
1339
|
|
|
1338
1340
|
// src/actions/package/clean-outputs.ts
|
|
1339
1341
|
import path3 from "node:path";
|
|
1340
|
-
import
|
|
1342
|
+
import chalk19 from "chalk";
|
|
1341
1343
|
var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
1342
1344
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1343
1345
|
const pkgName = process.env.npm_package_name;
|
|
@@ -1346,7 +1348,7 @@ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
|
1346
1348
|
path3.join(pkg, "build"),
|
|
1347
1349
|
path3.join(pkg, "docs")
|
|
1348
1350
|
];
|
|
1349
|
-
console.log(
|
|
1351
|
+
console.log(chalk19.green(`Cleaning Outputs [${pkgName}]`));
|
|
1350
1352
|
for (let folder of folders) {
|
|
1351
1353
|
deleteGlob(folder);
|
|
1352
1354
|
}
|
|
@@ -1355,11 +1357,11 @@ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
|
|
|
1355
1357
|
|
|
1356
1358
|
// src/actions/package/clean-typescript.ts
|
|
1357
1359
|
import path4 from "node:path";
|
|
1358
|
-
import
|
|
1360
|
+
import chalk20 from "chalk";
|
|
1359
1361
|
var packageCleanTypescript = /* @__PURE__ */ __name(() => {
|
|
1360
1362
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1361
1363
|
const pkgName = process.env.npm_package_name;
|
|
1362
|
-
console.log(
|
|
1364
|
+
console.log(chalk20.green(`Cleaning Typescript [${pkgName}]`));
|
|
1363
1365
|
const files = [
|
|
1364
1366
|
path4.join(pkg, "*.tsbuildinfo"),
|
|
1365
1367
|
path4.join(pkg, ".tsconfig.*"),
|
|
@@ -1380,19 +1382,19 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
1380
1382
|
}, "packageClean");
|
|
1381
1383
|
|
|
1382
1384
|
// src/actions/package/compile/compile.ts
|
|
1383
|
-
import
|
|
1385
|
+
import chalk24 from "chalk";
|
|
1384
1386
|
|
|
1385
1387
|
// src/actions/package/publint.ts
|
|
1386
1388
|
import { promises as fs2 } from "node:fs";
|
|
1387
|
-
import
|
|
1389
|
+
import chalk21 from "chalk";
|
|
1388
1390
|
import sortPackageJson from "sort-package-json";
|
|
1389
1391
|
var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
1390
1392
|
const pkgDir = process.env.INIT_CWD;
|
|
1391
1393
|
const sortedPkg = sortPackageJson(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1392
1394
|
await fs2.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1393
1395
|
const pkg = JSON.parse(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1394
|
-
console.log(
|
|
1395
|
-
console.log(
|
|
1396
|
+
console.log(chalk21.green(`Publint: ${pkg.name}`));
|
|
1397
|
+
console.log(chalk21.gray(pkgDir));
|
|
1396
1398
|
const { publint: publint2 } = await import("publint");
|
|
1397
1399
|
const { messages } = await publint2({
|
|
1398
1400
|
level: "suggestion",
|
|
@@ -1407,21 +1409,21 @@ var packagePublint = /* @__PURE__ */ __name(async (params) => {
|
|
|
1407
1409
|
for (const message of validMessages) {
|
|
1408
1410
|
switch (message.type) {
|
|
1409
1411
|
case "error": {
|
|
1410
|
-
console.error(
|
|
1412
|
+
console.error(chalk21.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1411
1413
|
break;
|
|
1412
1414
|
}
|
|
1413
1415
|
case "warning": {
|
|
1414
|
-
console.warn(
|
|
1416
|
+
console.warn(chalk21.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1415
1417
|
break;
|
|
1416
1418
|
}
|
|
1417
1419
|
default: {
|
|
1418
|
-
console.log(
|
|
1420
|
+
console.log(chalk21.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1419
1421
|
break;
|
|
1420
1422
|
}
|
|
1421
1423
|
}
|
|
1422
1424
|
}
|
|
1423
1425
|
if (params?.verbose) {
|
|
1424
|
-
console.log(
|
|
1426
|
+
console.log(chalk21.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1425
1427
|
}
|
|
1426
1428
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1427
1429
|
}, "packagePublint");
|
|
@@ -1465,7 +1467,7 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode = "single", exclude
|
|
|
1465
1467
|
|
|
1466
1468
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1467
1469
|
import { cwd } from "node:process";
|
|
1468
|
-
import
|
|
1470
|
+
import chalk22 from "chalk";
|
|
1469
1471
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1470
1472
|
import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys as sys2 } from "typescript";
|
|
1471
1473
|
|
|
@@ -1522,7 +1524,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
|
|
|
1522
1524
|
".spec."
|
|
1523
1525
|
];
|
|
1524
1526
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1525
|
-
console.log(
|
|
1527
|
+
console.log(chalk22.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1526
1528
|
if (files.length > 0) {
|
|
1527
1529
|
const program = createProgramFromConfig({
|
|
1528
1530
|
basePath: pkg ?? cwd(),
|
|
@@ -1584,7 +1586,7 @@ __name(deepMergeObjects, "deepMergeObjects");
|
|
|
1584
1586
|
|
|
1585
1587
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1586
1588
|
import { cwd as cwd2 } from "node:process";
|
|
1587
|
-
import
|
|
1589
|
+
import chalk23 from "chalk";
|
|
1588
1590
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1589
1591
|
import { DiagnosticCategory as DiagnosticCategory2, formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2, getPreEmitDiagnostics as getPreEmitDiagnostics2, sys as sys3 } from "typescript";
|
|
1590
1592
|
var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
@@ -1619,7 +1621,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
|
|
|
1619
1621
|
".d.mts"
|
|
1620
1622
|
];
|
|
1621
1623
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1622
|
-
console.log(
|
|
1624
|
+
console.log(chalk23.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1623
1625
|
if (files.length > 0) {
|
|
1624
1626
|
const program = createProgramFromConfig2({
|
|
1625
1627
|
basePath: pkg ?? cwd2(),
|
|
@@ -1779,7 +1781,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1779
1781
|
// src/actions/package/compile/compile.ts
|
|
1780
1782
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1781
1783
|
const pkg = process.env.INIT_CWD;
|
|
1782
|
-
console.log(
|
|
1784
|
+
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1783
1785
|
const config2 = await loadConfig(inConfig);
|
|
1784
1786
|
const publint2 = config2.publint;
|
|
1785
1787
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1791,7 +1793,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1791
1793
|
|
|
1792
1794
|
// src/actions/package/copy-assets.ts
|
|
1793
1795
|
import path5 from "node:path/posix";
|
|
1794
|
-
import
|
|
1796
|
+
import chalk25 from "chalk";
|
|
1795
1797
|
import cpy2 from "cpy";
|
|
1796
1798
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1797
1799
|
try {
|
|
@@ -1810,7 +1812,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1810
1812
|
flat: false
|
|
1811
1813
|
});
|
|
1812
1814
|
if (values.length > 0) {
|
|
1813
|
-
console.log(
|
|
1815
|
+
console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1814
1816
|
}
|
|
1815
1817
|
for (const value of values) {
|
|
1816
1818
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1839,7 +1841,7 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1839
1841
|
}, "packageCopyAssets");
|
|
1840
1842
|
|
|
1841
1843
|
// src/actions/package/cycle.ts
|
|
1842
|
-
import { cruise } from "dependency-cruiser";
|
|
1844
|
+
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1843
1845
|
var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
1844
1846
|
const pkg = process.env.INIT_CWD;
|
|
1845
1847
|
const pkgName = process.env.npm_package_name;
|
|
@@ -1868,7 +1870,7 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1868
1870
|
};
|
|
1869
1871
|
const target = `${pkg}/src`;
|
|
1870
1872
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1871
|
-
const result = await
|
|
1873
|
+
const result = await cruise2([
|
|
1872
1874
|
target
|
|
1873
1875
|
], cruiseOptions);
|
|
1874
1876
|
if (result.output) {
|
|
@@ -1885,7 +1887,7 @@ var packageCycle = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
1885
1887
|
// src/actions/package/gen-docs.ts
|
|
1886
1888
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1887
1889
|
import path6 from "node:path";
|
|
1888
|
-
import
|
|
1890
|
+
import chalk26 from "chalk";
|
|
1889
1891
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1890
1892
|
var ExitCodes = {
|
|
1891
1893
|
CompileError: 3,
|
|
@@ -1987,7 +1989,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1987
1989
|
return ExitCodes.OutputError;
|
|
1988
1990
|
}
|
|
1989
1991
|
}
|
|
1990
|
-
console.log(
|
|
1992
|
+
console.log(chalk26.green(`${pkgName} - Ok`));
|
|
1991
1993
|
return ExitCodes.Ok;
|
|
1992
1994
|
}, "runTypeDoc");
|
|
1993
1995
|
|
|
@@ -1996,7 +1998,7 @@ import { readdirSync } from "node:fs";
|
|
|
1996
1998
|
import path7 from "node:path";
|
|
1997
1999
|
import { cwd as cwd3 } from "node:process";
|
|
1998
2000
|
import { pathToFileURL } from "node:url";
|
|
1999
|
-
import
|
|
2001
|
+
import chalk27 from "chalk";
|
|
2000
2002
|
import { ESLint } from "eslint";
|
|
2001
2003
|
import { findUp } from "find-up";
|
|
2002
2004
|
import picomatch from "picomatch";
|
|
@@ -2013,10 +2015,10 @@ var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
|
2013
2015
|
];
|
|
2014
2016
|
for (const lintResult of lintResults) {
|
|
2015
2017
|
if (lintResult.messages.length > 0) {
|
|
2016
|
-
console.log(
|
|
2018
|
+
console.log(chalk27.gray(`
|
|
2017
2019
|
${lintResult.filePath}`));
|
|
2018
2020
|
for (const message of lintResult.messages) {
|
|
2019
|
-
console.log(
|
|
2021
|
+
console.log(chalk27.gray(` ${message.line}:${message.column}`), chalk27[colors[message.severity]](` ${severity[message.severity]}`), chalk27.white(` ${message.message}`), chalk27.gray(` ${message.ruleId}`));
|
|
2020
2022
|
}
|
|
2021
2023
|
}
|
|
2022
2024
|
}
|
|
@@ -2071,7 +2073,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2071
2073
|
});
|
|
2072
2074
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2073
2075
|
if (verbose) {
|
|
2074
|
-
console.log(
|
|
2076
|
+
console.log(chalk27.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2075
2077
|
}
|
|
2076
2078
|
const lintResults = await engine.lintFiles(files);
|
|
2077
2079
|
dumpMessages(lintResults);
|
|
@@ -2081,7 +2083,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2081
2083
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2082
2084
|
const lintTime = Date.now() - start;
|
|
2083
2085
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2084
|
-
console.log(
|
|
2086
|
+
console.log(chalk27.white(`Linted ${chalk27[filesCountColor](files.length)} files in ${chalk27[lintTimeColor](lintTime)}ms`));
|
|
2085
2087
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2086
2088
|
}, "packageLint");
|
|
2087
2089
|
|
|
@@ -2148,7 +2150,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2148
2150
|
}, "rebuild");
|
|
2149
2151
|
|
|
2150
2152
|
// src/actions/recompile.ts
|
|
2151
|
-
import
|
|
2153
|
+
import chalk28 from "chalk";
|
|
2152
2154
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2153
2155
|
return pkg ? await recompilePackage({
|
|
2154
2156
|
pkg,
|
|
@@ -2203,7 +2205,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2203
2205
|
`${jobs}`
|
|
2204
2206
|
] : [];
|
|
2205
2207
|
if (jobs) {
|
|
2206
|
-
console.log(
|
|
2208
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2207
2209
|
}
|
|
2208
2210
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2209
2211
|
[
|
|
@@ -2233,7 +2235,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2233
2235
|
]
|
|
2234
2236
|
]
|
|
2235
2237
|
]);
|
|
2236
|
-
console.log(`${
|
|
2238
|
+
console.log(`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`);
|
|
2237
2239
|
return result;
|
|
2238
2240
|
}, "recompileAll");
|
|
2239
2241
|
|
|
@@ -2267,9 +2269,9 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2267
2269
|
}, "reinstall");
|
|
2268
2270
|
|
|
2269
2271
|
// src/actions/relint.ts
|
|
2270
|
-
import
|
|
2272
|
+
import chalk29 from "chalk";
|
|
2271
2273
|
var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
2272
|
-
console.log(
|
|
2274
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2273
2275
|
const start = Date.now();
|
|
2274
2276
|
const result = runSteps("Relint [All-Packages]", [
|
|
2275
2277
|
[
|
|
@@ -2282,7 +2284,7 @@ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
|
|
|
2282
2284
|
]
|
|
2283
2285
|
]
|
|
2284
2286
|
]);
|
|
2285
|
-
console.log(
|
|
2287
|
+
console.log(chalk29.gray(`${"Relinted in"} [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2286
2288
|
return result;
|
|
2287
2289
|
}, "relintPackage");
|
|
2288
2290
|
var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
@@ -2294,7 +2296,7 @@ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
|
|
|
2294
2296
|
});
|
|
2295
2297
|
}, "relint");
|
|
2296
2298
|
var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
|
|
2297
|
-
console.log(
|
|
2299
|
+
console.log(chalk29.gray(`${"Relint"} [All-Packages]`));
|
|
2298
2300
|
const start = Date.now();
|
|
2299
2301
|
const verboseOptions = verbose ? [
|
|
2300
2302
|
"--verbose"
|
|
@@ -2321,7 +2323,7 @@ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental }
|
|
|
2321
2323
|
]
|
|
2322
2324
|
]
|
|
2323
2325
|
]);
|
|
2324
|
-
console.log(
|
|
2326
|
+
console.log(chalk29.gray(`Relinted in [${chalk29.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk29.gray("seconds")}`));
|
|
2325
2327
|
return result;
|
|
2326
2328
|
}, "relintAllPackages");
|
|
2327
2329
|
|
|
@@ -2361,7 +2363,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2361
2363
|
}, "sonar");
|
|
2362
2364
|
|
|
2363
2365
|
// src/actions/statics.ts
|
|
2364
|
-
import
|
|
2366
|
+
import chalk30 from "chalk";
|
|
2365
2367
|
var DefaultDependencies = [
|
|
2366
2368
|
"axios",
|
|
2367
2369
|
"@xylabs/pixel",
|
|
@@ -2372,7 +2374,7 @@ var DefaultDependencies = [
|
|
|
2372
2374
|
"@mui/system"
|
|
2373
2375
|
];
|
|
2374
2376
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2375
|
-
console.log(
|
|
2377
|
+
console.log(chalk30.green("Check Required Static Dependencies"));
|
|
2376
2378
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2377
2379
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2378
2380
|
}, "statics");
|
|
@@ -2490,7 +2492,7 @@ var loadPackageConfig = /* @__PURE__ */ __name(async () => {
|
|
|
2490
2492
|
}, "loadPackageConfig");
|
|
2491
2493
|
|
|
2492
2494
|
// src/xy/xy.ts
|
|
2493
|
-
import
|
|
2495
|
+
import chalk32 from "chalk";
|
|
2494
2496
|
|
|
2495
2497
|
// src/xy/xyBuildCommands.ts
|
|
2496
2498
|
var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
@@ -2731,17 +2733,17 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2731
2733
|
}, "xyInstallCommands");
|
|
2732
2734
|
|
|
2733
2735
|
// src/xy/xyLintCommands.ts
|
|
2734
|
-
import
|
|
2736
|
+
import chalk31 from "chalk";
|
|
2735
2737
|
var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
2736
2738
|
return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
|
|
2737
2739
|
return packagePositionalParam(yargs2);
|
|
2738
|
-
}, (argv) => {
|
|
2740
|
+
}, async (argv) => {
|
|
2739
2741
|
const start = Date.now();
|
|
2740
2742
|
if (argv.verbose) console.log("Cycle");
|
|
2741
|
-
process.exitCode = cycle({
|
|
2743
|
+
process.exitCode = await cycle({
|
|
2742
2744
|
pkg: argv.package
|
|
2743
2745
|
});
|
|
2744
|
-
console.log(
|
|
2746
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2745
2747
|
}).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
|
|
2746
2748
|
return packagePositionalParam(yargs2);
|
|
2747
2749
|
}, (argv) => {
|
|
@@ -2752,21 +2754,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2752
2754
|
}) : lint({
|
|
2753
2755
|
pkg: argv.package
|
|
2754
2756
|
});
|
|
2755
|
-
console.log(
|
|
2757
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2756
2758
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
2757
2759
|
return packagePositionalParam(yargs2);
|
|
2758
2760
|
}, (argv) => {
|
|
2759
2761
|
const start = Date.now();
|
|
2760
2762
|
if (argv.verbose) console.log("Fix");
|
|
2761
2763
|
process.exitCode = fix();
|
|
2762
|
-
console.log(
|
|
2764
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2763
2765
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
2764
2766
|
return packagePositionalParam(yargs2);
|
|
2765
2767
|
}, (argv) => {
|
|
2766
2768
|
if (argv.verbose) console.log("Relinting");
|
|
2767
2769
|
const start = Date.now();
|
|
2768
2770
|
process.exitCode = relint();
|
|
2769
|
-
console.log(
|
|
2771
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2770
2772
|
}).command("publint [package]", "Publint - Run Publint", (yargs2) => {
|
|
2771
2773
|
return packagePositionalParam(yargs2);
|
|
2772
2774
|
}, async (argv) => {
|
|
@@ -2776,21 +2778,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2776
2778
|
pkg: argv.package,
|
|
2777
2779
|
verbose: !!argv.verbose
|
|
2778
2780
|
});
|
|
2779
|
-
console.log(
|
|
2781
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2780
2782
|
}).command("knip", "Knip - Run Knip", (yargs2) => {
|
|
2781
2783
|
return packagePositionalParam(yargs2);
|
|
2782
2784
|
}, (argv) => {
|
|
2783
2785
|
if (argv.verbose) console.log("Knip");
|
|
2784
2786
|
const start = Date.now();
|
|
2785
2787
|
process.exitCode = knip();
|
|
2786
|
-
console.log(
|
|
2788
|
+
console.log(chalk31.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2787
2789
|
}).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
|
|
2788
2790
|
return packagePositionalParam(yargs2);
|
|
2789
2791
|
}, (argv) => {
|
|
2790
2792
|
const start = Date.now();
|
|
2791
2793
|
if (argv.verbose) console.log("Sonar Check");
|
|
2792
2794
|
process.exitCode = sonar();
|
|
2793
|
-
console.log(
|
|
2795
|
+
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2794
2796
|
});
|
|
2795
2797
|
}, "xyLintCommands");
|
|
2796
2798
|
|
|
@@ -2852,8 +2854,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2852
2854
|
var xy = /* @__PURE__ */ __name(async () => {
|
|
2853
2855
|
const options = xyParseOptions();
|
|
2854
2856
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2855
|
-
console.error(
|
|
2856
|
-
console.log(
|
|
2857
|
+
console.error(chalk32.yellow(`Command not found [${chalk32.magenta(process.argv[2])}]`));
|
|
2858
|
+
console.log(chalk32.gray("Try 'yarn xy --help' for list of commands"));
|
|
2857
2859
|
}).version().help().argv;
|
|
2858
2860
|
}, "xy");
|
|
2859
2861
|
export {
|