@xylabs/ts-scripts-yarn3 7.4.16 → 7.4.18
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/claude-settings.mjs +82 -0
- package/dist/actions/claude-settings.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +3 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +3 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +3 -0
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +3 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +3 -0
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +3 -0
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +194 -116
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +4 -1
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +5 -2
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +5 -2
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +5 -2
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +5 -2
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +5 -2
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +5 -2
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +5 -2
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +5 -2
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +5 -2
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +5 -2
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +5 -2
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +153 -71
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +214 -128
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +153 -71
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +153 -71
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +96 -17
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +3 -0
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
package/dist/xy/xy.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/xy/xy.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk31 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/actions/build.ts
|
|
5
5
|
import chalk9 from "chalk";
|
|
@@ -742,6 +742,77 @@ var claudeRules = ({ force } = {}) => {
|
|
|
742
742
|
return 0;
|
|
743
743
|
};
|
|
744
744
|
|
|
745
|
+
// src/actions/claude-settings.ts
|
|
746
|
+
import {
|
|
747
|
+
existsSync as existsSync6,
|
|
748
|
+
mkdirSync as mkdirSync3,
|
|
749
|
+
writeFileSync as writeFileSync4
|
|
750
|
+
} from "fs";
|
|
751
|
+
import PATH5 from "path";
|
|
752
|
+
import { createInterface } from "readline";
|
|
753
|
+
import chalk12 from "chalk";
|
|
754
|
+
var DEFAULT_SETTINGS = {
|
|
755
|
+
permissions: {
|
|
756
|
+
allow: [
|
|
757
|
+
"Bash(git *)",
|
|
758
|
+
"Bash(yarn *)",
|
|
759
|
+
"Bash(npx *)",
|
|
760
|
+
"Bash(node *)",
|
|
761
|
+
"Bash(ls *)",
|
|
762
|
+
"Bash(mkdir *)",
|
|
763
|
+
"Bash(cp *)",
|
|
764
|
+
"Bash(mv *)",
|
|
765
|
+
"Bash(rm *)",
|
|
766
|
+
"Bash(cat *)",
|
|
767
|
+
"Bash(head *)",
|
|
768
|
+
"Bash(tail *)",
|
|
769
|
+
"Bash(echo *)",
|
|
770
|
+
"Bash(pwd)",
|
|
771
|
+
"Bash(which *)",
|
|
772
|
+
"Bash(gh *)",
|
|
773
|
+
"Read",
|
|
774
|
+
"Edit",
|
|
775
|
+
"Write",
|
|
776
|
+
"Glob",
|
|
777
|
+
"Grep",
|
|
778
|
+
"Skill"
|
|
779
|
+
],
|
|
780
|
+
deny: [
|
|
781
|
+
"Bash(git push --force*)",
|
|
782
|
+
"Bash(git reset --hard*)",
|
|
783
|
+
"Bash(rm -rf /*)"
|
|
784
|
+
]
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
function askConfirmation(question) {
|
|
788
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
789
|
+
return new Promise((resolve) => {
|
|
790
|
+
rl.question(question, (answer) => {
|
|
791
|
+
rl.close();
|
|
792
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
async function claudeSettings() {
|
|
797
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
798
|
+
const claudeDir = PATH5.resolve(cwd, ".claude");
|
|
799
|
+
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
800
|
+
mkdirSync3(claudeDir, { recursive: true });
|
|
801
|
+
if (existsSync6(settingsPath)) {
|
|
802
|
+
const confirmed = await askConfirmation(
|
|
803
|
+
chalk12.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
804
|
+
);
|
|
805
|
+
if (!confirmed) {
|
|
806
|
+
console.log(chalk12.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
807
|
+
return 0;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
811
|
+
`, "utf8");
|
|
812
|
+
console.log(chalk12.green("Generated .claude/settings.local.json"));
|
|
813
|
+
return 0;
|
|
814
|
+
}
|
|
815
|
+
|
|
745
816
|
// src/actions/clean.ts
|
|
746
817
|
var clean = async ({ verbose, pkg }) => {
|
|
747
818
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -756,16 +827,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
756
827
|
|
|
757
828
|
// src/actions/clean-docs.ts
|
|
758
829
|
import path from "path";
|
|
759
|
-
import
|
|
830
|
+
import chalk13 from "chalk";
|
|
760
831
|
var cleanDocs = () => {
|
|
761
832
|
const pkgName = process.env.npm_package_name;
|
|
762
|
-
console.log(
|
|
833
|
+
console.log(chalk13.green(`Cleaning Docs [${pkgName}]`));
|
|
763
834
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
764
835
|
return 0;
|
|
765
836
|
};
|
|
766
837
|
|
|
767
838
|
// src/actions/compile.ts
|
|
768
|
-
import
|
|
839
|
+
import chalk14 from "chalk";
|
|
769
840
|
var compile = ({
|
|
770
841
|
verbose,
|
|
771
842
|
target,
|
|
@@ -806,7 +877,7 @@ var compileAll = ({
|
|
|
806
877
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
807
878
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
808
879
|
if (jobs) {
|
|
809
|
-
console.log(
|
|
880
|
+
console.log(chalk14.blue(`Jobs set to [${jobs}]`));
|
|
810
881
|
}
|
|
811
882
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
812
883
|
["yarn", [
|
|
@@ -820,13 +891,13 @@ var compileAll = ({
|
|
|
820
891
|
...targetOptions
|
|
821
892
|
]]
|
|
822
893
|
]);
|
|
823
|
-
console.log(`${
|
|
894
|
+
console.log(`${chalk14.gray("Compiled in")} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`);
|
|
824
895
|
return result;
|
|
825
896
|
};
|
|
826
897
|
|
|
827
898
|
// src/actions/copy-assets.ts
|
|
828
899
|
import path2 from "path/posix";
|
|
829
|
-
import
|
|
900
|
+
import chalk15 from "chalk";
|
|
830
901
|
import cpy from "cpy";
|
|
831
902
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
832
903
|
try {
|
|
@@ -849,7 +920,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
849
920
|
};
|
|
850
921
|
var copyTargetAssets = async (target, pkg) => {
|
|
851
922
|
const workspaces = yarnWorkspaces();
|
|
852
|
-
console.log(
|
|
923
|
+
console.log(chalk15.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
853
924
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
854
925
|
return pkg === void 0 || name === pkg;
|
|
855
926
|
});
|
|
@@ -933,7 +1004,7 @@ var dead = () => {
|
|
|
933
1004
|
};
|
|
934
1005
|
|
|
935
1006
|
// src/actions/deplint/deplint.ts
|
|
936
|
-
import
|
|
1007
|
+
import chalk21 from "chalk";
|
|
937
1008
|
|
|
938
1009
|
// src/actions/deplint/findFiles.ts
|
|
939
1010
|
import fs2 from "fs";
|
|
@@ -1080,6 +1151,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
1080
1151
|
ts.forEachChild(node, visit);
|
|
1081
1152
|
}
|
|
1082
1153
|
visit(sourceFile);
|
|
1154
|
+
for (const ref of sourceFile.typeReferenceDirectives) {
|
|
1155
|
+
typeImports.push(ref.fileName);
|
|
1156
|
+
}
|
|
1083
1157
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
1084
1158
|
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
1085
1159
|
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
@@ -1135,7 +1209,7 @@ function getExternalImportsFromFiles({
|
|
|
1135
1209
|
|
|
1136
1210
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1137
1211
|
import { builtinModules } from "module";
|
|
1138
|
-
import
|
|
1212
|
+
import chalk16 from "chalk";
|
|
1139
1213
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1140
1214
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1141
1215
|
}
|
|
@@ -1143,7 +1217,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1143
1217
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1144
1218
|
}
|
|
1145
1219
|
function logMissing(name, imp, importPaths) {
|
|
1146
|
-
console.log(`[${
|
|
1220
|
+
console.log(`[${chalk16.blue(name)}] Missing dependency in package.json: ${chalk16.red(imp)}`);
|
|
1147
1221
|
if (importPaths[imp]) {
|
|
1148
1222
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1149
1223
|
}
|
|
@@ -1172,7 +1246,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1172
1246
|
}
|
|
1173
1247
|
if (unlistedDependencies > 0) {
|
|
1174
1248
|
const packageLocation = `${location}/package.json`;
|
|
1175
|
-
console.log(` ${
|
|
1249
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1176
1250
|
`);
|
|
1177
1251
|
}
|
|
1178
1252
|
return unlistedDependencies;
|
|
@@ -1180,7 +1254,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1180
1254
|
|
|
1181
1255
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1182
1256
|
import { builtinModules as builtinModules2 } from "module";
|
|
1183
|
-
import
|
|
1257
|
+
import chalk17 from "chalk";
|
|
1184
1258
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1185
1259
|
devDependencies,
|
|
1186
1260
|
dependencies,
|
|
@@ -1194,7 +1268,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1194
1268
|
for (const imp of externalAllImports) {
|
|
1195
1269
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
1196
1270
|
unlistedDevDependencies++;
|
|
1197
|
-
console.log(`[${
|
|
1271
|
+
console.log(`[${chalk17.blue(name)}] Missing devDependency in package.json: ${chalk17.red(imp)}`);
|
|
1198
1272
|
if (allImportPaths[imp]) {
|
|
1199
1273
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1200
1274
|
}
|
|
@@ -1202,14 +1276,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1202
1276
|
}
|
|
1203
1277
|
if (unlistedDevDependencies > 0) {
|
|
1204
1278
|
const packageLocation = `${location}/package.json`;
|
|
1205
|
-
console.log(` ${
|
|
1279
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1206
1280
|
`);
|
|
1207
1281
|
}
|
|
1208
1282
|
return unlistedDevDependencies;
|
|
1209
1283
|
}
|
|
1210
1284
|
|
|
1211
1285
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1212
|
-
import
|
|
1286
|
+
import chalk18 from "chalk";
|
|
1213
1287
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1214
1288
|
externalDistImports,
|
|
1215
1289
|
externalDistTypeImports,
|
|
@@ -1221,22 +1295,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1221
1295
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1222
1296
|
unusedDependencies++;
|
|
1223
1297
|
if (externalAllImports.includes(dep)) {
|
|
1224
|
-
console.log(`[${
|
|
1298
|
+
console.log(`[${chalk18.blue(name)}] dependency should be devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1225
1299
|
} else {
|
|
1226
|
-
console.log(`[${
|
|
1300
|
+
console.log(`[${chalk18.blue(name)}] Unused dependency in package.json: ${chalk18.red(dep)}`);
|
|
1227
1301
|
}
|
|
1228
1302
|
}
|
|
1229
1303
|
}
|
|
1230
1304
|
if (unusedDependencies > 0) {
|
|
1231
1305
|
const packageLocation = `${location}/package.json`;
|
|
1232
|
-
console.log(` ${
|
|
1306
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1233
1307
|
`);
|
|
1234
1308
|
}
|
|
1235
1309
|
return unusedDependencies;
|
|
1236
1310
|
}
|
|
1237
1311
|
|
|
1238
1312
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1239
|
-
import
|
|
1313
|
+
import chalk19 from "chalk";
|
|
1240
1314
|
|
|
1241
1315
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1242
1316
|
import fs8 from "fs";
|
|
@@ -1520,19 +1594,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1520
1594
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1521
1595
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1522
1596
|
unusedDevDependencies++;
|
|
1523
|
-
console.log(`[${
|
|
1597
|
+
console.log(`[${chalk19.blue(name)}] Unused devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1524
1598
|
}
|
|
1525
1599
|
}
|
|
1526
1600
|
if (unusedDevDependencies > 0) {
|
|
1527
1601
|
const packageLocation = `${location}/package.json`;
|
|
1528
|
-
console.log(` ${
|
|
1602
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1529
1603
|
`);
|
|
1530
1604
|
}
|
|
1531
1605
|
return unusedDevDependencies;
|
|
1532
1606
|
}
|
|
1533
1607
|
|
|
1534
1608
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1535
|
-
import
|
|
1609
|
+
import chalk20 from "chalk";
|
|
1536
1610
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1537
1611
|
let unusedDependencies = 0;
|
|
1538
1612
|
for (const dep of peerDependencies) {
|
|
@@ -1540,15 +1614,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1540
1614
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1541
1615
|
unusedDependencies++;
|
|
1542
1616
|
if (dependencies.includes(dep)) {
|
|
1543
|
-
console.log(`[${
|
|
1617
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk20.red(dep)}`);
|
|
1544
1618
|
} else {
|
|
1545
|
-
console.log(`[${
|
|
1619
|
+
console.log(`[${chalk20.blue(name)}] Unused peerDependency in package.json: ${chalk20.red(dep)}`);
|
|
1546
1620
|
}
|
|
1547
1621
|
}
|
|
1548
1622
|
}
|
|
1549
1623
|
if (unusedDependencies > 0) {
|
|
1550
1624
|
const packageLocation = `${location}/package.json`;
|
|
1551
|
-
console.log(` ${
|
|
1625
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1552
1626
|
`);
|
|
1553
1627
|
}
|
|
1554
1628
|
return unusedDependencies;
|
|
@@ -1643,9 +1717,9 @@ var deplint = async ({
|
|
|
1643
1717
|
});
|
|
1644
1718
|
}
|
|
1645
1719
|
if (totalErrors > 0) {
|
|
1646
|
-
console.warn(`Deplint: Found ${
|
|
1720
|
+
console.warn(`Deplint: Found ${chalk21.red(totalErrors)} dependency problems. ${chalk21.red("\u2716")}`);
|
|
1647
1721
|
} else {
|
|
1648
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1722
|
+
console.info(`Deplint: Found no dependency problems. ${chalk21.green("\u2714")}`);
|
|
1649
1723
|
}
|
|
1650
1724
|
return 0;
|
|
1651
1725
|
};
|
|
@@ -1747,22 +1821,22 @@ var deployNext = () => {
|
|
|
1747
1821
|
};
|
|
1748
1822
|
|
|
1749
1823
|
// src/actions/dupdeps.ts
|
|
1750
|
-
import
|
|
1824
|
+
import chalk22 from "chalk";
|
|
1751
1825
|
var dupdeps = () => {
|
|
1752
|
-
console.log(
|
|
1826
|
+
console.log(chalk22.green("Checking all Dependencies for Duplicates"));
|
|
1753
1827
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1754
1828
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1755
1829
|
return detectDuplicateDependencies(dependencies);
|
|
1756
1830
|
};
|
|
1757
1831
|
|
|
1758
1832
|
// src/actions/lint.ts
|
|
1759
|
-
import
|
|
1833
|
+
import chalk23 from "chalk";
|
|
1760
1834
|
var lintPackage = ({
|
|
1761
1835
|
pkg,
|
|
1762
1836
|
fix: fix2,
|
|
1763
1837
|
verbose
|
|
1764
1838
|
}) => {
|
|
1765
|
-
console.log(
|
|
1839
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1766
1840
|
const start = Date.now();
|
|
1767
1841
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1768
1842
|
["yarn", [
|
|
@@ -1772,7 +1846,7 @@ var lintPackage = ({
|
|
|
1772
1846
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1773
1847
|
]]
|
|
1774
1848
|
]);
|
|
1775
|
-
console.log(
|
|
1849
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1776
1850
|
return result;
|
|
1777
1851
|
};
|
|
1778
1852
|
var lint = ({
|
|
@@ -1792,13 +1866,13 @@ var lint = ({
|
|
|
1792
1866
|
});
|
|
1793
1867
|
};
|
|
1794
1868
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1795
|
-
console.log(
|
|
1869
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1796
1870
|
const start = Date.now();
|
|
1797
1871
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1798
1872
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1799
1873
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1800
1874
|
]);
|
|
1801
|
-
console.log(
|
|
1875
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1802
1876
|
return result;
|
|
1803
1877
|
};
|
|
1804
1878
|
|
|
@@ -1826,7 +1900,7 @@ var filename = ".gitignore";
|
|
|
1826
1900
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1827
1901
|
|
|
1828
1902
|
// src/actions/gitlint.ts
|
|
1829
|
-
import
|
|
1903
|
+
import chalk24 from "chalk";
|
|
1830
1904
|
import ParseGitConfig from "parse-git-config";
|
|
1831
1905
|
var gitlint = () => {
|
|
1832
1906
|
console.log(`
|
|
@@ -1837,7 +1911,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1837
1911
|
const errors = 0;
|
|
1838
1912
|
const gitConfig = ParseGitConfig.sync();
|
|
1839
1913
|
const warn = (message) => {
|
|
1840
|
-
console.warn(
|
|
1914
|
+
console.warn(chalk24.yellow(`Warning: ${message}`));
|
|
1841
1915
|
warnings++;
|
|
1842
1916
|
};
|
|
1843
1917
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1857,13 +1931,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1857
1931
|
}
|
|
1858
1932
|
const resultMessages = [];
|
|
1859
1933
|
if (valid > 0) {
|
|
1860
|
-
resultMessages.push(
|
|
1934
|
+
resultMessages.push(chalk24.green(`Passed: ${valid}`));
|
|
1861
1935
|
}
|
|
1862
1936
|
if (warnings > 0) {
|
|
1863
|
-
resultMessages.push(
|
|
1937
|
+
resultMessages.push(chalk24.yellow(`Warnings: ${warnings}`));
|
|
1864
1938
|
}
|
|
1865
1939
|
if (errors > 0) {
|
|
1866
|
-
resultMessages.push(
|
|
1940
|
+
resultMessages.push(chalk24.red(` Errors: ${errors}`));
|
|
1867
1941
|
}
|
|
1868
1942
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1869
1943
|
`);
|
|
@@ -1872,7 +1946,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1872
1946
|
|
|
1873
1947
|
// src/actions/gitlint-fix.ts
|
|
1874
1948
|
import { execSync as execSync3 } from "child_process";
|
|
1875
|
-
import
|
|
1949
|
+
import chalk25 from "chalk";
|
|
1876
1950
|
import ParseGitConfig2 from "parse-git-config";
|
|
1877
1951
|
var gitlintFix = () => {
|
|
1878
1952
|
console.log(`
|
|
@@ -1881,15 +1955,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1881
1955
|
const gitConfig = ParseGitConfig2.sync();
|
|
1882
1956
|
if (gitConfig.core.ignorecase) {
|
|
1883
1957
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1884
|
-
console.warn(
|
|
1958
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1885
1959
|
}
|
|
1886
1960
|
if (gitConfig.core.autocrlf !== false) {
|
|
1887
1961
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1888
|
-
console.warn(
|
|
1962
|
+
console.warn(chalk25.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1889
1963
|
}
|
|
1890
1964
|
if (gitConfig.core.eol !== "lf") {
|
|
1891
1965
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1892
|
-
console.warn(
|
|
1966
|
+
console.warn(chalk25.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1893
1967
|
}
|
|
1894
1968
|
return 1;
|
|
1895
1969
|
};
|
|
@@ -1900,7 +1974,7 @@ var knip = () => {
|
|
|
1900
1974
|
};
|
|
1901
1975
|
|
|
1902
1976
|
// src/actions/license.ts
|
|
1903
|
-
import
|
|
1977
|
+
import chalk26 from "chalk";
|
|
1904
1978
|
import { init } from "license-checker";
|
|
1905
1979
|
var license = async (pkg) => {
|
|
1906
1980
|
const workspaces = yarnWorkspaces();
|
|
@@ -1925,18 +1999,18 @@ var license = async (pkg) => {
|
|
|
1925
1999
|
"LGPL-3.0-or-later",
|
|
1926
2000
|
"Python-2.0"
|
|
1927
2001
|
]);
|
|
1928
|
-
console.log(
|
|
2002
|
+
console.log(chalk26.green("License Checker"));
|
|
1929
2003
|
return (await Promise.all(
|
|
1930
2004
|
workspaceList.map(({ location, name }) => {
|
|
1931
2005
|
return new Promise((resolve) => {
|
|
1932
2006
|
init({ production: true, start: location }, (error, packages) => {
|
|
1933
2007
|
if (error) {
|
|
1934
|
-
console.error(
|
|
1935
|
-
console.error(
|
|
2008
|
+
console.error(chalk26.red(`License Checker [${name}] Error`));
|
|
2009
|
+
console.error(chalk26.gray(error));
|
|
1936
2010
|
console.log("\n");
|
|
1937
2011
|
resolve(1);
|
|
1938
2012
|
} else {
|
|
1939
|
-
console.log(
|
|
2013
|
+
console.log(chalk26.green(`License Checker [${name}]`));
|
|
1940
2014
|
let count = 0;
|
|
1941
2015
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1942
2016
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1952,7 +2026,7 @@ var license = async (pkg) => {
|
|
|
1952
2026
|
}
|
|
1953
2027
|
if (!orLicenseFound) {
|
|
1954
2028
|
count++;
|
|
1955
|
-
console.warn(
|
|
2029
|
+
console.warn(chalk26.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1956
2030
|
}
|
|
1957
2031
|
}
|
|
1958
2032
|
}
|
|
@@ -2011,7 +2085,7 @@ var rebuild = ({ target }) => {
|
|
|
2011
2085
|
};
|
|
2012
2086
|
|
|
2013
2087
|
// src/actions/recompile.ts
|
|
2014
|
-
import
|
|
2088
|
+
import chalk27 from "chalk";
|
|
2015
2089
|
var recompile = async ({
|
|
2016
2090
|
verbose,
|
|
2017
2091
|
target,
|
|
@@ -2047,7 +2121,7 @@ var recompileAll = async ({
|
|
|
2047
2121
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2048
2122
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2049
2123
|
if (jobs) {
|
|
2050
|
-
console.log(
|
|
2124
|
+
console.log(chalk27.blue(`Jobs set to [${jobs}]`));
|
|
2051
2125
|
}
|
|
2052
2126
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2053
2127
|
[
|
|
@@ -2078,7 +2152,7 @@ var recompileAll = async ({
|
|
|
2078
2152
|
]
|
|
2079
2153
|
]);
|
|
2080
2154
|
console.log(
|
|
2081
|
-
`${
|
|
2155
|
+
`${chalk27.gray("Recompiled in")} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`
|
|
2082
2156
|
);
|
|
2083
2157
|
return result;
|
|
2084
2158
|
};
|
|
@@ -2109,13 +2183,13 @@ var reinstall = () => {
|
|
|
2109
2183
|
};
|
|
2110
2184
|
|
|
2111
2185
|
// src/actions/relint.ts
|
|
2112
|
-
import
|
|
2186
|
+
import chalk28 from "chalk";
|
|
2113
2187
|
var relintPackage = ({
|
|
2114
2188
|
pkg,
|
|
2115
2189
|
fix: fix2,
|
|
2116
2190
|
verbose
|
|
2117
2191
|
}) => {
|
|
2118
|
-
console.log(
|
|
2192
|
+
console.log(chalk28.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2119
2193
|
const start = Date.now();
|
|
2120
2194
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2121
2195
|
["yarn", [
|
|
@@ -2125,7 +2199,7 @@ var relintPackage = ({
|
|
|
2125
2199
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2126
2200
|
]]
|
|
2127
2201
|
]);
|
|
2128
|
-
console.log(
|
|
2202
|
+
console.log(chalk28.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`));
|
|
2129
2203
|
return result;
|
|
2130
2204
|
};
|
|
2131
2205
|
var relint = ({
|
|
@@ -2145,13 +2219,13 @@ var relint = ({
|
|
|
2145
2219
|
});
|
|
2146
2220
|
};
|
|
2147
2221
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2148
|
-
console.log(
|
|
2222
|
+
console.log(chalk28.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2149
2223
|
const start = Date.now();
|
|
2150
2224
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2151
2225
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2152
2226
|
["yarn", ["eslint", ...fixOptions]]
|
|
2153
2227
|
]);
|
|
2154
|
-
console.log(
|
|
2228
|
+
console.log(chalk28.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`));
|
|
2155
2229
|
return result;
|
|
2156
2230
|
};
|
|
2157
2231
|
|
|
@@ -2169,10 +2243,10 @@ var sonar = () => {
|
|
|
2169
2243
|
};
|
|
2170
2244
|
|
|
2171
2245
|
// src/actions/statics.ts
|
|
2172
|
-
import
|
|
2246
|
+
import chalk29 from "chalk";
|
|
2173
2247
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2174
2248
|
var statics = () => {
|
|
2175
|
-
console.log(
|
|
2249
|
+
console.log(chalk29.green("Check Required Static Dependencies"));
|
|
2176
2250
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2177
2251
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2178
2252
|
};
|
|
@@ -2333,6 +2407,14 @@ var xyCommonCommands = (args) => {
|
|
|
2333
2407
|
if (argv.verbose) console.log("Claude Commands");
|
|
2334
2408
|
process.exitCode = claudeCommands();
|
|
2335
2409
|
}
|
|
2410
|
+
).command(
|
|
2411
|
+
"claude-settings",
|
|
2412
|
+
"Claude Settings - Initialize .claude/settings.local.json with XY Labs defaults",
|
|
2413
|
+
(yargs2) => yargs2,
|
|
2414
|
+
async (argv) => {
|
|
2415
|
+
if (argv.verbose) console.log("Claude Settings");
|
|
2416
|
+
process.exitCode = await claudeSettings();
|
|
2417
|
+
}
|
|
2336
2418
|
).command(
|
|
2337
2419
|
"claude-rules",
|
|
2338
2420
|
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
@@ -2618,7 +2700,7 @@ var xyInstallCommands = (args) => {
|
|
|
2618
2700
|
};
|
|
2619
2701
|
|
|
2620
2702
|
// src/xy/xyLintCommands.ts
|
|
2621
|
-
import
|
|
2703
|
+
import chalk30 from "chalk";
|
|
2622
2704
|
var xyLintCommands = (args) => {
|
|
2623
2705
|
return args.command(
|
|
2624
2706
|
"cycle [package]",
|
|
@@ -2630,7 +2712,7 @@ var xyLintCommands = (args) => {
|
|
|
2630
2712
|
const start = Date.now();
|
|
2631
2713
|
if (argv.verbose) console.log("Cycle");
|
|
2632
2714
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2633
|
-
console.log(
|
|
2715
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2634
2716
|
}
|
|
2635
2717
|
).command(
|
|
2636
2718
|
"lint [package]",
|
|
@@ -2660,7 +2742,7 @@ var xyLintCommands = (args) => {
|
|
|
2660
2742
|
cache: argv.cache,
|
|
2661
2743
|
verbose: !!argv.verbose
|
|
2662
2744
|
});
|
|
2663
|
-
console.log(
|
|
2745
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2664
2746
|
}
|
|
2665
2747
|
).command(
|
|
2666
2748
|
"deplint [package]",
|
|
@@ -2699,7 +2781,7 @@ var xyLintCommands = (args) => {
|
|
|
2699
2781
|
peerDeps: !!argv.peerDeps,
|
|
2700
2782
|
verbose: !!argv.verbose
|
|
2701
2783
|
});
|
|
2702
|
-
console.log(
|
|
2784
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2703
2785
|
}
|
|
2704
2786
|
).command(
|
|
2705
2787
|
"fix [package]",
|
|
@@ -2711,7 +2793,7 @@ var xyLintCommands = (args) => {
|
|
|
2711
2793
|
const start = Date.now();
|
|
2712
2794
|
if (argv.verbose) console.log("Fix");
|
|
2713
2795
|
process.exitCode = fix();
|
|
2714
|
-
console.log(
|
|
2796
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2715
2797
|
}
|
|
2716
2798
|
).command(
|
|
2717
2799
|
"relint [package]",
|
|
@@ -2723,7 +2805,7 @@ var xyLintCommands = (args) => {
|
|
|
2723
2805
|
if (argv.verbose) console.log("Relinting");
|
|
2724
2806
|
const start = Date.now();
|
|
2725
2807
|
process.exitCode = relint();
|
|
2726
|
-
console.log(
|
|
2808
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2727
2809
|
}
|
|
2728
2810
|
).command(
|
|
2729
2811
|
"publint [package]",
|
|
@@ -2735,7 +2817,7 @@ var xyLintCommands = (args) => {
|
|
|
2735
2817
|
if (argv.verbose) console.log("Publint");
|
|
2736
2818
|
const start = Date.now();
|
|
2737
2819
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2738
|
-
console.log(
|
|
2820
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2739
2821
|
}
|
|
2740
2822
|
).command(
|
|
2741
2823
|
"knip",
|
|
@@ -2747,7 +2829,7 @@ var xyLintCommands = (args) => {
|
|
|
2747
2829
|
if (argv.verbose) console.log("Knip");
|
|
2748
2830
|
const start = Date.now();
|
|
2749
2831
|
process.exitCode = knip();
|
|
2750
|
-
console.log(
|
|
2832
|
+
console.log(chalk30.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2751
2833
|
}
|
|
2752
2834
|
).command(
|
|
2753
2835
|
"sonar",
|
|
@@ -2759,7 +2841,7 @@ var xyLintCommands = (args) => {
|
|
|
2759
2841
|
const start = Date.now();
|
|
2760
2842
|
if (argv.verbose) console.log("Sonar Check");
|
|
2761
2843
|
process.exitCode = sonar();
|
|
2762
|
-
console.log(
|
|
2844
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2763
2845
|
}
|
|
2764
2846
|
);
|
|
2765
2847
|
};
|
|
@@ -2795,8 +2877,8 @@ var xyParseOptions = () => {
|
|
|
2795
2877
|
var xy = async () => {
|
|
2796
2878
|
const options = xyParseOptions();
|
|
2797
2879
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2798
|
-
console.error(
|
|
2799
|
-
console.log(
|
|
2880
|
+
console.error(chalk31.yellow(`Command not found [${chalk31.magenta(process.argv[2])}]`));
|
|
2881
|
+
console.log(chalk31.gray("Try 'yarn xy --help' for list of commands"));
|
|
2800
2882
|
}).version().help().argv;
|
|
2801
2883
|
};
|
|
2802
2884
|
export {
|