@williamthorsen/toolbelt.packaging 0.8.0 โ†’ 0.9.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.
@@ -1,4 +1,39 @@
1
1
  [
2
+ {
3
+ "version": "0.9.0",
4
+ "date": "2026-11-15",
5
+ "sections": [
6
+ {
7
+ "title": "๐ŸŽ‰ Features",
8
+ "audience": "all",
9
+ "items": [
10
+ {
11
+ "description": "Makes `ProjectRoot`, the result of `findProjectRoot`, a union discriminated by `source`, in which only a `source: 'marker'` result has a `marker` property, typed `string`, and a fallback result omits `marker` rather than setting it to `null`. (#593)",
12
+ "breaking": true,
13
+ "migration": "Replace a check of `result.marker === null` with `result.source !== 'marker'`, and check `source` before reading `marker`: TypeScript rejects `result.marker` on the un-narrowed union, and in untyped code `result.marker === null` is now always `false`, because a fallback result's `marker` is `undefined`.",
14
+ "hash": "cb849ee2916e74c1afd7f1e18fe4cc2c872ec9c8",
15
+ "entry": 1
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "title": "๐Ÿงช Tests",
21
+ "audience": "dev",
22
+ "items": [
23
+ {
24
+ "description": "Deletes the `DEFAULT_ROOT_MARKERS` block from `findProjectRoot.unit.test.ts`, whose one test compared the exported list against a copy of its own value and therefore checked a value rather than any behavior of `findProjectRoot`. (#592)",
25
+ "hash": "06ec984c5734607afb590d1b48777c433786a0de",
26
+ "entry": 1
27
+ },
28
+ {
29
+ "description": "Changes the kit tool tests of `async`, `enums`, and `packaging` to select the check under test by id through `selectCheck` rather than as `kit.checks[0]`, which would run the wrong check without any report once a kit declared another check ahead of it. (#605)",
30
+ "hash": "f06e0f299b3816ef383fe03072f224c53597680a",
31
+ "entry": 1
32
+ }
33
+ ]
34
+ }
35
+ ]
36
+ },
2
37
  {
3
38
  "version": "0.8.0",
4
39
  "date": "2026-11-13",
@@ -1,6 +1,6 @@
1
1
  /** @noformat -- @generated. Do not edit. Compiled by rdy. */
2
2
  /* eslint-disable */
3
- export const __readyupVersion = "0.46.2";
3
+ export const __readyupVersion = "0.46.3";
4
4
 
5
5
 
6
6
  // ../adoption/src/conventions/path-predicates.ts
@@ -109,10 +109,10 @@
109
109
  ],
110
110
  "name": "default",
111
111
  "path": "kits/default.js",
112
- "readyupVersion": "0.46.2",
112
+ "readyupVersion": "0.46.3",
113
113
  "source": "kits/default.ts",
114
114
  "sourceHash": "ee39b238",
115
- "targetHash": "65ee85d3"
115
+ "targetHash": "43fc053f"
116
116
  }
117
117
  ]
118
118
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.9.0 โ€” 2026-11-15
6
+
7
+ ### ๐ŸŽ‰ Features
8
+
9
+ - ๐Ÿšจ **Breaking:** Makes `ProjectRoot`, the result of `findProjectRoot`, a union discriminated by `source`, in which only a `source: 'marker'` result has a `marker` property, typed `string`, and a fallback result omits `marker` rather than setting it to `null`. (#593)
10
+
11
+ ### ๐Ÿงช Tests
12
+
13
+ - Deletes the `DEFAULT_ROOT_MARKERS` block from `findProjectRoot.unit.test.ts`, whose one test compared the exported list against a copy of its own value and therefore checked a value rather than any behavior of `findProjectRoot`. (#592)
14
+ - Changes the kit tool tests of `async`, `enums`, and `packaging` to select the check under test by id through `selectCheck` rather than as `kit.checks[0]`, which would run the wrong check without any report once a kit declared another check ahead of it. (#605)
15
+
5
16
  ## 0.8.0 โ€” 2026-11-13
6
17
 
7
18
  ### ๐ŸŽ‰ Features
package/README.md CHANGED
@@ -5,12 +5,11 @@
5
5
  Package and project layout utilities for TypeScript and JavaScript: where a package or project boundary begins, and what the manifest at that boundary declares.
6
6
 
7
7
  <!-- section:release-notes -->
8
- ## Release notes โ€” v0.8.0 (2026-11-13)
8
+ ## Release notes โ€” v0.9.0 (2026-11-15)
9
9
 
10
10
  ### ๐ŸŽ‰ Features
11
11
 
12
- - Adds `findNearestManifest` to `@williamthorsen/toolbelt.packaging/candidate`, which returns the nearest `package.json` at or above a directory that a caller's predicate accepts, together with its path and directory, and throws on a manifest that is unreadable as JSON or is not a JSON object. (#590)
13
- - Changes the fix text of the `no-hand-rolled-manifest-search` adoption check to recommend `findNearestManifest` for a loop that looks for the nearest manifest declaring some other field, or the nearest manifest whatever it declares, in place of `findDirectoryChainMatch` from `@williamthorsen/toolbelt.filesystem`. (#590)
12
+ - ๐Ÿšจ **Breaking:** Makes `ProjectRoot`, the result of `findProjectRoot`, a union discriminated by `source`, in which only a `source: 'marker'` result has a `marker` property, typed `string`, and a fallback result omits `marker` rather than setting it to `null`. (#593)
14
13
  <!-- /section:release-notes -->
15
14
 
16
15
  ## Installation
@@ -32,11 +31,9 @@ findProjectRoot(startDir: string, options?: { markers?: ReadonlyArray<string> })
32
31
  Resolves `startDir` to an absolute path, ascends from it, and returns the first directory that contains a root marker, along with the evidence that identified it:
33
32
 
34
33
  ```ts
35
- interface ProjectRoot {
36
- marker: string | null; // the marker that matched, or null when a fallback identified the root
37
- rootDir: string;
38
- source: 'marker' | 'package-json' | 'start-dir';
39
- }
34
+ type ProjectRoot =
35
+ | { marker: string; rootDir: string; source: 'marker' } // marker: the marker that matched
36
+ | { rootDir: string; source: 'package-json' | 'start-dir' };
40
37
  ```
41
38
 
42
39
  `DEFAULT_ROOT_MARKERS` is consulted in order, so the earliest entry wins when one directory contains several:
@@ -58,7 +55,7 @@ findProjectRoot(process.cwd(), { markers: [...DEFAULT_ROOT_MARKERS, 'deno.json']
58
55
 
59
56
  Each marker is a path relative to the level against which it is probed, on the terms set out by [`listDirectoryChainMatches`](https://github.com/williamthorsen/toolbelt/tree/main/packages/filesystem#listdirectorychainmatches): One that is absolute, or whose `..` segments escape its level, is rejected before any directory is probed.
60
57
 
61
- When no directory up to and including the filesystem root contains a marker, the result falls back in this order, reporting a `null` marker either way:
58
+ When no directory up to and including the filesystem root contains a marker, the result falls back in this order, and a fallback result does not have a `marker` property:
62
59
 
63
60
  1. the nearest ancestor containing a `package.json`, reported as `source: 'package-json'`;
64
61
  2. `startDir` itself, reported as `source: 'start-dir'`.
@@ -13,7 +13,7 @@ export declare const DEFAULT_ROOT_MARKERS: ReadonlyArray<string>;
13
13
  *
14
14
  * Ascends from `startDir` (resolved to an absolute path) and returns the first directory that contains one of
15
15
  * `markers`. If no directory up to and including the filesystem root contains one, falls back to the nearest
16
- * ancestor containing a `package.json`, then to `startDir` itself; both fallbacks report a `null` marker.
16
+ * ancestor containing a `package.json`, then to `startDir` itself; a fallback result does not have a `marker`.
17
17
  *
18
18
  * @example
19
19
  * findProjectRoot(import.meta.dirname); // { marker: '.git', rootDir: '/home/dev/my-app', source: 'marker' }
@@ -27,10 +27,13 @@ export interface FindProjectRootOptions {
27
27
  /** Replaces (does not extend) `DEFAULT_ROOT_MARKERS`. */
28
28
  markers?: ReadonlyArray<string> | undefined;
29
29
  }
30
- export interface ProjectRoot {
31
- /** The marker that identified the root, or `null` when a fallback did. */
32
- marker: string | null;
30
+ export type ProjectRoot = {
31
+ /** The marker that identified the root. */
32
+ marker: string;
33
33
  rootDir: string;
34
- source: ProjectRootSource;
35
- }
34
+ source: 'marker';
35
+ } | {
36
+ rootDir: string;
37
+ source: Exclude<ProjectRootSource, 'marker'>;
38
+ };
36
39
  export type ProjectRootSource = 'marker' | 'package-json' | 'start-dir';
@@ -16,7 +16,7 @@ export function findProjectRoot(startDir, options = {}) {
16
16
  }
17
17
  const manifestMatch = findDirectoryChainMatch(startDir, ['package.json']);
18
18
  if (manifestMatch !== undefined) {
19
- return { marker: null, rootDir: manifestMatch.dir, source: 'package-json' };
19
+ return { rootDir: manifestMatch.dir, source: 'package-json' };
20
20
  }
21
- return { marker: null, rootDir: path.resolve(startDir), source: 'start-dir' };
21
+ return { rootDir: path.resolve(startDir), source: 'start-dir' };
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/toolbelt.packaging",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Package and project layout utilities: where a package or project boundary begins, and what its manifest declares",
5
5
  "keywords": [
6
6
  "esm",
@@ -46,15 +46,15 @@
46
46
  ".meta/changelog.json"
47
47
  ],
48
48
  "dependencies": {
49
- "@williamthorsen/toolbelt.filesystem": "0.11.0",
49
+ "@williamthorsen/toolbelt.filesystem": "0.11.1",
50
50
  "@williamthorsen/toolbelt.objects": "4.4.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@williamthorsen/toolbelt.adoption": "0.1.0",
54
- "@williamthorsen/toolbelt.strings": "9.0.0",
55
- "@williamthorsen/toolbelt.testing": "0.8.3",
54
+ "@williamthorsen/toolbelt.strings": "9.0.1",
55
+ "@williamthorsen/toolbelt.testing": "0.8.4",
56
56
  "esbuild": "0.28.2",
57
- "readyup": "0.46.2"
57
+ "readyup": "0.46.3"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=24.0.0"