@wpelevator/wp-release 0.4.1 → 0.6.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 +136 -6
- package/dist/changeset-config.d.ts +189 -0
- package/dist/changeset-config.js +273 -0
- package/dist/changeset-release.d.ts +74 -0
- package/dist/changeset-release.js +829 -0
- package/dist/changesets.d.ts +72 -0
- package/dist/changesets.js +103 -0
- package/dist/cli.d.ts +12 -5
- package/dist/cli.js +78 -18
- package/dist/commands/changeset-add.d.ts +37 -0
- package/dist/commands/changeset-add.js +35 -0
- package/dist/commands/changeset-args.d.ts +114 -0
- package/dist/commands/changeset-args.js +139 -0
- package/dist/commands/changeset-status.d.ts +43 -0
- package/dist/commands/changeset-status.js +65 -0
- package/dist/commands/changeset-tag.d.ts +25 -0
- package/dist/commands/changeset-tag.js +27 -0
- package/dist/commands/changeset-version.d.ts +38 -0
- package/dist/commands/changeset-version.js +39 -0
- package/dist/commands/checksums.js +2 -0
- package/dist/commands/command.d.ts +2 -0
- package/dist/commands/sign.js +2 -0
- package/dist/commands/verify.js +61 -12
- package/dist/commands/version-check.js +5 -2
- package/dist/commands/zip.js +7 -7
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +8 -0
- package/dist/github-actions-writer.d.ts +52 -0
- package/dist/github-actions-writer.js +94 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +8 -3
- package/dist/logger.d.ts +88 -16
- package/dist/logger.js +73 -25
- package/dist/package-meta.d.ts +26 -0
- package/dist/package-meta.js +65 -10
- package/dist/report.d.ts +22 -0
- package/dist/report.js +35 -0
- package/dist/summary.d.ts +141 -0
- package/dist/summary.js +287 -0
- package/dist/svn-deploy.d.ts +2 -1
- package/dist/svn-deploy.js +8 -6
- package/dist/version-check.d.ts +39 -1
- package/dist/version-check.js +59 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# WP Release
|
|
2
2
|
|
|
3
|
-
Package, checksum, verify and version-check WordPress plugins and themes, and deploy plugins to the WordPress.org plugin SVN repository. Usable as a CLI, as a library, and through the [`wp-release-deploy-svn`](
|
|
3
|
+
Package, checksum, verify and version-check WordPress plugins and themes, and deploy plugins to the WordPress.org plugin SVN repository. Usable as a CLI, as a library, and through the [`wp-release-zip`](https://github.com/wpelevator/wp-release-zip), [`wp-release-checksums`](https://github.com/wpelevator/wp-release-checksums), [`wp-release-sign`](https://github.com/wpelevator/wp-release-sign) and [`wp-release-deploy-svn`](https://github.com/wpelevator/wp-release-deploy-svn) GitHub Actions.
|
|
4
4
|
|
|
5
5
|
Themes are released by uploading a ZIP on WordPress.org, so `deploy-svn` is for plugins only; use `zip` to build the theme upload.
|
|
6
6
|
|
|
7
|
-
**Status:** first release (0.x).
|
|
7
|
+
**Status:** first release (0.x). Signatures are tested against libsodium, but haven't been used for a real release yet.
|
|
8
8
|
|
|
9
9
|
Option names follow the existing community tools (10up WordPress.org actions, `wp dist-archive`, `wp-scripts plugin-zip`, `grunt-wp-deploy`) so that migrating needs few or no renames. See [Comparison with existing tools](#comparison-with-existing-tools) for the differences.
|
|
10
10
|
|
|
@@ -32,21 +32,117 @@ npx wp-release --help
|
|
|
32
32
|
| `wp-release verify [<source-dir>] --checksums <file> [options]` | Check a plugin or theme directory, or a ZIP, against a checksums manifest. |
|
|
33
33
|
| `wp-release version-check [<source-dir>] [options]` | Check that the `Version` header, readme `Stable tag`, PHP constants and git tag agree. |
|
|
34
34
|
| `wp-release deploy-svn [<source-dir>] [options]` | Deploy a plugin to the WordPress.org plugin SVN repository. |
|
|
35
|
+
| `wp-release changeset-add [options]` | Record the release impact of a pull request. |
|
|
36
|
+
| `wp-release changeset-status [options]` | List pending releases and check changed packages for changesets. |
|
|
37
|
+
| `wp-release changeset-version [options]` | Apply version bumps and changelog entries. |
|
|
38
|
+
| `wp-release changeset-tag [options]` | Create missing package release tags. |
|
|
35
39
|
|
|
36
40
|
Run `npx wp-release <command> --help` for the options of each command. Every command reads the plugin or theme directory from the first argument or `--source-dir`, defaulting to the current directory, and prints its result as JSON with `--json`.
|
|
37
41
|
|
|
42
|
+
### GitHub Actions annotations and job summaries
|
|
43
|
+
|
|
44
|
+
With the `github` log format, the CLI uses current GitHub Actions features to report problems where you look for them, instead of only in the log. `--log-format <name>` picks how the CLI logs, separately from the result that `--json` prints:
|
|
45
|
+
|
|
46
|
+
| Log format | Output |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `text` | Plain text. The default outside GitHub Actions. |
|
|
49
|
+
| `github` | GitHub Actions annotations and job summaries. The default when `GITHUB_ACTIONS=true`. `--ci` is a shorthand for it. |
|
|
50
|
+
|
|
51
|
+
Pass `--log-format text` for plain text in GitHub Actions. The GitHub Actions always use the `github` log format. Only the CLI checks `GITHUB_ACTIONS`: the library classes don't read the environment, and choose the format by the [writer](#logging) they get.
|
|
52
|
+
|
|
53
|
+
Errors, warnings and notices are printed as [workflow commands](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands), so they show up as annotations on the run and on the files of a pull request:
|
|
54
|
+
|
|
55
|
+
- `version-check` and `deploy-svn` annotate each version mismatch on the file and line of the version: the `Version` header, the readme `Stable tag` or the PHP constant.
|
|
56
|
+
- `verify` annotates each changed file and each file that isn't in the checksums.
|
|
57
|
+
|
|
58
|
+
Each command also adds a section to the [job summary](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#adding-a-job-summary) of the run, when `GITHUB_STEP_SUMMARY` is set:
|
|
59
|
+
|
|
60
|
+
| Command | Summary |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `deploy-svn` | Plugin, linked to its WordPress.org page, version, written SVN paths, the commit linked to its WordPress.org changeset (or the dry run or no-op result), and the SVN changes in a collapsed table. |
|
|
63
|
+
| `zip` | ZIP, number of files and checksums manifest. |
|
|
64
|
+
| `checksums` | Manifest and number of files. |
|
|
65
|
+
| `sign` | Signature files and the public key. |
|
|
66
|
+
| `verify` | That all files match, or the counts and a table of the changed, missing and extra files. |
|
|
67
|
+
| `version-check` | The matching version, or a table of the mismatches with their files and lines. |
|
|
68
|
+
|
|
69
|
+
A failed command adds its error to the summary, or a table of its problems with their files and lines, listing up to 100 and counting the rest. The Markdown of the summaries isn't part of the library API. File paths are relative to `GITHUB_WORKSPACE`, or the current directory without it. Files outside it, like those of an extracted ZIP, get an annotation without a file. Multi-line messages stay one annotation.
|
|
70
|
+
|
|
71
|
+
Use global `--config <path>` to select a config; relative paths resolve from the current directory. Otherwise, Changesets commands discover `wp-release.config.js`, `.mjs` or `.cjs` there.
|
|
72
|
+
|
|
73
|
+
### Changesets support (experimental)
|
|
74
|
+
|
|
75
|
+
Changesets support is experimental. It reads Changesets-style Markdown and loads JavaScript configs with descriptors for npm and Composer manifests, plugin and theme headers, readme Stable tags, PHP constants, and Git tags. Use ESM (`export default`) or CommonJS (`module.exports`); TypeScript configs are not supported. Frontmatter accepts `package-name: patch|minor|major` entries; advanced YAML and prerelease mode are unsupported.
|
|
76
|
+
|
|
77
|
+
Typical release flow, from a feature pull request to the publish workflows triggered by release tags:
|
|
78
|
+
|
|
79
|
+
```mermaid
|
|
80
|
+
flowchart TD
|
|
81
|
+
A["Contributor changes a plugin or package"] --> B{"Does this change need a release?"}
|
|
82
|
+
B -->|Yes| C["Add a changeset with package, bump, and release note"]
|
|
83
|
+
B -->|No| D["Add an empty changeset"]
|
|
84
|
+
C --> E["Open or update the feature pull request"]
|
|
85
|
+
D --> E
|
|
86
|
+
E --> F["changeset-status checks changed packages and PR changesets"]
|
|
87
|
+
F -->|Missing a changeset| G["Add the missing changeset"]
|
|
88
|
+
G --> E
|
|
89
|
+
F -->|Pass| H["Merge the feature pull request to main"]
|
|
90
|
+
H --> I["changeset-version updates configured version files and changelogs"]
|
|
91
|
+
I --> J{"Are there package releases to review?"}
|
|
92
|
+
J -->|Yes| K["Workflow opens or updates the Version Packages pull request"]
|
|
93
|
+
K --> L["Review and merge the Version Packages pull request"]
|
|
94
|
+
L --> M["changeset-tag creates tags for packages changed by that release"]
|
|
95
|
+
M --> N["GitHub Releases are created from changelog entries"]
|
|
96
|
+
N --> O["Tag-triggered publish and split workflows run"]
|
|
97
|
+
J -->|No| P["No package versions or release tags are created"]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
An empty changeset marks a feature PR as no-release. The version workflow consumes it without changing versions, and a release PR containing only its deletion produces no tags.
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
import { composerJsonVersion, defineConfig, gitTagVersion, packageJsonVersion, wordpressPluginVersion, wordpressStableTag } from '@wpelevator/wp-release';
|
|
104
|
+
|
|
105
|
+
export default defineConfig( {
|
|
106
|
+
baseBranch: 'main',
|
|
107
|
+
changesets: '.changeset',
|
|
108
|
+
readmeChangelog: true,
|
|
109
|
+
changelogInsertAfter: '<!-- changelog -->',
|
|
110
|
+
root: 'packages',
|
|
111
|
+
tagFormat: '{path}/{version}',
|
|
112
|
+
packages: [
|
|
113
|
+
{ glob: 'js/*', idFrom: 'package.json#name', version: { from: packageJsonVersion(), to: [ packageJsonVersion() ] } },
|
|
114
|
+
{ glob: 'plugins/*', idFrom: 'package.json#name', version: { from: wordpressPluginVersion(), to: [ wordpressPluginVersion(), wordpressStableTag( { ifPresent: true } ), composerJsonVersion( { ifPresent: true } ) ] } },
|
|
115
|
+
{ glob: 'php/*', idFrom: 'composer.json#name', version: { from: gitTagVersion( { pattern: '{path}/{version}' } ), to: [] } },
|
|
116
|
+
],
|
|
117
|
+
} );
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`version.from` selects the current version; `version.to` lists release targets. Package globs support `*`, `?` and `**`; `{path}` in tag templates is relative to `root`. Templates also accept `{type}`, `{name}` and `{slug}`, while `tagType` customizes the type label. Use `phpConstantVersion( { file, constant } )` to sync a PHP constant.
|
|
121
|
+
|
|
122
|
+
The default strategy requires stable `x.y.z` versions. Configure `nextVersion( { package, bump, currentVersion, changesets } )` for other formats; changeset bumps remain `patch`, `minor` or `major`, and prerelease syntax is unsupported.
|
|
123
|
+
|
|
124
|
+
Without `--since`, `changeset-status` compares against `origin/<baseBranch>`; fetch that ref or pass `--since` when using a fork or different upstream. `loadChangesetConfig()` discovers a conventional config at the repository root, unless `--config <path>` selects one explicitly.
|
|
125
|
+
|
|
126
|
+
Add release notes in a feature PR with `npx wp-release changeset-add --package @vendor/plugin --bump patch --summary "Fix the checkout validation."`. Repeat package and bump flags for multiple packages, or use `--empty` when no release is needed. In CI, `changeset-status --since origin/main` requires a changeset added by the PR; changesets already on the base do not count, while an empty PR changeset records an explicit no-release decision. Missing-change annotations identify an affected file.
|
|
127
|
+
|
|
128
|
+
On the release branch, preview with `changeset-version --dry-run`, then run `changeset-version` to update version targets and changelogs. By default, new Markdown entries go before the first version heading; `changelogInsertAfter` sets a literal insertion marker for `CHANGELOG.md` and, with `readmeChangelog`, the plugin readme. Put the marker in both files; a missing marker is an error. Without a marker, plugin readmes use the `== Changelog ==` heading. Failed updates are rolled back for safe retries.
|
|
129
|
+
|
|
130
|
+
After merging the release PR, `changeset-tag --since <merge-commit>^1 --push` pushes tags only for packages changed by that release. Add `--github-release` to create missing GitHub Releases; it requires `--push`. For initial adoption, preview all missing tags with `changeset-tag --dry-run` (without `--since`), then push if needed. Tag pushes need Git write credentials; GitHub Releases need authenticated `gh`.
|
|
131
|
+
|
|
132
|
+
For local development, run the TypeScript source with `npm run wp-release -- <command>` (for example, `npm run wp-release -- changeset-status --since origin/main`). GitHub workflows use the same CLI for versioning and tagging. `SUBTREE_DEPLOY_TOKEN` lets them update the Version Packages PR, push tags, and create GitHub Releases.
|
|
133
|
+
|
|
38
134
|
### Naming convention
|
|
39
135
|
|
|
40
136
|
`@wpelevator/wp-release` is the suite of release tools and `wp-release` is its CLI. "Release" is the whole workflow; each command is one operation in it. Commands are flat: a single word or dashed words like `version-check` and `deploy-svn`, without command groups or aliases. Each GitHub Action is named `wp-release-` followed by the command name, so the CLI command and the `uses:` name always match:
|
|
41
137
|
|
|
42
138
|
| Capability | CLI command | GitHub Action |
|
|
43
139
|
|---|---|---|
|
|
44
|
-
| Build a ZIP | `wp-release zip` | [`wpelevator/wp-release-zip`](
|
|
45
|
-
| Create a checksums manifest | `wp-release checksums` | [`wpelevator/wp-release-checksums`](
|
|
46
|
-
| Sign files | `wp-release sign` | [`wpelevator/wp-release-sign`](
|
|
140
|
+
| Build a ZIP | `wp-release zip` | [`wpelevator/wp-release-zip`](https://github.com/wpelevator/wp-release-zip) |
|
|
141
|
+
| Create a checksums manifest | `wp-release checksums` | [`wpelevator/wp-release-checksums`](https://github.com/wpelevator/wp-release-checksums) |
|
|
142
|
+
| Sign files | `wp-release sign` | [`wpelevator/wp-release-sign`](https://github.com/wpelevator/wp-release-sign) |
|
|
47
143
|
| Verify files against a manifest | `wp-release verify` | |
|
|
48
144
|
| Check that the versions agree | `wp-release version-check` | |
|
|
49
|
-
| Deploy to WordPress.org SVN | `wp-release deploy-svn` | [`wpelevator/wp-release-deploy-svn`](
|
|
145
|
+
| Deploy to WordPress.org SVN | `wp-release deploy-svn` | [`wpelevator/wp-release-deploy-svn`](https://github.com/wpelevator/wp-release-deploy-svn) |
|
|
50
146
|
|
|
51
147
|
Each concept has one name, written in the syntax of each interface:
|
|
52
148
|
|
|
@@ -59,6 +155,7 @@ Each concept has one name, written in the syntax of each interface:
|
|
|
59
155
|
| SVN tag to create | `--svn-tag <version>` | `svn-tag` | `svnTag` | Tag written by `deploy-svn`, distinct from a git tag. |
|
|
60
156
|
| SVN repository | `--svn-url <url>` | `svn-url` | `svnUrl` | Deploy destination. |
|
|
61
157
|
| SVN credentials | `--svn-username <name>`, `SVN_USERNAME` and `SVN_PASSWORD` env vars | `svn-username`, `svn-password` | `svnUsername`, `svnPassword` | Needed only to commit. There's no password flag, since it would show in the process list; the action inputs and library options fall back to the env vars. |
|
|
158
|
+
| Log format | `--log-format <text\|github>`, `--ci` for `github` | always `github` | `writer: new TextWriter()` or `new GitHubActionsWriter()` | How the log is printed: plain text, or GitHub Actions annotations and job summaries. Each name matches the start of its writer class. |
|
|
62
159
|
| Assets sync | `--no-assets` to skip | `assets: false` to skip | `assets` | Booleans are positive in the library and the action; `--no-assets` is only the CLI negation, never `noAssets` or a `no-assets` input. |
|
|
63
160
|
|
|
64
161
|
CLI JSON results use camelCase keys like `zipPath`, and GitHub Action outputs use kebab-case like `zip-path`. Library classes are named after the capability (`SvnDeploy`, `Svn`) without repeating "release".
|
|
@@ -83,6 +180,8 @@ The commands read the same headers as WordPress. The main plugin file is the top
|
|
|
83
180
|
|
|
84
181
|
### ZIP
|
|
85
182
|
|
|
183
|
+
The [`wp-release-zip`](https://github.com/wpelevator/wp-release-zip) GitHub Action runs this command.
|
|
184
|
+
|
|
86
185
|
`zip` writes `{slug}.{version}.zip` to the current directory, or to `--output <file>`, with the selected files in a `{slug}/` root folder:
|
|
87
186
|
|
|
88
187
|
```bash
|
|
@@ -97,6 +196,8 @@ wp-release zip dist --slug my-plugin --checksums
|
|
|
97
196
|
|
|
98
197
|
### Checksums
|
|
99
198
|
|
|
199
|
+
The [`wp-release-checksums`](https://github.com/wpelevator/wp-release-checksums) GitHub Action runs this command.
|
|
200
|
+
|
|
100
201
|
`checksums` writes a manifest with the MD5 and SHA-256 hash of every selected file, in the format of the WordPress.org plugin checksums API (`https://downloads.wordpress.org/plugin-checksums/{slug}/{version}.json`). Paths are relative to the plugin or theme folder, sorted, and use forward slashes:
|
|
101
202
|
|
|
102
203
|
```json
|
|
@@ -164,6 +265,8 @@ The public key has to come from somewhere other than the plugin that it checks,
|
|
|
164
265
|
|
|
165
266
|
### Sign
|
|
166
267
|
|
|
268
|
+
The [`wp-release-sign`](https://github.com/wpelevator/wp-release-sign) GitHub Action runs this command.
|
|
269
|
+
|
|
167
270
|
`sign` writes a detached signature next to each file, `<file>.sig`, so that downloads and installed copies can be trusted. Sign both the ZIP and the checksums manifest: the ZIP signature covers installs and updates, and the manifest signature covers the contents after unpacking and copies that weren't built by you.
|
|
168
271
|
|
|
169
272
|
```bash
|
|
@@ -192,6 +295,8 @@ wp-release version-check --constant MY_PLUGIN_VERSION --git-tag v1.2.0
|
|
|
192
295
|
|
|
193
296
|
### Deploy to SVN
|
|
194
297
|
|
|
298
|
+
The [`wp-release-deploy-svn`](https://github.com/wpelevator/wp-release-deploy-svn) GitHub Action runs this command.
|
|
299
|
+
|
|
195
300
|
`deploy-svn` syncs a plugin to the WordPress.org plugin SVN repository. Each SVN write is a separate flag and nothing is written unless requested. All writes go into one commit.
|
|
196
301
|
|
|
197
302
|
| Flag | Default | Writes |
|
|
@@ -240,6 +345,7 @@ Validation:
|
|
|
240
345
|
- `--version` defaults to `--svn-tag`, then the `Version` header of the deployed files; when `--version` and `--svn-tag` are both set they must match.
|
|
241
346
|
- Pre-release versions like `1.0.0-rc.1` can be tagged, but syncing one to `trunk/` warns, since trunk is for the development version.
|
|
242
347
|
- `--trunk` without `--svn-tag` works but warns, because trunk then differs from the stable tag that WordPress.org serves downloads from.
|
|
348
|
+
- A version mismatch throws a `VersionMismatchError`, a `ValidationError` with the `mismatches` and a problem for each, with its file and line. See [Logging](#logging).
|
|
243
349
|
|
|
244
350
|
### Exit codes
|
|
245
351
|
|
|
@@ -271,6 +377,30 @@ const { committed, revision, version, changes } = await new SvnDeploy(
|
|
|
271
377
|
|
|
272
378
|
`resolveDeployOptions()` applies the defaults and throws a `ValidationError` (with `exitCode` `2`) for invalid combinations. `SvnDeploy` exposes each step (`prepare()`, `checkVersions()`, `checkout()`, `sync()`, `commit()` and `cleanup()`) separately so CI wrappers can run and report them one by one; `run()` runs all of them, or nothing when there's nothing to write. `getPlan()` lists the planned SVN changes. The `Svn` class wraps the svn command line, and takes the command runner as a dependency so that tests can replace it.
|
|
273
379
|
|
|
380
|
+
### Logging
|
|
381
|
+
|
|
382
|
+
`Logger` filters messages by level and passes them to a writer, like the transports of other Node.js loggers. The writer decides how messages look:
|
|
383
|
+
|
|
384
|
+
- `TextWriter` prints plain text to `stdout` and `stderr`. It's the default.
|
|
385
|
+
- `GitHubActionsWriter` prints [workflow commands](#github-actions-annotations-and-job-summaries), so that notices, warnings and errors with a file are annotations, and appends summaries to `GITHUB_STEP_SUMMARY`. It's the CLI's `github` log format, and the GitHub Actions pass it to their logger. Its `workspace` and `summaryPath` options default to `GITHUB_WORKSPACE` and `GITHUB_STEP_SUMMARY`.
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
import { GitHubActionsWriter, Logger, logError } from '@wpelevator/wp-release';
|
|
389
|
+
|
|
390
|
+
const logger = new Logger( { writer: new GitHubActionsWriter(), verbose: true } );
|
|
391
|
+
|
|
392
|
+
logger.error( 'Version header is 1.2.0, expected 1.3.0.', {
|
|
393
|
+
file: 'my-plugin.php',
|
|
394
|
+
line: 4,
|
|
395
|
+
title: 'Version mismatch',
|
|
396
|
+
} );
|
|
397
|
+
logger.summary( ( { workspace } ) => `### Checked ${ workspace }` );
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
A writer implements `LogWriter` with `write()`, `startGroup()`, `endGroup()` and `summary()`, so other CI systems can have their own format. `summary()` takes a function that builds the Markdown, which only writers with a summary call.
|
|
401
|
+
|
|
402
|
+
A `ValidationError` can list `problems`, each with a `message` and an optional `file`, `line` and `title`. `logError( logger, error, title )` logs each problem as an error on its file and line and lists them in the summary under the title, or logs the message when there are none. `VersionMismatchError` and `version-check` report the version mismatches this way.
|
|
403
|
+
|
|
274
404
|
ZIP files and metadata:
|
|
275
405
|
|
|
276
406
|
```js
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { Changeset, ChangesetBump, ChangesetPackage } from './changesets.ts';
|
|
2
|
+
export type PackageVersionSource = {
|
|
3
|
+
kind: 'package-json';
|
|
4
|
+
file: string;
|
|
5
|
+
field: 'version';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'composer-json';
|
|
8
|
+
file: string;
|
|
9
|
+
field: 'version';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'wordpress-plugin-header';
|
|
12
|
+
file?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'wordpress-theme-header';
|
|
15
|
+
file?: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'wordpress-stable-tag';
|
|
18
|
+
file?: string;
|
|
19
|
+
ifPresent?: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'php-constant';
|
|
22
|
+
file: string;
|
|
23
|
+
constant: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'git-tag';
|
|
26
|
+
pattern?: string;
|
|
27
|
+
};
|
|
28
|
+
export type PackageVersionTarget = {
|
|
29
|
+
kind: 'package-json';
|
|
30
|
+
file: string;
|
|
31
|
+
field: 'version';
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'composer-json';
|
|
34
|
+
file: string;
|
|
35
|
+
field: 'version';
|
|
36
|
+
ifPresent: boolean;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'wordpress-plugin-header';
|
|
39
|
+
file?: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'wordpress-theme-header';
|
|
42
|
+
file?: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'wordpress-stable-tag';
|
|
45
|
+
file?: string;
|
|
46
|
+
ifPresent?: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'php-constant';
|
|
49
|
+
file: string;
|
|
50
|
+
constant: string;
|
|
51
|
+
};
|
|
52
|
+
export interface PackageVersionConfig {
|
|
53
|
+
/** File or tag that provides the package's current version. */
|
|
54
|
+
from: PackageVersionSource;
|
|
55
|
+
/** All version locations that should receive the next version. */
|
|
56
|
+
to: PackageVersionTarget[];
|
|
57
|
+
}
|
|
58
|
+
export type PackageIdSource = 'package.json#name' | 'composer.json#name' | 'path';
|
|
59
|
+
/** One directory pattern that describes packages sharing release behavior. */
|
|
60
|
+
export interface ChangesetPackageGroup {
|
|
61
|
+
/** Package directories to discover, relative to the configured package root. */
|
|
62
|
+
glob: string;
|
|
63
|
+
/** Package paths excluded from this group, relative to root. */
|
|
64
|
+
exclude?: string[];
|
|
65
|
+
/** Optional type used by the {type} tag template. */
|
|
66
|
+
tagType?: string;
|
|
67
|
+
/** Manifest field used as the changeset name; defaults to `path`. */
|
|
68
|
+
idFrom?: PackageIdSource;
|
|
69
|
+
/** Version source and files to update for every discovered package. */
|
|
70
|
+
version: PackageVersionConfig;
|
|
71
|
+
}
|
|
72
|
+
/** JavaScript configuration for changeset-aware releases. */
|
|
73
|
+
export interface ChangesetConfig {
|
|
74
|
+
/** Branch receiving ordinary changes. */
|
|
75
|
+
baseBranch?: string;
|
|
76
|
+
/** Directory containing Markdown changesets, relative to the repository root. */
|
|
77
|
+
changesets?: string;
|
|
78
|
+
/** Package groups to discover and release. */
|
|
79
|
+
packages: ChangesetPackageGroup[];
|
|
80
|
+
/** Git tag template supporting {name}, {slug}, {path}, {type} and {version}. */
|
|
81
|
+
tagFormat?: string;
|
|
82
|
+
/** Directory against which package paths in tag formats are calculated. */
|
|
83
|
+
root?: string;
|
|
84
|
+
/** Whether plugin readme changelogs are updated with CHANGELOG.md. */
|
|
85
|
+
readmeChangelog?: boolean;
|
|
86
|
+
/** Insert generated changelog entries after this literal marker. */
|
|
87
|
+
changelogInsertAfter?: string;
|
|
88
|
+
/** Calculate a package's next version instead of using stable SemVer bumps. */
|
|
89
|
+
nextVersion?: (input: NextVersionInput) => string;
|
|
90
|
+
}
|
|
91
|
+
/** Inputs supplied to a custom next-version strategy. */
|
|
92
|
+
export interface NextVersionInput {
|
|
93
|
+
package: ChangesetPackage;
|
|
94
|
+
bump: ChangesetBump;
|
|
95
|
+
currentVersion: string;
|
|
96
|
+
changesets: Changeset[];
|
|
97
|
+
}
|
|
98
|
+
export type WpReleaseConfig = ChangesetConfig;
|
|
99
|
+
export interface PackageJsonVersionOptions {
|
|
100
|
+
file?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface ComposerJsonVersionOptions {
|
|
103
|
+
file?: string;
|
|
104
|
+
/** Skip this target when the `version` property is absent instead of adding it. */
|
|
105
|
+
ifPresent?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface WordPressVersionFileOptions {
|
|
108
|
+
file?: string;
|
|
109
|
+
/** Skip a missing target file instead of failing. */
|
|
110
|
+
ifPresent?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface GitTagVersionOptions {
|
|
113
|
+
pattern?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface PhpConstantVersionOptions {
|
|
116
|
+
file: string;
|
|
117
|
+
constant: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Return a package.json version descriptor for use as a source or target.
|
|
121
|
+
*
|
|
122
|
+
* @param options Version manifest path.
|
|
123
|
+
* @return Package version descriptor.
|
|
124
|
+
*/
|
|
125
|
+
export declare function packageJsonVersion(options?: PackageJsonVersionOptions): PackageVersionSource & PackageVersionTarget;
|
|
126
|
+
/**
|
|
127
|
+
* Return a Composer version descriptor for use as a source or target.
|
|
128
|
+
*
|
|
129
|
+
* @param options Composer manifest path and missing-field behavior.
|
|
130
|
+
* @return Package version descriptor.
|
|
131
|
+
*/
|
|
132
|
+
export declare function composerJsonVersion(options?: ComposerJsonVersionOptions): PackageVersionSource & PackageVersionTarget;
|
|
133
|
+
/**
|
|
134
|
+
* Return a WordPress plugin header version descriptor.
|
|
135
|
+
*
|
|
136
|
+
* @param options Optional plugin main file path.
|
|
137
|
+
* @return Package version descriptor.
|
|
138
|
+
*/
|
|
139
|
+
export declare function wordpressPluginVersion(options?: WordPressVersionFileOptions): PackageVersionSource & PackageVersionTarget;
|
|
140
|
+
/**
|
|
141
|
+
* Return a WordPress theme style.css version descriptor.
|
|
142
|
+
*
|
|
143
|
+
* @param options Optional theme stylesheet path.
|
|
144
|
+
* @return Package version descriptor.
|
|
145
|
+
*/
|
|
146
|
+
export declare function wordpressThemeVersion(options?: WordPressVersionFileOptions): PackageVersionSource & PackageVersionTarget;
|
|
147
|
+
/**
|
|
148
|
+
* Return a WordPress readme Stable tag version descriptor.
|
|
149
|
+
*
|
|
150
|
+
* @param options Optional readme path.
|
|
151
|
+
* @return Package version descriptor.
|
|
152
|
+
*/
|
|
153
|
+
export declare function wordpressStableTag(options?: WordPressVersionFileOptions): PackageVersionSource & PackageVersionTarget;
|
|
154
|
+
/**
|
|
155
|
+
* Return a git tag version descriptor for packages without a version file.
|
|
156
|
+
*
|
|
157
|
+
* @param options Optional tag pattern.
|
|
158
|
+
* @return Package version descriptor.
|
|
159
|
+
*/
|
|
160
|
+
export declare function gitTagVersion(options?: GitTagVersionOptions): PackageVersionSource;
|
|
161
|
+
/**
|
|
162
|
+
* Return a PHP constant descriptor for use as a version source or target.
|
|
163
|
+
*
|
|
164
|
+
* @param options PHP file and constant name.
|
|
165
|
+
* @return Package version descriptor.
|
|
166
|
+
*/
|
|
167
|
+
export declare function phpConstantVersion(options: PhpConstantVersionOptions): PackageVersionSource & PackageVersionTarget;
|
|
168
|
+
/**
|
|
169
|
+
* Add type checking to a JavaScript wp-release configuration.
|
|
170
|
+
*
|
|
171
|
+
* @param config Repository release configuration.
|
|
172
|
+
* @return The same configuration object.
|
|
173
|
+
*/
|
|
174
|
+
export declare function defineConfig(config: ChangesetConfig): ChangesetConfig;
|
|
175
|
+
export interface LoadChangesetConfigInput {
|
|
176
|
+
cwd?: string;
|
|
177
|
+
configFile?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Load and validate the repository's JavaScript wp-release configuration.
|
|
181
|
+
*
|
|
182
|
+
* @param input Working directory and optional explicit config path.
|
|
183
|
+
* @return Loaded configuration and its absolute file path, or undefined when absent.
|
|
184
|
+
* @throws {ValidationError} If the module cannot be loaded or its shape is invalid.
|
|
185
|
+
*/
|
|
186
|
+
export declare function loadChangesetConfig(input?: LoadChangesetConfigInput): Promise<{
|
|
187
|
+
config: ChangesetConfig;
|
|
188
|
+
file: string;
|
|
189
|
+
} | undefined>;
|