@hublo/sentinel 1.7.0-alpha.5 → 1.7.0-alpha.7
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/bin/sentinel.js +13 -80
- package/dist/{chunk-P6KTBQ2Q.js → chunk-2LLRSWG2.js} +481 -188
- package/dist/{chunk-THTXP2QU.js → chunk-7E6YTTAK.js} +1 -1
- package/dist/chunk-7E6YTTAK.js.map +1 -0
- package/dist/{chunk-DLGBRLUU.js → chunk-EESVRILJ.js} +3 -16
- package/dist/chunk-EESVRILJ.js.map +1 -0
- package/dist/{chunk-YRBFCQQI.js → chunk-NSILXJWF.js} +7002 -5697
- package/dist/{chunk-LNFGVGLE.js → chunk-SWWQ7X7B.js} +11 -23
- package/dist/{chunk-LNFGVGLE.js.map → chunk-SWWQ7X7B.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -6
- package/dist/roles/build/nest/toolchain.d.ts +1 -1
- package/dist/roles/build/nest/toolchain.js +2 -6
- package/dist/roles/build/nest/toolchain.js.map +1 -1
- package/dist/roles/static-analysis/config.js +1 -1
- package/dist/roles/test/nest/toolchain.d.ts +1 -1
- package/dist/roles/test/nest/toolchain.js +2 -3
- package/dist/roles/test/nest/toolchain.js.map +1 -1
- package/dist/roles/test/react/toolchain.js +2 -3
- package/dist/roles/test/react/toolchain.js.map +1 -1
- package/dist/roles/test/shared-test-config.d.ts +1 -1
- package/dist/roles/test/shared-test-config.js +2 -3
- package/dist/tsconfig/nest.json +1 -10
- package/dist/tsconfig/node.json +1 -11
- package/dist/tsconfig/react.json +0 -3
- package/dist/{tsconfig-aliases-C_PxuZni.d.ts → tsconfig-aliases-Ce6axdJ4.d.ts} +2 -17
- package/dist/{validate-4V3EGTXN.js → validate-S5I4Z7IO.js} +1 -3
- package/docs/arch-adoption.md +146 -0
- package/docs/build-adoption.md +0 -7
- package/docs/test-adoption.md +1 -8
- package/docs/typescript-adoption.md +13 -92
- package/docs/typescript-traces.md +89 -7
- package/docs/using-sentinel.md +3 -2
- package/package.json +1 -4
- package/dist/chunk-DLGBRLUU.js.map +0 -1
- package/dist/chunk-H4HAFJFZ.js +0 -79
- package/dist/chunk-H4HAFJFZ.js.map +0 -1
- package/dist/chunk-THTXP2QU.js.map +0 -1
- package/dist/chunk-ZFG6P27V.js +0 -313
- package/dist/chunk-ZZMYV576.js +0 -297
- package/dist/migrate-5N7IPVF5.js +0 -550
- package/dist/tsconfig/legacy.json +0 -21
package/dist/bin/sentinel.js
CHANGED
|
@@ -12,13 +12,11 @@ import {
|
|
|
12
12
|
presetNotInstalledYet,
|
|
13
13
|
registerAdapters,
|
|
14
14
|
resolve
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-ZZMYV576.js";
|
|
15
|
+
} from "../chunk-NSILXJWF.js";
|
|
17
16
|
import {
|
|
18
17
|
resolveContext,
|
|
19
18
|
separateToolArgs
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-ZFG6P27V.js";
|
|
19
|
+
} from "../chunk-2LLRSWG2.js";
|
|
22
20
|
import {
|
|
23
21
|
ensureWorkspacePrep,
|
|
24
22
|
findWorkspaceRoot,
|
|
@@ -36,10 +34,9 @@ import {
|
|
|
36
34
|
SWEEPABLE_TARGETS,
|
|
37
35
|
TARGETS,
|
|
38
36
|
VERBS
|
|
39
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-7E6YTTAK.js";
|
|
40
38
|
import "../chunk-4EIY7TTR.js";
|
|
41
39
|
import "../chunk-O7REVMOC.js";
|
|
42
|
-
import "../chunk-H4HAFJFZ.js";
|
|
43
40
|
import "../chunk-QXFCZON7.js";
|
|
44
41
|
|
|
45
42
|
// bin/sentinel.ts
|
|
@@ -576,62 +573,6 @@ sentinel (${type}): ${asMessage(error)}
|
|
|
576
573
|
return worst;
|
|
577
574
|
}
|
|
578
575
|
|
|
579
|
-
// src/cli/run-migrate.ts
|
|
580
|
-
async function runMigrate(ctx) {
|
|
581
|
-
const { modules, scope } = resolveContext(ctx.cwd, { module: ctx.module, ci: false });
|
|
582
|
-
const [module] = modules;
|
|
583
|
-
if (scope === "all" || scope === "affected" || module === void 0) {
|
|
584
|
-
ctx.fail(
|
|
585
|
-
"--migrate writes files: target one module (run from its directory, or pass --module). Migrating every module at once is intentionally not allowed."
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
const unsupported = ctx.targets.filter((target) => target !== "typescript");
|
|
589
|
-
if (unsupported.length > 0) {
|
|
590
|
-
const named = unsupported.map((target) => `--${target}`).join(", ");
|
|
591
|
-
process.stdout.write(
|
|
592
|
-
` \xB7 ${named}: not available yet. \`--migrate\` answers \`--typescript\` today, by detaching the module from tsconfig.base.json. Nothing was migrated for ${named}.
|
|
593
|
-
`
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
if (!ctx.targets.includes("typescript")) return 1;
|
|
597
|
-
const { migrateModule } = await import("../migrate-5N7IPVF5.js");
|
|
598
|
-
const migration = migrateModule(module.root, {
|
|
599
|
-
write: !ctx.dryRun,
|
|
600
|
-
workspaceRoot: findWorkspaceRoot(module.root) ?? module.root
|
|
601
|
-
});
|
|
602
|
-
process.stdout.write(
|
|
603
|
-
ctx.json ? `${JSON.stringify({ module: module.name, target: "typescript", ...migration }, null, 2)}
|
|
604
|
-
` : renderMigration(module.name, migration)
|
|
605
|
-
);
|
|
606
|
-
return migration.outcome === "migrated" || migration.outcome === "proved" || migration.outcome === "skipped" ? 0 : 1;
|
|
607
|
-
}
|
|
608
|
-
var SHOWN_DIFFERENCES = 20;
|
|
609
|
-
function renderMigration(name, migration) {
|
|
610
|
-
const mark = migration.outcome === "migrated" || migration.outcome === "proved" ? "\u2713" : migration.outcome === "skipped" ? "\xB7" : "\u2717";
|
|
611
|
-
const lines = [` ${mark} ${name} \u2014 ${migration.message}`];
|
|
612
|
-
for (const file of migration.files) {
|
|
613
|
-
lines.push(` ${file.kept ? "\u2713" : "\xB7"} ${file.file}${file.reason ? `: ${file.reason}` : ""}`);
|
|
614
|
-
if (file.aliases !== void 0) {
|
|
615
|
-
lines.push(
|
|
616
|
-
` ${file.legacy ? "extends legacy, " : ""}${file.aliases.kept} of ${file.aliases.of} aliases, ${file.resolutions ?? 0} resolutions compared${file.written && file.written.length > 0 ? `, wrote ${file.written.join(", ")}` : ""}`
|
|
617
|
-
);
|
|
618
|
-
}
|
|
619
|
-
const differences = [
|
|
620
|
-
...(file.configDifferences ?? []).map(
|
|
621
|
-
(difference) => `${difference.key}: ${difference.before ?? "unset"} -> ${difference.after ?? "unset"}`
|
|
622
|
-
),
|
|
623
|
-
...file.resolutionDifferences ?? []
|
|
624
|
-
];
|
|
625
|
-
for (const line of differences.slice(0, SHOWN_DIFFERENCES)) lines.push(` ${line}`);
|
|
626
|
-
if (differences.length > SHOWN_DIFFERENCES) {
|
|
627
|
-
lines.push(` \u2026 ${differences.length - SHOWN_DIFFERENCES} more, all of them under --json`);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
for (const note of migration.notes) lines.push(` note: ${note}`);
|
|
631
|
-
return `${lines.join("\n")}
|
|
632
|
-
`;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
576
|
// src/cli/run-validate.ts
|
|
636
577
|
async function runValidate(ctx) {
|
|
637
578
|
const { modules } = resolveContext(ctx.cwd, { module: ctx.module, ci: ctx.ci });
|
|
@@ -644,7 +585,7 @@ async function runValidate(ctx) {
|
|
|
644
585
|
);
|
|
645
586
|
}
|
|
646
587
|
if (!ctx.targets.includes("test")) return 1;
|
|
647
|
-
const { validateModuleTests } = await import("../validate-
|
|
588
|
+
const { validateModuleTests } = await import("../validate-S5I4Z7IO.js");
|
|
648
589
|
const outcomes = modules.flatMap(
|
|
649
590
|
(module) => validateModuleTests(module.name, module.root)
|
|
650
591
|
);
|
|
@@ -696,15 +637,7 @@ var RULE_BLOCKS = [
|
|
|
696
637
|
// The other direction, and listed for the same reason: a rule a module adds to its lint
|
|
697
638
|
// preset is not drift, so nothing else on the row would ever show it was there.
|
|
698
639
|
{ key: "added", label: "added by the module (kept by --init, not drift):" },
|
|
699
|
-
{ key: "addedConfig", label: "config added by the module (kept by --init, not drift):" }
|
|
700
|
-
// TypeScript's two: an option the preset took over from the base, set to another value by the
|
|
701
|
-
// module (kept, so `conformant` cannot show it), and the debt a migrated module takes from
|
|
702
|
-
// `legacy`. Both are this module departing from the standard, named.
|
|
703
|
-
{
|
|
704
|
-
key: "standardOverrides",
|
|
705
|
-
label: "differs from the repo standard (kept by --init, not drift):"
|
|
706
|
-
},
|
|
707
|
-
{ key: "legacyCompromises", label: "inherited compromises (debt to remove):" }
|
|
640
|
+
{ key: "addedConfig", label: "config added by the module (kept by --init, not drift):" }
|
|
708
641
|
];
|
|
709
642
|
var MAX_INLINE_WIDTH = 60;
|
|
710
643
|
function renderValue(key, value, p) {
|
|
@@ -993,16 +926,13 @@ program.name("sentinel").description("One CLI that guards code health: presets,
|
|
|
993
926
|
"before",
|
|
994
927
|
[
|
|
995
928
|
"A check composes: verb + type + location.",
|
|
996
|
-
" verb what to do: --run --inspect --report --status --init --
|
|
929
|
+
" verb what to do: --run --inspect --report --status --init --validate (--migrate: planned)",
|
|
997
930
|
" type which check: --lint --typescript ... (omit = all types; or --all)",
|
|
998
931
|
" where run from a MODULE dir \u2192 that module; from the ROOT \u2192 --module <name>,",
|
|
999
932
|
" --ci (affected), or all modules. --init targets one module only.",
|
|
1000
933
|
""
|
|
1001
934
|
].join("\n")
|
|
1002
|
-
).option("--run", "execute the target tool").option("--inspect", "show the resolved configuration").option("--init", "set up a module: write its config stubs + the workspace prep it needs").option(
|
|
1003
|
-
"--migrate",
|
|
1004
|
-
"change an already-initialized setup: --typescript detaches the module from tsconfig.base.json"
|
|
1005
|
-
).option(
|
|
935
|
+
).option("--run", "execute the target tool").option("--inspect", "show the resolved configuration").option("--init", "set up a module: write its config stubs + the workspace prep it needs").option("--migrate", "planned: change an already-initialized setup (not available yet)").option(
|
|
1006
936
|
"--validate",
|
|
1007
937
|
"prove a migration kept the suite: record the reference, then compare against it"
|
|
1008
938
|
).option("--report", "deprecated: use --run --json").option("--status", "deprecated: use --inspect").option(
|
|
@@ -1181,8 +1111,8 @@ if (!Number.isInteger(maxDiagnostics) || maxDiagnostics < 0) {
|
|
|
1181
1111
|
`--max-diagnostics must be a non-negative integer (0 = no cap); got ${JSON.stringify(opts.maxDiagnostics)}.`
|
|
1182
1112
|
);
|
|
1183
1113
|
}
|
|
1184
|
-
if (opts.dryRun && verb !== "init"
|
|
1185
|
-
program.error("--dry-run only applies to --init
|
|
1114
|
+
if (opts.dryRun && verb !== "init") {
|
|
1115
|
+
program.error("--dry-run only applies to --init (the read verbs never write).");
|
|
1186
1116
|
}
|
|
1187
1117
|
if (opts.rehearse && !opts.dryRun) {
|
|
1188
1118
|
program.error(
|
|
@@ -1208,6 +1138,9 @@ async function exitWithoutTruncating(code) {
|
|
|
1208
1138
|
await new Promise((resolve2) => stream.once("drain", () => resolve2()));
|
|
1209
1139
|
}
|
|
1210
1140
|
async function main() {
|
|
1141
|
+
if (verb === "migrate") {
|
|
1142
|
+
program.error("--migrate is planned and not available yet; use --init to set a module up.");
|
|
1143
|
+
}
|
|
1211
1144
|
const context = {
|
|
1212
1145
|
verb,
|
|
1213
1146
|
cwd,
|
|
@@ -1232,7 +1165,7 @@ async function main() {
|
|
|
1232
1165
|
githubActions,
|
|
1233
1166
|
fail: (message) => program.error(message)
|
|
1234
1167
|
};
|
|
1235
|
-
const exitCode = verb === "init" ? await runInit(context) : verb === "validate" ? await runValidate(context) :
|
|
1168
|
+
const exitCode = verb === "init" ? await runInit(context) : verb === "validate" ? await runValidate(context) : await runVerb(context);
|
|
1236
1169
|
await exitWithoutTruncating(exitCode);
|
|
1237
1170
|
}
|
|
1238
1171
|
main().catch((error) => {
|