@xylabs/ts-scripts-yarn3 5.1.2 → 5.1.3
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/fix.mjs +108 -9
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +108 -116
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy-ts.mjs +102 -110
- package/dist/bin/xy-ts.mjs.map +1 -1
- package/dist/bin/xy.mjs +102 -110
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +111 -119
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +102 -110
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +102 -110
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +10 -18
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/fix.ts +3 -3
- package/src/xy/xyLintCommands.ts +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ declare const depsAll: ({ incremental, jobs, verbose, }: DepsParams) => number;
|
|
|
81
81
|
|
|
82
82
|
declare const dupdeps: () => number;
|
|
83
83
|
|
|
84
|
-
declare const fix: () => number
|
|
84
|
+
declare const fix: () => Promise<number>;
|
|
85
85
|
|
|
86
86
|
interface GenDocsParams {
|
|
87
87
|
incremental?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1007,19 +1007,105 @@ var dupdeps = /* @__PURE__ */ __name(() => {
|
|
|
1007
1007
|
return detectDuplicateDependencies(dependencies);
|
|
1008
1008
|
}, "dupdeps");
|
|
1009
1009
|
|
|
1010
|
-
// src/actions/
|
|
1011
|
-
|
|
1012
|
-
|
|
1010
|
+
// src/actions/lint.ts
|
|
1011
|
+
import chalk15 from "chalk";
|
|
1012
|
+
import { ESLint as ESLint2 } from "eslint";
|
|
1013
|
+
var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
1014
|
+
const colors = [
|
|
1015
|
+
"white",
|
|
1016
|
+
"yellow",
|
|
1017
|
+
"red"
|
|
1018
|
+
];
|
|
1019
|
+
const severity = [
|
|
1020
|
+
"none",
|
|
1021
|
+
"warning",
|
|
1022
|
+
"error"
|
|
1023
|
+
];
|
|
1024
|
+
for (const lintResult of lintResults) {
|
|
1025
|
+
if (lintResult.messages.length > 0) {
|
|
1026
|
+
console.log(chalk15.gray(`${lintResult.filePath}`));
|
|
1027
|
+
for (const message of lintResult.messages) {
|
|
1028
|
+
console.log(chalk15.gray(` ${message.line}:${message.column}`), chalk15[colors[message.severity]](` ${severity[message.severity]}`), chalk15.white(` ${message.message}`), chalk15.gray(` ${message.ruleId}`));
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}, "dumpMessages");
|
|
1033
|
+
var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
|
|
1034
|
+
const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
|
|
1035
|
+
if (!workspace) {
|
|
1036
|
+
console.error(chalk15.red(`Unable to locate package [${chalk15.magenta(pkg)}]`));
|
|
1037
|
+
process.exit(1);
|
|
1038
|
+
}
|
|
1039
|
+
const engine = new ESLint2({
|
|
1040
|
+
cache: true,
|
|
1041
|
+
fix: fix2
|
|
1042
|
+
});
|
|
1043
|
+
const lintResults = await engine.lintFiles(workspace.location);
|
|
1044
|
+
dumpMessages(lintResults);
|
|
1045
|
+
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1046
|
+
}, "lintPackage");
|
|
1047
|
+
var lintAll = /* @__PURE__ */ __name(async ({ fix: fix2 }) => {
|
|
1048
|
+
const workspace = yarnWorkspaces();
|
|
1049
|
+
for (const ws of workspace) {
|
|
1050
|
+
await lintPackage({
|
|
1051
|
+
pkg: ws.name,
|
|
1052
|
+
fix: fix2
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
}, "lintAll");
|
|
1056
|
+
var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
1057
|
+
return pkg ? await lintPackage({
|
|
1058
|
+
pkg,
|
|
1059
|
+
fix: fix2
|
|
1060
|
+
}) : lintAllPackages({
|
|
1061
|
+
verbose,
|
|
1062
|
+
incremental,
|
|
1063
|
+
fix: fix2
|
|
1064
|
+
});
|
|
1065
|
+
}, "lint");
|
|
1066
|
+
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incremental } = {}) => {
|
|
1067
|
+
console.log(chalk15.gray("Linting [All-Packages]"));
|
|
1068
|
+
const start = Date.now();
|
|
1069
|
+
const verboseOptions = verbose ? [
|
|
1070
|
+
"--verbose"
|
|
1071
|
+
] : [
|
|
1072
|
+
"--no-verbose"
|
|
1073
|
+
];
|
|
1074
|
+
const fixOptions = fix2 ? [
|
|
1075
|
+
"--fix"
|
|
1076
|
+
] : [
|
|
1077
|
+
""
|
|
1078
|
+
];
|
|
1079
|
+
const incrementalOptions = incremental ? [
|
|
1080
|
+
"--since",
|
|
1081
|
+
"-Apt"
|
|
1082
|
+
] : [
|
|
1083
|
+
"--parallel",
|
|
1084
|
+
"-Apt"
|
|
1085
|
+
];
|
|
1086
|
+
const result = runSteps("Lint [All-Packages]", [
|
|
1013
1087
|
[
|
|
1014
1088
|
"yarn",
|
|
1015
1089
|
[
|
|
1016
|
-
"
|
|
1017
|
-
"
|
|
1018
|
-
|
|
1019
|
-
|
|
1090
|
+
"workspaces",
|
|
1091
|
+
"foreach",
|
|
1092
|
+
...verboseOptions,
|
|
1093
|
+
...incrementalOptions,
|
|
1094
|
+
"run",
|
|
1095
|
+
"package-lint",
|
|
1096
|
+
...fixOptions
|
|
1020
1097
|
]
|
|
1021
1098
|
]
|
|
1022
1099
|
]);
|
|
1100
|
+
console.log(`${chalk15.gray("Linted in")} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`);
|
|
1101
|
+
return result;
|
|
1102
|
+
}, "lintAllPackages");
|
|
1103
|
+
|
|
1104
|
+
// src/actions/fix.ts
|
|
1105
|
+
var fix = /* @__PURE__ */ __name(async () => {
|
|
1106
|
+
return await lint({
|
|
1107
|
+
fix: true
|
|
1108
|
+
});
|
|
1023
1109
|
}, "fix");
|
|
1024
1110
|
|
|
1025
1111
|
// src/actions/gen-docs.ts
|
|
@@ -1075,7 +1161,7 @@ var filename = ".gitignore";
|
|
|
1075
1161
|
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
1076
1162
|
|
|
1077
1163
|
// src/actions/gitlint.ts
|
|
1078
|
-
import
|
|
1164
|
+
import chalk16 from "chalk";
|
|
1079
1165
|
import ParseGitConfig from "parse-git-config";
|
|
1080
1166
|
var gitlint = /* @__PURE__ */ __name(() => {
|
|
1081
1167
|
console.log(`
|
|
@@ -1086,7 +1172,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1086
1172
|
const errors = 0;
|
|
1087
1173
|
const gitConfig = ParseGitConfig.sync();
|
|
1088
1174
|
const warn = /* @__PURE__ */ __name((message) => {
|
|
1089
|
-
console.warn(
|
|
1175
|
+
console.warn(chalk16.yellow(`Warning: ${message}`));
|
|
1090
1176
|
warnings++;
|
|
1091
1177
|
}, "warn");
|
|
1092
1178
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1106,13 +1192,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1106
1192
|
}
|
|
1107
1193
|
const resultMessages = [];
|
|
1108
1194
|
if (valid > 0) {
|
|
1109
|
-
resultMessages.push(
|
|
1195
|
+
resultMessages.push(chalk16.green(`Passed: ${valid}`));
|
|
1110
1196
|
}
|
|
1111
1197
|
if (warnings > 0) {
|
|
1112
|
-
resultMessages.push(
|
|
1198
|
+
resultMessages.push(chalk16.yellow(`Warnings: ${warnings}`));
|
|
1113
1199
|
}
|
|
1114
1200
|
if (errors > 0) {
|
|
1115
|
-
resultMessages.push(
|
|
1201
|
+
resultMessages.push(chalk16.red(` Errors: ${errors}`));
|
|
1116
1202
|
}
|
|
1117
1203
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1118
1204
|
`);
|
|
@@ -1121,7 +1207,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1121
1207
|
|
|
1122
1208
|
// src/actions/gitlint-fix.ts
|
|
1123
1209
|
import { execSync as execSync2 } from "node:child_process";
|
|
1124
|
-
import
|
|
1210
|
+
import chalk17 from "chalk";
|
|
1125
1211
|
import ParseGitConfig2 from "parse-git-config";
|
|
1126
1212
|
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1127
1213
|
console.log(`
|
|
@@ -1132,25 +1218,25 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1132
1218
|
execSync2("git config core.ignorecase false", {
|
|
1133
1219
|
stdio: "inherit"
|
|
1134
1220
|
});
|
|
1135
|
-
console.warn(
|
|
1221
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1136
1222
|
}
|
|
1137
1223
|
if (gitConfig.core.autocrlf !== false) {
|
|
1138
1224
|
execSync2("git config core.autocrlf false", {
|
|
1139
1225
|
stdio: "inherit"
|
|
1140
1226
|
});
|
|
1141
|
-
console.warn(
|
|
1227
|
+
console.warn(chalk17.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1142
1228
|
}
|
|
1143
1229
|
if (gitConfig.core.eol !== "lf") {
|
|
1144
1230
|
execSync2("git config core.eol lf", {
|
|
1145
1231
|
stdio: "inherit"
|
|
1146
1232
|
});
|
|
1147
|
-
console.warn(
|
|
1233
|
+
console.warn(chalk17.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1148
1234
|
}
|
|
1149
1235
|
return 1;
|
|
1150
1236
|
}, "gitlintFix");
|
|
1151
1237
|
|
|
1152
1238
|
// src/actions/license.ts
|
|
1153
|
-
import
|
|
1239
|
+
import chalk18 from "chalk";
|
|
1154
1240
|
import { init } from "license-checker";
|
|
1155
1241
|
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1156
1242
|
const workspaces = yarnWorkspaces();
|
|
@@ -1175,7 +1261,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1175
1261
|
"LGPL-3.0-or-later",
|
|
1176
1262
|
"Python-2.0"
|
|
1177
1263
|
]);
|
|
1178
|
-
console.log(
|
|
1264
|
+
console.log(chalk18.green("License Checker"));
|
|
1179
1265
|
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1180
1266
|
return new Promise((resolve) => {
|
|
1181
1267
|
init({
|
|
@@ -1183,12 +1269,12 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1183
1269
|
start: location
|
|
1184
1270
|
}, (error, packages) => {
|
|
1185
1271
|
if (error) {
|
|
1186
|
-
console.error(
|
|
1187
|
-
console.error(
|
|
1272
|
+
console.error(chalk18.red(`License Checker [${name}] Error`));
|
|
1273
|
+
console.error(chalk18.gray(error));
|
|
1188
1274
|
console.log("\n");
|
|
1189
1275
|
resolve(1);
|
|
1190
1276
|
} else {
|
|
1191
|
-
console.log(
|
|
1277
|
+
console.log(chalk18.green(`License Checker [${name}]`));
|
|
1192
1278
|
let count = 0;
|
|
1193
1279
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1194
1280
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
@@ -1206,7 +1292,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1206
1292
|
}
|
|
1207
1293
|
if (!orLicenseFound) {
|
|
1208
1294
|
count++;
|
|
1209
|
-
console.warn(
|
|
1295
|
+
console.warn(chalk18.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1210
1296
|
}
|
|
1211
1297
|
}
|
|
1212
1298
|
}
|
|
@@ -1219,100 +1305,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1219
1305
|
}))).reduce((prev, value) => prev || value, 0);
|
|
1220
1306
|
}, "license");
|
|
1221
1307
|
|
|
1222
|
-
// src/actions/lint.ts
|
|
1223
|
-
import chalk18 from "chalk";
|
|
1224
|
-
import { ESLint as ESLint2 } from "eslint";
|
|
1225
|
-
var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
1226
|
-
const colors = [
|
|
1227
|
-
"white",
|
|
1228
|
-
"yellow",
|
|
1229
|
-
"red"
|
|
1230
|
-
];
|
|
1231
|
-
const severity = [
|
|
1232
|
-
"none",
|
|
1233
|
-
"warning",
|
|
1234
|
-
"error"
|
|
1235
|
-
];
|
|
1236
|
-
for (const lintResult of lintResults) {
|
|
1237
|
-
if (lintResult.messages.length > 0) {
|
|
1238
|
-
console.log(chalk18.gray(`${lintResult.filePath}`));
|
|
1239
|
-
for (const message of lintResult.messages) {
|
|
1240
|
-
console.log(chalk18.gray(` ${message.line}:${message.column}`), chalk18[colors[message.severity]](` ${severity[message.severity]}`), chalk18.white(` ${message.message}`), chalk18.gray(` ${message.ruleId}`));
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
}, "dumpMessages");
|
|
1245
|
-
var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
|
|
1246
|
-
const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
|
|
1247
|
-
if (!workspace) {
|
|
1248
|
-
console.error(chalk18.red(`Unable to locate package [${chalk18.magenta(pkg)}]`));
|
|
1249
|
-
process.exit(1);
|
|
1250
|
-
}
|
|
1251
|
-
const engine = new ESLint2({
|
|
1252
|
-
cache: true,
|
|
1253
|
-
fix: fix2
|
|
1254
|
-
});
|
|
1255
|
-
const lintResults = await engine.lintFiles(workspace.location);
|
|
1256
|
-
dumpMessages(lintResults);
|
|
1257
|
-
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1258
|
-
}, "lintPackage");
|
|
1259
|
-
var lintAll = /* @__PURE__ */ __name(async ({ fix: fix2 }) => {
|
|
1260
|
-
const workspace = yarnWorkspaces();
|
|
1261
|
-
for (const ws of workspace) {
|
|
1262
|
-
await lintPackage({
|
|
1263
|
-
pkg: ws.name,
|
|
1264
|
-
fix: fix2
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
}, "lintAll");
|
|
1268
|
-
var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
1269
|
-
return pkg ? await lintPackage({
|
|
1270
|
-
pkg,
|
|
1271
|
-
fix: fix2
|
|
1272
|
-
}) : lintAllPackages({
|
|
1273
|
-
verbose,
|
|
1274
|
-
incremental,
|
|
1275
|
-
fix: fix2
|
|
1276
|
-
});
|
|
1277
|
-
}, "lint");
|
|
1278
|
-
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incremental } = {}) => {
|
|
1279
|
-
console.log(chalk18.gray("Linting [All-Packages]"));
|
|
1280
|
-
const start = Date.now();
|
|
1281
|
-
const verboseOptions = verbose ? [
|
|
1282
|
-
"--verbose"
|
|
1283
|
-
] : [
|
|
1284
|
-
"--no-verbose"
|
|
1285
|
-
];
|
|
1286
|
-
const fixOptions = fix2 ? [
|
|
1287
|
-
"--fix"
|
|
1288
|
-
] : [
|
|
1289
|
-
""
|
|
1290
|
-
];
|
|
1291
|
-
const incrementalOptions = incremental ? [
|
|
1292
|
-
"--since",
|
|
1293
|
-
"-Apt"
|
|
1294
|
-
] : [
|
|
1295
|
-
"--parallel",
|
|
1296
|
-
"-Apt"
|
|
1297
|
-
];
|
|
1298
|
-
const result = runSteps("Lint [All-Packages]", [
|
|
1299
|
-
[
|
|
1300
|
-
"yarn",
|
|
1301
|
-
[
|
|
1302
|
-
"workspaces",
|
|
1303
|
-
"foreach",
|
|
1304
|
-
...verboseOptions,
|
|
1305
|
-
...incrementalOptions,
|
|
1306
|
-
"run",
|
|
1307
|
-
"package-lint",
|
|
1308
|
-
...fixOptions
|
|
1309
|
-
]
|
|
1310
|
-
]
|
|
1311
|
-
]);
|
|
1312
|
-
console.log(`${chalk18.gray("Linted in")} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`);
|
|
1313
|
-
return result;
|
|
1314
|
-
}, "lintAllPackages");
|
|
1315
|
-
|
|
1316
1308
|
// src/actions/lint-clean.ts
|
|
1317
1309
|
import { rmSync } from "node:fs";
|
|
1318
1310
|
var lintClean = /* @__PURE__ */ __name(async () => {
|
|
@@ -2814,16 +2806,16 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2814
2806
|
}, async (argv) => {
|
|
2815
2807
|
if (argv.verbose) console.log("Lint");
|
|
2816
2808
|
const start = Date.now();
|
|
2817
|
-
process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : await lint({
|
|
2809
|
+
process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
|
|
2818
2810
|
pkg: argv.package
|
|
2819
2811
|
});
|
|
2820
2812
|
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2821
2813
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
2822
2814
|
return packagePositionalParam(yargs2);
|
|
2823
|
-
}, (argv) => {
|
|
2815
|
+
}, async (argv) => {
|
|
2824
2816
|
const start = Date.now();
|
|
2825
2817
|
if (argv.verbose) console.log("Fix");
|
|
2826
|
-
process.exitCode = fix();
|
|
2818
|
+
process.exitCode = await fix();
|
|
2827
2819
|
console.log(chalk31.blue(`Finished in ${Date.now() - start}ms`));
|
|
2828
2820
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
2829
2821
|
return packagePositionalParam(yargs2);
|