@xylabs/ts-scripts-yarn3 5.1.2 → 5.1.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/fix.mjs +74 -98
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +106 -116
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint-clean.mjs +12 -135
- package/dist/actions/lint-clean.mjs.map +1 -1
- package/dist/actions/lint.mjs +5 -7
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/bin/xy-ts.mjs +77 -115
- package/dist/bin/xy-ts.mjs.map +1 -1
- package/dist/bin/xy.mjs +77 -115
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +109 -119
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +77 -115
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +77 -115
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +18 -56
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/fix.ts +3 -3
- package/src/actions/lint.ts +3 -4
- package/src/xy/xyLintCommands.ts +3 -3
package/dist/bin/xy.mjs
CHANGED
|
@@ -897,19 +897,66 @@ var dupdeps = /* @__PURE__ */ __name(() => {
|
|
|
897
897
|
return detectDuplicateDependencies(dependencies);
|
|
898
898
|
}, "dupdeps");
|
|
899
899
|
|
|
900
|
+
// src/actions/lint.ts
|
|
901
|
+
import chalk13 from "chalk";
|
|
902
|
+
import { ESLint as ESLint2 } from "eslint";
|
|
903
|
+
var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
904
|
+
const colors = [
|
|
905
|
+
"white",
|
|
906
|
+
"yellow",
|
|
907
|
+
"red"
|
|
908
|
+
];
|
|
909
|
+
const severity = [
|
|
910
|
+
"none",
|
|
911
|
+
"warning",
|
|
912
|
+
"error"
|
|
913
|
+
];
|
|
914
|
+
for (const lintResult of lintResults) {
|
|
915
|
+
if (lintResult.messages.length > 0) {
|
|
916
|
+
console.log(chalk13.gray(`${lintResult.filePath}`));
|
|
917
|
+
for (const message of lintResult.messages) {
|
|
918
|
+
console.log(chalk13.gray(` ${message.line}:${message.column}`), chalk13[colors[message.severity]](` ${severity[message.severity]}`), chalk13.white(` ${message.message}`), chalk13.gray(` ${message.ruleId}`));
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}, "dumpMessages");
|
|
923
|
+
var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
|
|
924
|
+
const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
|
|
925
|
+
if (!workspace) {
|
|
926
|
+
console.error(chalk13.red(`Unable to locate package [${chalk13.magenta(pkg)}]`));
|
|
927
|
+
process.exit(1);
|
|
928
|
+
}
|
|
929
|
+
const engine = new ESLint2({
|
|
930
|
+
cache: true,
|
|
931
|
+
fix: fix2
|
|
932
|
+
});
|
|
933
|
+
const lintResults = await engine.lintFiles(workspace.location);
|
|
934
|
+
dumpMessages(lintResults);
|
|
935
|
+
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
936
|
+
}, "lintPackage");
|
|
937
|
+
var lintAll = /* @__PURE__ */ __name(async ({ fix: fix2 }) => {
|
|
938
|
+
const workspace = yarnWorkspaces();
|
|
939
|
+
return (await Promise.all(workspace.map((ws) => lintPackage({
|
|
940
|
+
pkg: ws.name,
|
|
941
|
+
fix: fix2
|
|
942
|
+
})))).reduce((prev, curr) => prev + curr, 0);
|
|
943
|
+
}, "lintAll");
|
|
944
|
+
var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
945
|
+
return pkg ? await lintPackage({
|
|
946
|
+
pkg,
|
|
947
|
+
fix: fix2
|
|
948
|
+
}) : lintAll({
|
|
949
|
+
verbose,
|
|
950
|
+
incremental,
|
|
951
|
+
fix: fix2
|
|
952
|
+
});
|
|
953
|
+
}, "lint");
|
|
954
|
+
|
|
900
955
|
// src/actions/fix.ts
|
|
901
|
-
var fix = /* @__PURE__ */ __name(() => {
|
|
902
|
-
return
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
[
|
|
906
|
-
"eslint",
|
|
907
|
-
".",
|
|
908
|
-
"--fix",
|
|
909
|
-
"--cache"
|
|
910
|
-
]
|
|
911
|
-
]
|
|
912
|
-
]);
|
|
956
|
+
var fix = /* @__PURE__ */ __name(async () => {
|
|
957
|
+
return await lint({
|
|
958
|
+
fix: true
|
|
959
|
+
});
|
|
913
960
|
}, "fix");
|
|
914
961
|
|
|
915
962
|
// src/actions/gen-docs.ts
|
|
@@ -965,7 +1012,7 @@ var filename = ".gitignore";
|
|
|
965
1012
|
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
966
1013
|
|
|
967
1014
|
// src/actions/gitlint.ts
|
|
968
|
-
import
|
|
1015
|
+
import chalk14 from "chalk";
|
|
969
1016
|
import ParseGitConfig from "parse-git-config";
|
|
970
1017
|
var gitlint = /* @__PURE__ */ __name(() => {
|
|
971
1018
|
console.log(`
|
|
@@ -976,7 +1023,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
976
1023
|
const errors = 0;
|
|
977
1024
|
const gitConfig = ParseGitConfig.sync();
|
|
978
1025
|
const warn = /* @__PURE__ */ __name((message) => {
|
|
979
|
-
console.warn(
|
|
1026
|
+
console.warn(chalk14.yellow(`Warning: ${message}`));
|
|
980
1027
|
warnings++;
|
|
981
1028
|
}, "warn");
|
|
982
1029
|
if (gitConfig.core.ignorecase) {
|
|
@@ -996,13 +1043,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
996
1043
|
}
|
|
997
1044
|
const resultMessages = [];
|
|
998
1045
|
if (valid > 0) {
|
|
999
|
-
resultMessages.push(
|
|
1046
|
+
resultMessages.push(chalk14.green(`Passed: ${valid}`));
|
|
1000
1047
|
}
|
|
1001
1048
|
if (warnings > 0) {
|
|
1002
|
-
resultMessages.push(
|
|
1049
|
+
resultMessages.push(chalk14.yellow(`Warnings: ${warnings}`));
|
|
1003
1050
|
}
|
|
1004
1051
|
if (errors > 0) {
|
|
1005
|
-
resultMessages.push(
|
|
1052
|
+
resultMessages.push(chalk14.red(` Errors: ${errors}`));
|
|
1006
1053
|
}
|
|
1007
1054
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1008
1055
|
`);
|
|
@@ -1011,7 +1058,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1011
1058
|
|
|
1012
1059
|
// src/actions/gitlint-fix.ts
|
|
1013
1060
|
import { execSync as execSync2 } from "node:child_process";
|
|
1014
|
-
import
|
|
1061
|
+
import chalk15 from "chalk";
|
|
1015
1062
|
import ParseGitConfig2 from "parse-git-config";
|
|
1016
1063
|
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1017
1064
|
console.log(`
|
|
@@ -1022,25 +1069,25 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1022
1069
|
execSync2("git config core.ignorecase false", {
|
|
1023
1070
|
stdio: "inherit"
|
|
1024
1071
|
});
|
|
1025
|
-
console.warn(
|
|
1072
|
+
console.warn(chalk15.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1026
1073
|
}
|
|
1027
1074
|
if (gitConfig.core.autocrlf !== false) {
|
|
1028
1075
|
execSync2("git config core.autocrlf false", {
|
|
1029
1076
|
stdio: "inherit"
|
|
1030
1077
|
});
|
|
1031
|
-
console.warn(
|
|
1078
|
+
console.warn(chalk15.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1032
1079
|
}
|
|
1033
1080
|
if (gitConfig.core.eol !== "lf") {
|
|
1034
1081
|
execSync2("git config core.eol lf", {
|
|
1035
1082
|
stdio: "inherit"
|
|
1036
1083
|
});
|
|
1037
|
-
console.warn(
|
|
1084
|
+
console.warn(chalk15.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1038
1085
|
}
|
|
1039
1086
|
return 1;
|
|
1040
1087
|
}, "gitlintFix");
|
|
1041
1088
|
|
|
1042
1089
|
// src/actions/license.ts
|
|
1043
|
-
import
|
|
1090
|
+
import chalk16 from "chalk";
|
|
1044
1091
|
import { init } from "license-checker";
|
|
1045
1092
|
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1046
1093
|
const workspaces = yarnWorkspaces();
|
|
@@ -1065,7 +1112,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1065
1112
|
"LGPL-3.0-or-later",
|
|
1066
1113
|
"Python-2.0"
|
|
1067
1114
|
]);
|
|
1068
|
-
console.log(
|
|
1115
|
+
console.log(chalk16.green("License Checker"));
|
|
1069
1116
|
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1070
1117
|
return new Promise((resolve) => {
|
|
1071
1118
|
init({
|
|
@@ -1073,12 +1120,12 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1073
1120
|
start: location
|
|
1074
1121
|
}, (error, packages) => {
|
|
1075
1122
|
if (error) {
|
|
1076
|
-
console.error(
|
|
1077
|
-
console.error(
|
|
1123
|
+
console.error(chalk16.red(`License Checker [${name}] Error`));
|
|
1124
|
+
console.error(chalk16.gray(error));
|
|
1078
1125
|
console.log("\n");
|
|
1079
1126
|
resolve(1);
|
|
1080
1127
|
} else {
|
|
1081
|
-
console.log(
|
|
1128
|
+
console.log(chalk16.green(`License Checker [${name}]`));
|
|
1082
1129
|
let count = 0;
|
|
1083
1130
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1084
1131
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
@@ -1096,7 +1143,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1096
1143
|
}
|
|
1097
1144
|
if (!orLicenseFound) {
|
|
1098
1145
|
count++;
|
|
1099
|
-
console.warn(
|
|
1146
|
+
console.warn(chalk16.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1100
1147
|
}
|
|
1101
1148
|
}
|
|
1102
1149
|
}
|
|
@@ -1109,91 +1156,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1109
1156
|
}))).reduce((prev, value) => prev || value, 0);
|
|
1110
1157
|
}, "license");
|
|
1111
1158
|
|
|
1112
|
-
// src/actions/lint.ts
|
|
1113
|
-
import chalk16 from "chalk";
|
|
1114
|
-
import { ESLint as ESLint2 } from "eslint";
|
|
1115
|
-
var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
|
|
1116
|
-
const colors = [
|
|
1117
|
-
"white",
|
|
1118
|
-
"yellow",
|
|
1119
|
-
"red"
|
|
1120
|
-
];
|
|
1121
|
-
const severity = [
|
|
1122
|
-
"none",
|
|
1123
|
-
"warning",
|
|
1124
|
-
"error"
|
|
1125
|
-
];
|
|
1126
|
-
for (const lintResult of lintResults) {
|
|
1127
|
-
if (lintResult.messages.length > 0) {
|
|
1128
|
-
console.log(chalk16.gray(`${lintResult.filePath}`));
|
|
1129
|
-
for (const message of lintResult.messages) {
|
|
1130
|
-
console.log(chalk16.gray(` ${message.line}:${message.column}`), chalk16[colors[message.severity]](` ${severity[message.severity]}`), chalk16.white(` ${message.message}`), chalk16.gray(` ${message.ruleId}`));
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}, "dumpMessages");
|
|
1135
|
-
var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
|
|
1136
|
-
const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
|
|
1137
|
-
if (!workspace) {
|
|
1138
|
-
console.error(chalk16.red(`Unable to locate package [${chalk16.magenta(pkg)}]`));
|
|
1139
|
-
process.exit(1);
|
|
1140
|
-
}
|
|
1141
|
-
const engine = new ESLint2({
|
|
1142
|
-
cache: true,
|
|
1143
|
-
fix: fix2
|
|
1144
|
-
});
|
|
1145
|
-
const lintResults = await engine.lintFiles(workspace.location);
|
|
1146
|
-
dumpMessages(lintResults);
|
|
1147
|
-
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1148
|
-
}, "lintPackage");
|
|
1149
|
-
var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
1150
|
-
return pkg ? await lintPackage({
|
|
1151
|
-
pkg,
|
|
1152
|
-
fix: fix2
|
|
1153
|
-
}) : lintAllPackages({
|
|
1154
|
-
verbose,
|
|
1155
|
-
incremental,
|
|
1156
|
-
fix: fix2
|
|
1157
|
-
});
|
|
1158
|
-
}, "lint");
|
|
1159
|
-
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incremental } = {}) => {
|
|
1160
|
-
console.log(chalk16.gray("Linting [All-Packages]"));
|
|
1161
|
-
const start = Date.now();
|
|
1162
|
-
const verboseOptions = verbose ? [
|
|
1163
|
-
"--verbose"
|
|
1164
|
-
] : [
|
|
1165
|
-
"--no-verbose"
|
|
1166
|
-
];
|
|
1167
|
-
const fixOptions = fix2 ? [
|
|
1168
|
-
"--fix"
|
|
1169
|
-
] : [
|
|
1170
|
-
""
|
|
1171
|
-
];
|
|
1172
|
-
const incrementalOptions = incremental ? [
|
|
1173
|
-
"--since",
|
|
1174
|
-
"-Apt"
|
|
1175
|
-
] : [
|
|
1176
|
-
"--parallel",
|
|
1177
|
-
"-Apt"
|
|
1178
|
-
];
|
|
1179
|
-
const result = runSteps("Lint [All-Packages]", [
|
|
1180
|
-
[
|
|
1181
|
-
"yarn",
|
|
1182
|
-
[
|
|
1183
|
-
"workspaces",
|
|
1184
|
-
"foreach",
|
|
1185
|
-
...verboseOptions,
|
|
1186
|
-
...incrementalOptions,
|
|
1187
|
-
"run",
|
|
1188
|
-
"package-lint",
|
|
1189
|
-
...fixOptions
|
|
1190
|
-
]
|
|
1191
|
-
]
|
|
1192
|
-
]);
|
|
1193
|
-
console.log(`${chalk16.gray("Linted in")} [${chalk16.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk16.gray("seconds")}`);
|
|
1194
|
-
return result;
|
|
1195
|
-
}, "lintAllPackages");
|
|
1196
|
-
|
|
1197
1159
|
// src/actions/lint-profile.ts
|
|
1198
1160
|
var lintProfile = /* @__PURE__ */ __name(() => {
|
|
1199
1161
|
return runSteps("Lint Profile", [
|
|
@@ -1833,16 +1795,16 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
1833
1795
|
}, async (argv) => {
|
|
1834
1796
|
if (argv.verbose) console.log("Lint");
|
|
1835
1797
|
const start = Date.now();
|
|
1836
|
-
process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : await lint({
|
|
1798
|
+
process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
|
|
1837
1799
|
pkg: argv.package
|
|
1838
1800
|
});
|
|
1839
1801
|
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1840
1802
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
1841
1803
|
return packagePositionalParam(yargs2);
|
|
1842
|
-
}, (argv) => {
|
|
1804
|
+
}, async (argv) => {
|
|
1843
1805
|
const start = Date.now();
|
|
1844
1806
|
if (argv.verbose) console.log("Fix");
|
|
1845
|
-
process.exitCode = fix();
|
|
1807
|
+
process.exitCode = await fix();
|
|
1846
1808
|
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1847
1809
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
1848
1810
|
return packagePositionalParam(yargs2);
|