@hublo/sentinel 1.4.0-alpha.1 → 1.4.0-alpha.3

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `sentinel` is a standalone, semver-versioned package (published to a registry, consumed by a repo as a normal dependency) that unifies a repo's tooling, config, and quality checks into one place, so projects stop copying config files everywhere and stop carrying a pile of duplicated tooling dependencies.
6
6
 
7
- > Status: **the foundation, the TypeScript tool and the lint tool are shipped** (`@hublo/sentinel` on npm). The rest of this README is the design reference for the tools still to come, added one at a time on top of this foundation.
7
+ > Status: **the foundation, TypeScript, lint, format, build, dev and test are shipped** (`@hublo/sentinel` on npm). The rest of this README is the design reference for the tools still to come, added one at a time on top of this foundation.
8
8
 
9
9
  ---
10
10
 
@@ -43,8 +43,9 @@ A large monorepo accumulates:
43
43
 
44
44
  sentinel writes **standard config files** into a project (each just `extends` a sentinel preset) and runs the checks. Your editor and the tools read those **normal files natively**, they never call sentinel at runtime, so nothing is coupled to it or brittle.
45
45
 
46
- > **Shipped today:** the **TypeScript**, **lint**, **format**, **build** and **dev** tools. The
47
- > `--test` snippets below illustrate the end state and land with their own ticket.
46
+ > **Shipped today:** the **TypeScript**, **lint**, **format**, **build**, **dev** and **test**
47
+ > tools. `--test` migrates a module from jest to Vitest and proves the migration by comparing the
48
+ > full NAMES of the tests before and after; see [the test cheat sheet](docs/test-adoption.md).
48
49
 
49
50
  **Step 1 — put a module on sentinel** (once per module, by a dev; the files are committed). Run from the app dir; `--init` does it all, nothing is hand-edited:
50
51
 
@@ -168,6 +169,7 @@ throwaway run wants. Once a module has adopted, nothing is fetched any more: the
168
169
  - [`docs/format-adoption.md`](docs/format-adoption.md) — migrating a module from Prettier to oxfmt: why this config is materialized rather than a stub, how a module keeps its own formatting, and what did not survive the move.
169
170
  - [`docs/build-adoption.md`](docs/build-adoption.md) — moving a React app's Vite toolchain into sentinel: adoption changes the config's IMPORTS and nothing else, what sentinel owns versus what stays the app's, and why reading nothing is what makes losing nothing a guarantee.
170
171
  - [`docs/typescript-adoption.md`](docs/typescript-adoption.md) — the adoption cheat sheet: the two adoption steps, the command model (verb x type x location), options, reading a report, and troubleshooting.
172
+ - [`docs/test-adoption.md`](docs/test-adoption.md) — migrating a module from jest to Vitest: the two steps, what the migration rewrites and what it refuses BY NAME, how the baseline gate proves nothing was lost, and the failures worth recognising.
171
173
  - [`docs/typescript-traces.md`](docs/typescript-traces.md) — a **generated, versioned** reference of live command + output traces (every verb, option, config result and edge case) against the mock monorepo. Regenerate after CLI changes with `pnpm docs:traces`.
172
174
 
173
175
  ## Architecture: `target → runner → preset`
@@ -529,7 +531,7 @@ This scaffold is the foundation; each tool is added one at a time on top of it:
529
531
  2. **TypeScript** (`--typescript`) — runner `tsc` (later `tsgo`): presets react/nest/node, `--run`/`--inspect`/`--report`/`--init`, the composable grid, phased (non-breaking) strictness. **✅ shipped in `0.1.0-alpha.x`**
530
532
  3. **Lint** (`--lint`) — benchmark `eslint` vs `biome` vs `oxlint`.
531
533
  4. **Build** (`--build`) — `vite`.
532
- 5. **Test** (`--test`) — `vitest`, plus a11y / w3c setups.
534
+ 5. **Test** (`--test`) — `vitest`, migration from jest proven module by module against a name-level baseline. **✅ shipped in `1.4.0-alpha.x`**; a11y / w3c setups still to come.
533
535
  6. **Static analysis** (`--static-analysis`) — cycles, complexity, duplication, centrality.
534
536
  7. **Runtime analysis** (`--runtime-analysis`) — bundle, Lighthouse, web vitals.
535
537
  8. **Unified CI workflow + `--report --all` dashboard.**
@@ -16,7 +16,7 @@ import {
16
16
  registerAdapters,
17
17
  resolve,
18
18
  resolveBin
19
- } from "../chunk-O3XCQGTJ.js";
19
+ } from "../chunk-MUQWAZQN.js";
20
20
  import {
21
21
  WORKSPACE_ROOT_MARKER,
22
22
  ensureWorkspacePrep,
@@ -0,0 +1,70 @@
1
+ import {
2
+ findWorkspaceRoot
3
+ } from "./chunk-WLFE5RUU.js";
4
+
5
+ // src/roles/test/setup/workspace.ts
6
+ import { createRequire } from "module";
7
+ import { join } from "path";
8
+ function isMissingModule(error) {
9
+ return error?.code === "ERR_MODULE_NOT_FOUND";
10
+ }
11
+ async function optional(specifier, use) {
12
+ try {
13
+ use(await import(
14
+ /* @vite-ignore */
15
+ specifier
16
+ ));
17
+ } catch (error) {
18
+ if (!isMissingModule(error)) throw error;
19
+ }
20
+ }
21
+ function fromModule(specifier) {
22
+ try {
23
+ const require2 = createRequire(join(process.cwd(), "noop.cjs"));
24
+ return require2(specifier);
25
+ } catch {
26
+ return void 0;
27
+ }
28
+ }
29
+ async function loadEnvironment() {
30
+ await optional("dotenv-flow", (module) => {
31
+ const flow = module;
32
+ const config = flow.config ?? flow.default?.config;
33
+ const workspaceRoot = findWorkspaceRoot(process.cwd());
34
+ config?.({
35
+ silent: true,
36
+ purge_dotenv: true,
37
+ ...workspaceRoot === void 0 ? {} : { path: workspaceRoot }
38
+ });
39
+ });
40
+ }
41
+ async function pinLuxonZone() {
42
+ let pinned = false;
43
+ await optional("luxon", (module) => {
44
+ const settings = module.Settings;
45
+ if (settings === void 0) return;
46
+ settings.defaultZone = "utc";
47
+ pinned = true;
48
+ });
49
+ if (pinned) return;
50
+ const own = fromModule("luxon");
51
+ if (own?.Settings !== void 0) {
52
+ own.Settings.defaultZone = "utc";
53
+ return;
54
+ }
55
+ process.stderr.write(
56
+ "sentinel (test): luxon was not found in this module, so the UTC default zone is NOT pinned. Dates will follow the machine zone, as they did not under jest.\n"
57
+ );
58
+ }
59
+ async function installWorkspaceSetup() {
60
+ await loadEnvironment();
61
+ }
62
+ async function pinWorkspaceTimezone() {
63
+ await pinLuxonZone();
64
+ }
65
+
66
+ export {
67
+ installWorkspaceSetup,
68
+ pinWorkspaceTimezone
69
+ };
70
+ //# sourceMappingURL=chunk-CPCUPK4J.js.map