@simpleapps-com/augur-config 2.0.12 → 2.0.14
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/bin/augur-doctor.mjs +58 -10
- package/package.json +1 -1
package/bin/augur-doctor.mjs
CHANGED
|
@@ -95,6 +95,10 @@ function warn(id, label, detail) {
|
|
|
95
95
|
results.push({ status: "WARN", id, label, detail });
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
function suggest(id, label, detail) {
|
|
99
|
+
results.push({ status: "SUGGEST", id, label, detail });
|
|
100
|
+
}
|
|
101
|
+
|
|
98
102
|
function skip(id, label, detail) {
|
|
99
103
|
results.push({ status: "SKIP", id, label, detail });
|
|
100
104
|
}
|
|
@@ -526,21 +530,21 @@ if (pkg) {
|
|
|
526
530
|
}
|
|
527
531
|
}
|
|
528
532
|
|
|
529
|
-
// 18. Tailwind
|
|
533
|
+
// 18. Tailwind v4
|
|
530
534
|
if (pkg) {
|
|
531
535
|
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
532
536
|
const tailwindVersion = allDeps["tailwindcss"] || "";
|
|
533
537
|
if (tailwindVersion.startsWith("^4") || tailwindVersion.startsWith("4")) {
|
|
534
|
-
|
|
535
|
-
"tailwind",
|
|
536
|
-
"Tailwind v3.4 (not v4)",
|
|
537
|
-
`Found tailwindcss: ${tailwindVersion} -- downgrade to ^3.4`
|
|
538
|
-
);
|
|
538
|
+
pass("tailwind", "Tailwind v4 (platform standard)", "");
|
|
539
539
|
} else if (
|
|
540
540
|
tailwindVersion.startsWith("^3") ||
|
|
541
541
|
tailwindVersion.startsWith("3")
|
|
542
542
|
) {
|
|
543
|
-
|
|
543
|
+
fail(
|
|
544
|
+
"tailwind",
|
|
545
|
+
"Tailwind v4",
|
|
546
|
+
`Found tailwindcss: ${tailwindVersion} -- upgrade to ^4.0.0`
|
|
547
|
+
);
|
|
544
548
|
} else if (tailwindVersion) {
|
|
545
549
|
warn("tailwind", "Tailwind version unclear", `tailwindcss: ${tailwindVersion}`);
|
|
546
550
|
} else {
|
|
@@ -548,12 +552,54 @@ if (pkg) {
|
|
|
548
552
|
}
|
|
549
553
|
}
|
|
550
554
|
|
|
555
|
+
// 19. Pre-commit hooks (lefthook + lint-staged)
|
|
556
|
+
const lefthookFile = findFile("lefthook.yml", ".lefthook.yml");
|
|
557
|
+
if (lefthookFile) {
|
|
558
|
+
const lefthookContent = readFile(lefthookFile);
|
|
559
|
+
const hasPreCommit = lefthookContent && lefthookContent.includes("pre-commit");
|
|
560
|
+
const lintStagedConfig =
|
|
561
|
+
pkg?.["lint-staged"] ||
|
|
562
|
+
fileExists(".lintstagedrc") ||
|
|
563
|
+
fileExists(".lintstagedrc.json") ||
|
|
564
|
+
fileExists("lint-staged.config.js") ||
|
|
565
|
+
fileExists("lint-staged.config.mjs");
|
|
566
|
+
|
|
567
|
+
if (hasPreCommit && lintStagedConfig) {
|
|
568
|
+
pass("pre-commit", "Pre-commit hooks: lefthook + lint-staged", lefthookFile);
|
|
569
|
+
} else if (hasPreCommit) {
|
|
570
|
+
suggest(
|
|
571
|
+
"pre-commit",
|
|
572
|
+
"Pre-commit hooks: lefthook found but no lint-staged config",
|
|
573
|
+
"See https://github.com/simpleapps-com/augur-packages/wiki/guide-migration-runbook#pre-commit-hooks"
|
|
574
|
+
);
|
|
575
|
+
} else {
|
|
576
|
+
suggest(
|
|
577
|
+
"pre-commit",
|
|
578
|
+
"Pre-commit hooks: lefthook found but no pre-commit section",
|
|
579
|
+
"See https://github.com/simpleapps-com/augur-packages/wiki/guide-migration-runbook#pre-commit-hooks"
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
} else if (findFile(".husky/pre-commit", ".husky/_/pre-commit")) {
|
|
583
|
+
suggest(
|
|
584
|
+
"pre-commit",
|
|
585
|
+
"Pre-commit hooks: husky found -- consider switching to lefthook",
|
|
586
|
+
"See https://github.com/simpleapps-com/augur-packages/wiki/guide-migration-runbook#pre-commit-hooks"
|
|
587
|
+
);
|
|
588
|
+
} else {
|
|
589
|
+
suggest(
|
|
590
|
+
"pre-commit",
|
|
591
|
+
"No pre-commit hooks found -- recommended for code quality",
|
|
592
|
+
"See https://github.com/simpleapps-com/augur-packages/wiki/guide-migration-runbook#pre-commit-hooks"
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
|
|
551
596
|
// ── Output ───────────────────────────────────────────────────────────────────
|
|
552
597
|
|
|
553
598
|
const ICONS = {
|
|
554
599
|
PASS: "\x1b[32m[PASS]\x1b[0m",
|
|
555
600
|
FAIL: "\x1b[31m[FAIL]\x1b[0m",
|
|
556
601
|
WARN: "\x1b[33m[WARN]\x1b[0m",
|
|
602
|
+
SUGGEST: "\x1b[36m[SUGGEST]\x1b[0m",
|
|
557
603
|
SKIP: "\x1b[90m[SKIP]\x1b[0m",
|
|
558
604
|
};
|
|
559
605
|
|
|
@@ -578,7 +624,7 @@ const groups = {
|
|
|
578
624
|
"next-optimize",
|
|
579
625
|
"next-strict",
|
|
580
626
|
],
|
|
581
|
-
"Testing & Quality": ["contract-tests", "quality-script"],
|
|
627
|
+
"Testing & Quality": ["contract-tests", "quality-script", "pre-commit"],
|
|
582
628
|
"Patterns": ["no-wrapper", "auth", "image-loader"],
|
|
583
629
|
};
|
|
584
630
|
|
|
@@ -598,13 +644,15 @@ for (const [groupName, ids] of Object.entries(groups)) {
|
|
|
598
644
|
const passing = results.filter((r) => r.status === "PASS").length;
|
|
599
645
|
const failing = results.filter((r) => r.status === "FAIL").length;
|
|
600
646
|
const warnings = results.filter((r) => r.status === "WARN").length;
|
|
647
|
+
const suggestions = results.filter((r) => r.status === "SUGGEST").length;
|
|
601
648
|
const skipped = results.filter((r) => r.status === "SKIP").length;
|
|
602
|
-
const total = results.length - skipped;
|
|
649
|
+
const total = results.length - skipped - suggestions;
|
|
603
650
|
|
|
604
651
|
console.log(
|
|
605
652
|
`\x1b[1mScore: ${passing}/${total}\x1b[0m` +
|
|
606
653
|
(failing > 0 ? ` \x1b[31m(${failing} failing)\x1b[0m` : "") +
|
|
607
|
-
(warnings > 0 ? ` \x1b[33m(${warnings} warnings)\x1b[0m` : "")
|
|
654
|
+
(warnings > 0 ? ` \x1b[33m(${warnings} warnings)\x1b[0m` : "") +
|
|
655
|
+
(suggestions > 0 ? ` \x1b[36m(${suggestions} suggestions)\x1b[0m` : "")
|
|
608
656
|
);
|
|
609
657
|
console.log("");
|
|
610
658
|
|