@savvy-web/silk-effects 5.1.1 → 5.2.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.
- package/README.md +22 -22
- package/changesets/api/transformer.js +2 -1
- package/changesets/changelog/getDependencyReleaseLine.js +24 -5
- package/changesets/changelog/getReleaseLine.js +7 -4
- package/changesets/changelog/index.js +8 -6
- package/changesets/index.js +6 -11
- package/changesets/services/branch-analyzer.js +20 -19
- package/changesets/services/changelog.js +1 -1
- package/changesets/services/config-inspector.js +17 -17
- package/changesets/services/deps-regen.js +36 -34
- package/changesets/services/github.js +39 -40
- package/changesets/services/maintenance-reason.js +5 -1
- package/changesets/services/release-planner.js +7 -6
- package/changesets/utils/dependency-table.js +2 -1
- package/changesets/utils/jsonpath.js +5 -7
- package/changesets/utils/publishability.js +2 -2
- package/commitlint/detection/dco.js +2 -1
- package/commitlint/index.js +2 -1
- package/index.d.ts +254 -218
- package/index.js +7 -7
- package/lint/handlers/PnpmWorkspace.js +2 -1
- package/lint/handlers/Yaml.js +8 -4
- package/package.json +7 -7
- package/repos/index.js +3 -5
- package/repos/services/config-store.js +68 -67
- package/repos/services/manager.js +259 -258
- package/services/BiomeSchemaSync.js +65 -64
- package/services/ChangesetConfig.js +50 -50
- package/services/ChangesetConfigReader.js +59 -58
- package/services/ConfigDiscovery.js +42 -41
- package/services/SilkPublishability.js +54 -53
- package/services/SilkWorkspaceAnalyzer.js +110 -109
- package/turbo/index.js +2 -3
- package/turbo/services/TurboInspector.js +80 -79
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ All exports come from the package root:
|
|
|
33
33
|
```typescript
|
|
34
34
|
import {
|
|
35
35
|
SilkPublishability,
|
|
36
|
-
ChangesetConfig,
|
|
36
|
+
ChangesetConfig,
|
|
37
37
|
Changesets, Lint, Turbo,
|
|
38
38
|
} from "@savvy-web/silk-effects";
|
|
39
39
|
```
|
|
@@ -124,25 +124,25 @@ const messages = Changesets.ChangesetLinter.validateFile(".changeset/quiet-moons
|
|
|
124
124
|
|
|
125
125
|
These services read or write files. Provide the platform layer for your runtime, such as `NodeServices.layer`.
|
|
126
126
|
|
|
127
|
-
####
|
|
127
|
+
#### SilkPublishability.layer and SilkPublishability.layerAdaptive
|
|
128
128
|
|
|
129
|
-
`SilkPublishability.detect` is also exposed through `@effected/workspaces`'s `PublishabilityDetector` Tag so consumers can swap silk rules into any program that already yields the detector. Two layers override the Tag:
|
|
129
|
+
`SilkPublishability.detect` is also exposed through `@effected/workspaces`'s `PublishabilityDetector` Tag so consumers can swap silk rules into any program that already yields the detector. Two static layers override the Tag:
|
|
130
130
|
|
|
131
|
-
- `
|
|
132
|
-
- `
|
|
131
|
+
- `SilkPublishability.layer` — applies silk rules unconditionally. Requires `FileSystem`.
|
|
132
|
+
- `SilkPublishability.layerAdaptive` — ignore-aware. Changeset-`ignore`d packages resolve to `[]`, then it dispatches by changeset mode (`none` → `[]`, `silk` → silk rules, `vanilla` → the `@effected/workspaces` default). Requires `FileSystem` and `ChangesetConfig`.
|
|
133
133
|
|
|
134
134
|
```typescript
|
|
135
135
|
import { Effect } from "effect";
|
|
136
136
|
import { NodeServices } from "@effect/platform-node";
|
|
137
137
|
import { PublishabilityDetector } from "@effected/workspaces";
|
|
138
|
-
import {
|
|
138
|
+
import { SilkPublishability } from "@savvy-web/silk-effects";
|
|
139
139
|
|
|
140
140
|
const targets = await Effect.runPromise(
|
|
141
141
|
Effect.gen(function* () {
|
|
142
142
|
const detector = yield* PublishabilityDetector;
|
|
143
143
|
return yield* detector.detect(pkg, root);
|
|
144
144
|
}).pipe(
|
|
145
|
-
Effect.provide(
|
|
145
|
+
Effect.provide(SilkPublishability.layer),
|
|
146
146
|
Effect.provide(NodeServices.layer),
|
|
147
147
|
),
|
|
148
148
|
);
|
|
@@ -159,7 +159,7 @@ Typed accessor over a workspace root's `.changeset/config.json`, reading through
|
|
|
159
159
|
import { Effect } from "effect";
|
|
160
160
|
import { NodeServices } from "@effect/platform-node";
|
|
161
161
|
import {
|
|
162
|
-
ChangesetConfig,
|
|
162
|
+
ChangesetConfig, ChangesetConfigReader,
|
|
163
163
|
} from "@savvy-web/silk-effects";
|
|
164
164
|
|
|
165
165
|
const mode = await Effect.runPromise(
|
|
@@ -167,8 +167,8 @@ const mode = await Effect.runPromise(
|
|
|
167
167
|
const config = yield* ChangesetConfig;
|
|
168
168
|
return yield* config.mode(process.cwd());
|
|
169
169
|
}).pipe(
|
|
170
|
-
Effect.provide(
|
|
171
|
-
Effect.provide(
|
|
170
|
+
Effect.provide(ChangesetConfig.layer),
|
|
171
|
+
Effect.provide(ChangesetConfigReader.layer),
|
|
172
172
|
Effect.provide(NodeServices.layer),
|
|
173
173
|
),
|
|
174
174
|
);
|
|
@@ -212,7 +212,7 @@ Read and decode `.changeset/config.json`. Auto-detects whether the project uses
|
|
|
212
212
|
import { Effect } from "effect";
|
|
213
213
|
import { NodeServices } from "@effect/platform-node";
|
|
214
214
|
import {
|
|
215
|
-
ChangesetConfigReader,
|
|
215
|
+
ChangesetConfigReader,
|
|
216
216
|
} from "@savvy-web/silk-effects";
|
|
217
217
|
|
|
218
218
|
const config = await Effect.runPromise(
|
|
@@ -220,7 +220,7 @@ const config = await Effect.runPromise(
|
|
|
220
220
|
const reader = yield* ChangesetConfigReader;
|
|
221
221
|
return yield* reader.read(process.cwd());
|
|
222
222
|
}).pipe(
|
|
223
|
-
Effect.provide(
|
|
223
|
+
Effect.provide(ChangesetConfigReader.layer),
|
|
224
224
|
Effect.provide(NodeServices.layer),
|
|
225
225
|
),
|
|
226
226
|
);
|
|
@@ -234,14 +234,14 @@ Locate config files using a priority-based search convention. Checks `lib/config
|
|
|
234
234
|
```typescript
|
|
235
235
|
import { Effect } from "effect";
|
|
236
236
|
import { NodeServices } from "@effect/platform-node";
|
|
237
|
-
import { ConfigDiscovery
|
|
237
|
+
import { ConfigDiscovery } from "@savvy-web/silk-effects";
|
|
238
238
|
|
|
239
239
|
const result = await Effect.runPromise(
|
|
240
240
|
Effect.gen(function* () {
|
|
241
241
|
const cd = yield* ConfigDiscovery;
|
|
242
242
|
return yield* cd.find("biome.jsonc");
|
|
243
243
|
}).pipe(
|
|
244
|
-
Effect.provide(
|
|
244
|
+
Effect.provide(ConfigDiscovery.layer),
|
|
245
245
|
Effect.provide(NodeServices.layer),
|
|
246
246
|
),
|
|
247
247
|
);
|
|
@@ -255,14 +255,14 @@ Keep Biome config `$schema` URLs current. Locates `biome.json` or `biome.jsonc`,
|
|
|
255
255
|
```typescript
|
|
256
256
|
import { Effect } from "effect";
|
|
257
257
|
import { NodeServices } from "@effect/platform-node";
|
|
258
|
-
import { BiomeSchemaSync
|
|
258
|
+
import { BiomeSchemaSync } from "@savvy-web/silk-effects";
|
|
259
259
|
|
|
260
260
|
const result = await Effect.runPromise(
|
|
261
261
|
Effect.gen(function* () {
|
|
262
262
|
const bss = yield* BiomeSchemaSync;
|
|
263
263
|
return yield* bss.sync("2.0.0");
|
|
264
264
|
}).pipe(
|
|
265
|
-
Effect.provide(
|
|
265
|
+
Effect.provide(BiomeSchemaSync.layer),
|
|
266
266
|
Effect.provide(NodeServices.layer),
|
|
267
267
|
),
|
|
268
268
|
);
|
|
@@ -273,7 +273,7 @@ const result = await Effect.runPromise(
|
|
|
273
273
|
|
|
274
274
|
Resolve `.changeset/config.json` into a fully attributed view of the workspace: the configured changelog, base branch, access and ignore list, plus one scope per package carrying its `workspaceDir`, version, `additionalScopes` and resolved `versionFiles`. `inspect(cwd)` returns that view and `classify` maps arbitrary file paths to the package that owns them, which is how a branch diff becomes a per-package attribution. `refresh()` clears the per-root cache, which a long-lived host needs in order to see config edits made between calls.
|
|
275
275
|
|
|
276
|
-
`Changesets.
|
|
276
|
+
`Changesets.ConfigInspector.layer` requires `ChangesetConfigReader`, `WorkspaceDiscovery` from [`@effected/workspaces`](https://www.npmjs.com/package/@effected/workspaces) and `FileSystem`.
|
|
277
277
|
|
|
278
278
|
#### ReleasePlanner
|
|
279
279
|
|
|
@@ -292,7 +292,7 @@ const preview = yield* planner.preview(root, {
|
|
|
292
292
|
// => ChangesetPreview: per-release changelogEntry, versions and changeset ids
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
`Changesets.
|
|
295
|
+
`Changesets.ReleasePlanner.layer` requires `ConfigInspector` and `FileSystem`.
|
|
296
296
|
|
|
297
297
|
---
|
|
298
298
|
|
|
@@ -302,7 +302,7 @@ const preview = yield* planner.preview(root, {
|
|
|
302
302
|
|
|
303
303
|
`analyzeBranch` classifies a branch's diff by the package that owns each file, applying `ConfigInspector` attribution over the git range. This is what answers "what changed on this branch, and which package releases because of it", including the unmapped files that belong to no package.
|
|
304
304
|
|
|
305
|
-
`Changesets.
|
|
305
|
+
`Changesets.BranchAnalyzer.layer` requires `ConfigInspector` and the platform process spawner.
|
|
306
306
|
|
|
307
307
|
#### DepsRegen
|
|
308
308
|
|
|
@@ -329,13 +329,13 @@ const plan = await Effect.runPromise(
|
|
|
329
329
|
// => RegenPlan: files to write, rows per package, changesets to delete
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
-
`Changesets.
|
|
332
|
+
`Changesets.DepsRegen.layer` is the seam for callers injecting their own dependencies; it requires `WorkspaceSnapshots`, `ConfigInspector`, `WorkspaceDiscovery`, `PublishabilityDetector`, `ChangesetConfig`, `Git` and `FileSystem`.
|
|
333
333
|
|
|
334
334
|
#### TurboInspector
|
|
335
335
|
|
|
336
336
|
Read-only Turborepo inspection. Every method shells out to `turbo` with `--dry=json`, so no task ever runs. `diagnoseCache(task, cwd)` reports a per-package cache HIT/MISS breakdown for a task, `taskGraph(cwd, task?)` derives the task graph and its critical path and `affected(cwd, base?)` lists the packages affected relative to `base` (default `main`). It resolves the `turbo` binary through `ToolDiscovery` from [`@effected/commands`](https://www.npmjs.com/package/@effected/commands) and fails with a tagged error when `turbo` is missing or the directory is not a Turborepo. The service tag and its layer are exported under the `Turbo` namespace.
|
|
337
337
|
|
|
338
|
-
`Turbo.
|
|
338
|
+
`Turbo.TurboInspector.layer` requires `ToolDiscovery`, `Git` from [`@effected/git`](https://www.npmjs.com/package/@effected/git), `FileSystem` and the platform process spawner. Wire `ToolDiscovery` to the workspace with `Workspaces.localExecLayer()`, which teaches it the argv prefix that runs a project-local binary:
|
|
339
339
|
|
|
340
340
|
```typescript
|
|
341
341
|
import { Effect, Layer } from "effect";
|
|
@@ -356,7 +356,7 @@ const diagnosis = await Effect.runPromise(
|
|
|
356
356
|
const turbo = yield* Turbo.TurboInspector;
|
|
357
357
|
return yield* turbo.diagnoseCache("build:dev", process.cwd());
|
|
358
358
|
}).pipe(
|
|
359
|
-
Effect.provide(Turbo.
|
|
359
|
+
Effect.provide(Turbo.TurboInspector.layer),
|
|
360
360
|
Effect.provide(Layer.mergeAll(ToolsLive, Git.layer)),
|
|
361
361
|
Effect.provide(NodeServices.layer),
|
|
362
362
|
),
|
|
@@ -126,7 +126,8 @@ var ChangelogTransformer = class ChangelogTransformer {
|
|
|
126
126
|
*/
|
|
127
127
|
static transformFile(filePath, options) {
|
|
128
128
|
const content = readFileSync(filePath, "utf-8");
|
|
129
|
-
|
|
129
|
+
const result = ChangelogTransformer.transformContent(content, options);
|
|
130
|
+
writeFileSync(filePath, result, "utf-8");
|
|
130
131
|
}
|
|
131
132
|
};
|
|
132
133
|
|
|
@@ -78,6 +78,22 @@ function inferDependencyType(dep) {
|
|
|
78
78
|
return "dependency";
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
+
* Narrow a dependency update to one with both version endpoints present.
|
|
82
|
+
*
|
|
83
|
+
* `@changesets/types` only guarantees `oldVersion`/`newVersion` on the
|
|
84
|
+
* `major`/`minor`/`patch` arms of `ComprehensiveRelease`; a `type: "none"`
|
|
85
|
+
* entry may carry neither. The table's `From`/`To` columns are validated
|
|
86
|
+
* version strings, so an entry missing either endpoint has no row to render.
|
|
87
|
+
*
|
|
88
|
+
* @param dep - The dependency update to test
|
|
89
|
+
* @returns `true` when both `oldVersion` and `newVersion` are present
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
function isVersioned(dep) {
|
|
94
|
+
return dep.oldVersion !== void 0 && dep.newVersion !== void 0;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
81
97
|
* Format dependency release lines as a structured markdown table.
|
|
82
98
|
*
|
|
83
99
|
* This is the core Effect program that implements the `getDependencyReleaseLine`
|
|
@@ -88,8 +104,9 @@ function inferDependencyType(dep) {
|
|
|
88
104
|
* The function maps each `ModCompWithPackage` entry to a `DependencyTableRow`,
|
|
89
105
|
* inferring the dependency type from the consuming package's `package.json`,
|
|
90
106
|
* then delegates to `serializeDependencyTableToMarkdown` for GFM table
|
|
91
|
-
* rendering, prefixed with a `### Dependencies` heading.
|
|
92
|
-
*
|
|
107
|
+
* rendering, prefixed with a `### Dependencies` heading. Entries missing
|
|
108
|
+
* either version endpoint are dropped by {@link isVersioned}; the function
|
|
109
|
+
* returns an empty string when no rows survive.
|
|
93
110
|
*
|
|
94
111
|
* The `_changesets` and `_options` parameters are part of the Changesets API
|
|
95
112
|
* contract but are not used in the table format. They are retained for
|
|
@@ -98,19 +115,21 @@ function inferDependencyType(dep) {
|
|
|
98
115
|
* @param _changesets - Changesets that caused the dependency updates (unused in table format)
|
|
99
116
|
* @param dependenciesUpdated - The list of dependencies that were updated, including old/new versions
|
|
100
117
|
* @param _options - Validated configuration options (unused in table format)
|
|
101
|
-
* @returns An `Effect` that resolves to a `### Dependencies` heading followed by a formatted markdown table string, or empty string if no dependencies were updated
|
|
118
|
+
* @returns An `Effect` that resolves to a `### Dependencies` heading followed by a formatted markdown table string, or empty string if no dependencies with both version endpoints were updated
|
|
102
119
|
*/
|
|
103
120
|
function getDependencyReleaseLine(_changesets, dependenciesUpdated, _options) {
|
|
104
121
|
return Effect.gen(function* () {
|
|
105
122
|
if (dependenciesUpdated.length === 0) return "";
|
|
106
123
|
yield* GitHubService;
|
|
107
|
-
|
|
124
|
+
const rows = dependenciesUpdated.filter(isVersioned).map((dep) => ({
|
|
108
125
|
dependency: dep.name,
|
|
109
126
|
type: inferDependencyType(dep),
|
|
110
127
|
action: "updated",
|
|
111
128
|
from: dep.oldVersion,
|
|
112
129
|
to: dep.newVersion
|
|
113
|
-
}))
|
|
130
|
+
}));
|
|
131
|
+
if (rows.length === 0) return "";
|
|
132
|
+
return `### Dependencies\n\n${serializeDependencyTableToMarkdown(rows)}`;
|
|
114
133
|
});
|
|
115
134
|
}
|
|
116
135
|
|
|
@@ -84,7 +84,8 @@ function getReleaseLine(changeset, versionType, options) {
|
|
|
84
84
|
const parsed = parseChangesetSections(changeset.summary);
|
|
85
85
|
const firstLine = changeset.summary.split("\n")[0];
|
|
86
86
|
const commitMsg = parseCommitMessage(firstLine);
|
|
87
|
-
const
|
|
87
|
+
const bodyText = changeset.summary.split("\n").slice(1).join("\n");
|
|
88
|
+
const issueRefs = parseIssueReferences(bodyText);
|
|
88
89
|
const attribution = commitInfo ? formatPRAndUserAttribution(commitInfo.pull ?? void 0, commitInfo.user ?? void 0, commitInfo.links) : "";
|
|
89
90
|
if (parsed.sections.length > 0) {
|
|
90
91
|
const lines = [];
|
|
@@ -110,11 +111,13 @@ function getReleaseLine(changeset, versionType, options) {
|
|
|
110
111
|
}
|
|
111
112
|
return `${lines.join("\n").trimEnd()}${attribution}`;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
const commitType = commitMsg.type ?? versionType;
|
|
115
|
+
const entryInput = {
|
|
116
|
+
type: resolveCommitType(commitType, commitMsg.scope, commitMsg.breaking).heading,
|
|
115
117
|
summary: changeset.summary,
|
|
116
118
|
issues: issueRefs
|
|
117
|
-
}
|
|
119
|
+
};
|
|
120
|
+
return `- ${formatChangelogEntry(entryInput, { repo: options.repo })}${attribution}`;
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
123
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateChangesetOptions } from "../schemas/options.js";
|
|
2
|
-
import {
|
|
2
|
+
import { GitHubService } from "../services/github.js";
|
|
3
3
|
import { getDependencyReleaseLine } from "./getDependencyReleaseLine.js";
|
|
4
4
|
import { getReleaseLine } from "./getReleaseLine.js";
|
|
5
5
|
import { Effect } from "effect";
|
|
@@ -16,7 +16,7 @@ import { Effect } from "effect";
|
|
|
16
16
|
* @remarks
|
|
17
17
|
* The module composes two Effect programs — {@link getReleaseLine} and
|
|
18
18
|
* {@link getDependencyReleaseLine} — and runs each through
|
|
19
|
-
* `Effect.runPromise` with
|
|
19
|
+
* `Effect.runPromise` with `GitHubService.layer` (for commit metadata). Options are
|
|
20
20
|
* validated at the boundary via `validateChangesetOptions` before being
|
|
21
21
|
* passed to the formatters.
|
|
22
22
|
*
|
|
@@ -58,14 +58,14 @@ import { Effect } from "effect";
|
|
|
58
58
|
/**
|
|
59
59
|
* The layer providing every service the formatters need.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
61
|
+
* `GitHubService.layer` satisfies the requirements of both `getReleaseLine` and
|
|
62
62
|
* `getDependencyReleaseLine`, which each need only `GitHubService`. Markdown
|
|
63
63
|
* parsing is not a layer: the formatters call the remark pipeline's
|
|
64
64
|
* `parseMarkdown` / `stringifyMarkdown` functions directly.
|
|
65
65
|
*
|
|
66
66
|
* @internal
|
|
67
67
|
*/
|
|
68
|
-
const MainLayer =
|
|
68
|
+
const MainLayer = GitHubService.layer;
|
|
69
69
|
/**
|
|
70
70
|
* Changesets API `ChangelogFunctions` implementation.
|
|
71
71
|
*
|
|
@@ -79,13 +79,15 @@ const MainLayer = GitHubLive;
|
|
|
79
79
|
const changelogFunctions = {
|
|
80
80
|
getReleaseLine: async (changeset, versionType, options) => {
|
|
81
81
|
const program = Effect.gen(function* () {
|
|
82
|
-
|
|
82
|
+
const opts = yield* validateChangesetOptions(options);
|
|
83
|
+
return yield* getReleaseLine(changeset, versionType, opts);
|
|
83
84
|
});
|
|
84
85
|
return Effect.runPromise(program.pipe(Effect.provide(MainLayer)));
|
|
85
86
|
},
|
|
86
87
|
getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => {
|
|
87
88
|
const program = Effect.gen(function* () {
|
|
88
|
-
|
|
89
|
+
const opts = yield* validateChangesetOptions(options);
|
|
90
|
+
return yield* getDependencyReleaseLine(changesets, dependenciesUpdated, opts);
|
|
89
91
|
});
|
|
90
92
|
return Effect.runPromise(program.pipe(Effect.provide(MainLayer)));
|
|
91
93
|
}
|
package/changesets/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ChangesetIOError, ChangesetValidationError, ConfigurationError, GitErro
|
|
|
4
4
|
import { JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, VersionFileConfigSchema, VersionFilesSchema } from "./schemas/version-files.js";
|
|
5
5
|
import { GlobSchema, PackageScopeSchema, PackagesRecordSchema } from "./schemas/package-scope.js";
|
|
6
6
|
import { ChangesetOptionsSchema, RepoSchema } from "./schemas/options.js";
|
|
7
|
-
import {
|
|
7
|
+
import { GitHubService, makeGitHubTest } from "./services/github.js";
|
|
8
8
|
import { NonEmptyString, PositiveInteger } from "./schemas/primitives.js";
|
|
9
9
|
import { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VERSION_RE, VersionOrEmptySchema } from "./schemas/dependency-table.js";
|
|
10
10
|
import { serializeDependencyTableToMarkdown } from "./utils/dependency-table.js";
|
|
@@ -28,16 +28,16 @@ import { NormalizeFormatPlugin } from "./remark/plugins/normalize-format.js";
|
|
|
28
28
|
import { ReorderSectionsPlugin } from "./remark/plugins/reorder-sections.js";
|
|
29
29
|
import { SilkChangesetPreset, SilkChangesetTransformPreset } from "./remark/presets.js";
|
|
30
30
|
import { ChangelogTransformer } from "./api/transformer.js";
|
|
31
|
-
import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector,
|
|
32
|
-
import { BranchAnalysisSchema, BranchAnalyzer,
|
|
31
|
+
import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector, InspectedConfigSchema, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, makeConfigInspectorTest } from "./services/config-inspector.js";
|
|
32
|
+
import { BranchAnalysisSchema, BranchAnalyzer, BranchFileEntrySchema, FileStatusSchema, makeBranchAnalyzerTest } from "./services/branch-analyzer.js";
|
|
33
33
|
import { ChangelogService } from "./services/changelog.js";
|
|
34
34
|
import { computeWorkspaceDependencyDiffs } from "./utils/dep-diff.js";
|
|
35
35
|
import { gitMergeBase } from "./utils/git.js";
|
|
36
36
|
import { listPublishablePackageNames } from "./utils/publishability.js";
|
|
37
|
-
import { DepsRegen, DepsRegenDefault,
|
|
37
|
+
import { DepsRegen, DepsRegenDefault, isPureDependencyChangeset, makeDepsRegenDefault } from "./services/deps-regen.js";
|
|
38
38
|
import { MaintenanceReasonSchema, MaintenanceTriggerSchema, deriveMaintenanceReason } from "./services/maintenance-reason.js";
|
|
39
39
|
import { VersionFiles } from "./utils/version-files.js";
|
|
40
|
-
import { ReleasePlanner,
|
|
40
|
+
import { ReleasePlanner, makeReleasePlannerTest } from "./services/release-planner.js";
|
|
41
41
|
import { SectionCategorySchema } from "./categories/types.js";
|
|
42
42
|
import { CommitHashSchema, VersionTypeSchema } from "./schemas/git.js";
|
|
43
43
|
import { ChangesetSchema, ChangesetSummarySchema, DependencyTypeSchema, DependencyUpdateSchema } from "./schemas/changeset.js";
|
|
@@ -56,7 +56,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
56
56
|
AppliedReleaseSchema: () => AppliedReleaseSchema,
|
|
57
57
|
BranchAnalysisSchema: () => BranchAnalysisSchema,
|
|
58
58
|
BranchAnalyzer: () => BranchAnalyzer,
|
|
59
|
-
BranchAnalyzerLive: () => BranchAnalyzerLive,
|
|
60
59
|
BranchFileEntrySchema: () => BranchFileEntrySchema,
|
|
61
60
|
BumpTypeSchema: () => BumpTypeSchema,
|
|
62
61
|
Categories: () => Categories,
|
|
@@ -74,7 +73,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
74
73
|
ClassificationSchema: () => ClassificationSchema,
|
|
75
74
|
CommitHashSchema: () => CommitHashSchema,
|
|
76
75
|
ConfigInspector: () => ConfigInspector,
|
|
77
|
-
ConfigInspectorLive: () => ConfigInspectorLive,
|
|
78
76
|
ConfigurationError: () => ConfigurationError,
|
|
79
77
|
ContentStructureRule: () => ContentStructureRule,
|
|
80
78
|
ContributorFootnotesPlugin: () => ContributorFootnotesPlugin,
|
|
@@ -89,12 +87,10 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
89
87
|
DependencyUpdateSchema: () => DependencyUpdateSchema,
|
|
90
88
|
DepsRegen: () => DepsRegen,
|
|
91
89
|
DepsRegenDefault: () => DepsRegenDefault,
|
|
92
|
-
DepsRegenLive: () => DepsRegenLive,
|
|
93
90
|
FileStatusSchema: () => FileStatusSchema,
|
|
94
91
|
GitError: () => GitError,
|
|
95
92
|
GitHubApiError: () => GitHubApiError,
|
|
96
93
|
GitHubInfoSchema: () => GitHubInfoSchema,
|
|
97
|
-
GitHubLive: () => GitHubLive,
|
|
98
94
|
GitHubService: () => GitHubService,
|
|
99
95
|
GlobSchema: () => GlobSchema,
|
|
100
96
|
HeadingHierarchyRule: () => HeadingHierarchyRule,
|
|
@@ -123,7 +119,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
123
119
|
PreviewReleaseSchema: () => PreviewReleaseSchema,
|
|
124
120
|
ReleasePlanError: () => ReleasePlanError,
|
|
125
121
|
ReleasePlanner: () => ReleasePlanner,
|
|
126
|
-
ReleasePlannerLive: () => ReleasePlannerLive,
|
|
127
122
|
ReorderSectionsPlugin: () => ReorderSectionsPlugin,
|
|
128
123
|
RepoSchema: () => RepoSchema,
|
|
129
124
|
RequiredSectionsRule: () => RequiredSectionsRule,
|
|
@@ -159,4 +154,4 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
159
154
|
});
|
|
160
155
|
|
|
161
156
|
//#endregion
|
|
162
|
-
export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer,
|
|
157
|
+
export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer, BranchFileEntrySchema, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogTransformer, ChangesetIOError, ChangesetLinter, ChangesetOptionsSchema, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigurationError, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyActionSchema, DependencyTable, DependencyTableFormatRule, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, DependencyTypeSchema, DependencyUpdateSchema, DepsRegen, DepsRegenDefault, FileStatusSchema, GitError, GitHubApiError, GitHubInfoSchema, GitHubService, GlobSchema, HeadingHierarchyRule, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, MaintenanceNotePlugin, MaintenanceReasonSchema, MaintenanceTriggerSchema, MarkdownParseError, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule$1 as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScopeSchema, PackagesRecordSchema, PendingChangesetSchema, PositiveInteger, PreviewReleaseSchema, ReleasePlanError, ReleasePlanner, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VERSION_RE, VersionFileConfigSchema, VersionFileError, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionTypeSchema, changelogFunctions, changesets_exports, computeWorkspaceDependencyDiffs, deriveMaintenanceReason, gitMergeBase, isPureDependencyChangeset, listPublishablePackageNames, makeBranchAnalyzerTest, makeConfigInspectorTest, makeDepsRegenDefault, makeGitHubTest, makeReleasePlannerTest, serializeDependencyTableToMarkdown };
|
|
@@ -36,7 +36,7 @@ const BranchAnalysisSchema = Schema.Struct({
|
|
|
36
36
|
* @example
|
|
37
37
|
* ```typescript
|
|
38
38
|
* import { Effect } from "effect";
|
|
39
|
-
* import { BranchAnalyzer,
|
|
39
|
+
* import { BranchAnalyzer, ConfigInspector } from "@savvy-web/changesets";
|
|
40
40
|
*
|
|
41
41
|
* const program = Effect.gen(function* () {
|
|
42
42
|
* const analyzer = yield* BranchAnalyzer;
|
|
@@ -46,16 +46,30 @@ const BranchAnalysisSchema = Schema.Struct({
|
|
|
46
46
|
*
|
|
47
47
|
* Effect.runPromise(
|
|
48
48
|
* program.pipe(
|
|
49
|
-
* Effect.provide(
|
|
50
|
-
* Effect.provide(
|
|
51
|
-
* // ... +
|
|
49
|
+
* Effect.provide(BranchAnalyzer.layer),
|
|
50
|
+
* Effect.provide(ConfigInspector.layer),
|
|
51
|
+
* // ... + ChangesetConfigReader.layer + kit workspace layers + NodeServices.layer
|
|
52
52
|
* ),
|
|
53
53
|
* );
|
|
54
54
|
* ```
|
|
55
55
|
*
|
|
56
56
|
* @public
|
|
57
57
|
*/
|
|
58
|
-
var BranchAnalyzer = class extends Context.Service()("BranchAnalyzer") {
|
|
58
|
+
var BranchAnalyzer = class extends Context.Service()("BranchAnalyzer") {
|
|
59
|
+
/**
|
|
60
|
+
* Production layer for {@link BranchAnalyzer}.
|
|
61
|
+
*
|
|
62
|
+
* Requires {@link ConfigInspector} (which in turn requires
|
|
63
|
+
* `ChangesetConfigReader` and `WorkspaceDiscovery`) and a
|
|
64
|
+
* `ChildProcessSpawner` (satisfied by `NodeServices.layer`) for the
|
|
65
|
+
* internally-composed `@effected/git` layer.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
70
|
+
return makeShape(yield* ConfigInspector, yield* Git);
|
|
71
|
+
})).pipe(Layer.provide(Git.layer));
|
|
72
|
+
};
|
|
59
73
|
/**
|
|
60
74
|
* Fold a `@effected/git` typed failure into this package's {@link GitError},
|
|
61
75
|
* preserving the public `ConfigurationError | GitError` error channel.
|
|
@@ -139,19 +153,6 @@ function makeShape(inspector, git) {
|
|
|
139
153
|
return { analyzeBranch };
|
|
140
154
|
}
|
|
141
155
|
/**
|
|
142
|
-
* Live layer for {@link BranchAnalyzer}.
|
|
143
|
-
*
|
|
144
|
-
* Requires {@link ConfigInspector} (which in turn requires
|
|
145
|
-
* `ChangesetConfigReader` and `WorkspaceDiscovery`) and a
|
|
146
|
-
* `ChildProcessSpawner` (satisfied by `NodeServices.layer`) for the
|
|
147
|
-
* internally-composed `@effected/git` layer.
|
|
148
|
-
*
|
|
149
|
-
* @public
|
|
150
|
-
*/
|
|
151
|
-
const BranchAnalyzerLive = Layer.effect(BranchAnalyzer, Effect.gen(function* () {
|
|
152
|
-
return makeShape(yield* ConfigInspector, yield* Git);
|
|
153
|
-
})).pipe(Layer.provide(Git.layer));
|
|
154
|
-
/**
|
|
155
156
|
* Test factory — build a {@link BranchAnalyzer} that returns a fixed
|
|
156
157
|
* {@link BranchAnalysis} for any input.
|
|
157
158
|
*
|
|
@@ -162,4 +163,4 @@ function makeBranchAnalyzerTest(fixed) {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
//#endregion
|
|
165
|
-
export { BranchAnalysisSchema, BranchAnalyzer,
|
|
166
|
+
export { BranchAnalysisSchema, BranchAnalyzer, BranchFileEntrySchema, FileStatusSchema, makeBranchAnalyzerTest };
|
|
@@ -18,7 +18,7 @@ import { Context } from "effect";
|
|
|
18
18
|
* ```typescript
|
|
19
19
|
* import { Effect } from "effect";
|
|
20
20
|
* import type { ChangesetOptions } from "\@savvy-web/changesets";
|
|
21
|
-
* import { ChangelogService
|
|
21
|
+
* import { ChangelogService } from "\@savvy-web/changesets";
|
|
22
22
|
*
|
|
23
23
|
* const program = Effect.gen(function* () {
|
|
24
24
|
* const changelog = yield* ChangelogService;
|
|
@@ -39,7 +39,6 @@ import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
|
39
39
|
* {@link ConfigInspectorShape.classify} calls reuse it.
|
|
40
40
|
*
|
|
41
41
|
* @see {@link ConfigInspector} for the Effect service tag
|
|
42
|
-
* @see {@link ConfigInspectorLive} for the production layer
|
|
43
42
|
*
|
|
44
43
|
*/
|
|
45
44
|
/** A `versionFiles` entry expanded to its absolute target paths. @public */
|
|
@@ -93,7 +92,7 @@ const ClassificationSchema = Schema.Struct({
|
|
|
93
92
|
* @example
|
|
94
93
|
* ```typescript
|
|
95
94
|
* import { Effect } from "effect";
|
|
96
|
-
* import { ConfigInspector
|
|
95
|
+
* import { ConfigInspector } from "@savvy-web/changesets";
|
|
97
96
|
*
|
|
98
97
|
* const program = Effect.gen(function* () {
|
|
99
98
|
* const inspector = yield* ConfigInspector;
|
|
@@ -101,12 +100,24 @@ const ClassificationSchema = Schema.Struct({
|
|
|
101
100
|
* return config.packages.map((p) => p.name);
|
|
102
101
|
* });
|
|
103
102
|
*
|
|
104
|
-
* Effect.runPromise(program.pipe(Effect.provide(
|
|
103
|
+
* Effect.runPromise(program.pipe(Effect.provide(ConfigInspector.layer)));
|
|
105
104
|
* ```
|
|
106
105
|
*
|
|
107
106
|
* @public
|
|
108
107
|
*/
|
|
109
|
-
var ConfigInspector = class extends Context.Service()("ConfigInspector") {
|
|
108
|
+
var ConfigInspector = class extends Context.Service()("ConfigInspector") {
|
|
109
|
+
/**
|
|
110
|
+
* Production layer for {@link ConfigInspector}.
|
|
111
|
+
*
|
|
112
|
+
* Requires {@link ChangesetConfigReader} and `WorkspaceDiscovery`
|
|
113
|
+
* in the environment.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
118
|
+
return makeShape(yield* ChangesetConfigReader, yield* WorkspaceDiscovery, yield* FileSystem.FileSystem);
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
110
121
|
/**
|
|
111
122
|
* Pull the changelog formatter ID and its options object out of the raw
|
|
112
123
|
* `.changeset/config.json` shape (where `changelog` may be a tuple, a string,
|
|
@@ -500,22 +511,11 @@ function classifyOne(inspected, path) {
|
|
|
500
511
|
};
|
|
501
512
|
}
|
|
502
513
|
/**
|
|
503
|
-
* Live layer for {@link ConfigInspector}.
|
|
504
|
-
*
|
|
505
|
-
* Requires {@link ChangesetConfigReader} and `WorkspaceDiscovery`
|
|
506
|
-
* in the environment.
|
|
507
|
-
*
|
|
508
|
-
* @public
|
|
509
|
-
*/
|
|
510
|
-
const ConfigInspectorLive = Layer.effect(ConfigInspector, Effect.gen(function* () {
|
|
511
|
-
return makeShape(yield* ChangesetConfigReader, yield* WorkspaceDiscovery, yield* FileSystem.FileSystem);
|
|
512
|
-
}));
|
|
513
|
-
/**
|
|
514
514
|
* Test factory — build a {@link ConfigInspector} that returns a fixed
|
|
515
515
|
* {@link InspectedConfig} without touching the filesystem.
|
|
516
516
|
*
|
|
517
517
|
* Tests that need to exercise the inspect/classify logic against real files
|
|
518
|
-
* should compose `
|
|
518
|
+
* should compose `ConfigInspector.layer` with test layers for
|
|
519
519
|
* `ChangesetConfigReader` and `WorkspaceDiscovery` instead.
|
|
520
520
|
*
|
|
521
521
|
* @public
|
|
@@ -529,4 +529,4 @@ function makeConfigInspectorTest(fixed) {
|
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
//#endregion
|
|
532
|
-
export { ClassificationReasonSchema, ClassificationSchema, ConfigInspector,
|
|
532
|
+
export { ClassificationReasonSchema, ClassificationSchema, ConfigInspector, InspectedConfigSchema, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, makeConfigInspectorTest };
|