@adamhl8/configs 3.5.1 → 4.1.0

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.
Files changed (83) hide show
  1. package/README.md +53 -60
  2. package/dist/adamhl8-tsconfig/index +43 -0
  3. package/dist/configs/bask.base.d.ts +1 -2
  4. package/dist/configs/bask.base.js +20 -11
  5. package/dist/configs/bask.base.js.map +1 -1
  6. package/dist/configs/commitlint.base.d.ts +1 -2
  7. package/dist/configs/commitlint.base.js.map +1 -1
  8. package/dist/configs/configs.d.ts +7 -0
  9. package/dist/configs/configs.js +7 -0
  10. package/dist/configs/gitignore.base +0 -1
  11. package/dist/configs/knip.base.d.ts +17 -6
  12. package/dist/configs/knip.base.js +18 -9
  13. package/dist/configs/knip.base.js.map +1 -1
  14. package/dist/configs/oxfmt.base.d.ts +1 -2
  15. package/dist/configs/oxlint.base.d.ts +2 -3
  16. package/dist/configs/oxlint.base.js +12 -3
  17. package/dist/configs/oxlint.base.js.map +1 -1
  18. package/dist/configs/release-it.base.d.ts +1 -2
  19. package/dist/configs/tsconfig.base.json +1 -1
  20. package/dist/configs/tsconfig.no-dts.base.json +7 -0
  21. package/dist/configs/tsdown.base.d.ts +1 -2
  22. package/dist/configs/tsdown.base.js.map +1 -1
  23. package/dist/dep-report/dep-report.js +66 -0
  24. package/dist/dep-report/dep-report.js.map +1 -0
  25. package/dist/dep-report/prompt.md +28 -0
  26. package/dist/env/index.d.ts +1 -2
  27. package/dist/env/utils.d.ts +1 -2
  28. package/dist/index.d.ts +3 -2
  29. package/dist/index.js +1 -0
  30. package/dist/merge-config/merge-config.d.ts +5 -1
  31. package/dist/merge-config/merge-config.js +17 -7
  32. package/dist/merge-config/merge-config.js.map +1 -1
  33. package/dist/merge-config/merge.types.d.ts +1 -2
  34. package/dist/test-utils/fixture.d.ts +2 -9
  35. package/dist/test-utils/fixture.js +2 -3
  36. package/dist/test-utils/fixture.js.map +1 -1
  37. package/dist/test-utils/index.d.ts +2 -3
  38. package/dist/test-utils/index.js +3 -4
  39. package/dist/test-utils/pack.d.ts +5 -3
  40. package/dist/test-utils/pack.js +16 -4
  41. package/dist/test-utils/pack.js.map +1 -1
  42. package/dist/test-utils/shell/command.d.ts +1 -2
  43. package/dist/test-utils/shell/command.js +1 -1
  44. package/dist/test-utils/shell/command.js.map +1 -1
  45. package/dist/test-utils/shell/env.d.ts +1 -2
  46. package/dist/test-utils/shell/shell.d.ts +2 -1
  47. package/dist/test-utils/shell/shell.js +2 -1
  48. package/dist/test-utils/shell/shell.js.map +1 -1
  49. package/dist/test-utils/temp-dir.d.ts +2 -3
  50. package/dist/test-utils/temp-dir.js +5 -3
  51. package/dist/test-utils/temp-dir.js.map +1 -1
  52. package/dist/utils.js +11 -2
  53. package/dist/utils.js.map +1 -1
  54. package/package.json +28 -48
  55. package/dist/configs/bask.base.d.ts.map +0 -1
  56. package/dist/configs/commitlint.base.d.ts.map +0 -1
  57. package/dist/configs/knip.base.d.ts.map +0 -1
  58. package/dist/configs/oxfmt.base.d.ts.map +0 -1
  59. package/dist/configs/oxlint.base.d.ts.map +0 -1
  60. package/dist/configs/release-it.base.d.ts.map +0 -1
  61. package/dist/configs/tsdown.base.d.ts.map +0 -1
  62. package/dist/env/index.d.ts.map +0 -1
  63. package/dist/env/utils.d.ts.map +0 -1
  64. package/dist/merge-config/merge-config.d.ts.map +0 -1
  65. package/dist/merge-config/merge.types.d.ts.map +0 -1
  66. package/dist/test-utils/fixture.d.ts.map +0 -1
  67. package/dist/test-utils/pack.d.ts.map +0 -1
  68. package/dist/test-utils/shell/command.d.ts.map +0 -1
  69. package/dist/test-utils/shell/env.d.ts.map +0 -1
  70. package/dist/test-utils/shell/shell.d.ts.map +0 -1
  71. package/dist/test-utils/subprocess-coverage/child-preload.d.ts +0 -1
  72. package/dist/test-utils/subprocess-coverage/child-preload.js +0 -73
  73. package/dist/test-utils/subprocess-coverage/child-preload.js.map +0 -1
  74. package/dist/test-utils/subprocess-coverage/env.d.ts +0 -7
  75. package/dist/test-utils/subprocess-coverage/env.d.ts.map +0 -1
  76. package/dist/test-utils/subprocess-coverage/env.js +0 -19
  77. package/dist/test-utils/subprocess-coverage/env.js.map +0 -1
  78. package/dist/test-utils/subprocess-coverage/preload.d.ts +0 -1
  79. package/dist/test-utils/subprocess-coverage/preload.js +0 -43
  80. package/dist/test-utils/subprocess-coverage/preload.js.map +0 -1
  81. package/dist/test-utils/subprocess-coverage/report.js +0 -35
  82. package/dist/test-utils/subprocess-coverage/report.js.map +0 -1
  83. package/dist/test-utils/temp-dir.d.ts.map +0 -1
