@xylabs/ts-scripts-yarn3 7.4.27 → 7.4.28
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/index.mjs +311 -83
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lintlint.mjs +230 -0
- package/dist/actions/lintlint.mjs.map +1 -0
- package/dist/bin/xy.mjs +295 -48
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +351 -103
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +295 -48
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/lint/index.mjs +285 -38
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/lint/lintlintCommand.mjs +250 -0
- package/dist/xy/lint/lintlintCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +295 -48
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
package/dist/bin/xy.mjs
CHANGED
|
@@ -2448,14 +2448,241 @@ var license = async (pkg) => {
|
|
|
2448
2448
|
)).reduce((prev, value) => prev || value, 0);
|
|
2449
2449
|
};
|
|
2450
2450
|
|
|
2451
|
+
// src/actions/lintlint.ts
|
|
2452
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
|
|
2453
|
+
import PATH10 from "path";
|
|
2454
|
+
import chalk31 from "chalk";
|
|
2455
|
+
import { findUp } from "find-up";
|
|
2456
|
+
function parseRuleValue(value) {
|
|
2457
|
+
if (typeof value === "string") {
|
|
2458
|
+
return { level: value };
|
|
2459
|
+
}
|
|
2460
|
+
if (typeof value === "number") {
|
|
2461
|
+
return { level: String(value) };
|
|
2462
|
+
}
|
|
2463
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
2464
|
+
return {
|
|
2465
|
+
level: String(value[0]),
|
|
2466
|
+
options: value.length > 1 ? value.slice(1) : void 0
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
return void 0;
|
|
2470
|
+
}
|
|
2471
|
+
function normalizeLevel(level) {
|
|
2472
|
+
if (level === "0" || level === "off") return "off";
|
|
2473
|
+
if (level === "1" || level === "warn") return "warn";
|
|
2474
|
+
if (level === "2" || level === "error") return "error";
|
|
2475
|
+
return level;
|
|
2476
|
+
}
|
|
2477
|
+
function rulesMatch(a, b) {
|
|
2478
|
+
if (normalizeLevel(a.level) !== normalizeLevel(b.level)) return false;
|
|
2479
|
+
return JSON.stringify(a.options) === JSON.stringify(b.options);
|
|
2480
|
+
}
|
|
2481
|
+
function formatRule(entry) {
|
|
2482
|
+
if (entry.options) {
|
|
2483
|
+
return JSON.stringify([entry.level, ...entry.options]);
|
|
2484
|
+
}
|
|
2485
|
+
return JSON.stringify([entry.level]);
|
|
2486
|
+
}
|
|
2487
|
+
function mergeRulesFromBlocks(blocks) {
|
|
2488
|
+
const merged = /* @__PURE__ */ new Map();
|
|
2489
|
+
for (const block of blocks) {
|
|
2490
|
+
if (!block.rules) continue;
|
|
2491
|
+
for (const [name, value] of Object.entries(block.rules)) {
|
|
2492
|
+
const parsed = parseRuleValue(value);
|
|
2493
|
+
if (parsed) merged.set(name, parsed);
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
return merged;
|
|
2497
|
+
}
|
|
2498
|
+
function detectSharedPackage(source) {
|
|
2499
|
+
if (source.includes("@xylabs/eslint-config-react-flat")) return "@xylabs/eslint-config-react-flat";
|
|
2500
|
+
if (source.includes("@xylabs/eslint-config-flat")) return "@xylabs/eslint-config-flat";
|
|
2501
|
+
return void 0;
|
|
2502
|
+
}
|
|
2503
|
+
function extractLocalRuleBlocks(source) {
|
|
2504
|
+
const blocks = [];
|
|
2505
|
+
const ruleBlockRegex = /\{\s*(?:files\s*:\s*\[.*?\]\s*,\s*)?rules\s*:\s*\{([^}]*(?:\{[^}]*\}[^}]*)*)\}/g;
|
|
2506
|
+
let match;
|
|
2507
|
+
while ((match = ruleBlockRegex.exec(source)) !== null) {
|
|
2508
|
+
blocks.push(match[1]);
|
|
2509
|
+
}
|
|
2510
|
+
return blocks;
|
|
2511
|
+
}
|
|
2512
|
+
function extractRulesFromSourceBlocks(blocks) {
|
|
2513
|
+
const rules2 = /* @__PURE__ */ new Map();
|
|
2514
|
+
for (const block of blocks) {
|
|
2515
|
+
const ruleRegex = /['"]([^'"]+)['"]\s*:\s*(\[[\s\S]*?\](?=\s*,|\s*$))/gm;
|
|
2516
|
+
let match;
|
|
2517
|
+
while ((match = ruleRegex.exec(block)) !== null) {
|
|
2518
|
+
rules2.set(match[1], match[2]);
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
return rules2;
|
|
2522
|
+
}
|
|
2523
|
+
async function resolveSharedConfig(configDir, sharedPkg) {
|
|
2524
|
+
try {
|
|
2525
|
+
const sharedModule = await import(sharedPkg);
|
|
2526
|
+
const config2 = sharedModule.config ?? sharedModule.default;
|
|
2527
|
+
if (Array.isArray(config2)) return config2;
|
|
2528
|
+
return [];
|
|
2529
|
+
} catch {
|
|
2530
|
+
const distPath = PATH10.resolve(configDir, "node_modules", sharedPkg, "dist", "node", "index.mjs");
|
|
2531
|
+
try {
|
|
2532
|
+
const sharedModule = await import(distPath);
|
|
2533
|
+
const config2 = sharedModule.config ?? sharedModule.default;
|
|
2534
|
+
if (Array.isArray(config2)) return config2;
|
|
2535
|
+
} catch {
|
|
2536
|
+
const neutralPath = PATH10.resolve(configDir, "node_modules", sharedPkg, "dist", "neutral", "index.mjs");
|
|
2537
|
+
const sharedModule = await import(neutralPath);
|
|
2538
|
+
const config2 = sharedModule.config ?? sharedModule.default;
|
|
2539
|
+
if (Array.isArray(config2)) return config2;
|
|
2540
|
+
}
|
|
2541
|
+
return [];
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
async function loadSharedRules(configDir, sharedPkg, verbose) {
|
|
2545
|
+
const sharedBlocks = await resolveSharedConfig(configDir, sharedPkg);
|
|
2546
|
+
const sharedRules = mergeRulesFromBlocks(sharedBlocks);
|
|
2547
|
+
if (verbose) {
|
|
2548
|
+
console.log(chalk31.gray(`Shared config defines ${sharedRules.size} rules`));
|
|
2549
|
+
}
|
|
2550
|
+
if (sharedRules.size === 0) {
|
|
2551
|
+
console.error(chalk31.red("Could not load rules from shared config. Is it installed and built?"));
|
|
2552
|
+
return void 0;
|
|
2553
|
+
}
|
|
2554
|
+
return sharedRules;
|
|
2555
|
+
}
|
|
2556
|
+
async function loadLocalRules(eslintConfigPath, source, verbose) {
|
|
2557
|
+
const localModule = await import(eslintConfigPath);
|
|
2558
|
+
const localConfig = localModule.default ?? localModule;
|
|
2559
|
+
const localBlocks = Array.isArray(localConfig) ? localConfig : [localConfig];
|
|
2560
|
+
const resolved = mergeRulesFromBlocks(localBlocks);
|
|
2561
|
+
const localRuleBlocks = extractLocalRuleBlocks(source);
|
|
2562
|
+
const explicit = extractRulesFromSourceBlocks(localRuleBlocks);
|
|
2563
|
+
if (verbose) {
|
|
2564
|
+
console.log(chalk31.gray(`Local config has ${explicit.size} explicit rule setting(s)`));
|
|
2565
|
+
}
|
|
2566
|
+
return { explicit, resolved };
|
|
2567
|
+
}
|
|
2568
|
+
function compareRules(explicitRuleNames, allResolvedRules, sharedRules) {
|
|
2569
|
+
const redundant = [];
|
|
2570
|
+
const overrides = [];
|
|
2571
|
+
const additions = [];
|
|
2572
|
+
for (const ruleName of explicitRuleNames.keys()) {
|
|
2573
|
+
const resolvedEntry = allResolvedRules.get(ruleName);
|
|
2574
|
+
const sharedEntry = sharedRules.get(ruleName);
|
|
2575
|
+
if (!resolvedEntry) continue;
|
|
2576
|
+
if (!sharedEntry) {
|
|
2577
|
+
additions.push({ local: resolvedEntry, rule: ruleName });
|
|
2578
|
+
} else if (rulesMatch(resolvedEntry, sharedEntry)) {
|
|
2579
|
+
redundant.push({
|
|
2580
|
+
local: resolvedEntry,
|
|
2581
|
+
rule: ruleName,
|
|
2582
|
+
shared: sharedEntry
|
|
2583
|
+
});
|
|
2584
|
+
} else {
|
|
2585
|
+
overrides.push({
|
|
2586
|
+
local: resolvedEntry,
|
|
2587
|
+
rule: ruleName,
|
|
2588
|
+
shared: sharedEntry
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
return {
|
|
2593
|
+
additions,
|
|
2594
|
+
overrides,
|
|
2595
|
+
redundant
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2598
|
+
function reportResults({
|
|
2599
|
+
additions,
|
|
2600
|
+
overrides,
|
|
2601
|
+
redundant
|
|
2602
|
+
}, verbose) {
|
|
2603
|
+
if (redundant.length > 0) {
|
|
2604
|
+
console.log(chalk31.yellow(`
|
|
2605
|
+
${redundant.length} redundant rule(s) (same as shared config \u2014 can be removed):`));
|
|
2606
|
+
for (const { rule, local } of redundant) {
|
|
2607
|
+
console.log(chalk31.yellow(` ${rule}: ${formatRule(local)}`));
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
if (overrides.length > 0) {
|
|
2611
|
+
console.log(chalk31.cyan(`
|
|
2612
|
+
${overrides.length} rule override(s) (different from shared config):`));
|
|
2613
|
+
for (const {
|
|
2614
|
+
rule,
|
|
2615
|
+
local,
|
|
2616
|
+
shared
|
|
2617
|
+
} of overrides) {
|
|
2618
|
+
console.log(chalk31.cyan(` ${rule}:`));
|
|
2619
|
+
console.log(chalk31.gray(` shared: ${formatRule(shared)}`));
|
|
2620
|
+
console.log(chalk31.white(` local: ${formatRule(local)}`));
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
if (additions.length > 0 && verbose) {
|
|
2624
|
+
console.log(chalk31.gray(`
|
|
2625
|
+
${additions.length} local addition(s) (not in shared config):`));
|
|
2626
|
+
for (const { rule, local } of additions) {
|
|
2627
|
+
console.log(chalk31.gray(` ${rule}: ${formatRule(local)}`));
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
if (redundant.length === 0 && overrides.length === 0) {
|
|
2631
|
+
console.log(chalk31.green("No redundant or overridden rules found"));
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
function fixRedundantRules(eslintConfigPath, source, redundant) {
|
|
2635
|
+
let updated = source;
|
|
2636
|
+
for (const { rule } of redundant) {
|
|
2637
|
+
const escaped = rule.replaceAll("/", String.raw`\/`);
|
|
2638
|
+
const pattern = new RegExp(String.raw`[ \t]*['"]${escaped}['"]\s*:\s*\[[^\]]*\],?[ \t]*\n?`, "g");
|
|
2639
|
+
updated = updated.replace(pattern, "");
|
|
2640
|
+
}
|
|
2641
|
+
updated = updated.replaceAll(/\n{3,}/g, "\n\n");
|
|
2642
|
+
if (updated !== source) {
|
|
2643
|
+
writeFileSync6(eslintConfigPath, updated, "utf8");
|
|
2644
|
+
console.log(chalk31.green(`
|
|
2645
|
+
Fixed: removed ${redundant.length} redundant rule(s)`));
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
async function lintlint({ fix: fix2, verbose } = {}) {
|
|
2649
|
+
const eslintConfigPath = await findUp("eslint.config.mjs");
|
|
2650
|
+
if (!eslintConfigPath) {
|
|
2651
|
+
console.error(chalk31.red("No eslint.config.mjs found"));
|
|
2652
|
+
return 1;
|
|
2653
|
+
}
|
|
2654
|
+
const configDir = PATH10.dirname(eslintConfigPath);
|
|
2655
|
+
if (verbose) {
|
|
2656
|
+
console.log(chalk31.gray(`Found config: ${eslintConfigPath}`));
|
|
2657
|
+
}
|
|
2658
|
+
const source = readFileSync14(eslintConfigPath, "utf8");
|
|
2659
|
+
const sharedPkg = detectSharedPackage(source);
|
|
2660
|
+
if (!sharedPkg) {
|
|
2661
|
+
console.log(chalk31.yellow("No @xylabs/eslint-config-flat or @xylabs/eslint-config-react-flat imports found"));
|
|
2662
|
+
return 0;
|
|
2663
|
+
}
|
|
2664
|
+
if (verbose) {
|
|
2665
|
+
console.log(chalk31.gray(`Shared package: ${sharedPkg}`));
|
|
2666
|
+
}
|
|
2667
|
+
const sharedRules = await loadSharedRules(configDir, sharedPkg, !!verbose);
|
|
2668
|
+
if (!sharedRules) return 1;
|
|
2669
|
+
const { explicit, resolved } = await loadLocalRules(eslintConfigPath, source, !!verbose);
|
|
2670
|
+
const results = compareRules(explicit, resolved, sharedRules);
|
|
2671
|
+
reportResults(results, !!verbose);
|
|
2672
|
+
if (results.redundant.length > 0 && fix2) {
|
|
2673
|
+
fixRedundantRules(eslintConfigPath, source, results.redundant);
|
|
2674
|
+
}
|
|
2675
|
+
return results.redundant.length > 0 && !fix2 ? 1 : 0;
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2451
2678
|
// src/actions/npmignore-gen.ts
|
|
2452
2679
|
var filename = ".npmignore";
|
|
2453
2680
|
var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
2454
2681
|
|
|
2455
2682
|
// src/actions/package-lint.ts
|
|
2456
|
-
import { readFileSync as
|
|
2457
|
-
import
|
|
2458
|
-
import
|
|
2683
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
|
|
2684
|
+
import PATH11 from "path";
|
|
2685
|
+
import chalk32 from "chalk";
|
|
2459
2686
|
import picomatch from "picomatch";
|
|
2460
2687
|
function emptyResult() {
|
|
2461
2688
|
return {
|
|
@@ -2465,12 +2692,12 @@ function emptyResult() {
|
|
|
2465
2692
|
};
|
|
2466
2693
|
}
|
|
2467
2694
|
function readRootPackageJson(cwd) {
|
|
2468
|
-
const raw =
|
|
2695
|
+
const raw = readFileSync15(PATH11.resolve(cwd, "package.json"), "utf8");
|
|
2469
2696
|
return JSON.parse(raw);
|
|
2470
2697
|
}
|
|
2471
2698
|
function writeRootPackageJson(cwd, pkg) {
|
|
2472
|
-
const path8 =
|
|
2473
|
-
|
|
2699
|
+
const path8 = PATH11.resolve(cwd, "package.json");
|
|
2700
|
+
writeFileSync7(path8, `${JSON.stringify(pkg, null, 2)}
|
|
2474
2701
|
`, "utf8");
|
|
2475
2702
|
}
|
|
2476
2703
|
function isMonorepo(pkg) {
|
|
@@ -2497,7 +2724,7 @@ function checkRootPrivate(pkg) {
|
|
|
2497
2724
|
function fixRootPrivate(cwd, pkg) {
|
|
2498
2725
|
pkg.private = true;
|
|
2499
2726
|
writeRootPackageJson(cwd, pkg);
|
|
2500
|
-
console.log(
|
|
2727
|
+
console.log(chalk32.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
2501
2728
|
}
|
|
2502
2729
|
function checkNoPublishConfigOnPrivate(pkg) {
|
|
2503
2730
|
const result = emptyResult();
|
|
@@ -2509,7 +2736,7 @@ function checkNoPublishConfigOnPrivate(pkg) {
|
|
|
2509
2736
|
function fixNoPublishConfigOnPrivate(cwd, pkg) {
|
|
2510
2737
|
delete pkg.publishConfig;
|
|
2511
2738
|
writeRootPackageJson(cwd, pkg);
|
|
2512
|
-
console.log(
|
|
2739
|
+
console.log(chalk32.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
2513
2740
|
}
|
|
2514
2741
|
function checkDiscoverable(pkg, workspaces) {
|
|
2515
2742
|
const result = emptyResult();
|
|
@@ -2528,22 +2755,22 @@ function logResults(label, result, fix2) {
|
|
|
2528
2755
|
let errors = 0;
|
|
2529
2756
|
let fixed = 0;
|
|
2530
2757
|
for (const error of result.errors) {
|
|
2531
|
-
console.log(
|
|
2758
|
+
console.log(chalk32.red(` \u2717 ${error}`));
|
|
2532
2759
|
errors++;
|
|
2533
2760
|
}
|
|
2534
2761
|
for (const fixable of result.fixable) {
|
|
2535
2762
|
if (fix2) {
|
|
2536
2763
|
fixed++;
|
|
2537
2764
|
} else {
|
|
2538
|
-
console.log(
|
|
2765
|
+
console.log(chalk32.red(` \u2717 ${fixable} (fixable)`));
|
|
2539
2766
|
errors++;
|
|
2540
2767
|
}
|
|
2541
2768
|
}
|
|
2542
2769
|
for (const warning of result.warnings) {
|
|
2543
|
-
console.log(
|
|
2770
|
+
console.log(chalk32.yellow(` \u26A0 ${warning}`));
|
|
2544
2771
|
}
|
|
2545
2772
|
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
2546
|
-
console.log(
|
|
2773
|
+
console.log(chalk32.green(` \u2713 ${label}`));
|
|
2547
2774
|
}
|
|
2548
2775
|
return { errors, fixed };
|
|
2549
2776
|
}
|
|
@@ -2563,14 +2790,14 @@ function runChecks(entries, cwd, pkg, fix2) {
|
|
|
2563
2790
|
}
|
|
2564
2791
|
function logSummary(errors, fixed) {
|
|
2565
2792
|
if (fixed > 0) {
|
|
2566
|
-
console.log(
|
|
2793
|
+
console.log(chalk32.green(`
|
|
2567
2794
|
Fixed ${fixed} issue(s)`));
|
|
2568
2795
|
}
|
|
2569
2796
|
if (errors > 0) {
|
|
2570
|
-
console.log(
|
|
2797
|
+
console.log(chalk32.red(`
|
|
2571
2798
|
${errors} error(s) found`));
|
|
2572
2799
|
} else if (fixed === 0) {
|
|
2573
|
-
console.log(
|
|
2800
|
+
console.log(chalk32.green("\n All checks passed"));
|
|
2574
2801
|
}
|
|
2575
2802
|
}
|
|
2576
2803
|
function packageLintMonorepo(fix2 = false) {
|
|
@@ -2579,14 +2806,14 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
2579
2806
|
try {
|
|
2580
2807
|
pkg = readRootPackageJson(cwd);
|
|
2581
2808
|
} catch {
|
|
2582
|
-
console.error(
|
|
2809
|
+
console.error(chalk32.red("Could not read package.json"));
|
|
2583
2810
|
return 1;
|
|
2584
2811
|
}
|
|
2585
2812
|
if (!isMonorepo(pkg)) {
|
|
2586
|
-
console.log(
|
|
2813
|
+
console.log(chalk32.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
2587
2814
|
return 0;
|
|
2588
2815
|
}
|
|
2589
|
-
console.log(
|
|
2816
|
+
console.log(chalk32.green("Package Lint"));
|
|
2590
2817
|
const workspaces = yarnWorkspaces();
|
|
2591
2818
|
const checks = [
|
|
2592
2819
|
{
|
|
@@ -2660,7 +2887,7 @@ var rebuild = ({ target }) => {
|
|
|
2660
2887
|
};
|
|
2661
2888
|
|
|
2662
2889
|
// src/actions/recompile.ts
|
|
2663
|
-
import
|
|
2890
|
+
import chalk33 from "chalk";
|
|
2664
2891
|
var recompile = async ({
|
|
2665
2892
|
verbose,
|
|
2666
2893
|
target,
|
|
@@ -2696,7 +2923,7 @@ var recompileAll = async ({
|
|
|
2696
2923
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2697
2924
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2698
2925
|
if (jobs) {
|
|
2699
|
-
console.log(
|
|
2926
|
+
console.log(chalk33.blue(`Jobs set to [${jobs}]`));
|
|
2700
2927
|
}
|
|
2701
2928
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2702
2929
|
[
|
|
@@ -2727,7 +2954,7 @@ var recompileAll = async ({
|
|
|
2727
2954
|
]
|
|
2728
2955
|
]);
|
|
2729
2956
|
console.log(
|
|
2730
|
-
`${
|
|
2957
|
+
`${chalk33.gray("Recompiled in")} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`
|
|
2731
2958
|
);
|
|
2732
2959
|
return result;
|
|
2733
2960
|
};
|
|
@@ -2758,13 +2985,13 @@ var reinstall = () => {
|
|
|
2758
2985
|
};
|
|
2759
2986
|
|
|
2760
2987
|
// src/actions/relint.ts
|
|
2761
|
-
import
|
|
2988
|
+
import chalk34 from "chalk";
|
|
2762
2989
|
var relintPackage = ({
|
|
2763
2990
|
pkg,
|
|
2764
2991
|
fix: fix2,
|
|
2765
2992
|
verbose
|
|
2766
2993
|
}) => {
|
|
2767
|
-
console.log(
|
|
2994
|
+
console.log(chalk34.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2768
2995
|
const start = Date.now();
|
|
2769
2996
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2770
2997
|
["yarn", [
|
|
@@ -2774,7 +3001,7 @@ var relintPackage = ({
|
|
|
2774
3001
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2775
3002
|
]]
|
|
2776
3003
|
]);
|
|
2777
|
-
console.log(
|
|
3004
|
+
console.log(chalk34.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2778
3005
|
return result;
|
|
2779
3006
|
};
|
|
2780
3007
|
var relint = ({
|
|
@@ -2794,13 +3021,13 @@ var relint = ({
|
|
|
2794
3021
|
});
|
|
2795
3022
|
};
|
|
2796
3023
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2797
|
-
console.log(
|
|
3024
|
+
console.log(chalk34.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2798
3025
|
const start = Date.now();
|
|
2799
3026
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2800
3027
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2801
3028
|
["yarn", ["eslint", ...fixOptions]]
|
|
2802
3029
|
]);
|
|
2803
|
-
console.log(
|
|
3030
|
+
console.log(chalk34.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2804
3031
|
return result;
|
|
2805
3032
|
};
|
|
2806
3033
|
|
|
@@ -2828,10 +3055,10 @@ var sonar = () => {
|
|
|
2828
3055
|
};
|
|
2829
3056
|
|
|
2830
3057
|
// src/actions/statics.ts
|
|
2831
|
-
import
|
|
3058
|
+
import chalk35 from "chalk";
|
|
2832
3059
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2833
3060
|
var statics = () => {
|
|
2834
|
-
console.log(
|
|
3061
|
+
console.log(chalk35.green("Check Required Static Dependencies"));
|
|
2835
3062
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2836
3063
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2837
3064
|
};
|
|
@@ -3425,7 +3652,7 @@ var xyInstallCommands = (args) => {
|
|
|
3425
3652
|
};
|
|
3426
3653
|
|
|
3427
3654
|
// src/xy/lint/cycleCommand.ts
|
|
3428
|
-
import
|
|
3655
|
+
import chalk36 from "chalk";
|
|
3429
3656
|
var cycleCommand = {
|
|
3430
3657
|
command: "cycle [package]",
|
|
3431
3658
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -3436,12 +3663,12 @@ var cycleCommand = {
|
|
|
3436
3663
|
const start = Date.now();
|
|
3437
3664
|
if (argv.verbose) console.log("Cycle");
|
|
3438
3665
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
3439
|
-
console.log(
|
|
3666
|
+
console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
|
|
3440
3667
|
}
|
|
3441
3668
|
};
|
|
3442
3669
|
|
|
3443
3670
|
// src/xy/lint/deplintCommand.ts
|
|
3444
|
-
import
|
|
3671
|
+
import chalk37 from "chalk";
|
|
3445
3672
|
var deplintCommand = {
|
|
3446
3673
|
command: "deplint [package]",
|
|
3447
3674
|
describe: "Deplint - Run Deplint",
|
|
@@ -3479,12 +3706,12 @@ var deplintCommand = {
|
|
|
3479
3706
|
peerDeps: !!argv.peerDeps,
|
|
3480
3707
|
verbose: !!argv.verbose
|
|
3481
3708
|
});
|
|
3482
|
-
console.log(
|
|
3709
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
3483
3710
|
}
|
|
3484
3711
|
};
|
|
3485
3712
|
|
|
3486
3713
|
// src/xy/lint/fixCommand.ts
|
|
3487
|
-
import
|
|
3714
|
+
import chalk38 from "chalk";
|
|
3488
3715
|
var fixCommand = {
|
|
3489
3716
|
command: "fix [package]",
|
|
3490
3717
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -3495,12 +3722,12 @@ var fixCommand = {
|
|
|
3495
3722
|
const start = Date.now();
|
|
3496
3723
|
if (argv.verbose) console.log("Fix");
|
|
3497
3724
|
process.exitCode = fix();
|
|
3498
|
-
console.log(
|
|
3725
|
+
console.log(chalk38.blue(`Finished in ${Date.now() - start}ms`));
|
|
3499
3726
|
}
|
|
3500
3727
|
};
|
|
3501
3728
|
|
|
3502
3729
|
// src/xy/lint/knipCommand.ts
|
|
3503
|
-
import
|
|
3730
|
+
import chalk39 from "chalk";
|
|
3504
3731
|
var knipCommand = {
|
|
3505
3732
|
command: "knip",
|
|
3506
3733
|
describe: "Knip - Run Knip",
|
|
@@ -3511,12 +3738,12 @@ var knipCommand = {
|
|
|
3511
3738
|
if (argv.verbose) console.log("Knip");
|
|
3512
3739
|
const start = Date.now();
|
|
3513
3740
|
process.exitCode = knip();
|
|
3514
|
-
console.log(
|
|
3741
|
+
console.log(chalk39.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
3515
3742
|
}
|
|
3516
3743
|
};
|
|
3517
3744
|
|
|
3518
3745
|
// src/xy/lint/lintCommand.ts
|
|
3519
|
-
import
|
|
3746
|
+
import chalk40 from "chalk";
|
|
3520
3747
|
var lintCommand = {
|
|
3521
3748
|
command: "lint [package]",
|
|
3522
3749
|
describe: "Lint - Run Eslint",
|
|
@@ -3545,7 +3772,27 @@ var lintCommand = {
|
|
|
3545
3772
|
cache: argv.cache,
|
|
3546
3773
|
verbose: !!argv.verbose
|
|
3547
3774
|
});
|
|
3548
|
-
console.log(
|
|
3775
|
+
console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
|
|
3776
|
+
}
|
|
3777
|
+
};
|
|
3778
|
+
|
|
3779
|
+
// src/xy/lint/lintlintCommand.ts
|
|
3780
|
+
var lintlintCommand = {
|
|
3781
|
+
command: "lintlint",
|
|
3782
|
+
describe: "Lint Lint - Check for redundant or overridden ESLint rules vs shared config",
|
|
3783
|
+
builder: (yargs2) => {
|
|
3784
|
+
return yargs2.option("fix", {
|
|
3785
|
+
default: false,
|
|
3786
|
+
description: "Remove redundant rules from local config",
|
|
3787
|
+
type: "boolean"
|
|
3788
|
+
});
|
|
3789
|
+
},
|
|
3790
|
+
handler: async (argv) => {
|
|
3791
|
+
if (argv.verbose) console.log("Lint Lint");
|
|
3792
|
+
process.exitCode = await lintlint({
|
|
3793
|
+
fix: argv.fix,
|
|
3794
|
+
verbose: !!argv.verbose
|
|
3795
|
+
});
|
|
3549
3796
|
}
|
|
3550
3797
|
};
|
|
3551
3798
|
|
|
@@ -3567,7 +3814,7 @@ var packageLintCommand = {
|
|
|
3567
3814
|
};
|
|
3568
3815
|
|
|
3569
3816
|
// src/xy/lint/publintCommand.ts
|
|
3570
|
-
import
|
|
3817
|
+
import chalk41 from "chalk";
|
|
3571
3818
|
var publintCommand = {
|
|
3572
3819
|
command: "publint [package]",
|
|
3573
3820
|
describe: "Publint - Run Publint",
|
|
@@ -3578,12 +3825,12 @@ var publintCommand = {
|
|
|
3578
3825
|
if (argv.verbose) console.log("Publint");
|
|
3579
3826
|
const start = Date.now();
|
|
3580
3827
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
3581
|
-
console.log(
|
|
3828
|
+
console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
|
|
3582
3829
|
}
|
|
3583
3830
|
};
|
|
3584
3831
|
|
|
3585
3832
|
// src/xy/lint/relintCommand.ts
|
|
3586
|
-
import
|
|
3833
|
+
import chalk42 from "chalk";
|
|
3587
3834
|
var relintCommand = {
|
|
3588
3835
|
command: "relint [package]",
|
|
3589
3836
|
describe: "Relint - Clean & Lint",
|
|
@@ -3594,12 +3841,12 @@ var relintCommand = {
|
|
|
3594
3841
|
if (argv.verbose) console.log("Relinting");
|
|
3595
3842
|
const start = Date.now();
|
|
3596
3843
|
process.exitCode = relint();
|
|
3597
|
-
console.log(
|
|
3844
|
+
console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
|
|
3598
3845
|
}
|
|
3599
3846
|
};
|
|
3600
3847
|
|
|
3601
3848
|
// src/xy/lint/sonarCommand.ts
|
|
3602
|
-
import
|
|
3849
|
+
import chalk43 from "chalk";
|
|
3603
3850
|
var sonarCommand = {
|
|
3604
3851
|
command: "sonar",
|
|
3605
3852
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -3610,17 +3857,17 @@ var sonarCommand = {
|
|
|
3610
3857
|
const start = Date.now();
|
|
3611
3858
|
if (argv.verbose) console.log("Sonar Check");
|
|
3612
3859
|
process.exitCode = sonar();
|
|
3613
|
-
console.log(
|
|
3860
|
+
console.log(chalk43.blue(`Finished in ${Date.now() - start}ms`));
|
|
3614
3861
|
}
|
|
3615
3862
|
};
|
|
3616
3863
|
|
|
3617
3864
|
// src/xy/lint/index.ts
|
|
3618
3865
|
var xyLintCommands = (args) => {
|
|
3619
|
-
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
|
|
3866
|
+
return args.command(cycleCommand).command(lintCommand).command(lintlintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
|
|
3620
3867
|
};
|
|
3621
3868
|
|
|
3622
3869
|
// src/xy/xy.ts
|
|
3623
|
-
import
|
|
3870
|
+
import chalk44 from "chalk";
|
|
3624
3871
|
|
|
3625
3872
|
// src/xy/xyParseOptions.ts
|
|
3626
3873
|
import yargs from "yargs";
|
|
@@ -3661,8 +3908,8 @@ var xyParseOptions = () => {
|
|
|
3661
3908
|
var xy = async () => {
|
|
3662
3909
|
const options = xyParseOptions();
|
|
3663
3910
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3664
|
-
console.error(
|
|
3665
|
-
console.log(
|
|
3911
|
+
console.error(chalk44.yellow(`Command not found [${chalk44.magenta(process.argv[2])}]`));
|
|
3912
|
+
console.log(chalk44.gray("Try 'yarn xy --help' for list of commands"));
|
|
3666
3913
|
}).version().help().argv;
|
|
3667
3914
|
};
|
|
3668
3915
|
|