@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/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";
|
|
@@ -1153,6 +1224,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
1153
1224
|
ts.forEachChild(node, visit);
|
|
1154
1225
|
}
|
|
1155
1226
|
visit(sourceFile);
|
|
1227
|
+
for (const ref of sourceFile.typeReferenceDirectives) {
|
|
1228
|
+
typeImports.push(ref.fileName);
|
|
1229
|
+
}
|
|
1156
1230
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
1157
1231
|
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
1158
1232
|
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
@@ -1208,7 +1282,7 @@ function getExternalImportsFromFiles({
|
|
|
1208
1282
|
|
|
1209
1283
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1210
1284
|
import { builtinModules } from "module";
|
|
1211
|
-
import
|
|
1285
|
+
import chalk17 from "chalk";
|
|
1212
1286
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1213
1287
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1214
1288
|
}
|
|
@@ -1216,7 +1290,7 @@ function isTypeImportListed(imp, name, dependencies, devDependencies, peerDepend
|
|
|
1216
1290
|
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
1291
|
}
|
|
1218
1292
|
function logMissing(name, imp, importPaths) {
|
|
1219
|
-
console.log(`[${
|
|
1293
|
+
console.log(`[${chalk17.blue(name)}] Missing dependency in package.json: ${chalk17.red(imp)}`);
|
|
1220
1294
|
if (importPaths[imp]) {
|
|
1221
1295
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1222
1296
|
}
|
|
@@ -1245,7 +1319,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1245
1319
|
}
|
|
1246
1320
|
if (unlistedDependencies > 0) {
|
|
1247
1321
|
const packageLocation = `${location}/package.json`;
|
|
1248
|
-
console.log(` ${
|
|
1322
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1249
1323
|
`);
|
|
1250
1324
|
}
|
|
1251
1325
|
return unlistedDependencies;
|
|
@@ -1253,7 +1327,7 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1253
1327
|
|
|
1254
1328
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1255
1329
|
import { builtinModules as builtinModules2 } from "module";
|
|
1256
|
-
import
|
|
1330
|
+
import chalk18 from "chalk";
|
|
1257
1331
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1258
1332
|
devDependencies,
|
|
1259
1333
|
dependencies,
|
|
@@ -1267,7 +1341,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1267
1341
|
for (const imp of externalAllImports) {
|
|
1268
1342
|
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
1343
|
unlistedDevDependencies++;
|
|
1270
|
-
console.log(`[${
|
|
1344
|
+
console.log(`[${chalk18.blue(name)}] Missing devDependency in package.json: ${chalk18.red(imp)}`);
|
|
1271
1345
|
if (allImportPaths[imp]) {
|
|
1272
1346
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1273
1347
|
}
|
|
@@ -1275,14 +1349,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1275
1349
|
}
|
|
1276
1350
|
if (unlistedDevDependencies > 0) {
|
|
1277
1351
|
const packageLocation = `${location}/package.json`;
|
|
1278
|
-
console.log(` ${
|
|
1352
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1279
1353
|
`);
|
|
1280
1354
|
}
|
|
1281
1355
|
return unlistedDevDependencies;
|
|
1282
1356
|
}
|
|
1283
1357
|
|
|
1284
1358
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1285
|
-
import
|
|
1359
|
+
import chalk19 from "chalk";
|
|
1286
1360
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1287
1361
|
externalDistImports,
|
|
1288
1362
|
externalDistTypeImports,
|
|
@@ -1294,22 +1368,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1294
1368
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1295
1369
|
unusedDependencies++;
|
|
1296
1370
|
if (externalAllImports.includes(dep)) {
|
|
1297
|
-
console.log(`[${
|
|
1371
|
+
console.log(`[${chalk19.blue(name)}] dependency should be devDependency in package.json: ${chalk19.red(dep)}`);
|
|
1298
1372
|
} else {
|
|
1299
|
-
console.log(`[${
|
|
1373
|
+
console.log(`[${chalk19.blue(name)}] Unused dependency in package.json: ${chalk19.red(dep)}`);
|
|
1300
1374
|
}
|
|
1301
1375
|
}
|
|
1302
1376
|
}
|
|
1303
1377
|
if (unusedDependencies > 0) {
|
|
1304
1378
|
const packageLocation = `${location}/package.json`;
|
|
1305
|
-
console.log(` ${
|
|
1379
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1306
1380
|
`);
|
|
1307
1381
|
}
|
|
1308
1382
|
return unusedDependencies;
|
|
1309
1383
|
}
|
|
1310
1384
|
|
|
1311
1385
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1312
|
-
import
|
|
1386
|
+
import chalk20 from "chalk";
|
|
1313
1387
|
|
|
1314
1388
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1315
1389
|
import fs8 from "fs";
|
|
@@ -1593,19 +1667,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1593
1667
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1594
1668
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1595
1669
|
unusedDevDependencies++;
|
|
1596
|
-
console.log(`[${
|
|
1670
|
+
console.log(`[${chalk20.blue(name)}] Unused devDependency in package.json: ${chalk20.red(dep)}`);
|
|
1597
1671
|
}
|
|
1598
1672
|
}
|
|
1599
1673
|
if (unusedDevDependencies > 0) {
|
|
1600
1674
|
const packageLocation = `${location}/package.json`;
|
|
1601
|
-
console.log(` ${
|
|
1675
|
+
console.log(` ${chalk20.yellow(packageLocation)}
|
|
1602
1676
|
`);
|
|
1603
1677
|
}
|
|
1604
1678
|
return unusedDevDependencies;
|
|
1605
1679
|
}
|
|
1606
1680
|
|
|
1607
1681
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1608
|
-
import
|
|
1682
|
+
import chalk21 from "chalk";
|
|
1609
1683
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1610
1684
|
let unusedDependencies = 0;
|
|
1611
1685
|
for (const dep of peerDependencies) {
|
|
@@ -1613,15 +1687,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1613
1687
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1614
1688
|
unusedDependencies++;
|
|
1615
1689
|
if (dependencies.includes(dep)) {
|
|
1616
|
-
console.log(`[${
|
|
1690
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk21.red(dep)}`);
|
|
1617
1691
|
} else {
|
|
1618
|
-
console.log(`[${
|
|
1692
|
+
console.log(`[${chalk21.blue(name)}] Unused peerDependency in package.json: ${chalk21.red(dep)}`);
|
|
1619
1693
|
}
|
|
1620
1694
|
}
|
|
1621
1695
|
}
|
|
1622
1696
|
if (unusedDependencies > 0) {
|
|
1623
1697
|
const packageLocation = `${location}/package.json`;
|
|
1624
|
-
console.log(` ${
|
|
1698
|
+
console.log(` ${chalk21.yellow(packageLocation)}
|
|
1625
1699
|
`);
|
|
1626
1700
|
}
|
|
1627
1701
|
return unusedDependencies;
|
|
@@ -1716,9 +1790,9 @@ var deplint = async ({
|
|
|
1716
1790
|
});
|
|
1717
1791
|
}
|
|
1718
1792
|
if (totalErrors > 0) {
|
|
1719
|
-
console.warn(`Deplint: Found ${
|
|
1793
|
+
console.warn(`Deplint: Found ${chalk22.red(totalErrors)} dependency problems. ${chalk22.red("\u2716")}`);
|
|
1720
1794
|
} else {
|
|
1721
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1795
|
+
console.info(`Deplint: Found no dependency problems. ${chalk22.green("\u2714")}`);
|
|
1722
1796
|
}
|
|
1723
1797
|
return 0;
|
|
1724
1798
|
};
|
|
@@ -1820,22 +1894,22 @@ var deployNext = () => {
|
|
|
1820
1894
|
};
|
|
1821
1895
|
|
|
1822
1896
|
// src/actions/dupdeps.ts
|
|
1823
|
-
import
|
|
1897
|
+
import chalk23 from "chalk";
|
|
1824
1898
|
var dupdeps = () => {
|
|
1825
|
-
console.log(
|
|
1899
|
+
console.log(chalk23.green("Checking all Dependencies for Duplicates"));
|
|
1826
1900
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1827
1901
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1828
1902
|
return detectDuplicateDependencies(dependencies);
|
|
1829
1903
|
};
|
|
1830
1904
|
|
|
1831
1905
|
// src/actions/lint.ts
|
|
1832
|
-
import
|
|
1906
|
+
import chalk24 from "chalk";
|
|
1833
1907
|
var lintPackage = ({
|
|
1834
1908
|
pkg,
|
|
1835
1909
|
fix: fix2,
|
|
1836
1910
|
verbose
|
|
1837
1911
|
}) => {
|
|
1838
|
-
console.log(
|
|
1912
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1839
1913
|
const start = Date.now();
|
|
1840
1914
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1841
1915
|
["yarn", [
|
|
@@ -1845,7 +1919,7 @@ var lintPackage = ({
|
|
|
1845
1919
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1846
1920
|
]]
|
|
1847
1921
|
]);
|
|
1848
|
-
console.log(
|
|
1922
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1849
1923
|
return result;
|
|
1850
1924
|
};
|
|
1851
1925
|
var lint = ({
|
|
@@ -1865,13 +1939,13 @@ var lint = ({
|
|
|
1865
1939
|
});
|
|
1866
1940
|
};
|
|
1867
1941
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1868
|
-
console.log(
|
|
1942
|
+
console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1869
1943
|
const start = Date.now();
|
|
1870
1944
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1871
1945
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1872
1946
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1873
1947
|
]);
|
|
1874
|
-
console.log(
|
|
1948
|
+
console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1875
1949
|
return result;
|
|
1876
1950
|
};
|
|
1877
1951
|
|
|
@@ -1899,7 +1973,7 @@ var filename = ".gitignore";
|
|
|
1899
1973
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1900
1974
|
|
|
1901
1975
|
// src/actions/gitlint.ts
|
|
1902
|
-
import
|
|
1976
|
+
import chalk25 from "chalk";
|
|
1903
1977
|
import ParseGitConfig from "parse-git-config";
|
|
1904
1978
|
var gitlint = () => {
|
|
1905
1979
|
console.log(`
|
|
@@ -1910,7 +1984,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1910
1984
|
const errors = 0;
|
|
1911
1985
|
const gitConfig = ParseGitConfig.sync();
|
|
1912
1986
|
const warn = (message) => {
|
|
1913
|
-
console.warn(
|
|
1987
|
+
console.warn(chalk25.yellow(`Warning: ${message}`));
|
|
1914
1988
|
warnings++;
|
|
1915
1989
|
};
|
|
1916
1990
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1930,13 +2004,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1930
2004
|
}
|
|
1931
2005
|
const resultMessages = [];
|
|
1932
2006
|
if (valid > 0) {
|
|
1933
|
-
resultMessages.push(
|
|
2007
|
+
resultMessages.push(chalk25.green(`Passed: ${valid}`));
|
|
1934
2008
|
}
|
|
1935
2009
|
if (warnings > 0) {
|
|
1936
|
-
resultMessages.push(
|
|
2010
|
+
resultMessages.push(chalk25.yellow(`Warnings: ${warnings}`));
|
|
1937
2011
|
}
|
|
1938
2012
|
if (errors > 0) {
|
|
1939
|
-
resultMessages.push(
|
|
2013
|
+
resultMessages.push(chalk25.red(` Errors: ${errors}`));
|
|
1940
2014
|
}
|
|
1941
2015
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1942
2016
|
`);
|
|
@@ -1945,7 +2019,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1945
2019
|
|
|
1946
2020
|
// src/actions/gitlint-fix.ts
|
|
1947
2021
|
import { execSync as execSync3 } from "child_process";
|
|
1948
|
-
import
|
|
2022
|
+
import chalk26 from "chalk";
|
|
1949
2023
|
import ParseGitConfig2 from "parse-git-config";
|
|
1950
2024
|
var gitlintFix = () => {
|
|
1951
2025
|
console.log(`
|
|
@@ -1954,15 +2028,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1954
2028
|
const gitConfig = ParseGitConfig2.sync();
|
|
1955
2029
|
if (gitConfig.core.ignorecase) {
|
|
1956
2030
|
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1957
|
-
console.warn(
|
|
2031
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1958
2032
|
}
|
|
1959
2033
|
if (gitConfig.core.autocrlf !== false) {
|
|
1960
2034
|
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1961
|
-
console.warn(
|
|
2035
|
+
console.warn(chalk26.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1962
2036
|
}
|
|
1963
2037
|
if (gitConfig.core.eol !== "lf") {
|
|
1964
2038
|
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1965
|
-
console.warn(
|
|
2039
|
+
console.warn(chalk26.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1966
2040
|
}
|
|
1967
2041
|
return 1;
|
|
1968
2042
|
};
|
|
@@ -1973,7 +2047,7 @@ var knip = () => {
|
|
|
1973
2047
|
};
|
|
1974
2048
|
|
|
1975
2049
|
// src/actions/license.ts
|
|
1976
|
-
import
|
|
2050
|
+
import chalk27 from "chalk";
|
|
1977
2051
|
import { init } from "license-checker";
|
|
1978
2052
|
var license = async (pkg) => {
|
|
1979
2053
|
const workspaces = yarnWorkspaces();
|
|
@@ -1998,18 +2072,18 @@ var license = async (pkg) => {
|
|
|
1998
2072
|
"LGPL-3.0-or-later",
|
|
1999
2073
|
"Python-2.0"
|
|
2000
2074
|
]);
|
|
2001
|
-
console.log(
|
|
2075
|
+
console.log(chalk27.green("License Checker"));
|
|
2002
2076
|
return (await Promise.all(
|
|
2003
2077
|
workspaceList.map(({ location, name }) => {
|
|
2004
2078
|
return new Promise((resolve) => {
|
|
2005
2079
|
init({ production: true, start: location }, (error, packages) => {
|
|
2006
2080
|
if (error) {
|
|
2007
|
-
console.error(
|
|
2008
|
-
console.error(
|
|
2081
|
+
console.error(chalk27.red(`License Checker [${name}] Error`));
|
|
2082
|
+
console.error(chalk27.gray(error));
|
|
2009
2083
|
console.log("\n");
|
|
2010
2084
|
resolve(1);
|
|
2011
2085
|
} else {
|
|
2012
|
-
console.log(
|
|
2086
|
+
console.log(chalk27.green(`License Checker [${name}]`));
|
|
2013
2087
|
let count = 0;
|
|
2014
2088
|
for (const [name2, info] of Object.entries(packages)) {
|
|
2015
2089
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -2025,7 +2099,7 @@ var license = async (pkg) => {
|
|
|
2025
2099
|
}
|
|
2026
2100
|
if (!orLicenseFound) {
|
|
2027
2101
|
count++;
|
|
2028
|
-
console.warn(
|
|
2102
|
+
console.warn(chalk27.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
2029
2103
|
}
|
|
2030
2104
|
}
|
|
2031
2105
|
}
|
|
@@ -2045,12 +2119,12 @@ var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
|
2045
2119
|
|
|
2046
2120
|
// src/actions/package/clean-outputs.ts
|
|
2047
2121
|
import path8 from "path";
|
|
2048
|
-
import
|
|
2122
|
+
import chalk28 from "chalk";
|
|
2049
2123
|
var packageCleanOutputs = () => {
|
|
2050
2124
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2051
2125
|
const pkgName = process.env.npm_package_name;
|
|
2052
2126
|
const folders = [path8.join(pkg, "dist"), path8.join(pkg, "build"), path8.join(pkg, "docs")];
|
|
2053
|
-
console.log(
|
|
2127
|
+
console.log(chalk28.green(`Cleaning Outputs [${pkgName}]`));
|
|
2054
2128
|
for (let folder of folders) {
|
|
2055
2129
|
deleteGlob(folder);
|
|
2056
2130
|
}
|
|
@@ -2059,11 +2133,11 @@ var packageCleanOutputs = () => {
|
|
|
2059
2133
|
|
|
2060
2134
|
// src/actions/package/clean-typescript.ts
|
|
2061
2135
|
import path9 from "path";
|
|
2062
|
-
import
|
|
2136
|
+
import chalk29 from "chalk";
|
|
2063
2137
|
var packageCleanTypescript = () => {
|
|
2064
2138
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
2065
2139
|
const pkgName = process.env.npm_package_name;
|
|
2066
|
-
console.log(
|
|
2140
|
+
console.log(chalk29.green(`Cleaning Typescript [${pkgName}]`));
|
|
2067
2141
|
const files = [path9.join(pkg, "*.tsbuildinfo"), path9.join(pkg, ".tsconfig.*"), path9.join(pkg, ".eslintcache")];
|
|
2068
2142
|
for (let file of files) {
|
|
2069
2143
|
deleteGlob(file);
|
|
@@ -2077,32 +2151,35 @@ var packageClean = async () => {
|
|
|
2077
2151
|
};
|
|
2078
2152
|
|
|
2079
2153
|
// src/actions/package/compile/compile.ts
|
|
2080
|
-
import
|
|
2154
|
+
import chalk34 from "chalk";
|
|
2081
2155
|
|
|
2082
2156
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
2083
|
-
import
|
|
2157
|
+
import chalk33 from "chalk";
|
|
2084
2158
|
import { build as build2, defineConfig } from "tsup";
|
|
2085
2159
|
|
|
2086
2160
|
// src/actions/package/compile/inputs.ts
|
|
2087
|
-
import
|
|
2161
|
+
import chalk30 from "chalk";
|
|
2088
2162
|
import { glob as glob2 } from "glob";
|
|
2089
2163
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
2090
2164
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
2091
2165
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2092
2166
|
if (verbose) {
|
|
2093
|
-
console.log(
|
|
2167
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2094
2168
|
}
|
|
2095
2169
|
return result;
|
|
2096
2170
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
2097
2171
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
2098
2172
|
if (verbose) {
|
|
2099
|
-
console.log(
|
|
2173
|
+
console.log(chalk30.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
2100
2174
|
}
|
|
2101
2175
|
return result;
|
|
2102
2176
|
})];
|
|
2103
2177
|
};
|
|
2104
2178
|
|
|
2105
2179
|
// src/actions/package/compile/buildEntries.ts
|
|
2180
|
+
var isSpecOrStory = (entry) => {
|
|
2181
|
+
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");
|
|
2182
|
+
};
|
|
2106
2183
|
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
2107
2184
|
let entries = [];
|
|
2108
2185
|
switch (entryMode) {
|
|
@@ -2111,7 +2188,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
2111
2188
|
break;
|
|
2112
2189
|
}
|
|
2113
2190
|
case "all": {
|
|
2114
|
-
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !
|
|
2191
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !isSpecOrStory(entry)) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
2115
2192
|
break;
|
|
2116
2193
|
}
|
|
2117
2194
|
case "custom": {
|
|
@@ -2155,7 +2232,7 @@ function deepMergeObjects(objects) {
|
|
|
2155
2232
|
|
|
2156
2233
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
2157
2234
|
import { cwd as cwd2 } from "process";
|
|
2158
|
-
import
|
|
2235
|
+
import chalk31 from "chalk";
|
|
2159
2236
|
import { createProgramFromConfig } from "tsc-prog";
|
|
2160
2237
|
import ts3, {
|
|
2161
2238
|
DiagnosticCategory,
|
|
@@ -2177,7 +2254,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
2177
2254
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
2178
2255
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
2179
2256
|
if (verbose) {
|
|
2180
|
-
console.log(
|
|
2257
|
+
console.log(chalk31.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2181
2258
|
}
|
|
2182
2259
|
const configFilePath = ts3.findConfigFile(
|
|
2183
2260
|
"./",
|
|
@@ -2200,10 +2277,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2200
2277
|
emitDeclarationOnly: true,
|
|
2201
2278
|
noEmit: false
|
|
2202
2279
|
};
|
|
2203
|
-
console.log(
|
|
2280
|
+
console.log(chalk31.cyan(`Validating Files: ${entries.length}`));
|
|
2204
2281
|
if (verbose) {
|
|
2205
2282
|
for (const entry of entries) {
|
|
2206
|
-
console.log(
|
|
2283
|
+
console.log(chalk31.grey(`Validating: ${entry}`));
|
|
2207
2284
|
}
|
|
2208
2285
|
}
|
|
2209
2286
|
try {
|
|
@@ -2227,7 +2304,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2227
2304
|
);
|
|
2228
2305
|
console.error(formattedDiagnostics);
|
|
2229
2306
|
}
|
|
2230
|
-
const nonEmitPatterns = [".stories.", "/stories/", ".spec.", "/spec/", ".example."];
|
|
2307
|
+
const nonEmitPatterns = [".stories.", "/stories/", "/stories.", ".spec.", "/spec/", "/spec.", ".example."];
|
|
2231
2308
|
program.emit(void 0, (fileName, text, writeByteOrderMark) => {
|
|
2232
2309
|
if (nonEmitPatterns.some((pattern) => fileName.includes(pattern))) {
|
|
2233
2310
|
return;
|
|
@@ -2239,7 +2316,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2239
2316
|
return 0;
|
|
2240
2317
|
} finally {
|
|
2241
2318
|
if (verbose) {
|
|
2242
|
-
console.log(
|
|
2319
|
+
console.log(chalk31.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2243
2320
|
}
|
|
2244
2321
|
}
|
|
2245
2322
|
};
|
|
@@ -2247,7 +2324,7 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
2247
2324
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
2248
2325
|
import path10 from "path";
|
|
2249
2326
|
import { cwd as cwd3 } from "process";
|
|
2250
|
-
import
|
|
2327
|
+
import chalk32 from "chalk";
|
|
2251
2328
|
import { rollup } from "rollup";
|
|
2252
2329
|
import dts from "rollup-plugin-dts";
|
|
2253
2330
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -2272,8 +2349,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2272
2349
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
2273
2350
|
return;
|
|
2274
2351
|
}
|
|
2275
|
-
console.warn(
|
|
2276
|
-
console.warn(
|
|
2352
|
+
console.warn(chalk32.yellow(`[${warning.code}] ${warning.message}`));
|
|
2353
|
+
console.warn(chalk32.gray(inputPath));
|
|
2277
2354
|
warn(warning);
|
|
2278
2355
|
}
|
|
2279
2356
|
});
|
|
@@ -2283,8 +2360,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2283
2360
|
});
|
|
2284
2361
|
} catch (ex) {
|
|
2285
2362
|
const error = ex;
|
|
2286
|
-
console.warn(
|
|
2287
|
-
console.warn(
|
|
2363
|
+
console.warn(chalk32.red(error));
|
|
2364
|
+
console.warn(chalk32.gray(inputPath));
|
|
2288
2365
|
}
|
|
2289
2366
|
if (verbose) {
|
|
2290
2367
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -2292,7 +2369,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
2292
2369
|
}
|
|
2293
2370
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
2294
2371
|
if (verbose) {
|
|
2295
|
-
console.log(
|
|
2372
|
+
console.log(chalk32.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2296
2373
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
2297
2374
|
}
|
|
2298
2375
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -2316,7 +2393,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
2316
2393
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
2317
2394
|
}));
|
|
2318
2395
|
if (verbose) {
|
|
2319
|
-
console.log(
|
|
2396
|
+
console.log(chalk32.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
2320
2397
|
}
|
|
2321
2398
|
return 0;
|
|
2322
2399
|
};
|
|
@@ -2328,15 +2405,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2328
2405
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
2329
2406
|
}
|
|
2330
2407
|
if (entries.length === 0) {
|
|
2331
|
-
console.warn(
|
|
2408
|
+
console.warn(chalk33.yellow(`No entries found in ${srcDir} to compile`));
|
|
2332
2409
|
return 0;
|
|
2333
2410
|
}
|
|
2334
2411
|
if (verbose) {
|
|
2335
|
-
console.log(
|
|
2412
|
+
console.log(chalk33.gray(`buildDir [${buildDir}]`));
|
|
2336
2413
|
}
|
|
2337
2414
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
2338
2415
|
if (validationResult !== 0) {
|
|
2339
|
-
console.error(
|
|
2416
|
+
console.error(chalk33.red(`Compile:Validation had ${validationResult} errors`));
|
|
2340
2417
|
return validationResult;
|
|
2341
2418
|
}
|
|
2342
2419
|
const optionsParams = tsupOptions([{
|
|
@@ -2361,12 +2438,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
2361
2438
|
})
|
|
2362
2439
|
)).flat();
|
|
2363
2440
|
if (verbose) {
|
|
2364
|
-
console.log(
|
|
2365
|
-
console.log(
|
|
2441
|
+
console.log(chalk33.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2442
|
+
console.log(chalk33.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
2366
2443
|
}
|
|
2367
2444
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
2368
2445
|
if (verbose) {
|
|
2369
|
-
console.log(
|
|
2446
|
+
console.log(chalk33.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
2370
2447
|
}
|
|
2371
2448
|
if (bundleTypes) {
|
|
2372
2449
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -2477,14 +2554,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
2477
2554
|
// src/actions/package/compile/compile.ts
|
|
2478
2555
|
var packageCompile = async (inConfig = {}) => {
|
|
2479
2556
|
const pkg = process.env.INIT_CWD;
|
|
2480
|
-
console.log(
|
|
2557
|
+
console.log(chalk34.green(`Compiling ${pkg}`));
|
|
2481
2558
|
const config2 = await loadConfig(inConfig);
|
|
2482
2559
|
return await packageCompileTsup(config2);
|
|
2483
2560
|
};
|
|
2484
2561
|
|
|
2485
2562
|
// src/actions/package/copy-assets.ts
|
|
2486
2563
|
import path11 from "path/posix";
|
|
2487
|
-
import
|
|
2564
|
+
import chalk35 from "chalk";
|
|
2488
2565
|
import cpy2 from "cpy";
|
|
2489
2566
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
2490
2567
|
try {
|
|
@@ -2497,7 +2574,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
2497
2574
|
}
|
|
2498
2575
|
);
|
|
2499
2576
|
if (values.length > 0) {
|
|
2500
|
-
console.log(
|
|
2577
|
+
console.log(chalk35.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2501
2578
|
}
|
|
2502
2579
|
for (const value of values) {
|
|
2503
2580
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -2562,9 +2639,9 @@ var packageCycle = async () => {
|
|
|
2562
2639
|
};
|
|
2563
2640
|
|
|
2564
2641
|
// src/actions/package/gen-docs.ts
|
|
2565
|
-
import { existsSync as
|
|
2642
|
+
import { existsSync as existsSync8 } from "fs";
|
|
2566
2643
|
import path12 from "path";
|
|
2567
|
-
import
|
|
2644
|
+
import chalk36 from "chalk";
|
|
2568
2645
|
import {
|
|
2569
2646
|
Application,
|
|
2570
2647
|
ArgumentsReader,
|
|
@@ -2582,7 +2659,7 @@ var ExitCodes = {
|
|
|
2582
2659
|
};
|
|
2583
2660
|
var packageGenDocs = async () => {
|
|
2584
2661
|
const pkg = process.env.INIT_CWD;
|
|
2585
|
-
if (pkg !== void 0 && !
|
|
2662
|
+
if (pkg !== void 0 && !existsSync8(path12.join(pkg, "typedoc.json"))) {
|
|
2586
2663
|
return;
|
|
2587
2664
|
}
|
|
2588
2665
|
const app = await Application.bootstrap({
|
|
@@ -2668,7 +2745,7 @@ var runTypeDoc = async (app) => {
|
|
|
2668
2745
|
return ExitCodes.OutputError;
|
|
2669
2746
|
}
|
|
2670
2747
|
}
|
|
2671
|
-
console.log(
|
|
2748
|
+
console.log(chalk36.green(`${pkgName} - Ok`));
|
|
2672
2749
|
return ExitCodes.Ok;
|
|
2673
2750
|
};
|
|
2674
2751
|
|
|
@@ -2677,7 +2754,7 @@ import { readdirSync as readdirSync4 } from "fs";
|
|
|
2677
2754
|
import path13 from "path";
|
|
2678
2755
|
import { cwd as cwd4 } from "process";
|
|
2679
2756
|
import { pathToFileURL } from "url";
|
|
2680
|
-
import
|
|
2757
|
+
import chalk37 from "chalk";
|
|
2681
2758
|
import { ESLint } from "eslint";
|
|
2682
2759
|
import { findUp } from "find-up";
|
|
2683
2760
|
import picomatch from "picomatch";
|
|
@@ -2686,14 +2763,14 @@ var dumpMessages = (lintResults) => {
|
|
|
2686
2763
|
const severity = ["none", "warning", "error"];
|
|
2687
2764
|
for (const lintResult of lintResults) {
|
|
2688
2765
|
if (lintResult.messages.length > 0) {
|
|
2689
|
-
console.log(
|
|
2766
|
+
console.log(chalk37.gray(`
|
|
2690
2767
|
${lintResult.filePath}`));
|
|
2691
2768
|
for (const message of lintResult.messages) {
|
|
2692
2769
|
console.log(
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2770
|
+
chalk37.gray(` ${message.line}:${message.column}`),
|
|
2771
|
+
chalk37[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2772
|
+
chalk37.white(` ${message.message}`),
|
|
2773
|
+
chalk37.gray(` ${message.ruleId}`)
|
|
2697
2774
|
);
|
|
2698
2775
|
}
|
|
2699
2776
|
}
|
|
@@ -2731,10 +2808,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2731
2808
|
cache
|
|
2732
2809
|
});
|
|
2733
2810
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
2734
|
-
console.log(
|
|
2811
|
+
console.log(chalk37.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2735
2812
|
if (verbose) {
|
|
2736
2813
|
for (const file of files) {
|
|
2737
|
-
console.log(
|
|
2814
|
+
console.log(chalk37.gray(` ${file}`));
|
|
2738
2815
|
}
|
|
2739
2816
|
}
|
|
2740
2817
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -2745,32 +2822,32 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2745
2822
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2746
2823
|
const lintTime = Date.now() - start;
|
|
2747
2824
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2748
|
-
console.log(
|
|
2825
|
+
console.log(chalk37.white(`Linted ${chalk37[filesCountColor](files.length)} files in ${chalk37[lintTimeColor](lintTime)}ms`));
|
|
2749
2826
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2750
2827
|
};
|
|
2751
2828
|
|
|
2752
2829
|
// src/actions/package/publint.ts
|
|
2753
2830
|
import { promises as fs10 } from "fs";
|
|
2754
|
-
import
|
|
2831
|
+
import chalk38 from "chalk";
|
|
2755
2832
|
import sortPackageJson from "sort-package-json";
|
|
2756
2833
|
var customPubLint = (pkg) => {
|
|
2757
2834
|
let errorCount = 0;
|
|
2758
2835
|
let warningCount = 0;
|
|
2759
2836
|
if (pkg.files === void 0) {
|
|
2760
|
-
console.warn(
|
|
2837
|
+
console.warn(chalk38.yellow('Publint [custom]: "files" field is missing'));
|
|
2761
2838
|
warningCount++;
|
|
2762
2839
|
}
|
|
2763
2840
|
if (pkg.main !== void 0) {
|
|
2764
|
-
console.warn(
|
|
2841
|
+
console.warn(chalk38.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2765
2842
|
warningCount++;
|
|
2766
2843
|
}
|
|
2767
2844
|
if (pkg.sideEffects !== false) {
|
|
2768
|
-
console.warn(
|
|
2845
|
+
console.warn(chalk38.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2769
2846
|
warningCount++;
|
|
2770
2847
|
}
|
|
2771
2848
|
if (pkg.resolutions !== void 0) {
|
|
2772
|
-
console.warn(
|
|
2773
|
-
console.warn(
|
|
2849
|
+
console.warn(chalk38.yellow('Publint [custom]: "resolutions" in use'));
|
|
2850
|
+
console.warn(chalk38.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2774
2851
|
warningCount++;
|
|
2775
2852
|
}
|
|
2776
2853
|
return [errorCount, warningCount];
|
|
@@ -2780,8 +2857,8 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2780
2857
|
const sortedPkg = sortPackageJson(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2781
2858
|
await fs10.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2782
2859
|
const pkg = JSON.parse(await fs10.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2783
|
-
console.log(
|
|
2784
|
-
console.log(
|
|
2860
|
+
console.log(chalk38.green(`Publint: ${pkg.name}`));
|
|
2861
|
+
console.log(chalk38.gray(pkgDir));
|
|
2785
2862
|
const { publint: publint2 } = await import("publint");
|
|
2786
2863
|
const { messages } = await publint2({
|
|
2787
2864
|
level: "suggestion",
|
|
@@ -2792,22 +2869,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2792
2869
|
for (const message of messages) {
|
|
2793
2870
|
switch (message.type) {
|
|
2794
2871
|
case "error": {
|
|
2795
|
-
console.error(
|
|
2872
|
+
console.error(chalk38.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2796
2873
|
break;
|
|
2797
2874
|
}
|
|
2798
2875
|
case "warning": {
|
|
2799
|
-
console.warn(
|
|
2876
|
+
console.warn(chalk38.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2800
2877
|
break;
|
|
2801
2878
|
}
|
|
2802
2879
|
default: {
|
|
2803
|
-
console.log(
|
|
2880
|
+
console.log(chalk38.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2804
2881
|
break;
|
|
2805
2882
|
}
|
|
2806
2883
|
}
|
|
2807
2884
|
}
|
|
2808
2885
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2809
2886
|
if (verbose) {
|
|
2810
|
-
console.log(
|
|
2887
|
+
console.log(chalk38.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2811
2888
|
}
|
|
2812
2889
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2813
2890
|
};
|
|
@@ -2858,7 +2935,7 @@ var rebuild = ({ target }) => {
|
|
|
2858
2935
|
};
|
|
2859
2936
|
|
|
2860
2937
|
// src/actions/recompile.ts
|
|
2861
|
-
import
|
|
2938
|
+
import chalk39 from "chalk";
|
|
2862
2939
|
var recompile = async ({
|
|
2863
2940
|
verbose,
|
|
2864
2941
|
target,
|
|
@@ -2894,7 +2971,7 @@ var recompileAll = async ({
|
|
|
2894
2971
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2895
2972
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2896
2973
|
if (jobs) {
|
|
2897
|
-
console.log(
|
|
2974
|
+
console.log(chalk39.blue(`Jobs set to [${jobs}]`));
|
|
2898
2975
|
}
|
|
2899
2976
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2900
2977
|
[
|
|
@@ -2925,7 +3002,7 @@ var recompileAll = async ({
|
|
|
2925
3002
|
]
|
|
2926
3003
|
]);
|
|
2927
3004
|
console.log(
|
|
2928
|
-
`${
|
|
3005
|
+
`${chalk39.gray("Recompiled in")} [${chalk39.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk39.gray("seconds")}`
|
|
2929
3006
|
);
|
|
2930
3007
|
return result;
|
|
2931
3008
|
};
|
|
@@ -2956,13 +3033,13 @@ var reinstall = () => {
|
|
|
2956
3033
|
};
|
|
2957
3034
|
|
|
2958
3035
|
// src/actions/relint.ts
|
|
2959
|
-
import
|
|
3036
|
+
import chalk40 from "chalk";
|
|
2960
3037
|
var relintPackage = ({
|
|
2961
3038
|
pkg,
|
|
2962
3039
|
fix: fix2,
|
|
2963
3040
|
verbose
|
|
2964
3041
|
}) => {
|
|
2965
|
-
console.log(
|
|
3042
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2966
3043
|
const start = Date.now();
|
|
2967
3044
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2968
3045
|
["yarn", [
|
|
@@ -2972,7 +3049,7 @@ var relintPackage = ({
|
|
|
2972
3049
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2973
3050
|
]]
|
|
2974
3051
|
]);
|
|
2975
|
-
console.log(
|
|
3052
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
2976
3053
|
return result;
|
|
2977
3054
|
};
|
|
2978
3055
|
var relint = ({
|
|
@@ -2992,13 +3069,13 @@ var relint = ({
|
|
|
2992
3069
|
});
|
|
2993
3070
|
};
|
|
2994
3071
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2995
|
-
console.log(
|
|
3072
|
+
console.log(chalk40.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2996
3073
|
const start = Date.now();
|
|
2997
3074
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2998
3075
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2999
3076
|
["yarn", ["eslint", ...fixOptions]]
|
|
3000
3077
|
]);
|
|
3001
|
-
console.log(
|
|
3078
|
+
console.log(chalk40.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk40.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk40.gray("seconds")}`));
|
|
3002
3079
|
return result;
|
|
3003
3080
|
};
|
|
3004
3081
|
|
|
@@ -3016,10 +3093,10 @@ var sonar = () => {
|
|
|
3016
3093
|
};
|
|
3017
3094
|
|
|
3018
3095
|
// src/actions/statics.ts
|
|
3019
|
-
import
|
|
3096
|
+
import chalk41 from "chalk";
|
|
3020
3097
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
3021
3098
|
var statics = () => {
|
|
3022
|
-
console.log(
|
|
3099
|
+
console.log(chalk41.green("Check Required Static Dependencies"));
|
|
3023
3100
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
3024
3101
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
3025
3102
|
};
|
|
@@ -3076,7 +3153,7 @@ var loadPackageConfig = async () => {
|
|
|
3076
3153
|
};
|
|
3077
3154
|
|
|
3078
3155
|
// src/xy/xy.ts
|
|
3079
|
-
import
|
|
3156
|
+
import chalk43 from "chalk";
|
|
3080
3157
|
|
|
3081
3158
|
// src/xy/xyBuildCommands.ts
|
|
3082
3159
|
var xyBuildCommands = (args) => {
|
|
@@ -3191,6 +3268,14 @@ var xyCommonCommands = (args) => {
|
|
|
3191
3268
|
if (argv.verbose) console.log("Claude Commands");
|
|
3192
3269
|
process.exitCode = claudeCommands();
|
|
3193
3270
|
}
|
|
3271
|
+
).command(
|
|
3272
|
+
"claude-settings",
|
|
3273
|
+
"Claude Settings - Initialize .claude/settings.local.json with XY Labs defaults",
|
|
3274
|
+
(yargs2) => yargs2,
|
|
3275
|
+
async (argv) => {
|
|
3276
|
+
if (argv.verbose) console.log("Claude Settings");
|
|
3277
|
+
process.exitCode = await claudeSettings();
|
|
3278
|
+
}
|
|
3194
3279
|
).command(
|
|
3195
3280
|
"claude-rules",
|
|
3196
3281
|
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
@@ -3476,7 +3561,7 @@ var xyInstallCommands = (args) => {
|
|
|
3476
3561
|
};
|
|
3477
3562
|
|
|
3478
3563
|
// src/xy/xyLintCommands.ts
|
|
3479
|
-
import
|
|
3564
|
+
import chalk42 from "chalk";
|
|
3480
3565
|
var xyLintCommands = (args) => {
|
|
3481
3566
|
return args.command(
|
|
3482
3567
|
"cycle [package]",
|
|
@@ -3488,7 +3573,7 @@ var xyLintCommands = (args) => {
|
|
|
3488
3573
|
const start = Date.now();
|
|
3489
3574
|
if (argv.verbose) console.log("Cycle");
|
|
3490
3575
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3491
|
-
console.log(
|
|
3576
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3492
3577
|
}
|
|
3493
3578
|
).command(
|
|
3494
3579
|
"lint [package]",
|
|
@@ -3518,7 +3603,7 @@ var xyLintCommands = (args) => {
|
|
|
3518
3603
|
cache: argv.cache,
|
|
3519
3604
|
verbose: !!argv.verbose
|
|
3520
3605
|
});
|
|
3521
|
-
console.log(
|
|
3606
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3522
3607
|
}
|
|
3523
3608
|
).command(
|
|
3524
3609
|
"deplint [package]",
|
|
@@ -3557,7 +3642,7 @@ var xyLintCommands = (args) => {
|
|
|
3557
3642
|
peerDeps: !!argv.peerDeps,
|
|
3558
3643
|
verbose: !!argv.verbose
|
|
3559
3644
|
});
|
|
3560
|
-
console.log(
|
|
3645
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3561
3646
|
}
|
|
3562
3647
|
).command(
|
|
3563
3648
|
"fix [package]",
|
|
@@ -3569,7 +3654,7 @@ var xyLintCommands = (args) => {
|
|
|
3569
3654
|
const start = Date.now();
|
|
3570
3655
|
if (argv.verbose) console.log("Fix");
|
|
3571
3656
|
process.exitCode = fix();
|
|
3572
|
-
console.log(
|
|
3657
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3573
3658
|
}
|
|
3574
3659
|
).command(
|
|
3575
3660
|
"relint [package]",
|
|
@@ -3581,7 +3666,7 @@ var xyLintCommands = (args) => {
|
|
|
3581
3666
|
if (argv.verbose) console.log("Relinting");
|
|
3582
3667
|
const start = Date.now();
|
|
3583
3668
|
process.exitCode = relint();
|
|
3584
|
-
console.log(
|
|
3669
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3585
3670
|
}
|
|
3586
3671
|
).command(
|
|
3587
3672
|
"publint [package]",
|
|
@@ -3593,7 +3678,7 @@ var xyLintCommands = (args) => {
|
|
|
3593
3678
|
if (argv.verbose) console.log("Publint");
|
|
3594
3679
|
const start = Date.now();
|
|
3595
3680
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3596
|
-
console.log(
|
|
3681
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3597
3682
|
}
|
|
3598
3683
|
).command(
|
|
3599
3684
|
"knip",
|
|
@@ -3605,7 +3690,7 @@ var xyLintCommands = (args) => {
|
|
|
3605
3690
|
if (argv.verbose) console.log("Knip");
|
|
3606
3691
|
const start = Date.now();
|
|
3607
3692
|
process.exitCode = knip();
|
|
3608
|
-
console.log(
|
|
3693
|
+
console.log(chalk42.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3609
3694
|
}
|
|
3610
3695
|
).command(
|
|
3611
3696
|
"sonar",
|
|
@@ -3617,7 +3702,7 @@ var xyLintCommands = (args) => {
|
|
|
3617
3702
|
const start = Date.now();
|
|
3618
3703
|
if (argv.verbose) console.log("Sonar Check");
|
|
3619
3704
|
process.exitCode = sonar();
|
|
3620
|
-
console.log(
|
|
3705
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3621
3706
|
}
|
|
3622
3707
|
);
|
|
3623
3708
|
};
|
|
@@ -3653,8 +3738,8 @@ var xyParseOptions = () => {
|
|
|
3653
3738
|
var xy = async () => {
|
|
3654
3739
|
const options = xyParseOptions();
|
|
3655
3740
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3656
|
-
console.error(
|
|
3657
|
-
console.log(
|
|
3741
|
+
console.error(chalk43.yellow(`Command not found [${chalk43.magenta(process.argv[2])}]`));
|
|
3742
|
+
console.log(chalk43.gray("Try 'yarn xy --help' for list of commands"));
|
|
3658
3743
|
}).version().help().argv;
|
|
3659
3744
|
};
|
|
3660
3745
|
export {
|
|
@@ -3672,6 +3757,7 @@ export {
|
|
|
3672
3757
|
claudeMdProjectTemplate,
|
|
3673
3758
|
claudeMdRuleTemplates,
|
|
3674
3759
|
claudeRules,
|
|
3760
|
+
claudeSettings,
|
|
3675
3761
|
clean,
|
|
3676
3762
|
cleanAll,
|
|
3677
3763
|
cleanDocs,
|