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