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