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