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