@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/xy/xy.mjs
CHANGED
|
@@ -896,19 +896,96 @@ var dupdeps = /* @__PURE__ */ __name(() => {
|
|
|
896
896
|
return detectDuplicateDependencies(dependencies);
|
|
897
897
|
}, "dupdeps");
|
|
898
898
|
|
|
899
|
-
// src/actions/
|
|
900
|
-
|
|
901
|
-
|
|
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 lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
|
|
937
|
+
return pkg ? await lintPackage({
|
|
938
|
+
pkg,
|
|
939
|
+
fix: fix2
|
|
940
|
+
}) : lintAllPackages({
|
|
941
|
+
verbose,
|
|
942
|
+
incremental,
|
|
943
|
+
fix: fix2
|
|
944
|
+
});
|
|
945
|
+
}, "lint");
|
|
946
|
+
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incremental } = {}) => {
|
|
947
|
+
console.log(chalk13.gray("Linting [All-Packages]"));
|
|
948
|
+
const start = Date.now();
|
|
949
|
+
const verboseOptions = verbose ? [
|
|
950
|
+
"--verbose"
|
|
951
|
+
] : [
|
|
952
|
+
"--no-verbose"
|
|
953
|
+
];
|
|
954
|
+
const fixOptions = fix2 ? [
|
|
955
|
+
"--fix"
|
|
956
|
+
] : [
|
|
957
|
+
""
|
|
958
|
+
];
|
|
959
|
+
const incrementalOptions = incremental ? [
|
|
960
|
+
"--since",
|
|
961
|
+
"-Apt"
|
|
962
|
+
] : [
|
|
963
|
+
"--parallel",
|
|
964
|
+
"-Apt"
|
|
965
|
+
];
|
|
966
|
+
const result = runSteps("Lint [All-Packages]", [
|
|
902
967
|
[
|
|
903
968
|
"yarn",
|
|
904
969
|
[
|
|
905
|
-
"
|
|
906
|
-
"
|
|
907
|
-
|
|
908
|
-
|
|
970
|
+
"workspaces",
|
|
971
|
+
"foreach",
|
|
972
|
+
...verboseOptions,
|
|
973
|
+
...incrementalOptions,
|
|
974
|
+
"run",
|
|
975
|
+
"package-lint",
|
|
976
|
+
...fixOptions
|
|
909
977
|
]
|
|
910
978
|
]
|
|
911
979
|
]);
|
|
980
|
+
console.log(`${chalk13.gray("Linted in")} [${chalk13.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk13.gray("seconds")}`);
|
|
981
|
+
return result;
|
|
982
|
+
}, "lintAllPackages");
|
|
983
|
+
|
|
984
|
+
// src/actions/fix.ts
|
|
985
|
+
var fix = /* @__PURE__ */ __name(async () => {
|
|
986
|
+
return await lint({
|
|
987
|
+
fix: true
|
|
988
|
+
});
|
|
912
989
|
}, "fix");
|
|
913
990
|
|
|
914
991
|
// src/actions/gen-docs.ts
|
|
@@ -964,7 +1041,7 @@ var filename = ".gitignore";
|
|
|
964
1041
|
var gitignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename, pkg), "gitignoreGen");
|
|
965
1042
|
|
|
966
1043
|
// src/actions/gitlint.ts
|
|
967
|
-
import
|
|
1044
|
+
import chalk14 from "chalk";
|
|
968
1045
|
import ParseGitConfig from "parse-git-config";
|
|
969
1046
|
var gitlint = /* @__PURE__ */ __name(() => {
|
|
970
1047
|
console.log(`
|
|
@@ -975,7 +1052,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
975
1052
|
const errors = 0;
|
|
976
1053
|
const gitConfig = ParseGitConfig.sync();
|
|
977
1054
|
const warn = /* @__PURE__ */ __name((message) => {
|
|
978
|
-
console.warn(
|
|
1055
|
+
console.warn(chalk14.yellow(`Warning: ${message}`));
|
|
979
1056
|
warnings++;
|
|
980
1057
|
}, "warn");
|
|
981
1058
|
if (gitConfig.core.ignorecase) {
|
|
@@ -995,13 +1072,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
995
1072
|
}
|
|
996
1073
|
const resultMessages = [];
|
|
997
1074
|
if (valid > 0) {
|
|
998
|
-
resultMessages.push(
|
|
1075
|
+
resultMessages.push(chalk14.green(`Passed: ${valid}`));
|
|
999
1076
|
}
|
|
1000
1077
|
if (warnings > 0) {
|
|
1001
|
-
resultMessages.push(
|
|
1078
|
+
resultMessages.push(chalk14.yellow(`Warnings: ${warnings}`));
|
|
1002
1079
|
}
|
|
1003
1080
|
if (errors > 0) {
|
|
1004
|
-
resultMessages.push(
|
|
1081
|
+
resultMessages.push(chalk14.red(` Errors: ${errors}`));
|
|
1005
1082
|
}
|
|
1006
1083
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1007
1084
|
`);
|
|
@@ -1010,7 +1087,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1010
1087
|
|
|
1011
1088
|
// src/actions/gitlint-fix.ts
|
|
1012
1089
|
import { execSync as execSync2 } from "node:child_process";
|
|
1013
|
-
import
|
|
1090
|
+
import chalk15 from "chalk";
|
|
1014
1091
|
import ParseGitConfig2 from "parse-git-config";
|
|
1015
1092
|
var gitlintFix = /* @__PURE__ */ __name(() => {
|
|
1016
1093
|
console.log(`
|
|
@@ -1021,25 +1098,25 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1021
1098
|
execSync2("git config core.ignorecase false", {
|
|
1022
1099
|
stdio: "inherit"
|
|
1023
1100
|
});
|
|
1024
|
-
console.warn(
|
|
1101
|
+
console.warn(chalk15.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1025
1102
|
}
|
|
1026
1103
|
if (gitConfig.core.autocrlf !== false) {
|
|
1027
1104
|
execSync2("git config core.autocrlf false", {
|
|
1028
1105
|
stdio: "inherit"
|
|
1029
1106
|
});
|
|
1030
|
-
console.warn(
|
|
1107
|
+
console.warn(chalk15.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1031
1108
|
}
|
|
1032
1109
|
if (gitConfig.core.eol !== "lf") {
|
|
1033
1110
|
execSync2("git config core.eol lf", {
|
|
1034
1111
|
stdio: "inherit"
|
|
1035
1112
|
});
|
|
1036
|
-
console.warn(
|
|
1113
|
+
console.warn(chalk15.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1037
1114
|
}
|
|
1038
1115
|
return 1;
|
|
1039
1116
|
}, "gitlintFix");
|
|
1040
1117
|
|
|
1041
1118
|
// src/actions/license.ts
|
|
1042
|
-
import
|
|
1119
|
+
import chalk16 from "chalk";
|
|
1043
1120
|
import { init } from "license-checker";
|
|
1044
1121
|
var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
1045
1122
|
const workspaces = yarnWorkspaces();
|
|
@@ -1064,7 +1141,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1064
1141
|
"LGPL-3.0-or-later",
|
|
1065
1142
|
"Python-2.0"
|
|
1066
1143
|
]);
|
|
1067
|
-
console.log(
|
|
1144
|
+
console.log(chalk16.green("License Checker"));
|
|
1068
1145
|
return (await Promise.all(workspaceList.map(({ location, name }) => {
|
|
1069
1146
|
return new Promise((resolve) => {
|
|
1070
1147
|
init({
|
|
@@ -1072,12 +1149,12 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1072
1149
|
start: location
|
|
1073
1150
|
}, (error, packages) => {
|
|
1074
1151
|
if (error) {
|
|
1075
|
-
console.error(
|
|
1076
|
-
console.error(
|
|
1152
|
+
console.error(chalk16.red(`License Checker [${name}] Error`));
|
|
1153
|
+
console.error(chalk16.gray(error));
|
|
1077
1154
|
console.log("\n");
|
|
1078
1155
|
resolve(1);
|
|
1079
1156
|
} else {
|
|
1080
|
-
console.log(
|
|
1157
|
+
console.log(chalk16.green(`License Checker [${name}]`));
|
|
1081
1158
|
let count = 0;
|
|
1082
1159
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1083
1160
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [
|
|
@@ -1095,7 +1172,7 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1095
1172
|
}
|
|
1096
1173
|
if (!orLicenseFound) {
|
|
1097
1174
|
count++;
|
|
1098
|
-
console.warn(
|
|
1175
|
+
console.warn(chalk16.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1099
1176
|
}
|
|
1100
1177
|
}
|
|
1101
1178
|
}
|
|
@@ -1108,91 +1185,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1108
1185
|
}))).reduce((prev, value) => prev || value, 0);
|
|
1109
1186
|
}, "license");
|
|
1110
1187
|
|
|
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
1188
|
// src/actions/lint-profile.ts
|
|
1197
1189
|
var lintProfile = /* @__PURE__ */ __name(() => {
|
|
1198
1190
|
return runSteps("Lint Profile", [
|
|
@@ -1832,16 +1824,16 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
1832
1824
|
}, async (argv) => {
|
|
1833
1825
|
if (argv.verbose) console.log("Lint");
|
|
1834
1826
|
const start = Date.now();
|
|
1835
|
-
process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : await lint({
|
|
1827
|
+
process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
|
|
1836
1828
|
pkg: argv.package
|
|
1837
1829
|
});
|
|
1838
1830
|
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1839
1831
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
1840
1832
|
return packagePositionalParam(yargs2);
|
|
1841
|
-
}, (argv) => {
|
|
1833
|
+
}, async (argv) => {
|
|
1842
1834
|
const start = Date.now();
|
|
1843
1835
|
if (argv.verbose) console.log("Fix");
|
|
1844
|
-
process.exitCode = fix();
|
|
1836
|
+
process.exitCode = await fix();
|
|
1845
1837
|
console.log(chalk19.blue(`Finished in ${Date.now() - start}ms`));
|
|
1846
1838
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
1847
1839
|
return packagePositionalParam(yargs2);
|