diff options
| author | Matt Pocock <mattpocockvoice@gmail.com> | 2026-10-08 09:48:14 +0100 |
|---|---|---|
| committer | Matt Pocock <mattpocockvoice@gmail.com> | 2026-10-08 09:48:14 +0100 |
| commit | 8a4ccc72e615c1e69ec7ad08f452010615bca48d (patch) | |
| tree | 927e021f25b9954a8c812f96be0379d77ee593e1 | |
| parent | b0618bc436ad893b3c5e84e55fba86586d34a404 (diff) | |
setup-ts-deep-modules: scan app code in lint:boundaries, detect bun.locksetup-ts-deep-modules-scan-and-bun
Closes #1148, #1088.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | .changeset/setup-ts-deep-modules-scan-and-bun.md | 5 | ||||
| -rw-r--r-- | skills/in-progress/setup-ts-deep-modules/SKILL.md | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/.changeset/setup-ts-deep-modules-scan-and-bun.md b/.changeset/setup-ts-deep-modules-scan-and-bun.md new file mode 100644 index 0000000..abdc20c --- /dev/null +++ b/.changeset/setup-ts-deep-modules-scan-and-bun.md @@ -0,0 +1,5 @@ +--- +"mattpocock-skills": patch +--- + +`setup-ts-deep-modules` scans app code as well as packages in `lint:boundaries` and proves an app-side deep import fails (#1148); it detects Bun from `bun.lock` as well as `bun.lockb` (#1088). diff --git a/skills/in-progress/setup-ts-deep-modules/SKILL.md b/skills/in-progress/setup-ts-deep-modules/SKILL.md index 7e30047..ded2c75 100644 --- a/skills/in-progress/setup-ts-deep-modules/SKILL.md +++ b/skills/in-progress/setup-ts-deep-modules/SKILL.md @@ -38,7 +38,7 @@ Layering (which packages may depend on which) is a *different* concern and is le ### 1. Detect the environment -- **Package manager**: `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `bun.lockb` → bun, else npm. Use it for every command below (`pnpm`/`yarn`/`npm run`/`bunx`). +- **Package manager**: `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `bun.lock` or `bun.lockb` → bun, else npm. Use it for every command below (`pnpm`/`yarn`/`npm run`/`bunx`). - **Packages root**: if `src/` exists use `src/packages`, else `packages`. Confirm the choice with the user if the repo already has a different obvious convention. - **Existing config**: check for a `.dependency-cruiser.*` file. If one exists, do **not** overwrite it: merge the four rules and the options in, and tell the user what you added. @@ -58,7 +58,7 @@ Copy [`dependency-cruiser.config.cjs`](./dependency-cruiser.config.cjs) to the r ### 4. Wire it into the checks -- Add a `lint:boundaries` script: `depcruise <packages-root>` (or `depcruise src`). +- Add a `lint:boundaries` script that scans the packages **and** the app code importing them: `depcruise src`, or every such source root if code lives outside `src/`. A scan of `<packages-root>` alone never sees app imports. - Fold it into the repo's umbrella check command, the one that already runs typecheck (e.g. a `check` / `ci` / `validate` script). Do **not** touch `tsconfig` or add path aliases. - If there is no umbrella script, add `lint:boundaries` and tell the user to include it in CI. @@ -83,8 +83,10 @@ This is the completion criterion for the whole skill: a config that doesn't fail 1. Run `lint:boundaries`. It must **pass** on the clean example. 2. Temporarily add a deep import to `tests/example.test.ts` (e.g. `import { thing } from "../lib/impl"`). Run `lint:boundaries` again; it must **fail** with `tests-through-entrypoints`. 3. Revert the deep import. Run once more, and it must **pass**. +4. Temporarily add an app file outside `<packages-root>` (e.g. `src/boundary-probe.ts`) that imports `<packages-root>/example/lib/impl`. Run `lint:boundaries`; it must **fail** with `entrypoint-boundary-from-app`. +5. Delete the probe file. Run once more, and it must **pass**. -**Done when:** you have observed a pass, then a fail on the deep import, then a pass again. If step 2 does not fail, the rules are not wired correctly, so fix before finishing. +**Done when:** you have observed a pass, a fail on each deep import, and a pass after each revert. If either deep import does not fail, the rules are not wired correctly, so fix before finishing. ### 7. Document the convention |
