@savvy-web/silk 1.3.11 → 2.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.
- package/README.md +7 -5
- package/changesets-changelog.cjs +39298 -96760
- package/changesets-changelog.d.cts +24 -14
- package/changesets-changelog.d.ts +24 -14
- package/changesets-changelog.js +54057 -1
- package/changesets-markdownlint.cjs +39295 -96757
- package/changesets-markdownlint.d.cts +24 -14
- package/changesets-markdownlint.d.ts +24 -14
- package/changesets-markdownlint.js +54057 -1
- package/package.json +6 -5
- package/tsconfig/node/dist/tsconfig.tsbuildinfo +1 -1
- package/_virtual/_rolldown/runtime.cjs +0 -45
- package/_virtual/_rolldown/runtime.js +0 -45
- package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.cjs +0 -15
- package/packages/silk-effects/dist/dev/pkg/_virtual/_rolldown/runtime.js +0 -14
- package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.cjs +0 -247
- package/packages/silk-effects/dist/dev/pkg/changesets/api/categories.js +0 -247
- package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.cjs +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/api/changelog.js +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.cjs +0 -163
- package/packages/silk-effects/dist/dev/pkg/changesets/api/dependency-table.js +0 -163
- package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.cjs +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/api/linter.js +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.cjs +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/api/transformer.js +0 -134
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.cjs +0 -317
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/index.js +0 -299
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.cjs +0 -65
- package/packages/silk-effects/dist/dev/pkg/changesets/categories/types.js +0 -65
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.cjs +0 -114
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/formatting.js +0 -113
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.cjs +0 -118
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getDependencyReleaseLine.js +0 -118
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.cjs +0 -122
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/getReleaseLine.js +0 -122
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.cjs +0 -97
- package/packages/silk-effects/dist/dev/pkg/changesets/changelog/index.js +0 -97
- package/packages/silk-effects/dist/dev/pkg/changesets/constants.cjs +0 -43
- package/packages/silk-effects/dist/dev/pkg/changesets/constants.js +0 -42
- package/packages/silk-effects/dist/dev/pkg/changesets/errors.cjs +0 -386
- package/packages/silk-effects/dist/dev/pkg/changesets/errors.js +0 -371
- package/packages/silk-effects/dist/dev/pkg/changesets/index.cjs +0 -300
- package/packages/silk-effects/dist/dev/pkg/changesets/index.js +0 -179
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.cjs +0 -34
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/index.js +0 -29
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.cjs +0 -98
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/content-structure.js +0 -98
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.cjs +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/dependency-table-format.js +0 -170
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.cjs +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/heading-hierarchy.js +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.cjs +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/required-sections.js +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.cjs +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/uncategorized-content.js +0 -54
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.cjs +0 -31
- package/packages/silk-effects/dist/dev/pkg/changesets/markdownlint/rules/utils.js +0 -30
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.cjs +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/aggregate-dependency-tables.js +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.cjs +0 -123
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/contributor-footnotes.js +0 -123
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.cjs +0 -32
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/deduplicate-items.js +0 -32
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.cjs +0 -59
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/issue-link-refs.js +0 -59
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.cjs +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/maintenance-note.js +0 -61
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.cjs +0 -43
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/merge-sections.js +0 -43
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.cjs +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/normalize-format.js +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.cjs +0 -34
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/plugins/reorder-sections.js +0 -34
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.cjs +0 -120
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/presets.js +0 -119
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.cjs +0 -22
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/content-structure.js +0 -22
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.cjs +0 -40
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/dependency-table-format.js +0 -40
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.cjs +0 -19
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/heading-hierarchy.js +0 -19
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.cjs +0 -17
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/required-sections.js +0 -17
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.cjs +0 -31
- package/packages/silk-effects/dist/dev/pkg/changesets/remark/rules/uncategorized-content.js +0 -31
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.cjs +0 -148
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/changeset.js +0 -145
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.cjs +0 -203
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/dependency-table.js +0 -198
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.cjs +0 -69
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/git.js +0 -68
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.cjs +0 -177
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/github.js +0 -174
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.cjs +0 -183
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/options.js +0 -181
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.cjs +0 -129
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js +0 -127
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.cjs +0 -72
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/primitives.js +0 -71
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.cjs +0 -62
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/release-plan.js +0 -56
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.cjs +0 -154
- package/packages/silk-effects/dist/dev/pkg/changesets/schemas/version-files.js +0 -150
- package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.cjs +0 -300
- package/packages/silk-effects/dist/dev/pkg/changesets/services/branch-analyzer.js +0 -294
- package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.cjs +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/services/changelog.js +0 -49
- package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.cjs +0 -489
- package/packages/silk-effects/dist/dev/pkg/changesets/services/config-inspector.js +0 -481
- package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.cjs +0 -375
- package/packages/silk-effects/dist/dev/pkg/changesets/services/deps-regen.js +0 -371
- package/packages/silk-effects/dist/dev/pkg/changesets/services/github.cjs +0 -160
- package/packages/silk-effects/dist/dev/pkg/changesets/services/github.js +0 -157
- package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.cjs +0 -68
- package/packages/silk-effects/dist/dev/pkg/changesets/services/maintenance-reason.js +0 -66
- package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.cjs +0 -87
- package/packages/silk-effects/dist/dev/pkg/changesets/services/markdown.js +0 -85
- package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.cjs +0 -338
- package/packages/silk-effects/dist/dev/pkg/changesets/services/release-planner.js +0 -334
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.cjs +0 -81
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/commit-parser.js +0 -80
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.cjs +0 -111
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dep-diff.js +0 -111
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.cjs +0 -351
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/dependency-table.js +0 -347
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.cjs +0 -51
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/git.js +0 -51
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.cjs +0 -102
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/issue-refs.js +0 -101
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.cjs +0 -178
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/jsonpath.js +0 -175
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.cjs +0 -51
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/logger.js +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.cjs +0 -59
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/markdown-link.js +0 -57
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.cjs +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/publishability.js +0 -50
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.cjs +0 -81
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/remark-pipeline.js +0 -79
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.cjs +0 -94
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/section-parser.js +0 -94
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.cjs +0 -47
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/strip-frontmatter.js +0 -46
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.cjs +0 -110
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-blocks.js +0 -108
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.cjs +0 -336
- package/packages/silk-effects/dist/dev/pkg/changesets/utils/version-files.js +0 -336
- package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.cjs +0 -55
- package/packages/silk-effects/dist/dev/pkg/changesets/vendor/github-info.js +0 -55
- package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.cjs +0 -21
- package/packages/silk-effects/dist/dev/pkg/errors/ChangesetConfigError.js +0 -21
- package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.cjs +0 -101
- package/packages/silk-effects/dist/dev/pkg/schemas/VersioningSchemas.js +0 -99
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.cjs +0 -81
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfig.js +0 -80
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.cjs +0 -109
- package/packages/silk-effects/dist/dev/pkg/services/ChangesetConfigReader.js +0 -108
- package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.cjs +0 -238
- package/packages/silk-effects/dist/dev/pkg/services/SilkPublishability.js +0 -236
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
const require_errors = require('../errors.cjs');
|
|
2
|
-
const require_version_files = require('./version-files.cjs');
|
|
3
|
-
const require_package_scope = require('./package-scope.cjs');
|
|
4
|
-
let effect = require("effect");
|
|
5
|
-
|
|
6
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/schemas/options.js
|
|
7
|
-
/**
|
|
8
|
-
* Changeset configuration option schemas and validation.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Defines the schema for the options object passed to the
|
|
12
|
-
* \@savvy-web/changesets changelog formatter in `.changeset/config.json`.
|
|
13
|
-
* The options are specified as the second element of the changelog array:
|
|
14
|
-
*
|
|
15
|
-
* ```json
|
|
16
|
-
* {
|
|
17
|
-
* "changelog": ["@savvy-web/changesets/changelog", { "repo": "owner/repo" }]
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @see {@link https://github.com/changesets/changesets/blob/main/docs/config-file-options.md | Changesets config docs}
|
|
22
|
-
* @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
/** Regex for `owner/repo` format, shared between schema and validation. */
|
|
26
|
-
const REPO_PATTERN = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
|
|
27
|
-
/**
|
|
28
|
-
* Schema for a GitHub repository in `owner/repo` format.
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Validates that the string matches the `owner/repository` format used
|
|
32
|
-
* by GitHub. Both the owner and repository segments accept alphanumeric
|
|
33
|
-
* characters, dots, underscores, and hyphens.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* import { Schema } from "effect";
|
|
38
|
-
* import { RepoSchema } from "@savvy-web/changesets";
|
|
39
|
-
*
|
|
40
|
-
* // Succeeds
|
|
41
|
-
* Schema.decodeUnknownSync(RepoSchema)("microsoft/vscode");
|
|
42
|
-
*
|
|
43
|
-
* // Throws ParseError — missing slash
|
|
44
|
-
* Schema.decodeUnknownSync(RepoSchema)("vscode");
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @see {@link ChangesetOptionsSchema} which uses this for the `repo` field
|
|
48
|
-
*
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
const RepoSchema = effect.Schema.String.pipe(effect.Schema.pattern(REPO_PATTERN, { message: () => "Repository must be in format \"owner/repository\" (e.g., \"microsoft/vscode\")" }));
|
|
52
|
-
/**
|
|
53
|
-
* Schema for changeset configuration options.
|
|
54
|
-
*
|
|
55
|
-
* @remarks
|
|
56
|
-
* The `repo` field is required; all other fields are optional with sensible
|
|
57
|
-
* defaults applied by the changelog formatter at runtime.
|
|
58
|
-
*
|
|
59
|
-
* Two related fields describe release surfaces:
|
|
60
|
-
*
|
|
61
|
-
* - `packages` (new, recommended) — a record keyed by package name with
|
|
62
|
-
* per-package `additionalScopes` and `versionFiles`. This is the shape
|
|
63
|
-
* introduced in 0.9.0 and the only shape that will be accepted in 1.0.0.
|
|
64
|
-
* - `versionFiles` (deprecated) — a flat array of entries each carrying
|
|
65
|
-
* their own `package` field. Still accepted in 0.9.0 with a deprecation
|
|
66
|
-
* warning emitted by `ConfigInspector` at config-load time; removed in
|
|
67
|
-
* 1.0.0.
|
|
68
|
-
*
|
|
69
|
-
* A config that declares **both** `packages` and the deprecated
|
|
70
|
-
* `versionFiles` field is rejected — the user must pick one.
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* import { Schema } from "effect";
|
|
75
|
-
* import { ChangesetOptionsSchema } from "@savvy-web/changesets";
|
|
76
|
-
* import type { ChangesetOptions } from "@savvy-web/changesets";
|
|
77
|
-
*
|
|
78
|
-
* // New per-package shape (recommended)
|
|
79
|
-
* const opts: ChangesetOptions = Schema.decodeUnknownSync(ChangesetOptionsSchema)({
|
|
80
|
-
* repo: "savvy-web/changesets",
|
|
81
|
-
* packages: {
|
|
82
|
-
* "@savvy-web/changesets": {
|
|
83
|
-
* additionalScopes: ["plugin/**"],
|
|
84
|
-
* versionFiles: [{ glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] }],
|
|
85
|
-
* },
|
|
86
|
-
* },
|
|
87
|
-
* });
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* @see {@link ChangesetOptions} for the inferred TypeScript type
|
|
91
|
-
* @see {@link validateChangesetOptions} for Effect-idiomatic validation with detailed error messages
|
|
92
|
-
* @see {@link PackagesRecordSchema} for the new `packages` shape
|
|
93
|
-
* @see {@link LegacyVersionFilesSchema} for the deprecated `versionFiles` shape
|
|
94
|
-
*
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
const ChangesetOptionsSchema = effect.Schema.Struct({
|
|
98
|
-
/** GitHub repository in `owner/repo` format. */
|
|
99
|
-
repo: RepoSchema,
|
|
100
|
-
/** Whether to include commit hash links in output. */
|
|
101
|
-
commitLinks: effect.Schema.optional(effect.Schema.Boolean),
|
|
102
|
-
/** Whether to include pull request links in output. */
|
|
103
|
-
prLinks: effect.Schema.optional(effect.Schema.Boolean),
|
|
104
|
-
/** Whether to include issue reference links in output. */
|
|
105
|
-
issueLinks: effect.Schema.optional(effect.Schema.Boolean),
|
|
106
|
-
/** Custom issue reference prefixes (e.g., `["#", "GH-"]`). */
|
|
107
|
-
issuePrefixes: effect.Schema.optional(effect.Schema.Array(effect.Schema.String)),
|
|
108
|
-
/**
|
|
109
|
-
* Per-package release surfaces. Each entry declares `additionalScopes`
|
|
110
|
-
* (globs outside the workspace dir that belong to the package) and
|
|
111
|
-
* `versionFiles` (files bumped in lockstep with the package's version).
|
|
112
|
-
*/
|
|
113
|
-
packages: effect.Schema.optional(require_package_scope.PackagesRecordSchema),
|
|
114
|
-
/**
|
|
115
|
-
* DEPRECATED. Top-level flat array of version-file entries each with
|
|
116
|
-
* their own `package` field. Migrate to `packages[<name>].versionFiles`.
|
|
117
|
-
* Removed in 1.0.0.
|
|
118
|
-
*
|
|
119
|
-
* @deprecated 0.9.0 — migrate to `packages`. Removed in 1.0.0.
|
|
120
|
-
*/
|
|
121
|
-
versionFiles: effect.Schema.optional(require_version_files.LegacyVersionFilesSchema)
|
|
122
|
-
}).pipe(effect.Schema.filter((opts) => opts.packages === void 0 || opts.versionFiles === void 0, { message: () => "Configuration cannot declare both `packages` and the deprecated top-level `versionFiles` array. Migrate the legacy `versionFiles` entries into `packages[<name>].versionFiles` and remove the top-level field." }));
|
|
123
|
-
/**
|
|
124
|
-
* Validate changeset options with Effect-idiomatic error handling.
|
|
125
|
-
*
|
|
126
|
-
* @remarks
|
|
127
|
-
* Provides detailed, user-friendly error messages that match the prior art
|
|
128
|
-
* from \@savvy-web/changelog. Performs manual pre-validation for `null`,
|
|
129
|
-
* non-object, and missing `repo` before delegating to schema decoding.
|
|
130
|
-
* This layered approach ensures that the most common misconfiguration
|
|
131
|
-
* (missing `repo`) produces a clear, actionable message rather than a
|
|
132
|
-
* generic schema parse error.
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* import { Effect } from "effect";
|
|
137
|
-
* import { validateChangesetOptions, ConfigurationError } from "@savvy-web/changesets";
|
|
138
|
-
*
|
|
139
|
-
* const program = validateChangesetOptions({ repo: "savvy-web/changesets" }).pipe(
|
|
140
|
-
* Effect.catchTag("ConfigurationError", (err) =>
|
|
141
|
-
* Effect.logError(`Config invalid: ${err.message}`)
|
|
142
|
-
* ),
|
|
143
|
-
* );
|
|
144
|
-
*
|
|
145
|
-
* Effect.runPromise(program);
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @param input - Raw configuration input (typically from `.changeset/config.json`)
|
|
149
|
-
* @returns An Effect that succeeds with decoded {@link ChangesetOptions} or fails with a {@link ConfigurationError}
|
|
150
|
-
*
|
|
151
|
-
* @see {@link ChangesetOptionsSchema} for the expected configuration shape
|
|
152
|
-
* @see {@link ConfigurationError} for the error type produced on validation failure
|
|
153
|
-
*
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
function validateChangesetOptions(input) {
|
|
157
|
-
if (input === null || input === void 0) return effect.Effect.fail(new require_errors.ConfigurationError({
|
|
158
|
-
field: "options",
|
|
159
|
-
reason: "Configuration is required. Add options to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
|
|
160
|
-
}));
|
|
161
|
-
if (typeof input !== "object") return effect.Effect.fail(new require_errors.ConfigurationError({
|
|
162
|
-
field: "options",
|
|
163
|
-
reason: "Configuration must be an object"
|
|
164
|
-
}));
|
|
165
|
-
const obj = input;
|
|
166
|
-
if (!("repo" in obj) || obj.repo === void 0) return effect.Effect.fail(new require_errors.ConfigurationError({
|
|
167
|
-
field: "repo",
|
|
168
|
-
reason: "Repository name is required. Add the \"repo\" option to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
|
|
169
|
-
}));
|
|
170
|
-
if (typeof obj.repo === "string" && !REPO_PATTERN.test(obj.repo)) return effect.Effect.fail(new require_errors.ConfigurationError({
|
|
171
|
-
field: "repo",
|
|
172
|
-
reason: `Invalid repository format: "${obj.repo}". Expected format is "owner/repository" (e.g., "microsoft/vscode")`
|
|
173
|
-
}));
|
|
174
|
-
return effect.Schema.decodeUnknown(ChangesetOptionsSchema)(input).pipe(effect.Effect.mapError((parseError) => new require_errors.ConfigurationError({
|
|
175
|
-
field: "options",
|
|
176
|
-
reason: String(parseError)
|
|
177
|
-
})));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
//#endregion
|
|
181
|
-
exports.ChangesetOptionsSchema = ChangesetOptionsSchema;
|
|
182
|
-
exports.RepoSchema = RepoSchema;
|
|
183
|
-
exports.validateChangesetOptions = validateChangesetOptions;
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { ConfigurationError } from "../errors.js";
|
|
2
|
-
import { LegacyVersionFilesSchema } from "./version-files.js";
|
|
3
|
-
import { PackagesRecordSchema } from "./package-scope.js";
|
|
4
|
-
import { Effect, Schema } from "effect";
|
|
5
|
-
|
|
6
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/schemas/options.js
|
|
7
|
-
/**
|
|
8
|
-
* Changeset configuration option schemas and validation.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Defines the schema for the options object passed to the
|
|
12
|
-
* \@savvy-web/changesets changelog formatter in `.changeset/config.json`.
|
|
13
|
-
* The options are specified as the second element of the changelog array:
|
|
14
|
-
*
|
|
15
|
-
* ```json
|
|
16
|
-
* {
|
|
17
|
-
* "changelog": ["@savvy-web/changesets/changelog", { "repo": "owner/repo" }]
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @see {@link https://github.com/changesets/changesets/blob/main/docs/config-file-options.md | Changesets config docs}
|
|
22
|
-
* @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
/** Regex for `owner/repo` format, shared between schema and validation. */
|
|
26
|
-
const REPO_PATTERN = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
|
|
27
|
-
/**
|
|
28
|
-
* Schema for a GitHub repository in `owner/repo` format.
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Validates that the string matches the `owner/repository` format used
|
|
32
|
-
* by GitHub. Both the owner and repository segments accept alphanumeric
|
|
33
|
-
* characters, dots, underscores, and hyphens.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* import { Schema } from "effect";
|
|
38
|
-
* import { RepoSchema } from "@savvy-web/changesets";
|
|
39
|
-
*
|
|
40
|
-
* // Succeeds
|
|
41
|
-
* Schema.decodeUnknownSync(RepoSchema)("microsoft/vscode");
|
|
42
|
-
*
|
|
43
|
-
* // Throws ParseError — missing slash
|
|
44
|
-
* Schema.decodeUnknownSync(RepoSchema)("vscode");
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @see {@link ChangesetOptionsSchema} which uses this for the `repo` field
|
|
48
|
-
*
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
const RepoSchema = Schema.String.pipe(Schema.pattern(REPO_PATTERN, { message: () => "Repository must be in format \"owner/repository\" (e.g., \"microsoft/vscode\")" }));
|
|
52
|
-
/**
|
|
53
|
-
* Schema for changeset configuration options.
|
|
54
|
-
*
|
|
55
|
-
* @remarks
|
|
56
|
-
* The `repo` field is required; all other fields are optional with sensible
|
|
57
|
-
* defaults applied by the changelog formatter at runtime.
|
|
58
|
-
*
|
|
59
|
-
* Two related fields describe release surfaces:
|
|
60
|
-
*
|
|
61
|
-
* - `packages` (new, recommended) — a record keyed by package name with
|
|
62
|
-
* per-package `additionalScopes` and `versionFiles`. This is the shape
|
|
63
|
-
* introduced in 0.9.0 and the only shape that will be accepted in 1.0.0.
|
|
64
|
-
* - `versionFiles` (deprecated) — a flat array of entries each carrying
|
|
65
|
-
* their own `package` field. Still accepted in 0.9.0 with a deprecation
|
|
66
|
-
* warning emitted by `ConfigInspector` at config-load time; removed in
|
|
67
|
-
* 1.0.0.
|
|
68
|
-
*
|
|
69
|
-
* A config that declares **both** `packages` and the deprecated
|
|
70
|
-
* `versionFiles` field is rejected — the user must pick one.
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* import { Schema } from "effect";
|
|
75
|
-
* import { ChangesetOptionsSchema } from "@savvy-web/changesets";
|
|
76
|
-
* import type { ChangesetOptions } from "@savvy-web/changesets";
|
|
77
|
-
*
|
|
78
|
-
* // New per-package shape (recommended)
|
|
79
|
-
* const opts: ChangesetOptions = Schema.decodeUnknownSync(ChangesetOptionsSchema)({
|
|
80
|
-
* repo: "savvy-web/changesets",
|
|
81
|
-
* packages: {
|
|
82
|
-
* "@savvy-web/changesets": {
|
|
83
|
-
* additionalScopes: ["plugin/**"],
|
|
84
|
-
* versionFiles: [{ glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] }],
|
|
85
|
-
* },
|
|
86
|
-
* },
|
|
87
|
-
* });
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* @see {@link ChangesetOptions} for the inferred TypeScript type
|
|
91
|
-
* @see {@link validateChangesetOptions} for Effect-idiomatic validation with detailed error messages
|
|
92
|
-
* @see {@link PackagesRecordSchema} for the new `packages` shape
|
|
93
|
-
* @see {@link LegacyVersionFilesSchema} for the deprecated `versionFiles` shape
|
|
94
|
-
*
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
const ChangesetOptionsSchema = Schema.Struct({
|
|
98
|
-
/** GitHub repository in `owner/repo` format. */
|
|
99
|
-
repo: RepoSchema,
|
|
100
|
-
/** Whether to include commit hash links in output. */
|
|
101
|
-
commitLinks: Schema.optional(Schema.Boolean),
|
|
102
|
-
/** Whether to include pull request links in output. */
|
|
103
|
-
prLinks: Schema.optional(Schema.Boolean),
|
|
104
|
-
/** Whether to include issue reference links in output. */
|
|
105
|
-
issueLinks: Schema.optional(Schema.Boolean),
|
|
106
|
-
/** Custom issue reference prefixes (e.g., `["#", "GH-"]`). */
|
|
107
|
-
issuePrefixes: Schema.optional(Schema.Array(Schema.String)),
|
|
108
|
-
/**
|
|
109
|
-
* Per-package release surfaces. Each entry declares `additionalScopes`
|
|
110
|
-
* (globs outside the workspace dir that belong to the package) and
|
|
111
|
-
* `versionFiles` (files bumped in lockstep with the package's version).
|
|
112
|
-
*/
|
|
113
|
-
packages: Schema.optional(PackagesRecordSchema),
|
|
114
|
-
/**
|
|
115
|
-
* DEPRECATED. Top-level flat array of version-file entries each with
|
|
116
|
-
* their own `package` field. Migrate to `packages[<name>].versionFiles`.
|
|
117
|
-
* Removed in 1.0.0.
|
|
118
|
-
*
|
|
119
|
-
* @deprecated 0.9.0 — migrate to `packages`. Removed in 1.0.0.
|
|
120
|
-
*/
|
|
121
|
-
versionFiles: Schema.optional(LegacyVersionFilesSchema)
|
|
122
|
-
}).pipe(Schema.filter((opts) => opts.packages === void 0 || opts.versionFiles === void 0, { message: () => "Configuration cannot declare both `packages` and the deprecated top-level `versionFiles` array. Migrate the legacy `versionFiles` entries into `packages[<name>].versionFiles` and remove the top-level field." }));
|
|
123
|
-
/**
|
|
124
|
-
* Validate changeset options with Effect-idiomatic error handling.
|
|
125
|
-
*
|
|
126
|
-
* @remarks
|
|
127
|
-
* Provides detailed, user-friendly error messages that match the prior art
|
|
128
|
-
* from \@savvy-web/changelog. Performs manual pre-validation for `null`,
|
|
129
|
-
* non-object, and missing `repo` before delegating to schema decoding.
|
|
130
|
-
* This layered approach ensures that the most common misconfiguration
|
|
131
|
-
* (missing `repo`) produces a clear, actionable message rather than a
|
|
132
|
-
* generic schema parse error.
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* import { Effect } from "effect";
|
|
137
|
-
* import { validateChangesetOptions, ConfigurationError } from "@savvy-web/changesets";
|
|
138
|
-
*
|
|
139
|
-
* const program = validateChangesetOptions({ repo: "savvy-web/changesets" }).pipe(
|
|
140
|
-
* Effect.catchTag("ConfigurationError", (err) =>
|
|
141
|
-
* Effect.logError(`Config invalid: ${err.message}`)
|
|
142
|
-
* ),
|
|
143
|
-
* );
|
|
144
|
-
*
|
|
145
|
-
* Effect.runPromise(program);
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @param input - Raw configuration input (typically from `.changeset/config.json`)
|
|
149
|
-
* @returns An Effect that succeeds with decoded {@link ChangesetOptions} or fails with a {@link ConfigurationError}
|
|
150
|
-
*
|
|
151
|
-
* @see {@link ChangesetOptionsSchema} for the expected configuration shape
|
|
152
|
-
* @see {@link ConfigurationError} for the error type produced on validation failure
|
|
153
|
-
*
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
function validateChangesetOptions(input) {
|
|
157
|
-
if (input === null || input === void 0) return Effect.fail(new ConfigurationError({
|
|
158
|
-
field: "options",
|
|
159
|
-
reason: "Configuration is required. Add options to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
|
|
160
|
-
}));
|
|
161
|
-
if (typeof input !== "object") return Effect.fail(new ConfigurationError({
|
|
162
|
-
field: "options",
|
|
163
|
-
reason: "Configuration must be an object"
|
|
164
|
-
}));
|
|
165
|
-
const obj = input;
|
|
166
|
-
if (!("repo" in obj) || obj.repo === void 0) return Effect.fail(new ConfigurationError({
|
|
167
|
-
field: "repo",
|
|
168
|
-
reason: "Repository name is required. Add the \"repo\" option to your changesets config:\n\"changelog\": [\"@savvy-web/changesets\", { \"repo\": \"owner/repository\" }]"
|
|
169
|
-
}));
|
|
170
|
-
if (typeof obj.repo === "string" && !REPO_PATTERN.test(obj.repo)) return Effect.fail(new ConfigurationError({
|
|
171
|
-
field: "repo",
|
|
172
|
-
reason: `Invalid repository format: "${obj.repo}". Expected format is "owner/repository" (e.g., "microsoft/vscode")`
|
|
173
|
-
}));
|
|
174
|
-
return Schema.decodeUnknown(ChangesetOptionsSchema)(input).pipe(Effect.mapError((parseError) => new ConfigurationError({
|
|
175
|
-
field: "options",
|
|
176
|
-
reason: String(parseError)
|
|
177
|
-
})));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
//#endregion
|
|
181
|
-
export { ChangesetOptionsSchema, RepoSchema, validateChangesetOptions };
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
const require_version_files = require('./version-files.cjs');
|
|
2
|
-
let effect = require("effect");
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js
|
|
5
|
-
/**
|
|
6
|
-
* Schemas for the per-package release-surface configuration introduced in
|
|
7
|
-
* \@savvy-web/changesets 0.9.0.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* A `PackageScope` is the value side of the `packages` record on the
|
|
11
|
-
* \@savvy-web/changesets changelog options. It tells the formatter which
|
|
12
|
-
* non-workspace paths belong to a package's release surface (via
|
|
13
|
-
* `additionalScopes`) and which files have their version fields bumped in
|
|
14
|
-
* lockstep with the package (via `versionFiles`).
|
|
15
|
-
*
|
|
16
|
-
* ```jsonc
|
|
17
|
-
* "changelog": [
|
|
18
|
-
* "@savvy-web/changesets/changelog",
|
|
19
|
-
* {
|
|
20
|
-
* "repo": "savvy-web/changesets",
|
|
21
|
-
* "packages": {
|
|
22
|
-
* "@savvy-web/changesets": {
|
|
23
|
-
* "additionalScopes": ["plugin/**"],
|
|
24
|
-
* "versionFiles": [
|
|
25
|
-
* { "glob": "plugin/.claude-plugin/plugin.json",
|
|
26
|
-
* "paths": ["$.version"] }
|
|
27
|
-
* ]
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
* }
|
|
31
|
-
* ]
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* Validation contracts that span multiple packages (no-overlap rules for
|
|
35
|
-
* `additionalScopes`, no glob+path conflicts in `versionFiles`, unknown
|
|
36
|
-
* package keys) are enforced by `ConfigInspector` at load time, not at the
|
|
37
|
-
* schema level — schemas only validate per-entry shape.
|
|
38
|
-
*
|
|
39
|
-
* @see {@link ChangesetOptionsSchema} for the consuming options shape
|
|
40
|
-
* @see {@link VersionFileConfigSchema} for the version-file entry shape
|
|
41
|
-
* @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* Schema for a single repo-relative glob pattern.
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
* Globs in `additionalScopes` must be repo-relative — absolute paths and
|
|
49
|
-
* parent traversal (`../`) are rejected outright because they cannot be
|
|
50
|
-
* meaningfully resolved against the project workspace. Negation patterns
|
|
51
|
-
* (`!path/**`) are accepted; minimatch handles them at match time.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { Schema } from "effect";
|
|
56
|
-
* import { GlobSchema } from "@savvy-web/changesets";
|
|
57
|
-
*
|
|
58
|
-
* Schema.decodeUnknownSync(GlobSchema)("plugin/**"); // ok
|
|
59
|
-
* Schema.decodeUnknownSync(GlobSchema)("!plugin/cache/**"); // ok (negation)
|
|
60
|
-
* Schema.decodeUnknownSync(GlobSchema)("/absolute/path"); // throws
|
|
61
|
-
* Schema.decodeUnknownSync(GlobSchema)("../sibling/**"); // throws
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
const GlobSchema = effect.Schema.String.pipe(effect.Schema.minLength(1), effect.Schema.filter((s) => !s.startsWith("/") && !s.startsWith("../") && !s.includes("/../"), { message: () => "Glob must be repo-relative — absolute paths and parent traversal (../) are not allowed" }));
|
|
67
|
-
/**
|
|
68
|
-
* Schema for a single entry in the `packages` record — the per-package
|
|
69
|
-
* release-surface declaration.
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* Both fields are optional. An empty object (`{}`) is a valid PackageScope
|
|
73
|
-
* and means "this package uses only its workspace directory as its release
|
|
74
|
-
* surface."
|
|
75
|
-
*
|
|
76
|
-
* - `additionalScopes` — repo-relative globs naming files outside the
|
|
77
|
-
* package's workspace directory that belong to the package's release
|
|
78
|
-
* surface. The contract is "a path belongs to exactly one package" — if
|
|
79
|
-
* two packages declare overlapping additionalScopes, the config is
|
|
80
|
-
* rejected by `ConfigInspector`.
|
|
81
|
-
* - `versionFiles` — files whose JSON fields are bumped in lockstep with
|
|
82
|
-
* this package's version. Each entry uses the new {@link VersionFileConfigSchema}
|
|
83
|
-
* shape (no `package` field; the parent record key names the owner).
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```typescript
|
|
87
|
-
* import { Schema } from "effect";
|
|
88
|
-
* import { PackageScopeSchema } from "@savvy-web/changesets";
|
|
89
|
-
*
|
|
90
|
-
* const scope = Schema.decodeUnknownSync(PackageScopeSchema)({
|
|
91
|
-
* additionalScopes: ["plugin/**", "!plugin/.cache/**"],
|
|
92
|
-
* versionFiles: [
|
|
93
|
-
* { glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] },
|
|
94
|
-
* ],
|
|
95
|
-
* });
|
|
96
|
-
* ```
|
|
97
|
-
*
|
|
98
|
-
* @see {@link PackageScope} for the inferred TypeScript type
|
|
99
|
-
* @see {@link GlobSchema} for individual glob validation rules
|
|
100
|
-
* @see {@link VersionFileConfigSchema} for the version-file entry shape
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
const PackageScopeSchema = effect.Schema.Struct({
|
|
105
|
-
/** Repo-relative globs naming files outside the package's workspace directory that belong to its release surface. */
|
|
106
|
-
additionalScopes: effect.Schema.optional(effect.Schema.Array(GlobSchema)),
|
|
107
|
-
/** Files whose JSON fields are bumped in lockstep with this package's version. */
|
|
108
|
-
versionFiles: effect.Schema.optional(effect.Schema.Array(require_version_files.VersionFileConfigSchema))
|
|
109
|
-
});
|
|
110
|
-
/**
|
|
111
|
-
* Schema for the `packages` record on the changelog options.
|
|
112
|
-
*
|
|
113
|
-
* @remarks
|
|
114
|
-
* Keys are package names. The schema itself does not validate that keys
|
|
115
|
-
* resolve to known workspace packages — that check is performed by
|
|
116
|
-
* `ConfigInspector` at config-load time, where `WorkspaceDiscovery` is
|
|
117
|
-
* available to enumerate the workspace.
|
|
118
|
-
*
|
|
119
|
-
* @public
|
|
120
|
-
*/
|
|
121
|
-
const PackagesRecordSchema = effect.Schema.Record({
|
|
122
|
-
key: effect.Schema.String,
|
|
123
|
-
value: PackageScopeSchema
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
//#endregion
|
|
127
|
-
exports.GlobSchema = GlobSchema;
|
|
128
|
-
exports.PackageScopeSchema = PackageScopeSchema;
|
|
129
|
-
exports.PackagesRecordSchema = PackagesRecordSchema;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { VersionFileConfigSchema } from "./version-files.js";
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region ../silk-effects/dist/dev/pkg/changesets/schemas/package-scope.js
|
|
5
|
-
/**
|
|
6
|
-
* Schemas for the per-package release-surface configuration introduced in
|
|
7
|
-
* \@savvy-web/changesets 0.9.0.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* A `PackageScope` is the value side of the `packages` record on the
|
|
11
|
-
* \@savvy-web/changesets changelog options. It tells the formatter which
|
|
12
|
-
* non-workspace paths belong to a package's release surface (via
|
|
13
|
-
* `additionalScopes`) and which files have their version fields bumped in
|
|
14
|
-
* lockstep with the package (via `versionFiles`).
|
|
15
|
-
*
|
|
16
|
-
* ```jsonc
|
|
17
|
-
* "changelog": [
|
|
18
|
-
* "@savvy-web/changesets/changelog",
|
|
19
|
-
* {
|
|
20
|
-
* "repo": "savvy-web/changesets",
|
|
21
|
-
* "packages": {
|
|
22
|
-
* "@savvy-web/changesets": {
|
|
23
|
-
* "additionalScopes": ["plugin/**"],
|
|
24
|
-
* "versionFiles": [
|
|
25
|
-
* { "glob": "plugin/.claude-plugin/plugin.json",
|
|
26
|
-
* "paths": ["$.version"] }
|
|
27
|
-
* ]
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
* }
|
|
31
|
-
* ]
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* Validation contracts that span multiple packages (no-overlap rules for
|
|
35
|
-
* `additionalScopes`, no glob+path conflicts in `versionFiles`, unknown
|
|
36
|
-
* package keys) are enforced by `ConfigInspector` at load time, not at the
|
|
37
|
-
* schema level — schemas only validate per-entry shape.
|
|
38
|
-
*
|
|
39
|
-
* @see {@link ChangesetOptionsSchema} for the consuming options shape
|
|
40
|
-
* @see {@link VersionFileConfigSchema} for the version-file entry shape
|
|
41
|
-
* @see {@link https://effect.website/docs/schema/introduction | Effect Schema documentation}
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* Schema for a single repo-relative glob pattern.
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
* Globs in `additionalScopes` must be repo-relative — absolute paths and
|
|
49
|
-
* parent traversal (`../`) are rejected outright because they cannot be
|
|
50
|
-
* meaningfully resolved against the project workspace. Negation patterns
|
|
51
|
-
* (`!path/**`) are accepted; minimatch handles them at match time.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { Schema } from "effect";
|
|
56
|
-
* import { GlobSchema } from "@savvy-web/changesets";
|
|
57
|
-
*
|
|
58
|
-
* Schema.decodeUnknownSync(GlobSchema)("plugin/**"); // ok
|
|
59
|
-
* Schema.decodeUnknownSync(GlobSchema)("!plugin/cache/**"); // ok (negation)
|
|
60
|
-
* Schema.decodeUnknownSync(GlobSchema)("/absolute/path"); // throws
|
|
61
|
-
* Schema.decodeUnknownSync(GlobSchema)("../sibling/**"); // throws
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
const GlobSchema = Schema.String.pipe(Schema.minLength(1), Schema.filter((s) => !s.startsWith("/") && !s.startsWith("../") && !s.includes("/../"), { message: () => "Glob must be repo-relative — absolute paths and parent traversal (../) are not allowed" }));
|
|
67
|
-
/**
|
|
68
|
-
* Schema for a single entry in the `packages` record — the per-package
|
|
69
|
-
* release-surface declaration.
|
|
70
|
-
*
|
|
71
|
-
* @remarks
|
|
72
|
-
* Both fields are optional. An empty object (`{}`) is a valid PackageScope
|
|
73
|
-
* and means "this package uses only its workspace directory as its release
|
|
74
|
-
* surface."
|
|
75
|
-
*
|
|
76
|
-
* - `additionalScopes` — repo-relative globs naming files outside the
|
|
77
|
-
* package's workspace directory that belong to the package's release
|
|
78
|
-
* surface. The contract is "a path belongs to exactly one package" — if
|
|
79
|
-
* two packages declare overlapping additionalScopes, the config is
|
|
80
|
-
* rejected by `ConfigInspector`.
|
|
81
|
-
* - `versionFiles` — files whose JSON fields are bumped in lockstep with
|
|
82
|
-
* this package's version. Each entry uses the new {@link VersionFileConfigSchema}
|
|
83
|
-
* shape (no `package` field; the parent record key names the owner).
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```typescript
|
|
87
|
-
* import { Schema } from "effect";
|
|
88
|
-
* import { PackageScopeSchema } from "@savvy-web/changesets";
|
|
89
|
-
*
|
|
90
|
-
* const scope = Schema.decodeUnknownSync(PackageScopeSchema)({
|
|
91
|
-
* additionalScopes: ["plugin/**", "!plugin/.cache/**"],
|
|
92
|
-
* versionFiles: [
|
|
93
|
-
* { glob: "plugin/.claude-plugin/plugin.json", paths: ["$.version"] },
|
|
94
|
-
* ],
|
|
95
|
-
* });
|
|
96
|
-
* ```
|
|
97
|
-
*
|
|
98
|
-
* @see {@link PackageScope} for the inferred TypeScript type
|
|
99
|
-
* @see {@link GlobSchema} for individual glob validation rules
|
|
100
|
-
* @see {@link VersionFileConfigSchema} for the version-file entry shape
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
const PackageScopeSchema = Schema.Struct({
|
|
105
|
-
/** Repo-relative globs naming files outside the package's workspace directory that belong to its release surface. */
|
|
106
|
-
additionalScopes: Schema.optional(Schema.Array(GlobSchema)),
|
|
107
|
-
/** Files whose JSON fields are bumped in lockstep with this package's version. */
|
|
108
|
-
versionFiles: Schema.optional(Schema.Array(VersionFileConfigSchema))
|
|
109
|
-
});
|
|
110
|
-
/**
|
|
111
|
-
* Schema for the `packages` record on the changelog options.
|
|
112
|
-
*
|
|
113
|
-
* @remarks
|
|
114
|
-
* Keys are package names. The schema itself does not validate that keys
|
|
115
|
-
* resolve to known workspace packages — that check is performed by
|
|
116
|
-
* `ConfigInspector` at config-load time, where `WorkspaceDiscovery` is
|
|
117
|
-
* available to enumerate the workspace.
|
|
118
|
-
*
|
|
119
|
-
* @public
|
|
120
|
-
*/
|
|
121
|
-
const PackagesRecordSchema = Schema.Record({
|
|
122
|
-
key: Schema.String,
|
|
123
|
-
value: PackageScopeSchema
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
//#endregion
|
|
127
|
-
export { GlobSchema, PackageScopeSchema, PackagesRecordSchema };
|