@xylabs/ts-scripts-yarn3 7.4.15 → 7.4.17
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/index.mjs +191 -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 +150 -71
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +211 -128
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +150 -71
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +150 -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/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -815,6 +815,77 @@ var claudeRules = ({ force } = {}) => {
|
|
|
815
815
|
return 0;
|
|
816
816
|
};
|
|
817
817
|
|
|
818
|
+
// src/actions/claude-settings.ts
|
|
819
|
+
import {
|
|
820
|
+
existsSync as existsSync7,
|
|
821
|
+
mkdirSync as mkdirSync3,
|
|
822
|
+
writeFileSync as writeFileSync4
|
|
823
|
+
} from "fs";
|
|
824
|
+
import PATH5 from "path";
|
|
825
|
+
import { createInterface } from "readline";
|
|
826
|
+
import chalk13 from "chalk";
|
|
827
|
+
var DEFAULT_SETTINGS = {
|
|
828
|
+
permissions: {
|
|
829
|
+
allow: [
|
|
830
|
+
"Bash(git *)",
|
|
831
|
+
"Bash(yarn *)",
|
|
832
|
+
"Bash(npx *)",
|
|
833
|
+
"Bash(node *)",
|
|
834
|
+
"Bash(ls *)",
|
|
835
|
+
"Bash(mkdir *)",
|
|
836
|
+
"Bash(cp *)",
|
|
837
|
+
"Bash(mv *)",
|
|
838
|
+
"Bash(rm *)",
|
|
839
|
+
"Bash(cat *)",
|
|
840
|
+
"Bash(head *)",
|
|
841
|
+
"Bash(tail *)",
|
|
842
|
+
"Bash(echo *)",
|
|
843
|
+
"Bash(pwd)",
|
|
844
|
+
"Bash(which *)",
|
|
845
|
+
"Bash(gh *)",
|
|
846
|
+
"Read",
|
|
847
|
+
"Edit",
|
|
848
|
+
"Write",
|
|
849
|
+
"Glob",
|
|
850
|
+
"Grep",
|
|
851
|
+
"Skill"
|
|
852
|
+
],
|
|
853
|
+
deny: [
|
|
854
|
+
"Bash(git push --force*)",
|
|
855
|
+
"Bash(git reset --hard*)",
|
|
856
|
+
"Bash(rm -rf /*)"
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
function askConfirmation(question) {
|
|
861
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
862
|
+
return new Promise((resolve) => {
|
|
863
|
+
rl.question(question, (answer) => {
|
|
864
|
+
rl.close();
|
|
865
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
866
|
+
});
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
async function claudeSettings() {
|
|
870
|
+
const cwd5 = INIT_CWD() ?? process.cwd();
|
|
871
|
+
const claudeDir = PATH5.resolve(cwd5, ".claude");
|
|
872
|
+
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
873
|
+
mkdirSync3(claudeDir, { recursive: true });
|
|
874
|
+
if (existsSync7(settingsPath)) {
|
|
875
|
+
const confirmed = await askConfirmation(
|
|
876
|
+
chalk13.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
877
|
+
);
|
|
878
|
+
if (!confirmed) {
|
|
879
|
+
console.log(chalk13.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
880
|
+
return 0;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
884
|
+
`, "utf8");
|
|
885
|
+
console.log(chalk13.green("Generated .claude/settings.local.json"));
|
|
886
|
+
return 0;
|
|
887
|
+
}
|
|
888
|
+
|
|
818
889
|
// src/actions/clean.ts
|
|
819
890
|
var clean = async ({ verbose, pkg }) => {
|
|
820
891
|
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
@@ -829,16 +900,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
829
900
|
|
|
830
901
|
// src/actions/clean-docs.ts
|
|
831
902
|
import path from "path";
|
|
832
|
-
import
|
|
903
|
+
import chalk14 from "chalk";
|
|
833
904
|
var cleanDocs = () => {
|
|
834
905
|
const pkgName = process.env.npm_package_name;
|
|
835
|
-
console.log(
|
|
906
|
+
console.log(chalk14.green(`Cleaning Docs [${pkgName}]`));
|
|
836
907
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
837
908
|
return 0;
|
|
838
909
|
};
|
|
839
910
|
|
|
840
911
|
// src/actions/compile.ts
|
|
841
|
-
import
|
|
912
|
+
import chalk15 from "chalk";
|
|
842
913
|
var compile = ({
|
|
843
914
|
verbose,
|
|
844
915
|
target,
|
|
@@ -879,7 +950,7 @@ var compileAll = ({
|
|
|
879
950
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
880
951
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
881
952
|
if (jobs) {
|
|
882
|
-
console.log(
|
|
953
|
+
console.log(chalk15.blue(`Jobs set to [${jobs}]`));
|
|
883
954
|
}
|
|
884
955
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
885
956
|
["yarn", [
|
|
@@ -893,13 +964,13 @@ var compileAll = ({
|
|
|
893
964
|
...targetOptions
|
|
894
965
|
]]
|
|
895
966
|
]);
|
|
896
|
-
console.log(`${
|
|
967
|
+
console.log(`${chalk15.gray("Compiled in")} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`);
|
|
897
968
|
return result;
|
|
898
969
|
};
|
|
899
970
|
|
|
900
971
|
// src/actions/copy-assets.ts
|
|
901
972
|
import path2 from "path/posix";
|
|
902
|
-
import
|
|
973
|
+
import chalk16 from "chalk";
|
|
903
974
|
import cpy from "cpy";
|
|
904
975
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
905
976
|
try {
|
|
@@ -922,7 +993,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
922
993
|
};
|
|
923
994
|
var copyTargetAssets = async (target, pkg) => {
|
|
924
995
|
const workspaces = yarnWorkspaces();
|
|
925
|
-
console.log(
|
|
996
|
+
console.log(chalk16.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
926
997
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
927
998
|
return pkg === void 0 || name === pkg;
|
|
928
999
|
});
|
|
@@ -1006,7 +1077,7 @@ var dead = () => {
|
|
|
1006
1077
|
};
|
|
1007
1078
|
|
|
1008
1079
|
// src/actions/deplint/deplint.ts
|
|
1009
|
-
import
|
|
1080
|
+
import chalk22 from "chalk";
|
|
1010
1081
|
|
|
1011
1082
|
// src/actions/deplint/findFiles.ts
|
|
1012
1083
|
import fs2 from "fs";
|
|
@@ -1208,7 +1279,7 @@ function getExternalImportsFromFiles({
|
|
|
1208
1279
|
|
|
1209
1280
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1210
1281
|
import { builtinModules } from "module";
|
|
1211
|
-
import
|
|
1282
|
+
import chalk17 from "chalk";
|
|
1212
1283
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1213
1284
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1214
1285
|
}
|
|
@@ -1216,7 +1287,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1216
1287
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1217
1288
|
}
|
|
1218
1289
|
function logMissing(name, imp, importPaths) {
|
|
1219
|
-
console.log(`[${
|
|
1290
|
+
console.log(`[${chalk17.blue(name)}] Missing dependency in package.json: ${chalk17.red(imp)}`);
|
|
1220
1291
|
if (importPaths[imp]) {
|
|
1221
1292
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1222
1293
|
}
|
|
@@ -1245,7 +1316,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1245
1316
|
}
|
|
1246
1317
|
if (unlistedDependencies > 0) {
|
|
1247
1318
|
const packageLocation = `${location}/package.json`;
|
|
1248
|
-
console.log(` ${
|
|
1319
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1249
1320
|
`);
|
|
1250
1321
|
}
|
|
1251
1322
|
return unlistedDependencies;
|
|
@@ -1253,7 +1324,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1253
1324
|
|
|
1254
1325
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1255
1326
|
import { builtinModules as builtinModules2 } from "module";
|
|
1256
|
-
import
|
|
1327
|
+
import chalk18 from "chalk";
|
|
1257
1328
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1258
1329
|
devDependencies,
|
|
1259
1330
|
dependencies,
|
|
@@ -1267,7 +1338,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1267
1338
|
for (const imp of externalAllImports) {
|
|
1268
1339
|
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)) {
|
|
1269
1340
|
unlistedDevDependencies++;
|
|
1270
|
-
console.log(`[${
|
|
1341
|
+
console.log(`[${chalk18.blue(name)}] Missing devDependency in package.json: ${chalk18.red(imp)}`);
|
|
1271
1342
|
if (allImportPaths[imp]) {
|
|
1272
1343
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1273
1344
|
}
|
|
@@ -1275,14 +1346,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1275
1346
|
}
|
|
1276
1347
|
if (unlistedDevDependencies > 0) {
|
|
1277
1348
|
const packageLocation = `${location}/package.json`;
|
|
1278
|
-
console.log(` ${
|
|
1349
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1279
1350
|
`);
|
|
1280
1351
|
}
|
|
1281
1352
|
return unlistedDevDependencies;
|
|
1282
1353
|
}
|
|
1283
1354
|
|
|
1284
1355
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1285
|
-
import
|
|
1356
|
+
import chalk19 from "chalk";
|
|
1286
1357
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1287
1358
|
externalDistImports,
|
|
1288
1359
|
externalDistTypeImports,
|
|
@@ -1294,22 +1365,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1294
1365
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1295
1366
|
unusedDependencies++;
|
|
1296
1367
|
if (externalAllImports.includes(dep)) {
|
|
1297
|
-
console.log(`[${
|
|
1368
|
+
console.log(`[${chalk19.blue(name)}] dependency should be devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1298
1369
|
} else {
|
|
1299
|
-
console.log(`[${
|
|
1370
|
+
console.log(`[${chalk19.blue(name)}] Unused dependency in package.json: ${chalk19.red(dep)}`);
|
|
1300
1371
|
}
|
|
1301
1372
|
}
|
|
1302
1373
|
}
|
|
1303
1374
|
if (unusedDependencies > 0) {
|
|
1304
1375
|
const packageLocation = `${location}/package.json`;
|
|
1305
|
-
console.log(` ${
|
|
1376
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1306
1377
|
`);
|
|
1307
1378
|
}
|
|
1308
1379
|
return unusedDependencies;
|
|
1309
1380
|
}
|
|
1310
1381
|
|
|
1311
1382
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1312
|
-
import
|
|
1383
|
+
import chalk20 from "chalk";
|
|
1313
1384
|
|
|
1314
1385
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1315
1386
|
import fs8 from "fs";
|
|
@@ -1593,19 +1664,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1593
1664
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1594
1665
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1595
1666
|
unusedDevDependencies++;
|
|
1596
|
-
console.log(`[${
|
|
1667
|
+
console.log(`[${chalk20.blue(name)}] Unused devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1597
1668
|
}
|
|
1598
1669
|
}
|
|
1599
1670
|
if (unusedDevDependencies > 0) {
|
|
1600
1671
|
const packageLocation = `${location}/package.json`;
|
|
1601
|
-
console.log(` ${
|
|
1672
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1602
1673
|
`);
|
|
1603
1674
|
}
|
|
1604
1675
|
return unusedDevDependencies;
|
|
1605
1676
|
}
|
|
1606
1677
|
|
|
1607
1678
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1608
|
-
import
|
|
1679
|
+
import chalk21 from "chalk";
|
|
1609
1680
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1610
1681
|
let unusedDependencies = 0;
|
|
1611
1682
|
for (const dep of peerDependencies) {
|
|
@@ -1613,15 +1684,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1613
1684
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1614
1685
|
unusedDependencies++;
|
|
1615
1686
|
if (dependencies.includes(dep)) {
|
|
1616
|
-
console.log(`[${
|
|
1687
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk21.red(dep)}`);
|
|
1617
1688
|
} else {
|
|
1618
|
-
console.log(`[${
|
|
1689
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency in package.json: ${chalk21.red(dep)}`);
|
|
1619
1690
|
}
|
|
1620
1691
|
}
|
|
1621
1692
|
}
|
|
1622
1693
|
if (unusedDependencies > 0) {
|
|
1623
1694
|
const packageLocation = `${location}/package.json`;
|
|
1624
|
-
console.log(` ${
|
|
1695
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1625
1696
|
`);
|
|
1626
1697
|
}
|
|
1627
1698
|
return unusedDependencies;
|
|
@@ -1716,9 +1787,9 @@ var deplint = async ({
|
|
|
1716
1787
|
});
|
|
1717
1788
|
}
|
|
1718
1789
|
if (totalErrors > 0) {
|
|
1719
|
-
console.warn(`Deplint: Found ${
|
|
1790
|
+
console.warn(`Deplint: Found ${chalk22.red(totalErrors)} dependency problems. ${chalk22.red("\u2716")}`);
|
|
1720
1791
|
} else {
|
|
1721
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1792
|
+
console.info(`Deplint: Found no dependency problems. ${chalk22.green("\u2714")}`);
|
|
1722
1793
|
}
|
|
1723
1794
|
return 0;
|
|
1724
1795
|
};
|
|
@@ -1820,22 +1891,22 @@ var deployNext = () => {
|
|
|
1820
1891
|
};
|
|
1821
1892
|
|
|
1822
1893
|
// src/actions/dupdeps.ts
|
|
1823
|
-
import
|
|
1894
|
+
import chalk23 from "chalk";
|
|
1824
1895
|
var dupdeps = () => {
|
|
1825
|
-
console.log(
|
|
1896
|
+
console.log(chalk23.green("Checking all Dependencies for Duplicates"));
|
|
1826
1897
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1827
1898
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1828
1899
|
return detectDuplicateDependencies(dependencies);
|
|
1829
1900
|
};
|
|
1830
1901
|
|
|
1831
1902
|
// src/actions/lint.ts
|
|
1832
|
-
import
|
|
1903
|
+
import chalk24 from "chalk";
|
|
1833
1904
|
var lintPackage = ({
|
|
1834
1905
|
pkg,
|
|
1835
1906
|
fix: fix2,
|
|
1836
1907
|
verbose
|
|
1837
1908
|
}) => {
|
|
1838
|
-
console.log(
|
|
1909
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1839
1910
|
const start = Date.now();
|
|
1840
1911
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1841
1912
|
["yarn", [
|
|
@@ -1845,7 +1916,7 @@ var lintPackage = ({
|
|
|
1845
1916
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1846
1917
|
]]
|
|
1847
1918
|
]);
|
|
1848
|
-
console.log(
|
|
1919
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1849
1920
|
return result;
|
|
1850
1921
|
};
|
|
1851
1922
|
var lint = ({
|
|
@@ -1865,13 +1936,13 @@ var lint = ({
|
|
|
1865
1936
|
});
|
|
1866
1937
|
};
|
|
1867
1938
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1868
|
-
console.log(
|
|
1939
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1869
1940
|
const start = Date.now();
|
|
1870
1941
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1871
1942
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1872
1943
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1873
1944
|
]);
|
|
1874
|
-
console.log(
|
|
1945
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1875
1946
|
return result;
|
|
1876
1947
|
};
|
|
1877
1948
|
|
|
@@ -1899,7 +1970,7 @@ var filename = ".gitignore";
|
|
|
1899
1970
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1900
1971
|
|
|
1901
1972
|
// src/actions/gitlint.ts
|
|
1902
|
-
import
|
|
1973
|
+
import chalk25 from "chalk";
|
|
1903
1974
|
import ParseGitConfig from "parse-git-config";
|
|
1904
1975
|
var gitlint = () => {
|
|
1905
1976
|
console.log(`
|
|
@@ -1910,7 +1981,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1910
1981
|
const errors = 0;
|
|
1911
1982
|
const gitConfig = ParseGitConfig.sync();
|
|
1912
1983
|
const warn = (message) => {
|
|
1913
|
-
console.warn(
|
|
1984
|
+
console.warn(chalk25.yellow(`Warning: ${message}`));
|
|
1914
1985
|
warnings++;
|
|
1915
1986
|
};
|
|
1916
1987
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1930,13 +2001,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1930
2001
|
}
|
|
1931
2002
|
const resultMessages = [];
|
|
1932
2003
|
if (valid > 0) {
|
|
1933
|
-
resultMessages.push(
|
|
2004
|
+
resultMessages.push(chalk25.green(`Passed: ${valid}`));
|
|
1934
2005
|
}
|
|
1935
2006
|
if (warnings > 0) {
|
|
1936
|
-
resultMessages.push(
|
|
2007
|
+
resultMessages.push(chalk25.yellow(`Warnings: ${warnings}`));
|
|
1937
2008
|
}
|
|
1938
2009
|
if (errors > 0) {
|
|
1939
|
-
resultMessages.push(
|
|
2010
|
+
resultMessages.push(chalk25.red(` Errors: ${errors}`));
|
|
1940
2011
|
}
|
|
1941
2012
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1942
2013
|
`);
|
|
@@ -1945,7 +2016,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1945
2016
|
|
|
1946
2017
|
// src/actions/gitlint-fix.ts
|
|
1947
2018
|
import { execSync as execSync3 } from "child_process";
|
|
1948
|
-
import
|
|
2019
|
+
import chalk26 from "chalk";
|
|
1949
2020
|
import ParseGitConfig2 from "parse-git-config";
|
|
1950
2021
|
var gitlintFix = () => {
|
|
1951
2022
|
console.log(`
|
|
@@ -1954,15 +2025,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1954
2025
|
const gitConfig = ParseGitConfig2.sync();
|
|
1955
2026
|
if (gitConfig.core.ignorecase) {
|
|
1956
2027
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1957
|
-
console.warn(
|
|
2028
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1958
2029
|
}
|
|
1959
2030
|
if (gitConfig.core.autocrlf !== false) {
|
|
1960
2031
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1961
|
-
console.warn(
|
|
2032
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1962
2033
|
}
|
|
1963
2034
|
if (gitConfig.core.eol !== "lf") {
|
|
1964
2035
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1965
|
-
console.warn(
|
|
2036
|
+
console.warn(chalk26.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1966
2037
|
}
|
|
1967
2038
|
return 1;
|
|
1968
2039
|
};
|
|
@@ -1973,7 +2044,7 @@ var knip = () => {
|
|
|
1973
2044
|
};
|
|
1974
2045
|
|
|
1975
2046
|
// src/actions/license.ts
|
|
1976
|
-
import
|
|
2047
|
+
import chalk27 from "chalk";
|
|
1977
2048
|
import { init } from "license-checker";
|
|
1978
2049
|
var license = async (pkg) => {
|
|
1979
2050
|
const workspaces = yarnWorkspaces();
|
|
@@ -1998,18 +2069,18 @@ var license = async (pkg) => {
|
|
|
1998
2069
|
"LGPL-3.0-or-later",
|
|
1999
2070
|
"Python-2.0"
|
|
2000
2071
|
]);
|
|
2001
|
-
console.log(
|
|
2072
|
+
console.log(chalk27.green("License Checker"));
|
|
2002
2073
|
return (await Promise.all(
|
|
2003
2074
|
workspaceList.map(({ location, name }) => {
|
|
2004
2075
|
return new Promise((resolve) => {
|
|
2005
2076
|
init({ production: true, start: location }, (error, packages) => {
|
|
2006
2077
|
if (error) {
|
|
2007
|
-
console.error(
|
|
2008
|
-
console.error(
|
|
2078
|
+
console.error(chalk27.red(`License Checker [${name}] Error`));
|
|
2079
|
+
console.error(chalk27.gray(error));
|
|
2009
2080
|
console.log("\n");
|
|
2010
2081
|
resolve(1);
|
|
2011
2082
|
} else {
|
|
2012
|
-
console.log(
|
|
2083
|
+
console.log(chalk27.green(`License Checker [${name}]`));
|
|
2013
2084
|
let count = 0;
|
|
2014
2085
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2015
2086
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2025,7 +2096,7 @@ var license = async (pkg) => {
|
|
|
2025
2096
|
}
|
|
2026
2097
|
if (!orLicenseFound) {
|
|
2027
2098
|
count++;
|
|
2028
|
-
console.warn(
|
|
2099
|
+
console.warn(chalk27.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2029
2100
|
}
|
|
2030
2101
|
}
|
|
2031
2102
|
}
|
|
@@ -2045,12 +2116,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
2045
2116
|
|
|
2046
2117
|
// src/actions/package/clean-outputs.ts
|
|
2047
2118
|
import path8 from "path";
|
|
2048
|
-
import
|
|
2119
|
+
import chalk28 from "chalk";
|
|
2049
2120
|
var packageCleanOutputs = () => {
|
|
2050
2121
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2051
2122
|
const pkgName = process.env.npm_package_name;
|
|
2052
2123
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
2053
|
-
console.log(
|
|
2124
|
+
console.log(chalk28.green(`Cleaning Outputs [${pkgName}]`));
|
|
2054
2125
|
for (let folder of folders) {
|
|
2055
2126
|
deleteGlob(folder);
|
|
2056
2127
|
}
|
|
@@ -2059,11 +2130,11 @@ var packageCleanOutputs = () => {
|
|
|
2059
2130
|
|
|
2060
2131
|
// src/actions/package/clean-typescript.ts
|
|
2061
2132
|
import path9 from "path";
|
|
2062
|
-
import
|
|
2133
|
+
import chalk29 from "chalk";
|
|
2063
2134
|
var packageCleanTypescript = () => {
|
|
2064
2135
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2065
2136
|
const pkgName = process.env.npm_package_name;
|
|
2066
|
-
console.log(
|
|
2137
|
+
console.log(chalk29.green(`Cleaning Typescript [${pkgName}]`));
|
|
2067
2138
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
2068
2139
|
for (let file of files) {
|
|
2069
2140
|
deleteGlob(file);
|
|
@@ -2077,32 +2148,35 @@ var packageClean = async () => {
|
|
|
2077
2148
|
};
|
|
2078
2149
|
|
|
2079
2150
|
// src/actions/package/compile/compile.ts
|
|
2080
|
-
import
|
|
2151
|
+
import chalk34 from "chalk";
|
|
2081
2152
|
|
|
2082
2153
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2083
|
-
import
|
|
2154
|
+
import chalk33 from "chalk";
|
|
2084
2155
|
import { build as build2, defineConfig } from "tsup";
|
|
2085
2156
|
|
|
2086
2157
|
// src/actions/package/compile/inputs.ts
|
|
2087
|
-
import
|
|
2158
|
+
import chalk30 from "chalk";
|
|
2088
2159
|
import { glob as glob2 } from "glob";
|
|
2089
2160
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2090
2161
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2091
2162
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2092
2163
|
if (verbose) {
|
|
2093
|
-
console.log(
|
|
2164
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2094
2165
|
}
|
|
2095
2166
|
return result;
|
|
2096
2167
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2097
2168
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2098
2169
|
if (verbose) {
|
|
2099
|
-
console.log(
|
|
2170
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2100
2171
|
}
|
|
2101
2172
|
return result;
|
|
2102
2173
|
})];
|
|
2103
2174
|
};
|
|
2104
2175
|
|
|
2105
2176
|
// src/actions/package/compile/buildEntries.ts
|
|
2177
|
+
var isSpecOrStory = (entry) => {
|
|
2178
|
+
return entry.includes(".spec.") || entry.includes(".stories.") || entry.startsWith("spec/") || entry.includes("/spec/") || entry.startsWith("stories/") || entry.includes("/stories/") || entry === "spec.ts" || entry.endsWith("/spec.ts") || entry === "stories.ts" || entry.endsWith("/stories.ts");
|
|
2179
|
+
};
|
|
2106
2180
|
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
2107
2181
|
let entries = [];
|
|
2108
2182
|
switch (entryMode) {
|
|
@@ -2111,7 +2185,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
2111
2185
|
break;
|
|
2112
2186
|
}
|
|
2113
2187
|
case "all": {
|
|
2114
|
-
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !
|
|
2188
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !isSpecOrStory(entry)) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
2115
2189
|
break;
|
|
2116
2190
|
}
|
|
2117
2191
|
case "custom": {
|
|
@@ -2155,7 +2229,7 @@ function deepMergeObjects(objects) {
|
|
|
2155
2229
|
|
|
2156
2230
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2157
2231
|
import { cwd as cwd2 } from "process";
|
|
2158
|
-
import
|
|
2232
|
+
import chalk31 from "chalk";
|
|
2159
2233
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2160
2234
|
import ts3, {
|
|
2161
2235
|
DiagnosticCategory,
|
|
@@ -2177,7 +2251,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2177
2251
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2178
2252
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2179
2253
|
if (verbose) {
|
|
2180
|
-
console.log(
|
|
2254
|
+
console.log(chalk31.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2181
2255
|
}
|
|
2182
2256
|
const configFilePath = ts3.findConfigFile(
|
|
2183
2257
|
"./",
|
|
@@ -2200,10 +2274,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2200
2274
|
emitDeclarationOnly: true,
|
|
2201
2275
|
noEmit: false
|
|
2202
2276
|
};
|
|
2203
|
-
console.log(
|
|
2277
|
+
console.log(chalk31.cyan(`Validating Files: ${entries.length}`));
|
|
2204
2278
|
if (verbose) {
|
|
2205
2279
|
for (const entry of entries) {
|
|
2206
|
-
console.log(
|
|
2280
|
+
console.log(chalk31.grey(`Validating: ${entry}`));
|
|
2207
2281
|
}
|
|
2208
2282
|
}
|
|
2209
2283
|
try {
|
|
@@ -2227,7 +2301,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2227
2301
|
);
|
|
2228
2302
|
console.error(formattedDiagnostics);
|
|
2229
2303
|
}
|
|
2230
|
-
const nonEmitPatterns = [".stories.", "/stories/", ".spec.", "/spec/", ".example."];
|
|
2304
|
+
const nonEmitPatterns = [".stories.", "/stories/", "/stories.", ".spec.", "/spec/", "/spec.", ".example."];
|
|
2231
2305
|
program.emit(void 0, (fileName, text, writeByteOrderMark) => {
|
|
2232
2306
|
if (nonEmitPatterns.some((pattern) => fileName.includes(pattern))) {
|
|
2233
2307
|
return;
|
|
@@ -2239,7 +2313,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2239
2313
|
return 0;
|
|
2240
2314
|
} finally {
|
|
2241
2315
|
if (verbose) {
|
|
2242
|
-
console.log(
|
|
2316
|
+
console.log(chalk31.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2243
2317
|
}
|
|
2244
2318
|
}
|
|
2245
2319
|
};
|
|
@@ -2247,7 +2321,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2247
2321
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2248
2322
|
import path10 from "path";
|
|
2249
2323
|
import { cwd as cwd3 } from "process";
|
|
2250
|
-
import
|
|
2324
|
+
import chalk32 from "chalk";
|
|
2251
2325
|
import { rollup } from "rollup";
|
|
2252
2326
|
import dts from "rollup-plugin-dts";
|
|
2253
2327
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2272,8 +2346,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2272
2346
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2273
2347
|
return;
|
|
2274
2348
|
}
|
|
2275
|
-
console.warn(
|
|
2276
|
-
console.warn(
|
|
2349
|
+
console.warn(chalk32.yellow(`[${warning.code}] ${warning.message}`));
|
|
2350
|
+
console.warn(chalk32.gray(inputPath));
|
|
2277
2351
|
warn(warning);
|
|
2278
2352
|
}
|
|
2279
2353
|
});
|
|
@@ -2283,8 +2357,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2283
2357
|
});
|
|
2284
2358
|
} catch (ex) {
|
|
2285
2359
|
const error = ex;
|
|
2286
|
-
console.warn(
|
|
2287
|
-
console.warn(
|
|
2360
|
+
console.warn(chalk32.red(error));
|
|
2361
|
+
console.warn(chalk32.gray(inputPath));
|
|
2288
2362
|
}
|
|
2289
2363
|
if (verbose) {
|
|
2290
2364
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2292,7 +2366,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2292
2366
|
}
|
|
2293
2367
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2294
2368
|
if (verbose) {
|
|
2295
|
-
console.log(
|
|
2369
|
+
console.log(chalk32.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2296
2370
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2297
2371
|
}
|
|
2298
2372
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2316,7 +2390,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2316
2390
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2317
2391
|
}));
|
|
2318
2392
|
if (verbose) {
|
|
2319
|
-
console.log(
|
|
2393
|
+
console.log(chalk32.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2320
2394
|
}
|
|
2321
2395
|
return 0;
|
|
2322
2396
|
};
|
|
@@ -2328,15 +2402,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2328
2402
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2329
2403
|
}
|
|
2330
2404
|
if (entries.length === 0) {
|
|
2331
|
-
console.warn(
|
|
2405
|
+
console.warn(chalk33.yellow(`No entries found in ${srcDir} to compile`));
|
|
2332
2406
|
return 0;
|
|
2333
2407
|
}
|
|
2334
2408
|
if (verbose) {
|
|
2335
|
-
console.log(
|
|
2409
|
+
console.log(chalk33.gray(`buildDir [${buildDir}]`));
|
|
2336
2410
|
}
|
|
2337
2411
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2338
2412
|
if (validationResult !== 0) {
|
|
2339
|
-
console.error(
|
|
2413
|
+
console.error(chalk33.red(`Compile:Validation had ${validationResult} errors`));
|
|
2340
2414
|
return validationResult;
|
|
2341
2415
|
}
|
|
2342
2416
|
const optionsParams = tsupOptions([{
|
|
@@ -2361,12 +2435,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2361
2435
|
})
|
|
2362
2436
|
)).flat();
|
|
2363
2437
|
if (verbose) {
|
|
2364
|
-
console.log(
|
|
2365
|
-
console.log(
|
|
2438
|
+
console.log(chalk33.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2439
|
+
console.log(chalk33.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2366
2440
|
}
|
|
2367
2441
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2368
2442
|
if (verbose) {
|
|
2369
|
-
console.log(
|
|
2443
|
+
console.log(chalk33.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2370
2444
|
}
|
|
2371
2445
|
if (bundleTypes) {
|
|
2372
2446
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2477,14 +2551,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2477
2551
|
// src/actions/package/compile/compile.ts
|
|
2478
2552
|
var packageCompile = async (inConfig = {}) => {
|
|
2479
2553
|
const pkg = process.env.INIT_CWD;
|
|
2480
|
-
console.log(
|
|
2554
|
+
console.log(chalk34.green(`Compiling ${pkg}`));
|
|
2481
2555
|
const config2 = await loadConfig(inConfig);
|
|
2482
2556
|
return await packageCompileTsup(config2);
|
|
2483
2557
|
};
|
|
2484
2558
|
|
|
2485
2559
|
// src/actions/package/copy-assets.ts
|
|
2486
2560
|
import path11 from "path/posix";
|
|
2487
|
-
import
|
|
2561
|
+
import chalk35 from "chalk";
|
|
2488
2562
|
import cpy2 from "cpy";
|
|
2489
2563
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2490
2564
|
try {
|
|
@@ -2497,7 +2571,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2497
2571
|
}
|
|
2498
2572
|
);
|
|
2499
2573
|
if (values.length > 0) {
|
|
2500
|
-
console.log(
|
|
2574
|
+
console.log(chalk35.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2501
2575
|
}
|
|
2502
2576
|
for (const value of values) {
|
|
2503
2577
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2562,9 +2636,9 @@ var packageCycle = async () => {
|
|
|
2562
2636
|
};
|
|
2563
2637
|
|
|
2564
2638
|
// src/actions/package/gen-docs.ts
|
|
2565
|
-
import { existsSync as
|
|
2639
|
+
import { existsSync as existsSync8 } from "fs";
|
|
2566
2640
|
import path12 from "path";
|
|
2567
|
-
import
|
|
2641
|
+
import chalk36 from "chalk";
|
|
2568
2642
|
import {
|
|
2569
2643
|
Application,
|
|
2570
2644
|
ArgumentsReader,
|
|
@@ -2582,7 +2656,7 @@ var ExitCodes = {
|
|
|
2582
2656
|
};
|
|
2583
2657
|
var packageGenDocs = async () => {
|
|
2584
2658
|
const pkg = process.env.INIT_CWD;
|
|
2585
|
-
if (pkg !== void 0 && !
|
|
2659
|
+
if (pkg !== void 0 && !existsSync8(path12.join(pkg, "typedoc.json"))) {
|
|
2586
2660
|
return;
|
|
2587
2661
|
}
|
|
2588
2662
|
const app = await Application.bootstrap({
|
|
@@ -2668,7 +2742,7 @@ var runTypeDoc = async (app) => {
|
|
|
2668
2742
|
return ExitCodes.OutputError;
|
|
2669
2743
|
}
|
|
2670
2744
|
}
|
|
2671
|
-
console.log(
|
|
2745
|
+
console.log(chalk36.green(`${pkgName} - Ok`));
|
|
2672
2746
|
return ExitCodes.Ok;
|
|
2673
2747
|
};
|
|
2674
2748
|
|
|
@@ -2677,7 +2751,7 @@ import { readdirSync as readdirSync4 } from "fs";
|
|
|
2677
2751
|
import path13 from "path";
|
|
2678
2752
|
import { cwd as cwd4 } from "process";
|
|
2679
2753
|
import { pathToFileURL } from "url";
|
|
2680
|
-
import
|
|
2754
|
+
import chalk37 from "chalk";
|
|
2681
2755
|
import { ESLint } from "eslint";
|
|
2682
2756
|
import { findUp } from "find-up";
|
|
2683
2757
|
import picomatch from "picomatch";
|
|
@@ -2686,14 +2760,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2686
2760
|
const severity = ["none", "warning", "error"];
|
|
2687
2761
|
for (const lintResult of lintResults) {
|
|
2688
2762
|
if (lintResult.messages.length > 0) {
|
|
2689
|
-
console.log(
|
|
2763
|
+
console.log(chalk37.gray(`
|
|
2690
2764
|
${lintResult.filePath}`));
|
|
2691
2765
|
for (const message of lintResult.messages) {
|
|
2692
2766
|
console.log(
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2767
|
+
chalk37.gray(` ${message.line}:${message.column}`),
|
|
2768
|
+
chalk37[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2769
|
+
chalk37.white(` ${message.message}`),
|
|
2770
|
+
chalk37.gray(` ${message.ruleId}`)
|
|
2697
2771
|
);
|
|
2698
2772
|
}
|
|
2699
2773
|
}
|
|
@@ -2731,10 +2805,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2731
2805
|
cache
|
|
2732
2806
|
});
|
|
2733
2807
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2734
|
-
console.log(
|
|
2808
|
+
console.log(chalk37.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2735
2809
|
if (verbose) {
|
|
2736
2810
|
for (const file of files) {
|
|
2737
|
-
console.log(
|
|
2811
|
+
console.log(chalk37.gray(` ${file}`));
|
|
2738
2812
|
}
|
|
2739
2813
|
}
|
|
2740
2814
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2745,32 +2819,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2745
2819
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2746
2820
|
const lintTime = Date.now() - start;
|
|
2747
2821
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2748
|
-
console.log(
|
|
2822
|
+
console.log(chalk37.white(`Linted ${chalk37[filesCountColor](files.length)} files in ${chalk37[lintTimeColor](lintTime)}ms`));
|
|
2749
2823
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2750
2824
|
};
|
|
2751
2825
|
|
|
2752
2826
|
// src/actions/package/publint.ts
|
|
2753
2827
|
import { promises as fs10 } from "fs";
|
|
2754
|
-
import
|
|
2828
|
+
import chalk38 from "chalk";
|
|
2755
2829
|
import sortPackageJson from "sort-package-json";
|
|
2756
2830
|
var customPubLint = (pkg) => {
|
|
2757
2831
|
let errorCount = 0;
|
|
2758
2832
|
let warningCount = 0;
|
|
2759
2833
|
if (pkg.files === void 0) {
|
|
2760
|
-
console.warn(
|
|
2834
|
+
console.warn(chalk38.yellow('Publint [custom]: "files" field is missing'));
|
|
2761
2835
|
warningCount++;
|
|
2762
2836
|
}
|
|
2763
2837
|
if (pkg.main !== void 0) {
|
|
2764
|
-
console.warn(
|
|
2838
|
+
console.warn(chalk38.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2765
2839
|
warningCount++;
|
|
2766
2840
|
}
|
|
2767
2841
|
if (pkg.sideEffects !== false) {
|
|
2768
|
-
console.warn(
|
|
2842
|
+
console.warn(chalk38.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2769
2843
|
warningCount++;
|
|
2770
2844
|
}
|
|
2771
2845
|
if (pkg.resolutions !== void 0) {
|
|
2772
|
-
console.warn(
|
|
2773
|
-
console.warn(
|
|
2846
|
+
console.warn(chalk38.yellow('Publint [custom]: "resolutions" in use'));
|
|
2847
|
+
console.warn(chalk38.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2774
2848
|
warningCount++;
|
|
2775
2849
|
}
|
|
2776
2850
|
return [errorCount, warningCount];
|
|
@@ -2780,8 +2854,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2780
2854
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2781
2855
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2782
2856
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2783
|
-
console.log(
|
|
2784
|
-
console.log(
|
|
2857
|
+
console.log(chalk38.green(`Publint: ${pkg.name}`));
|
|
2858
|
+
console.log(chalk38.gray(pkgDir));
|
|
2785
2859
|
const { publint: publint2 } = await import("publint");
|
|
2786
2860
|
const { messages } = await publint2({
|
|
2787
2861
|
level: "suggestion",
|
|
@@ -2792,22 +2866,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2792
2866
|
for (const message of messages) {
|
|
2793
2867
|
switch (message.type) {
|
|
2794
2868
|
case "error": {
|
|
2795
|
-
console.error(
|
|
2869
|
+
console.error(chalk38.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2796
2870
|
break;
|
|
2797
2871
|
}
|
|
2798
2872
|
case "warning": {
|
|
2799
|
-
console.warn(
|
|
2873
|
+
console.warn(chalk38.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2800
2874
|
break;
|
|
2801
2875
|
}
|
|
2802
2876
|
default: {
|
|
2803
|
-
console.log(
|
|
2877
|
+
console.log(chalk38.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2804
2878
|
break;
|
|
2805
2879
|
}
|
|
2806
2880
|
}
|
|
2807
2881
|
}
|
|
2808
2882
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2809
2883
|
if (verbose) {
|
|
2810
|
-
console.log(
|
|
2884
|
+
console.log(chalk38.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2811
2885
|
}
|
|
2812
2886
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2813
2887
|
};
|
|
@@ -2858,7 +2932,7 @@ var rebuild = ({ target }) => {
|
|
|
2858
2932
|
};
|
|
2859
2933
|
|
|
2860
2934
|
// src/actions/recompile.ts
|
|
2861
|
-
import
|
|
2935
|
+
import chalk39 from "chalk";
|
|
2862
2936
|
var recompile = async ({
|
|
2863
2937
|
verbose,
|
|
2864
2938
|
target,
|
|
@@ -2894,7 +2968,7 @@ var recompileAll = async ({
|
|
|
2894
2968
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2895
2969
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2896
2970
|
if (jobs) {
|
|
2897
|
-
console.log(
|
|
2971
|
+
console.log(chalk39.blue(`Jobs set to [${jobs}]`));
|
|
2898
2972
|
}
|
|
2899
2973
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2900
2974
|
[
|
|
@@ -2925,7 +2999,7 @@ var recompileAll = async ({
|
|
|
2925
2999
|
]
|
|
2926
3000
|
]);
|
|
2927
3001
|
console.log(
|
|
2928
|
-
`${
|
|
3002
|
+
`${chalk39.gray("Recompiled in")} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`
|
|
2929
3003
|
);
|
|
2930
3004
|
return result;
|
|
2931
3005
|
};
|
|
@@ -2956,13 +3030,13 @@ var reinstall = () => {
|
|
|
2956
3030
|
};
|
|
2957
3031
|
|
|
2958
3032
|
// src/actions/relint.ts
|
|
2959
|
-
import
|
|
3033
|
+
import chalk40 from "chalk";
|
|
2960
3034
|
var relintPackage = ({
|
|
2961
3035
|
pkg,
|
|
2962
3036
|
fix: fix2,
|
|
2963
3037
|
verbose
|
|
2964
3038
|
}) => {
|
|
2965
|
-
console.log(
|
|
3039
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2966
3040
|
const start = Date.now();
|
|
2967
3041
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2968
3042
|
["yarn", [
|
|
@@ -2972,7 +3046,7 @@ var relintPackage = ({
|
|
|
2972
3046
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2973
3047
|
]]
|
|
2974
3048
|
]);
|
|
2975
|
-
console.log(
|
|
3049
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
2976
3050
|
return result;
|
|
2977
3051
|
};
|
|
2978
3052
|
var relint = ({
|
|
@@ -2992,13 +3066,13 @@ var relint = ({
|
|
|
2992
3066
|
});
|
|
2993
3067
|
};
|
|
2994
3068
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2995
|
-
console.log(
|
|
3069
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2996
3070
|
const start = Date.now();
|
|
2997
3071
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2998
3072
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2999
3073
|
["yarn", ["eslint", ...fixOptions]]
|
|
3000
3074
|
]);
|
|
3001
|
-
console.log(
|
|
3075
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
3002
3076
|
return result;
|
|
3003
3077
|
};
|
|
3004
3078
|
|
|
@@ -3016,10 +3090,10 @@ var sonar = () => {
|
|
|
3016
3090
|
};
|
|
3017
3091
|
|
|
3018
3092
|
// src/actions/statics.ts
|
|
3019
|
-
import
|
|
3093
|
+
import chalk41 from "chalk";
|
|
3020
3094
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
3021
3095
|
var statics = () => {
|
|
3022
|
-
console.log(
|
|
3096
|
+
console.log(chalk41.green("Check Required Static Dependencies"));
|
|
3023
3097
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
3024
3098
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
3025
3099
|
};
|
|
@@ -3076,7 +3150,7 @@ var loadPackageConfig = async () => {
|
|
|
3076
3150
|
};
|
|
3077
3151
|
|
|
3078
3152
|
// src/xy/xy.ts
|
|
3079
|
-
import
|
|
3153
|
+
import chalk43 from "chalk";
|
|
3080
3154
|
|
|
3081
3155
|
// src/xy/xyBuildCommands.ts
|
|
3082
3156
|
var xyBuildCommands = (args) => {
|
|
@@ -3191,6 +3265,14 @@ var xyCommonCommands = (args) => {
|
|
|
3191
3265
|
if (argv.verbose) console.log("Claude Commands");
|
|
3192
3266
|
process.exitCode = claudeCommands();
|
|
3193
3267
|
}
|
|
3268
|
+
).command(
|
|
3269
|
+
"claude-settings",
|
|
3270
|
+
"Claude Settings - Initialize .claude/settings.local.json with XY Labs defaults",
|
|
3271
|
+
(yargs2) => yargs2,
|
|
3272
|
+
async (argv) => {
|
|
3273
|
+
if (argv.verbose) console.log("Claude Settings");
|
|
3274
|
+
process.exitCode = await claudeSettings();
|
|
3275
|
+
}
|
|
3194
3276
|
).command(
|
|
3195
3277
|
"claude-rules",
|
|
3196
3278
|
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
@@ -3476,7 +3558,7 @@ var xyInstallCommands = (args) => {
|
|
|
3476
3558
|
};
|
|
3477
3559
|
|
|
3478
3560
|
// src/xy/xyLintCommands.ts
|
|
3479
|
-
import
|
|
3561
|
+
import chalk42 from "chalk";
|
|
3480
3562
|
var xyLintCommands = (args) => {
|
|
3481
3563
|
return args.command(
|
|
3482
3564
|
"cycle [package]",
|
|
@@ -3488,7 +3570,7 @@ var xyLintCommands = (args) => {
|
|
|
3488
3570
|
const start = Date.now();
|
|
3489
3571
|
if (argv.verbose) console.log("Cycle");
|
|
3490
3572
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3491
|
-
console.log(
|
|
3573
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3492
3574
|
}
|
|
3493
3575
|
).command(
|
|
3494
3576
|
"lint [package]",
|
|
@@ -3518,7 +3600,7 @@ var xyLintCommands = (args) => {
|
|
|
3518
3600
|
cache: argv.cache,
|
|
3519
3601
|
verbose: !!argv.verbose
|
|
3520
3602
|
});
|
|
3521
|
-
console.log(
|
|
3603
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3522
3604
|
}
|
|
3523
3605
|
).command(
|
|
3524
3606
|
"deplint [package]",
|
|
@@ -3557,7 +3639,7 @@ var xyLintCommands = (args) => {
|
|
|
3557
3639
|
peerDeps: !!argv.peerDeps,
|
|
3558
3640
|
verbose: !!argv.verbose
|
|
3559
3641
|
});
|
|
3560
|
-
console.log(
|
|
3642
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3561
3643
|
}
|
|
3562
3644
|
).command(
|
|
3563
3645
|
"fix [package]",
|
|
@@ -3569,7 +3651,7 @@ var xyLintCommands = (args) => {
|
|
|
3569
3651
|
const start = Date.now();
|
|
3570
3652
|
if (argv.verbose) console.log("Fix");
|
|
3571
3653
|
process.exitCode = fix();
|
|
3572
|
-
console.log(
|
|
3654
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3573
3655
|
}
|
|
3574
3656
|
).command(
|
|
3575
3657
|
"relint [package]",
|
|
@@ -3581,7 +3663,7 @@ var xyLintCommands = (args) => {
|
|
|
3581
3663
|
if (argv.verbose) console.log("Relinting");
|
|
3582
3664
|
const start = Date.now();
|
|
3583
3665
|
process.exitCode = relint();
|
|
3584
|
-
console.log(
|
|
3666
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3585
3667
|
}
|
|
3586
3668
|
).command(
|
|
3587
3669
|
"publint [package]",
|
|
@@ -3593,7 +3675,7 @@ var xyLintCommands = (args) => {
|
|
|
3593
3675
|
if (argv.verbose) console.log("Publint");
|
|
3594
3676
|
const start = Date.now();
|
|
3595
3677
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3596
|
-
console.log(
|
|
3678
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3597
3679
|
}
|
|
3598
3680
|
).command(
|
|
3599
3681
|
"knip",
|
|
@@ -3605,7 +3687,7 @@ var xyLintCommands = (args) => {
|
|
|
3605
3687
|
if (argv.verbose) console.log("Knip");
|
|
3606
3688
|
const start = Date.now();
|
|
3607
3689
|
process.exitCode = knip();
|
|
3608
|
-
console.log(
|
|
3690
|
+
console.log(chalk42.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3609
3691
|
}
|
|
3610
3692
|
).command(
|
|
3611
3693
|
"sonar",
|
|
@@ -3617,7 +3699,7 @@ var xyLintCommands = (args) => {
|
|
|
3617
3699
|
const start = Date.now();
|
|
3618
3700
|
if (argv.verbose) console.log("Sonar Check");
|
|
3619
3701
|
process.exitCode = sonar();
|
|
3620
|
-
console.log(
|
|
3702
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3621
3703
|
}
|
|
3622
3704
|
);
|
|
3623
3705
|
};
|
|
@@ -3653,8 +3735,8 @@ var xyParseOptions = () => {
|
|
|
3653
3735
|
var xy = async () => {
|
|
3654
3736
|
const options = xyParseOptions();
|
|
3655
3737
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3656
|
-
console.error(
|
|
3657
|
-
console.log(
|
|
3738
|
+
console.error(chalk43.yellow(`Command not found [${chalk43.magenta(process.argv[2])}]`));
|
|
3739
|
+
console.log(chalk43.gray("Try 'yarn xy --help' for list of commands"));
|
|
3658
3740
|
}).version().help().argv;
|
|
3659
3741
|
};
|
|
3660
3742
|
export {
|
|
@@ -3672,6 +3754,7 @@ export {
|
|
|
3672
3754
|
claudeMdProjectTemplate,
|
|
3673
3755
|
claudeMdRuleTemplates,
|
|
3674
3756
|
claudeRules,
|
|
3757
|
+
claudeSettings,
|
|
3675
3758
|
clean,
|
|
3676
3759
|
cleanAll,
|
|
3677
3760
|
cleanDocs,
|