package/README.md CHANGED
@@ -26,9 +26,11 @@ Configs, tasks, and workflows I use across my TS projects.
26
26
  - [release-it](#release-it)
27
27
  - [lefthook](#lefthook)
28
28
  - [bask tasks](#bask-tasks)
29
+ - [Dependency report](#dependency-report)
29
30
  - [Synced files](#synced-files)
30
31
  - [bunfig](#bunfig)
31
32
  - [gitignore](#gitignore)
33
+ - [tsconfig extends](#tsconfig-extends)
32
34
  - [Utilities](#utilities)
33
35
  - [env](#env)
34
36
  - [test](#test)
@@ -61,7 +63,6 @@ Some tools are only needed by some projects:
61
63
  - Published packages: `tsdown publint @arethetypeswrong/core`
62
64
  - Releases: `release-it release-it-git-cliff` (see [release-it](#release-it))
63
65
  - Astro projects that use Tailwind: `tailwint @tailwindcss/language-server` (see [bask tasks](#bask-tasks))
64
- - Subprocess test coverage: `@vitest/istanbul-lib-coverage @vitest/istanbul-lib-instrument @vitest/istanbul-lib-report @vitest/istanbul-lib-source-maps` (see [Subprocess coverage](#subprocess-coverage))
65
66
 
66
67
  ## Setup
67
68
 
@@ -82,7 +83,7 @@ A project using everything here has these files:
82
83
  | `.github/workflows/*.yml` | [GitHub Actions](#github-actions) |
83
84
  | `github.tofu` | [GitHub repo settings](#github-repo-settings) |
84
85
 
85
- `bunfig.toml` and `.gitignore` are kept up to date by the [synced files](#synced-files).
86
+ `bunfig.toml`, `.gitignore`, and the `extends` in `tsconfig.json` are kept up to date by the [synced files](#synced-files).
86
87
 
87
88
  ## Configs
88
89
 
@@ -118,6 +119,10 @@ The second config works at any depth: only the arrays you provide are replaced,
118
119
 
119
120
  The base tsconfig adds stricter checks like `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes`, with no emit and bundler module resolution. It sets `types: ["bun"]`, so the project needs `@types/bun` installed.
120
121
 
122
+ The base sets `declaration: true` so `tsc` fails on an export whose type can't be named. tsdown doesn't catch this: with Bun's isolated linker, it silently publishes that export as `any`.
123
+
124
+ `@adamhl8/configs/tsconfig/no-dts` is the same config with `declaration` off, so `tsc` doesn't report these errors in a project that never publishes a `.d.ts`. You don't need to choose between them because the [tsconfig sync](#tsconfig-extends) sets `extends` for you.
125
+
121
126
  ### oxfmt
122
127
 
123
128
  ```ts
@@ -148,11 +153,13 @@ export default defineConfig(config)
148
153
 
149
154
  The base turns on every rule category as an error, with type-aware linting and type checking, then turns off the rules that don't fit. It also loads these JS plugins with every rule on, except the rules a native rule already covers:
150
155
 
151
- - Always: [bunisms](https://github.com/himynameisdave/eslint-plugin-bunisms), [clean-modules](https://github.com/adamhl8/eslint-plugin-clean-modules), [directive-comments](https://github.com/tunderadev/oxlint-plugin-directive-comments), [e18e](https://github.com/e18e/eslint-plugin), and [regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
156
+ - Always: [bunisms](https://github.com/himynameisdave/eslint-plugin-bunisms), [clean-modules](https://github.com/adamhl8/oxlint-plugin-clean-modules), [directive-comments](https://github.com/tunderadev/oxlint-plugin-directive-comments), [e18e](https://github.com/e18e/eslint-plugin), [package-boundaries](https://github.com/adamhl8/oxlint-plugin-package-boundaries), and [regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
152
157
  - When the project depends on `hono`: [hono](https://github.com/ouka-lab/eslint-plugin-hono)
153
158
  - When the project depends on `react`: [react-web-api](https://github.com/Rel1cx/eslint-react) and [react-you-might-not-need-an-effect](https://github.com/nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect)
154
159
  - When the project has a Tailwind stylesheet: [oxlint-tailwindcss](https://github.com/sergioazoc/oxlint-tailwindcss)
155
160
 
161
+ package-boundaries is off for tests, in `__tests__` dirs and `*.test.ts` files, because a test may import any module.
162
+
156
163
  The plugins are loaded from `@adamhl8/configs`'s own dependencies, so the project doesn't install them. In a project whose `package.json` has `engines.node`, the bunisms rules are off in `src/` (except in tests), because that code runs on Node.
157
164
 
158
165
  oxlint-tailwindcss runs every rule except `enforce-sort-order` and `enforce-consistent-line-wrapping` (oxfmt handles these), `enforce-logical` (it conflicts with `enforce-physical`), and `max-class-count`. It reads the design system from the same stylesheet oxfmt sorts against. If that's the wrong file, set `settings: { tailwindcss: { entryPoint: "path/to/global.css" } }`, alongside the oxfmt `sortTailwindcss` override.
@@ -168,7 +175,14 @@ const config = knipConfig({ ... })
168
175
  export default config
169
176
  ```
170
177
 
171
- The base leaves `fixtures` and `fixture` dirs out of the analysis, at any depth. It adds `**/*.test.ts` and `bask.ts` to the bun plugin's entries rather than the top-level `entry`, so a project's own `entry` doesn't replace knip's default entries. knip doesn't see commands run through bask's `sh`, so a dependency that's only run there goes in `ignoreDependencies`.
178
+ The base leaves `fixtures` and `fixture` dirs out of the analysis, at any depth. It adds `**/*.test.ts` and `bask.ts` to the bun plugin's entries rather than the top-level `entry`. knip doesn't see commands run through bask's `sh`, so a dependency that's only run there goes in `ignoreDependencies`.
179
+
180
+ `knipConfig` returns a function, because knip passes it the CLI arguments. The `lint` task runs knip twice:
181
+
182
+ - `knip` checks everything, tests included.
183
+ - `knip --production` leaves out tests and devDependencies. It reports an export that only tests use, so a package's main module exports only what runtime code uses. It keeps an export that its own module uses, so a test can import it from that module. It also leaves `__tests__` dirs out, and skips binaries, because dev tools come from devDependencies.
184
+
185
+ The production run starts from the entries marked with a trailing `!`. The base tsconfig's `outDir` lets knip map the `dist/` files in `package.json`'s `main`, `bin`, and `exports` back to `src/`, so those count without any marking. knip's default entries (`index`, `cli`, and `main`, at the root or in `src/`) are marked too. A project's own top-level `entry` replaces knip's default entries. So mark each runtime entry the project lists, like `entry: ["src/server.ts!"]`. An entry without the `!`, like a script or a test that runs by path, counts only in the plain run.
172
186
 
173
187
  ### tsdown
174
188
 
@@ -260,17 +274,17 @@ export * from "@adamhl8/configs/bask"
260
274
 
261
275
  Run `bunx bask` to list them along with the allowed commit types.
262
276
 
263
- | Task | What it does |
264
- | -------------- | -------------------------------------------------------------------------------------------------------------------------------- |
265
- | `lint` | Updates the README's table of contents, runs oxlint (with fixes), oxfmt, tailwint, `tofu fmt`, knip, and actionlint, then `test` |
266
- | `build` | Runs `lint`, `tsdown`, and `tofu-check`. In CI, it fails when lint fixes or formatting changed any files |
267
- | `test` | Runs `bun test`, which passes when there are no tests |
268
- | `bump-deps` | Updates every dependency to its latest version, then reinstalls without the lockfile, `node_modules`, or bun's cache |
269
- | `release` | Starts the [release workflow](#release) (`gh workflow run release.yml`) |
270
- | `release-run` | Runs `release-it --ci`. It's hidden because only the release workflow runs it |
271
- | `tofu-check` | Runs `tofu plan` to check the [GitHub repo settings](#github-repo-settings) for drift |
272
- | `commit-types` | Prints the allowed commit types |
273
- | `prepare` | Runs `lefthook install`, the [synced files](#synced-files), and `tofu init -upgrade` |
277
+ | Task | What it does |
278
+ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
279
+ | `lint` | Updates the README's table of contents, runs oxlint (with fixes), oxfmt, tailwint, `tofu fmt`, `tsc`, knip, and actionlint, then `test` |
280
+ | `build` | Runs `lint`, `tsdown`, and `tofu-check`. In CI, it fails when lint fixes or formatting changed any files |
281
+ | `test` | Runs `bun test`, which passes when there are no tests |
282
+ | `bump-deps` | Updates every dependency to its latest version, then reinstalls without the lockfile, `node_modules`, or bun's cache. Then [reports](#dependency-report) what the changes mean for the project |
283
+ | `release` | Starts the [release workflow](#release) (`gh workflow run release.yml`) |
284
+ | `release-run` | Runs `release-it --ci`. It's hidden because only the release workflow runs it |
285
+ | `tofu-check` | Runs `tofu plan` to check the [GitHub repo settings](#github-repo-settings) for drift |
286
+ | `commit-types` | Prints the allowed commit types |
287
+ | `prepare` | Runs `lefthook install`, the [synced files](#synced-files), and `tofu init -upgrade` |
274
288
 
275
289
  The tasks skip the steps a project doesn't need, so projects can use them as-is:
276
290
 
@@ -278,6 +292,7 @@ The tasks skip the steps a project doesn't need, so projects can use them as-is:
278
292
  - `build` runs `tsdown` only when the project has a `tsdown.config.ts`.
279
293
  - `tofu-check` and `tofu init` run only outside CI, in a project with a root `.tofu` file, on a machine with the `adamhl8` AWS profile.
280
294
  - `prepare` skips `lefthook install` in CI, so commits made by the workflows don't run the hooks.
295
+ - `bump-deps` runs the [dependency report](#dependency-report) only outside CI, when a range changed by more than a patch, on a machine with `claude` installed.
281
296
 
282
297
  tailwint runs on `.astro` files because oxlint can't see Astro markup. It only checks and never fixes, because tailwint resolves a class conflict by deleting a class by position, not by which one wins. Projects with `.astro` files install it:
283
298
 
@@ -316,6 +331,12 @@ The only script left in `package.json` is `prepare`, which hands off to bask:
316
331
 
317
332
  The `prepare` script and task `sh` calls run local bins by their bare name, because `bun run` and bask both put `node_modules/.bin` on `PATH`. Git hooks and the workflows run `bunx bask` rather than `bun bask`, because `bun bask` runs `bask.ts` instead of the bask bin.
318
333
 
334
+ ### Dependency report
335
+
336
+ After `bump-deps` reinstalls, it runs Claude Code headless (`claude -p`) on the ranges that changed. It skips patch-only bumps of 1.0+ packages, but keeps 0.x patch bumps, because those can add features or break things. Claude reads the release notes, compares rule lists and config schemas between versions, and runs the project's checks. It prints a report of what needs action, what's worth knowing, and what needs nothing. The last line is a `claude --resume` command to pick up that session and act on the report, along with what the run cost.
337
+
338
+ The run uses `auto` permission mode with the file-editing tools denied, and the prompt tells Claude not to change the project. The report runs before a project's own `bumpDeps.after` hooks. The prompt lives in `src/dep-report/prompt.md`.
339
+
319
340
  ## Synced files
320
341
 
321
342
  ### bunfig
@@ -350,6 +371,17 @@ dist/
350
371
 
351
372
  Everything below the marker is left untouched. The sync can also be run manually by running `adamhl8-gitignore`.
352
373
 
374
+ ### tsconfig extends
375
+
376
+ A tsconfig can't branch on the project, so the right base config is synced into the project's `tsconfig.json`. The `prepare` task runs the `adamhl8-tsconfig` bin, which sets `extends` based on whether the `package.json` declares types:
377
+
378
+ - `@adamhl8/configs/tsconfig` when it has a top-level `types` or `typings` field, or a `types` condition or declaration file path anywhere in `exports`
379
+ - `@adamhl8/configs/tsconfig/no-dts` otherwise
380
+
381
+ A package that publishes types has to declare them for this to work. TypeScript also finds a `.d.ts` next to its `.js` without one, but this sync would then turn off the `declaration` check that protects those types.
382
+
383
+ Only the `extends` value changes, so comments, formatting, and other options are left untouched. To opt out, extend anything other than these two configs, or set `declaration` in the project's own `compilerOptions`. The sync can also be run manually by running `adamhl8-tsconfig`.
384
+
353
385
  ## Utilities
354
386
 
355
387
  ### env
@@ -377,7 +409,7 @@ Helpers for integration tests that run real commands in temp dirs, exported from
377
409
  ```ts
378
410
  import { copyFixture, minimalEnv, packPackage } from "@adamhl8/configs/test"
379
411
 
380
- const tarball = await packPackage(ROOT) // once per run, like in a preload's `beforeAll`
412
+ const tarball = await packPackage(ROOT)
381
413
  const { dir, run } = await copyFixture(FIXTURE, { shell: { env: minimalEnv() } })
382
414
  await run`bun add -d ${tarball}`
383
415
 
@@ -394,11 +426,10 @@ const { exitCode: failedCode } = await run`my-cli --bad-flag`.nothrow()
394
426
  - Each command can chain `.cwd()`, `.env()` (merged over the shell's), `.localBins()`, and `.nothrow()`.
395
427
  - The `node` shims from `bask` and `bun run --bun` are taken off `PATH`, so `node` is always the real Node.
396
428
  - Commands read the test runner's stdin, so add `< /dev/null` to a command that might prompt.
397
- - `copyFixture(fixture, { prefix, shell })` copies a fixture dir into a temp dir and returns the `dir` plus a `run` shell bound to it. `shell` takes the `createShell` options except `cwd`.
398
- - `packPackage(root)` runs `bun tsdown` when `root` has a `tsdown.config.ts`, then packs it with `bun pm pack --ignore-scripts` into a temp dir, and returns the tarball path.
429
+ - `copyFixture(fixture, { shell })` copies a fixture dir into a temp dir and returns the `dir` plus a `run` shell bound to it. `shell` takes the `createShell` options except `cwd`.
430
+ - `packPackage(root)` runs `bun tsdown` when `root` has a `tsdown.config.ts`, then packs it with `bun pm pack --ignore-scripts` into a temp dir, and returns the tarball path. It runs once per resolved `root` for the life of the test process, so call it wherever a test needs the tarball. Concurrent callers share one build, and a failed pack fails every caller the same way.
399
431
  - `minimalEnv(extra)` returns just `PATH` and `HOME`, plus `extra`.
400
- - `makeTempDir(prefix)` makes a temp dir that's removed after the test run. `copyFixture` and `packPackage` use it.
401
- - `subprocessCoverageEnv()` returns the variables that turn on [subprocess coverage](#subprocess-coverage) for a shell's `env`, or nothing when it's off.
432
+ - `makeTempDir()` makes a temp dir that's removed after the test run. Its name starts with the name of the current working directory, so a dir left behind by a killed run shows which project it came from. `copyFixture` and `packPackage` use it.
402
433
 
403
434
  The temp dirs are removed by a preload, which each project adds to its `bunfig.toml`:
404
435
 
@@ -415,46 +446,6 @@ import "@adamhl8/configs/test/preload"
415
446
 
416
447
  It isn't in the shared bunfig base because `adamhl8-bunfig` merges arrays by index, so a project's own `preload` would replace it.
417
448
 
418
- #### Subprocess coverage
419
-
420
- Bun's coverage only measures the test process, so it misses a package's own code when tests run it from the packed tarball in child processes. A second preload covers that code, imported after the first at the top of the project's own preload:
421
-
422
- ```ts
423
- import "@adamhl8/configs/test/preload"
424
- import "@adamhl8/configs/test/subprocess-coverage"
425
- ```
426
-
427
- A project without its own preload can list both in `bunfig.toml` instead:
428
-
429
- ```toml
430
- [test]
431
- preload = ["@adamhl8/configs/test/preload", "@adamhl8/configs/test/subprocess-coverage"]
432
- ```
433
-
434
- - It sets `BUN_OPTIONS` and a settings variable on `process.env`. Every Bun process started with them loads a preload that instruments the installed package's `dist/` with Istanbul (the package named in the project's `package.json`).
435
- - A shell that inherits `process.env` passes the variables on as is. A shell that replaces it, like one built on `minimalEnv()`, adds them with `subprocessCoverageEnv()`:
436
-
437
- ```ts
438
- import { copyFixture, minimalEnv, subprocessCoverageEnv } from "@adamhl8/configs/test"
439
-
440
- const { run } = await copyFixture(FIXTURE, { shell: { env: minimalEnv(subprocessCoverageEnv()) } })
441
- ```
442
-
443
- - After the run, the coverage from every process is merged, mapped back to `src/` through the package's source maps, printed as a table (statements, branches, functions, lines), and written to `coverage/subprocess/lcov.info`, which keeps it apart from the `coverage/lcov.info` that Bun writes.
444
- - To keep Bun's own coverage for code that tests import directly, leave `coverage = true` under `[test]` and list the files that subprocess coverage owns in `coveragePathIgnorePatterns`. Bun then skips those files, and the subprocess report keeps only them, so each file appears in one of the two tables. A file you don't list is left to Bun, so a file that only child processes load shows up in neither table. With `coverage = false`, the subprocess report keeps every file.
445
-
446
- ```toml
447
- [test]
448
- coverage = true
449
- coveragePathIgnorePatterns = ["**/__tests__/**", "src/cli/**"]
450
- ```
451
-
452
- - This reads `bunfig.toml` from the project root, so turning on Bun's coverage with `--coverage` instead leaves the subprocess report unfiltered.
453
- - The project needs the optional peer dependencies listed under [Installation](#installation) and a build with source maps, which `tsdownConfig` produces. Tests have to install the packed tarball, as with `packPackage`, because only the installed `dist/` is instrumented.
454
- - A process killed by a signal writes no coverage. An `exit` listener that the package adds in the same tick as a synchronous `process.exit()` isn't counted.
455
-
456
- Import it only from a preload. Imported from a test file, its `afterAll` would be scoped to that file, so the report would run after that file instead of after the whole run.
457
-
458
449
  ## GitHub Actions
459
450
 
460
451
  This repo hosts three reusable workflows you can call from other projects instead of copy/pasting them. The calling project must use `bun`, have a `bask.ts` that re-exports the base tasks (see [bask tasks](#bask-tasks)), and have a commitlint config (e.g. via these configs). The workflows set up bun, actionlint, and OpenTofu themselves.
@@ -618,3 +609,5 @@ The `prepare` task runs `tofu init -upgrade`, and the `tofu-check` task (which `
618
609
  bun links a dependency's `package.json` bin executables into the local `node_modules/.bin`, but not the bins of the package being developed itself. This repo depends on itself (`"@adamhl8/configs": "file:."`) so that its own bins can be run directly, e.g. `adamhl8-bunfig` instead of `src/adamhl8-bunfig/index.ts`. That's also why this repo's `bask.ts` runs `tsdown` before the `prepare` task: the bins point at `dist/`, so those builds need to be available.
619
610
 
620
611
  With bun's `isolated` linker, the self-dependency is a copy made at install time. After adding or moving an export, run `bun install --force` to refresh the copy, or type checks of code that imports the new export fail.
612
+
613
+ `bun.lock` records this repo's bins on the self-dependency's entry, and `bun install` doesn't update an existing entry. After adding a bin, add it to that entry by hand, or `bun install` fails in the `prepare` task with `Script not found`. Running `rm bun.lock && bun install` also updates the entry, but it can pick up newer dependency versions.
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bun
2
+ import bun from "bun";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { isPlainObject } from "es-toolkit/predicate";
5
+ const keysOf = (value) => isPlainObject(value) ? Object.keys(value) : [];
6
+ const DECLARATION_FILE = /\.d\.[cm]?ts$/v;
7
+ /** Checks an `exports` value, at any depth, for a `types` condition or a path to a declaration file. */
8
+ const exportsDeclareTypes = (value) => {
9
+ if (typeof value === "string") return DECLARATION_FILE.test(value);
10
+ if (Array.isArray(value)) return value.some(exportsDeclareTypes);
11
+ if (!isPlainObject(value)) return false;
12
+ return "types" in value || Object.values(value).some(exportsDeclareTypes);
13
+ };
14
+ /**
15
+ * Reads the project's `package.json` fields that the base configs branch on. `dependencies` merges the regular, dev,
16
+ * and peer dependency names. `publishesTypes` is true when the `package.json` declares types.
17
+ */
18
+ const readProjectPackageJson = () => {
19
+ const packageJson = existsSync("package.json") ? JSON.parse(readFileSync("package.json", "utf8")) : {};
20
+ const fields = isPlainObject(packageJson) ? packageJson : {};
21
+ return {
22
+ dependencies: new Set([
23
+ "dependencies",
24
+ "devDependencies",
25
+ "peerDependencies"
26
+ ].flatMap((field) => keysOf(fields[field]))),
27
+ engines: new Set(keysOf(fields["engines"])),
28
+ publishesTypes: "types" in fields || "typings" in fields || exportsDeclareTypes(fields["exports"])
29
+ };
30
+ };
31
+ const TSCONFIG_PATH = "tsconfig.json";
32
+ const DTS_CONFIG = "@adamhl8/configs/tsconfig";
33
+ const NO_DTS_CONFIG = "@adamhl8/configs/tsconfig/no-dts";
34
+ const MANAGED_EXTENDS = /(?<key>"extends"\s*:\s*)"@adamhl8\/configs\/tsconfig(?:\/no-dts)?"/v;
35
+ const tsconfigFile = bun.file(TSCONFIG_PATH);
36
+ if (await tsconfigFile.exists()) {
37
+ const { publishesTypes } = readProjectPackageJson();
38
+ const config = publishesTypes ? DTS_CONFIG : NO_DTS_CONFIG;
39
+ const current = await tsconfigFile.text();
40
+ const updated = current.replace(MANAGED_EXTENDS, `$<key>"${config}"`);
41
+ if (updated !== current) await bun.write(TSCONFIG_PATH, updated);
42
+ }
43
+ export {};
@@ -6,5 +6,4 @@ export declare const lint: import("@adamhl8/bask").Task;
6
6
  export declare const build: import("@adamhl8/bask").Task;
7
7
  export declare const release: import("@adamhl8/bask").Task;
8
8
  export declare const releaseRun: import("@adamhl8/bask").Task;
9
- export declare const commitTypes: import("@adamhl8/bask").Task;
10
- //# sourceMappingURL=bask.base.d.ts.map
9
+ export declare const commitTypes: import("@adamhl8/bask").Task;
@@ -1,3 +1,4 @@
1
+ import { readDependencyRanges, reportDependencyChanges } from "../dep-report/dep-report.js";
1
2
  import { resolveProjectTailwind } from "../utils.js";
2
3
  import { existsSync } from "node:fs";
3
4
  import { list, task } from "@adamhl8/bask";
@@ -19,26 +20,32 @@ const tofuCheck = task(async ({ sh }) => {
19
20
  });
20
21
  const prepare = task(async ({ sh }) => {
21
22
  if (!inCi) await sh`lefthook install`;
22
- await sh`bun adamhl8-gitignore`;
23
- await sh`bun adamhl8-bunfig`;
24
- await sh`bun oxfmt bunfig.toml`;
23
+ await sh`adamhl8-gitignore`;
24
+ await sh`adamhl8-bunfig`;
25
+ await sh`adamhl8-tsconfig`;
26
+ await sh`oxfmt bunfig.toml`;
25
27
  if (await canRunTofu()) await sh`tofu init -upgrade`;
26
28
  });
29
+ let rangesBeforeBump = /* @__PURE__ */ new Map();
27
30
  const bumpDeps = task(async ({ sh }) => {
28
31
  await sh`bunx npm-check-updates --upgrade --format group`;
29
32
  await sh`rm -f bun.lock`;
30
33
  await sh`rm -rf node_modules/`;
31
34
  await sh`bun install --no-summary --no-cache`;
35
+ if (!inCi) await reportDependencyChanges(rangesBeforeBump);
36
+ });
37
+ bumpDeps.before(() => {
38
+ rangesBeforeBump = readDependencyRanges();
32
39
  });
33
40
  const test = task(async ({ sh }) => {
34
41
  await sh`bun test --pass-with-no-tests`.echo(false);
35
42
  });
36
43
  const lint = task(async ({ sh }) => {
37
- await sh`bun markdown-toc -i --bullets - --maxdepth 3 ./README.md`;
38
- await sh`bun oxlint --fix --fix-suggestions --fix-dangerously`;
39
- await sh`bun oxfmt`;
44
+ await sh`markdown-toc -i --bullets - --maxdepth 3 ./README.md`;
45
+ await sh`oxlint --fix --fix-suggestions --fix-dangerously`;
46
+ await sh`oxfmt`;
40
47
  if (resolveProjectTailwind()) {
41
- if ((await lsFiles([":(glob)**/*.astro"])).length > 0) await sh`bun tailwint "**/*.astro"`;
48
+ if ((await lsFiles([":(glob)**/*.astro"])).length > 0) await sh`tailwint "**/*.astro"`;
42
49
  }
43
50
  const tofuFiles = await lsFiles([
44
51
  ":(glob)**/*.tf",
@@ -48,13 +55,15 @@ const lint = task(async ({ sh }) => {
48
55
  ":(glob)**/*.tofutest.hcl"
49
56
  ]);
50
57
  if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`;
51
- await sh`bun knip-bun`;
58
+ await sh`tsc`;
59
+ await sh`knip-bun`;
60
+ await sh`knip-bun --production`;
52
61
  if (existsSync(".github/workflows")) await sh`actionlint`;
53
62
  await test();
54
63
  });
55
64
  const build = task(async ({ sh }) => {
56
65
  await lint();
57
- if (await bun.file("tsdown.config.ts").exists()) await sh`bun tsdown`;
66
+ if (await bun.file("tsdown.config.ts").exists()) await sh`tsdown`;
58
67
  if (inCi) {
59
68
  await sh`git add --intent-to-add --all`;
60
69
  await sh`git diff --exit-code`;
@@ -65,10 +74,10 @@ const release = task(async ({ sh }) => {
65
74
  await sh`gh workflow run release.yml`;
66
75
  });
67
76
  const releaseRun = task({ hidden: true }, async ({ sh }) => {
68
- await sh`bun release-it -VV --ci`;
77
+ await sh`release-it -VV --ci`;
69
78
  });
70
79
  const commitTypes = task(async ({ sh }) => {
71
- const { 2: types } = (await sh`bun commitlint --print-config json`.echo(false).json()).rules["type-enum"];
80
+ const { 2: types } = (await sh`commitlint --print-config json`.echo(false).json()).rules["type-enum"];
72
81
  console.log(`Commit types:\n ${types.join("\n ")}`);
73
82
  });
74
83
  list.after(async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"bask.base.js","names":[],"sources":["../../src/configs/bask.base.ts"],"sourcesContent":["import { existsSync } from \"node:fs\"\n\nimport { list, task } from \"@adamhl8/bask\"\nimport bun, { $, Glob } from \"bun\"\n\nimport { resolveProjectTailwind } from \"#utils.ts\"\n\nconst inCi = Boolean(process.env[\"CI\"])\n\n/** Lists tracked and untracked files matching the pathspecs, skipping gitignored ones. */\nconst lsFiles = async (pathspecs: string[]) => {\n const output = await $`git ls-files -z --cached --others --exclude-standard -- ${pathspecs}`.quiet().text()\n return output.split(\"\\0\").filter(Boolean)\n}\n\n/** Checks that we're not in CI, the repo has a root tofu module, and the aws profile exists on this machine. */\nconst canRunTofu = async () => {\n if (inCi) return false\n const tofuFiles = await Array.fromAsync(new Glob(\"*.tofu\").scan())\n if (tofuFiles.length === 0) return false\n const profiles = await $`aws configure list-profiles`.nothrow().quiet().text()\n return profiles.split(\"\\n\").includes(\"adamhl8\")\n}\n\nexport const tofuCheck = task(async ({ sh }) => {\n if (await canRunTofu()) await sh`tofu plan -detailed-exitcode -concise -compact-warnings`\n})\n\nexport const prepare = task(async ({ sh }) => {\n // Skip `lefthook install` in CI so commits made by the workflows don't run the hooks.\n if (!inCi) await sh`lefthook install`\n await sh`bun adamhl8-gitignore`\n await sh`bun adamhl8-bunfig`\n await sh`bun oxfmt bunfig.toml`\n if (await canRunTofu()) await sh`tofu init -upgrade`\n})\n\nexport const bumpDeps = task(async ({ sh }) => {\n await sh`bunx npm-check-updates --upgrade --format group`\n await sh`rm -f bun.lock`\n await sh`rm -rf node_modules/`\n await sh`bun install --no-summary --no-cache`\n})\n\nexport const test = task(async ({ sh }) => {\n await sh`bun test --pass-with-no-tests`.echo(false)\n})\n\nexport const lint = task(async ({ sh }) => {\n await sh`bun markdown-toc -i --bullets - --maxdepth 3 ./README.md`\n await sh`bun oxlint --fix --fix-suggestions --fix-dangerously`\n await sh`bun oxfmt`\n\n if (resolveProjectTailwind()) {\n // Check for `.astro` files first so projects without them don't need tailwint installed.\n const astroFiles = await lsFiles([\":(glob)**/*.astro\"])\n // Skip `--fix` because tailwint resolves a class conflict by deleting a class by position, not by which one wins.\n if (astroFiles.length > 0) await sh`bun tailwint \"**/*.astro\"`\n }\n\n const tofuFiles = await lsFiles([\n \":(glob)**/*.tf\",\n \":(glob)**/*.tofu\",\n \":(glob)**/*.tfvars\",\n \":(glob)**/*.tftest.hcl\",\n \":(glob)**/*.tofutest.hcl\",\n ])\n if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`\n\n await sh`bun knip-bun`\n if (existsSync(\".github/workflows\")) await sh`actionlint`\n await test()\n})\n\nexport const build = task(async ({ sh }) => {\n await lint()\n if (await bun.file(\"tsdown.config.ts\").exists()) await sh`bun tsdown`\n // Fail in CI if the build changed or created any files, because lint fixes and formatting are applied in place.\n // `--intent-to-add` makes untracked files show up in the diff.\n if (inCi) {\n await sh`git add --intent-to-add --all`\n await sh`git diff --exit-code`\n }\n await tofuCheck()\n})\n\nexport const release = task(async ({ sh }) => {\n await sh`gh workflow run release.yml`\n})\n\nexport const releaseRun = task({ hidden: true }, async ({ sh }) => {\n await sh`bun release-it -VV --ci`\n})\n\nexport const commitTypes = task(async ({ sh }) => {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `commitlint --print-config json` prints\n const config = (await sh`bun commitlint --print-config json`.echo(false).json()) as {\n rules: { \"type-enum\": [number, string, string[]] }\n }\n const { 2: types } = config.rules[\"type-enum\"]\n console.log(`Commit types:\\n ${types.join(\"\\n \")}`)\n})\n\nlist.after(async () => {\n console.log()\n await commitTypes()\n})\n"],"mappings":";;;;;AAOA,MAAM,OAAO,QAAQ,QAAQ,IAAI,KAAK;;AAGtC,MAAM,UAAU,OAAO,cAAwB;CAE7C,QAAO,MADc,CAAC,2DAA2D,YAAY,MAAM,CAAC,CAAC,KAAK,EAAA,CAC5F,MAAM,IAAI,CAAC,CAAC,OAAO,OAAO;AAC1C;;AAGA,MAAM,aAAa,YAAY;CAC7B,IAAI,MAAM,OAAO;CAEjB,KAAI,MADoB,MAAM,UAAU,IAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAA,CACnD,WAAW,GAAG,OAAO;CAEnC,QAAO,MADgB,CAAC,8BAA8B,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAA,CAC7D,MAAM,IAAI,CAAC,CAAC,SAAS,SAAS;AAChD;AAEA,MAAa,YAAY,KAAK,OAAO,EAAE,SAAS;CAC9C,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE;AAClC,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAE5C,IAAI,CAAC,MAAM,MAAM,EAAE;CACnB,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE;AAClC,CAAC;AAED,MAAa,WAAW,KAAK,OAAO,EAAE,SAAS;CAC7C,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;AACV,CAAC;AAED,MAAa,OAAO,KAAK,OAAO,EAAE,SAAS;CACzC,MAAM,EAAE,gCAAgC,KAAK,KAAK;AACpD,CAAC;AAED,MAAa,OAAO,KAAK,OAAO,EAAE,SAAS;CACzC,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CAER,IAAI,uBAAuB,GAIrB;OAAA,MAFqB,QAAQ,CAAC,mBAAmB,CAAC,EAAA,CAEvC,SAAS,GAAG,MAAM,EAAE;CAAA;CAGrC,MAAM,YAAY,MAAM,QAAQ;EAC9B;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,IAAI,UAAU,SAAS,GAAG,MAAM,EAAE,YAAY;CAE9C,MAAM,EAAE;CACR,IAAI,WAAW,mBAAmB,GAAG,MAAM,EAAE;CAC7C,MAAM,KAAK;AACb,CAAC;AAED,MAAa,QAAQ,KAAK,OAAO,EAAE,SAAS;CAC1C,MAAM,KAAK;CACX,IAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC,CAAC,OAAO,GAAG,MAAM,EAAE;CAGzD,IAAI,MAAM;EACR,MAAM,EAAE;EACR,MAAM,EAAE;CACV;CACA,MAAM,UAAU;AAClB,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAC5C,MAAM,EAAE;AACV,CAAC;AAED,MAAa,aAAa,KAAK,EAAE,QAAQ,KAAK,GAAG,OAAO,EAAE,SAAS;CACjE,MAAM,EAAE;AACV,CAAC;AAED,MAAa,cAAc,KAAK,OAAO,EAAE,SAAS;CAKhD,MAAM,EAAE,GAAG,WAAU,MAHC,EAAE,qCAAqC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAA,CAGlD,MAAM;CAClC,QAAQ,IAAI,sBAAsB,MAAM,KAAK,QAAQ,GAAG;AAC1D,CAAC;AAED,KAAK,MAAM,YAAY;CACrB,QAAQ,IAAI;CACZ,MAAM,YAAY;AACpB,CAAC"}
1
+ {"version":3,"file":"bask.base.js","names":[],"sources":["../../src/configs/bask.base.ts"],"sourcesContent":["import { existsSync } from \"node:fs\"\n\nimport { list, task } from \"@adamhl8/bask\"\nimport bun, { $, Glob } from \"bun\"\n\nimport { readDependencyRanges, reportDependencyChanges } from \"#dep-report/dep-report.ts\"\nimport { resolveProjectTailwind } from \"#utils.ts\"\n\nconst inCi = Boolean(process.env[\"CI\"])\n\n/** Lists tracked and untracked files matching the pathspecs, skipping gitignored ones. */\nconst lsFiles = async (pathspecs: string[]) => {\n const output = await $`git ls-files -z --cached --others --exclude-standard -- ${pathspecs}`.quiet().text()\n return output.split(\"\\0\").filter(Boolean)\n}\n\n/** Checks that we're not in CI, the repo has a root tofu module, and the aws profile exists on this machine. */\nconst canRunTofu = async () => {\n if (inCi) return false\n const tofuFiles = await Array.fromAsync(new Glob(\"*.tofu\").scan())\n if (tofuFiles.length === 0) return false\n const profiles = await $`aws configure list-profiles`.nothrow().quiet().text()\n return profiles.split(\"\\n\").includes(\"adamhl8\")\n}\n\nexport const tofuCheck = task(async ({ sh }) => {\n if (await canRunTofu()) await sh`tofu plan -detailed-exitcode -concise -compact-warnings`\n})\n\nexport const prepare = task(async ({ sh }) => {\n // Skip `lefthook install` in CI so commits made by the workflows don't run the hooks.\n if (!inCi) await sh`lefthook install`\n await sh`adamhl8-gitignore`\n await sh`adamhl8-bunfig`\n await sh`adamhl8-tsconfig`\n await sh`oxfmt bunfig.toml`\n if (await canRunTofu()) await sh`tofu init -upgrade`\n})\n\nlet rangesBeforeBump = new Map<string, string>()\n\nexport const bumpDeps = task(async ({ sh }) => {\n await sh`bunx npm-check-updates --upgrade --format group`\n await sh`rm -f bun.lock`\n await sh`rm -rf node_modules/`\n await sh`bun install --no-summary --no-cache`\n if (!inCi) await reportDependencyChanges(rangesBeforeBump)\n})\n\n// Register the snapshot here so it runs before a project's own `before` hooks, which can bump ranges too.\nbumpDeps.before(() => {\n rangesBeforeBump = readDependencyRanges()\n})\n\nexport const test = task(async ({ sh }) => {\n await sh`bun test --pass-with-no-tests`.echo(false)\n})\n\nexport const lint = task(async ({ sh }) => {\n await sh`markdown-toc -i --bullets - --maxdepth 3 ./README.md`\n await sh`oxlint --fix --fix-suggestions --fix-dangerously`\n await sh`oxfmt`\n\n if (resolveProjectTailwind()) {\n // Check for `.astro` files first so projects without them don't need tailwint installed.\n const astroFiles = await lsFiles([\":(glob)**/*.astro\"])\n // Skip `--fix` because tailwint resolves a class conflict by deleting a class by position, not by which one wins.\n if (astroFiles.length > 0) await sh`tailwint \"**/*.astro\"`\n }\n\n const tofuFiles = await lsFiles([\n \":(glob)**/*.tf\",\n \":(glob)**/*.tofu\",\n \":(glob)**/*.tfvars\",\n \":(glob)**/*.tftest.hcl\",\n \":(glob)**/*.tofutest.hcl\",\n ])\n if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`\n\n await sh`tsc`\n await sh`knip-bun`\n await sh`knip-bun --production`\n if (existsSync(\".github/workflows\")) await sh`actionlint`\n await test()\n})\n\nexport const build = task(async ({ sh }) => {\n await lint()\n if (await bun.file(\"tsdown.config.ts\").exists()) await sh`tsdown`\n // Fail in CI if the build changed or created any files, because lint fixes and formatting are applied in place.\n // `--intent-to-add` makes untracked files show up in the diff.\n if (inCi) {\n await sh`git add --intent-to-add --all`\n await sh`git diff --exit-code`\n }\n await tofuCheck()\n})\n\nexport const release = task(async ({ sh }) => {\n await sh`gh workflow run release.yml`\n})\n\nexport const releaseRun = task({ hidden: true }, async ({ sh }) => {\n await sh`release-it -VV --ci`\n})\n\nexport const commitTypes = task(async ({ sh }) => {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `commitlint --print-config json` prints\n const config = (await sh`commitlint --print-config json`.echo(false).json()) as {\n rules: { \"type-enum\": [number, string, string[]] }\n }\n const { 2: types } = config.rules[\"type-enum\"]\n console.log(`Commit types:\\n ${types.join(\"\\n \")}`)\n})\n\nlist.after(async () => {\n console.log()\n await commitTypes()\n})\n"],"mappings":";;;;;;AAQA,MAAM,OAAO,QAAQ,QAAQ,IAAI,KAAK;;AAGtC,MAAM,UAAU,OAAO,cAAwB;CAE7C,QAAO,MADc,CAAC,2DAA2D,YAAY,MAAM,CAAC,CAAC,KAAK,EAAA,CAC5F,MAAM,IAAI,CAAC,CAAC,OAAO,OAAO;AAC1C;;AAGA,MAAM,aAAa,YAAY;CAC7B,IAAI,MAAM,OAAO;CAEjB,KAAI,MADoB,MAAM,UAAU,IAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAA,CACnD,WAAW,GAAG,OAAO;CAEnC,QAAO,MADgB,CAAC,8BAA8B,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAA,CAC7D,MAAM,IAAI,CAAC,CAAC,SAAS,SAAS;AAChD;AAEA,MAAa,YAAY,KAAK,OAAO,EAAE,SAAS;CAC9C,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE;AAClC,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAE5C,IAAI,CAAC,MAAM,MAAM,EAAE;CACnB,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE;AAClC,CAAC;AAED,IAAI,mCAAmB,IAAI,IAAoB;AAE/C,MAAa,WAAW,KAAK,OAAO,EAAE,SAAS;CAC7C,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,IAAI,CAAC,MAAM,MAAM,wBAAwB,gBAAgB;AAC3D,CAAC;AAGD,SAAS,aAAa;CACpB,mBAAmB,qBAAqB;AAC1C,CAAC;AAED,MAAa,OAAO,KAAK,OAAO,EAAE,SAAS;CACzC,MAAM,EAAE,gCAAgC,KAAK,KAAK;AACpD,CAAC;AAED,MAAa,OAAO,KAAK,OAAO,EAAE,SAAS;CACzC,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CAER,IAAI,uBAAuB,GAIrB;OAAA,MAFqB,QAAQ,CAAC,mBAAmB,CAAC,EAAA,CAEvC,SAAS,GAAG,MAAM,EAAE;CAAA;CAGrC,MAAM,YAAY,MAAM,QAAQ;EAC9B;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,IAAI,UAAU,SAAS,GAAG,MAAM,EAAE,YAAY;CAE9C,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,IAAI,WAAW,mBAAmB,GAAG,MAAM,EAAE;CAC7C,MAAM,KAAK;AACb,CAAC;AAED,MAAa,QAAQ,KAAK,OAAO,EAAE,SAAS;CAC1C,MAAM,KAAK;CACX,IAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC,CAAC,OAAO,GAAG,MAAM,EAAE;CAGzD,IAAI,MAAM;EACR,MAAM,EAAE;EACR,MAAM,EAAE;CACV;CACA,MAAM,UAAU;AAClB,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAC5C,MAAM,EAAE;AACV,CAAC;AAED,MAAa,aAAa,KAAK,EAAE,QAAQ,KAAK,GAAG,OAAO,EAAE,SAAS;CACjE,MAAM,EAAE;AACV,CAAC;AAED,MAAa,cAAc,KAAK,OAAO,EAAE,SAAS;CAKhD,MAAM,EAAE,GAAG,WAAU,MAHC,EAAE,iCAAiC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAA,CAG9C,MAAM;CAClC,QAAQ,IAAI,sBAAsB,MAAM,KAAK,QAAQ,GAAG;AAC1D,CAAC;AAED,KAAK,MAAM,YAAY;CACrB,QAAQ,IAAI;CACZ,MAAM,YAAY;AACpB,CAAC"}
@@ -5,5 +5,4 @@ export declare const commitlintConfig: OptionalMergeConfigFn<UserConfig, {
5
5
  readonly rules: {
6
6
  readonly "type-enum": readonly [2, "always", string[]];
7
7
  };
8
- }>;
9
- //# sourceMappingURL=commitlint.base.d.ts.map
8
+ }>;
@@ -1 +1 @@
1
- {"version":3,"file":"commitlint.base.js","names":[],"sources":["../../src/configs/commitlint.base.ts"],"sourcesContent":["import conventional from \"@commitlint/config-conventional\"\nimport type { UserConfig } from \"@commitlint/types\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\nconst [_severity, _condition, conventionalTypes] = conventional.rules[\"type-enum\"]\n\nconst EXCLUDED_TYPES = new Set([\"test\", \"style\", \"build\"])\nconst filteredTypes = conventionalTypes.filter((type) => !EXCLUDED_TYPES.has(type))\nconst commitTypes = [...filteredTypes, \"improve\", \"release\"]\n\nconst baseConfig = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"type-enum\": [2, \"always\", commitTypes],\n },\n} as const satisfies UserConfig\n\nexport const commitlintConfig = createMergeConfigFn<UserConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAKA,MAAM,CAAC,WAAW,YAAY,qBAAqB,aAAa,MAAM;AAEtE,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAQ;CAAS;AAAO,CAAC;AAIzD,MAAM,aAAa;CACjB,SAAS,CAAC,iCAAiC;CAC3C,OAAO,EACL,aAAa;EAAC;EAAG;EAAU;GALV,GADC,kBAAkB,QAAQ,SAAS,CAAC,eAAe,IAAI,IAAI,CAC7C;GAAG;GAAW;EAKT;CAAC,EACxC;AACF;AAEA,MAAa,mBAAmB,oBAAmD,UAAU"}
1
+ {"version":3,"file":"commitlint.base.js","names":[],"sources":["../../src/configs/commitlint.base.ts"],"sourcesContent":["import conventional from \"@commitlint/config-conventional\"\nimport type { UserConfig } from \"@commitlint/types\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\nconst [_severity, _condition, conventionalTypes] = conventional.rules[\"type-enum\"]\n\nconst EXCLUDED_TYPES = new Set([\"test\", \"style\", \"build\"])\nconst filteredTypes = conventionalTypes.filter((type) => !EXCLUDED_TYPES.has(type))\nconst commitTypes = [...filteredTypes, \"improve\", \"release\"]\n\nconst baseConfig = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n // oxlint-disable-next-line typescript/no-unsafe-enum-assignment - use `2` because the enum leaks into consumer types\n \"type-enum\": [2, \"always\", commitTypes],\n },\n} as const satisfies UserConfig\n\nexport const commitlintConfig = createMergeConfigFn<UserConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAKA,MAAM,CAAC,WAAW,YAAY,qBAAqB,aAAa,MAAM;AAEtE,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAQ;CAAS;AAAO,CAAC;AAIzD,MAAM,aAAa;CACjB,SAAS,CAAC,iCAAiC;CAC3C,OAAO,EAEL,aAAa;EAAC;EAAG;EAAU;GANV,GADC,kBAAkB,QAAQ,SAAS,CAAC,eAAe,IAAI,IAAI,CAC7C;GAAG;GAAW;EAMT;CAAC,EACxC;AACF;AAEA,MAAa,mBAAmB,oBAAmD,UAAU"}
@@ -0,0 +1,7 @@
1
+ import { commitlintConfig } from "./commitlint.base.js";
2
+ import { KnipArgs, knipConfig } from "./knip.base.js";
3
+ import { oxfmtConfig } from "./oxfmt.base.js";
4
+ import { oxlintConfig } from "./oxlint.base.js";
5
+ import { releaseItConfig } from "./release-it.base.js";
6
+ import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./tsdown.base.js";
7
+ export { type KnipArgs, commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
@@ -0,0 +1,7 @@
1
+ import { commitlintConfig } from "./commitlint.base.js";
2
+ import { knipConfig } from "./knip.base.js";
3
+ import { oxfmtConfig } from "./oxfmt.base.js";
4
+ import { oxlintConfig } from "./oxlint.base.js";
5
+ import { releaseItConfig } from "./release-it.base.js";
6
+ import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./tsdown.base.js";
7
+ export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
@@ -1,5 +1,4 @@
1
1
  node_modules/
2
2
  dist/
3
- /coverage/
4
3
  .terraform
5
4
  .terraform.lock.hcl
@@ -1,9 +1,20 @@
1
- import { OptionalMergeConfigFn } from "../merge-config/merge-config.js";
2
- import { KnipConfig } from "knip";
3
- export declare const knipConfig: OptionalMergeConfigFn<KnipConfig, {
4
- readonly project: ["**/*", "!**/fixtures/**", "!**/fixture/**"];
1
+ import { ArgsMergeConfigFn } from "../merge-config/merge-config.js";
2
+ import { KnipConfig, KnipConfiguration } from "knip";
3
+ type KnipCliArgs = Parameters<Extract<KnipConfig, (...args: never[]) => unknown>>[0];
4
+ /**
5
+ * The CLI arguments knip passes to its config. Wrap them in an interface so a hover shows `KnipArgs` instead of every
6
+ * option. Export it so a project's `knip.ts` can name it in its declarations.
7
+ */
8
+ export interface KnipArgs extends KnipCliArgs {}
9
+ /** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */
10
+ declare const createBaseConfig: ({ production }: KnipArgs) => {
11
+ readonly project: ["**/*!", "!**/__tests__/**!", "!**/fixtures/**", "!**/fixture/**"];
5
12
  readonly bun: {
6
13
  readonly entry: ["**/*.test.ts", "bask.ts"];
7
14
  };
8
- }>;
9
- //# sourceMappingURL=knip.base.d.ts.map
15
+ readonly ignoreExportsUsedInFile: boolean;
16
+ readonly exclude: [] | ["binaries"];
17
+ };
18
+ type BaseConfig = ReturnType<typeof createBaseConfig>;
19
+ export declare const knipConfig: ArgsMergeConfigFn<KnipConfiguration, BaseConfig, KnipArgs>;
20
+ export {};
@@ -1,12 +1,21 @@
1
- import { createMergeConfigFn } from "../merge-config/merge-config.js";
2
- const knipConfig = createMergeConfigFn({
3
- project: [
4
- "**/*",
5
- "!**/fixtures/**",
6
- "!**/fixture/**"
7
- ],
8
- bun: { entry: ["**/*.test.ts", "bask.ts"] }
9
- });
1
+ import { createArgsMergeConfigFn } from "../merge-config/merge-config.js";
2
+ // src/configs/knip.base.ts
3
+ /** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */
4
+ const createBaseConfig = ({ production }) => {
5
+ const isProduction = production === true;
6
+ return {
7
+ project: [
8
+ "**/*!",
9
+ "!**/__tests__/**!",
10
+ "!**/fixtures/**",
11
+ "!**/fixture/**"
12
+ ],
13
+ bun: { entry: ["**/*.test.ts", "bask.ts"] },
14
+ ignoreExportsUsedInFile: isProduction,
15
+ exclude: isProduction ? ["binaries"] : []
16
+ };
17
+ };
18
+ const knipConfig = createArgsMergeConfigFn(createBaseConfig);
10
19
  export { knipConfig };
11
20
 
12
21
  //# sourceMappingURL=knip.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\nconst baseConfig = {\n // Exclude fixtures with negated `project` globs because knip hints to remove an `ignore` glob that hides nothing.\n project: [\"**/*\", \"!**/fixtures/**\", \"!**/fixture/**\"],\n bun: {\n // List `bask.ts` because bask loads it by path and nothing imports it.\n // Add it here because a top-level `entry` replaces knip's default entries.\n entry: [\"**/*.test.ts\", \"bask.ts\"],\n },\n} as const satisfies KnipConfig\n\nexport const knipConfig = createMergeConfigFn<KnipConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";AAcA,MAAa,aAAa,oBAAmD;CAR3E,SAAS;EAAC;EAAQ;EAAmB;CAAgB;CACrD,KAAK,EAGH,OAAO,CAAC,gBAAgB,SAAS,EACnC;AAG2E,CAAU"}
1
+ {"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig, KnipConfiguration } from \"knip\"\n\nimport type { ArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\ntype KnipCliArgs = Parameters<Extract<KnipConfig, (...args: never[]) => unknown>>[0]\n\n/**\n * The CLI arguments knip passes to its config. Wrap them in an interface so a hover shows `KnipArgs` instead of every\n * option. Export it so a project's `knip.ts` can name it in its declarations.\n */\n// oxlint-disable-next-line typescript/no-empty-interface, typescript/no-empty-object-type - name knip's CLI args so a hover shows the name, not every option\nexport interface KnipArgs extends KnipCliArgs {}\n\n/** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */\nconst createBaseConfig = ({ production }: KnipArgs) => {\n const isProduction = production === true\n return {\n // Mark `**/*` with `!`, because `knip --production` only reads marked patterns.\n // Mark the `__tests__` exclusion too, so it applies only to the production run.\n // Exclude fixtures with negated `project` globs because knip hints to remove an `ignore` glob that hides nothing.\n project: [\"**/*!\", \"!**/__tests__/**!\", \"!**/fixtures/**\", \"!**/fixture/**\"],\n bun: {\n // List `bask.ts` because bask loads it by path and nothing imports it.\n // Add it here because a top-level `entry` replaces knip's default entries.\n entry: [\"**/*.test.ts\", \"bask.ts\"],\n },\n // Keep an export that its own module uses, so a test can import it from that module.\n // A re-export that only tests use still shows up, so a package's main module exports only what runtime code uses.\n ignoreExportsUsedInFile: isProduction,\n // Skip binaries in the production run, because it ignores devDependencies and reports the dev tools that configs run.\n // Mark each branch `as const`, because the outer `as const` doesn't reach into a conditional.\n exclude: isProduction ? ([\"binaries\"] as const) : ([] as const),\n } as const satisfies KnipConfiguration\n}\n\ntype BaseConfig = ReturnType<typeof createBaseConfig>\n\n// Return the config as a function, because knip calls it with its CLI arguments and the production run needs its own settings.\n// Annotate the export so the published types name knip's types instead of spelling them out.\nexport const knipConfig: ArgsMergeConfigFn<KnipConfiguration, BaseConfig, KnipArgs> = createArgsMergeConfigFn<\n KnipConfiguration,\n BaseConfig,\n KnipArgs\n>(createBaseConfig)\n"],"mappings":";;;AAeA,MAAM,oBAAoB,EAAE,iBAA2B;CACrD,MAAM,eAAe,eAAe;CACpC,OAAO;EAIL,SAAS;GAAC;GAAS;GAAqB;GAAmB;EAAgB;EAC3E,KAAK,EAGH,OAAO,CAAC,gBAAgB,SAAS,EACnC;EAGA,yBAAyB;EAGzB,SAAS,eAAgB,CAAC,UAAU,IAAe,CAAC;CACtD;AACF;AAMA,MAAa,aAAyE,wBAIpF,gBAAgB"}
@@ -17,5 +17,4 @@ export declare const oxfmtConfig: OptionalMergeConfigFn<OxfmtConfig, {
17
17
  readonly sortTailwindcss: true | {
18
18
  stylesheet: string;
19
19
  };
20
- }>;
21
- //# sourceMappingURL=oxfmt.base.d.ts.map
20
+ }>;
@@ -5,7 +5,7 @@ export declare const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, {
5
5
  options: {
6
6
  readonly reportUnusedDisableDirectives: "error";
7
7
  readonly typeAware: true;
8
- readonly typeCheck: true;
8
+ readonly typeCheck: false;
9
9
  };
10
10
  categories: {
11
11
  readonly correctness: "error";
@@ -152,5 +152,4 @@ export declare const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, {
152
152
  [k: string]: unknown;
153
153
  };
154
154
  }>;
155
- export {};
156
- //# sourceMappingURL=oxlint.base.d.ts.map
155
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { createMergeConfigFn } from "../merge-config/merge-config.js";
2
2
  import { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from "../utils.js";
3
- import cleanModulesPlugin from "@adamhl8/eslint-plugin-clean-modules";
3
+ import cleanModulesPlugin from "@adamhl8/oxlint-plugin-clean-modules";
4
+ import packageBoundariesPlugin from "@adamhl8/oxlint-plugin-package-boundaries";
4
5
  import e18ePlugin from "@e18e/eslint-plugin";
5
6
  import bunismsPlugin from "eslint-plugin-bunisms";
6
7
  import honoPlugin from "eslint-plugin-hono";
@@ -31,7 +32,7 @@ const plugins = {
31
32
  rules: { "bunisms/prefer-mock-restore-in-after-each": "off" }
32
33
  },
33
34
  "clean-modules": {
34
- package: "@adamhl8/eslint-plugin-clean-modules",
35
+ package: "@adamhl8/oxlint-plugin-clean-modules",
35
36
  pluginRules: cleanModulesPlugin.rules
36
37
  },
37
38
  "directive-comments": {
@@ -68,6 +69,14 @@ const plugins = {
68
69
  pluginRules: honoPlugin.rules,
69
70
  rules: { "hono/no-process-env": "off" }
70
71
  },
72
+ "package-boundaries": {
73
+ overrides: [{
74
+ files: ["**/__tests__/**", "**/*.test.{ts,tsx}"],
75
+ rules: setAllPluginRules("package-boundaries", packageBoundariesPlugin.rules, "off")
76
+ }],
77
+ package: "@adamhl8/oxlint-plugin-package-boundaries",
78
+ pluginRules: packageBoundariesPlugin.rules
79
+ },
71
80
  "react-web-api": {
72
81
  enabled: dependencies.has("react"),
73
82
  package: "eslint-plugin-react-web-api",
@@ -121,7 +130,7 @@ const nativeConfig = {
121
130
  options: {
122
131
  reportUnusedDisableDirectives: "error",
123
132
  typeAware: true,
124
- typeCheck: true
133
+ typeCheck: false
125
134
  },
126
135
  categories: {
127
136
  correctness: "error",