@wpelevator/wp-release 0.5.0 → 0.6.1

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.
@@ -0,0 +1,43 @@
1
+ export interface ChangesetStatusResult {
2
+ changesets: Array<{
3
+ fileName: string;
4
+ packages: Record<string, string>;
5
+ summary: string;
6
+ }>;
7
+ releases: Array<{
8
+ package: string;
9
+ bump: string;
10
+ currentVersion: string;
11
+ nextVersion: string;
12
+ }>;
13
+ changedPackages: string[];
14
+ changedPackageFiles: Record<string, string[]>;
15
+ missingChangesets: string[];
16
+ }
17
+ declare const _default: {
18
+ name: string;
19
+ usage: string;
20
+ summary: string;
21
+ help: string;
22
+ options: {
23
+ readonly since: {
24
+ readonly type: "string";
25
+ };
26
+ };
27
+ run({ values, cwd, configFile, logger }: import("./command.ts").CommandContext): Promise<{
28
+ exitCode: number;
29
+ result: {
30
+ releases: {
31
+ package: string;
32
+ bump: "patch" | "minor" | "major";
33
+ currentVersion: string;
34
+ nextVersion: string;
35
+ }[];
36
+ changesets: import("../changesets.ts").Changeset[];
37
+ changedPackages: string[];
38
+ changedPackageFiles: Record<string, string[]>;
39
+ missingChangesets: string[];
40
+ };
41
+ }>;
42
+ };
43
+ export default _default;
@@ -0,0 +1,65 @@
1
+ import { getChangesetStatus } from "../changeset-release.js";
2
+ import { changesetStatusArgs, parseChangesetStatusArgs, } from "./changeset-args.js";
3
+ export default {
4
+ name: 'changeset-status',
5
+ usage: 'changeset-status [--since <ref>]',
6
+ summary: 'Show pending releases and check changed packages for changesets.',
7
+ help: `Options:
8
+ --since <ref> Compare changed files with this git ref (for CI)
9
+
10
+ Exit status is 2 when a changed package has no changeset added since the comparison base.
11
+ An empty changeset added since the comparison base counts as an explicit no-release decision.`,
12
+ options: changesetStatusArgs,
13
+ async run({ values, cwd, configFile, logger }) {
14
+ const { since } = parseChangesetStatusArgs(values);
15
+ const result = await getChangesetStatus({
16
+ cwd,
17
+ ...(configFile ? { configFile } : {}),
18
+ ...(since ? { since } : {}),
19
+ });
20
+ logger.summary(() => {
21
+ const rows = result.changedPackages.map((name) => {
22
+ let status = 'no release requested';
23
+ if (result.releases.some((release) => release.package.name === name)) {
24
+ status = 'changeset found';
25
+ }
26
+ if (result.missingChangesets.includes(name)) {
27
+ status = 'missing changeset';
28
+ }
29
+ return [name, status];
30
+ });
31
+ return [
32
+ '### Changeset status',
33
+ '',
34
+ '| Package | Status |',
35
+ '| --- | --- |',
36
+ ...rows.map((row) => `| ${row.join(' | ')} |`),
37
+ ].join('\n');
38
+ });
39
+ result.releases.forEach((release) => logger.info(`${release.package.name}: ${release.currentVersion} → ${release.nextVersion} (${release.bump})`));
40
+ if (result.missingChangesets.length) {
41
+ result.missingChangesets.forEach((name) => {
42
+ const file = result.changedPackageFiles[name]?.[0];
43
+ logger.error(`Changed package "${name}" has no changeset.`, {
44
+ file,
45
+ title: 'Missing changeset',
46
+ });
47
+ });
48
+ }
49
+ else if (!result.releases.length) {
50
+ logger.info('No pending package releases.');
51
+ }
52
+ return {
53
+ exitCode: result.missingChangesets.length ? 2 : 0,
54
+ result: {
55
+ ...result,
56
+ releases: result.releases.map((item) => ({
57
+ package: item.package.name,
58
+ bump: item.bump,
59
+ currentVersion: item.currentVersion,
60
+ nextVersion: item.nextVersion,
61
+ })),
62
+ },
63
+ };
64
+ },
65
+ };
@@ -0,0 +1,28 @@
1
+ declare const _default: {
2
+ name: string;
3
+ usage: string;
4
+ summary: string;
5
+ help: string;
6
+ options: {
7
+ readonly push: {
8
+ readonly type: "boolean";
9
+ };
10
+ readonly 'dry-run': {
11
+ readonly type: "boolean";
12
+ };
13
+ readonly untagged: {
14
+ readonly type: "boolean";
15
+ };
16
+ readonly 'github-release': {
17
+ readonly type: "boolean";
18
+ };
19
+ readonly since: {
20
+ readonly type: "string";
21
+ };
22
+ };
23
+ run({ values, cwd, configFile, logger }: import("./command.ts").CommandContext): Promise<{
24
+ exitCode: number;
25
+ result: import("../changeset-release.ts").ChangesetTagResult;
26
+ }>;
27
+ };
28
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { tagChangesets } from "../changeset-release.js";
2
+ import { parseChangesetTagArgs, changesetTagArgs } from "./changeset-args.js";
3
+ export default {
4
+ name: 'changeset-tag',
5
+ usage: 'changeset-tag [--dry-run] [--untagged] [--since <ref>] [--push] [--github-release]',
6
+ summary: 'Create missing release tags for configured package versions.',
7
+ help: `Options:
8
+ --dry-run List missing tags without creating them
9
+ --untagged List only releases without a tag, without creating tags
10
+ --since <ref> Tag packages changed since this git ref
11
+ --push Push newly created tags to origin
12
+ --github-release Create a GitHub Release for each tag
13
+
14
+ Tags are created only when absent, and GitHub Releases are created only when
15
+ missing, so rerunning after a partial failure is safe. --github-release also
16
+ requires --push. With --json or --github-output, --untagged lists the releases
17
+ that still need a tag, for example to release each of them with a separate
18
+ workflow.`,
19
+ options: changesetTagArgs,
20
+ async run({ values, cwd, configFile, logger }) {
21
+ const args = parseChangesetTagArgs(values);
22
+ const result = await tagChangesets({
23
+ cwd,
24
+ ...(configFile ? { configFile } : {}),
25
+ ...args,
26
+ });
27
+ result.tags.forEach((item) => logger.info(`${item.created ? 'Created' : 'Exists'} ${item.tag}`));
28
+ return { exitCode: 0, result };
29
+ },
30
+ };
@@ -0,0 +1,38 @@
1
+ export interface ChangesetVersionResult {
2
+ date: string;
3
+ changed: boolean;
4
+ releases: Array<{
5
+ package: string;
6
+ bump: string;
7
+ currentVersion: string;
8
+ nextVersion: string;
9
+ }>;
10
+ }
11
+ declare const _default: {
12
+ name: string;
13
+ usage: string;
14
+ summary: string;
15
+ help: string;
16
+ options: {
17
+ readonly 'dry-run': {
18
+ readonly type: "boolean";
19
+ };
20
+ readonly date: {
21
+ readonly type: "string";
22
+ };
23
+ };
24
+ run({ values, cwd, configFile, logger }: import("./command.ts").CommandContext): Promise<{
25
+ exitCode: number;
26
+ result: {
27
+ date: string;
28
+ changed: boolean;
29
+ releases: {
30
+ package: string;
31
+ bump: "patch" | "minor" | "major";
32
+ currentVersion: string;
33
+ nextVersion: string;
34
+ }[];
35
+ };
36
+ }>;
37
+ };
38
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import { versionChangesets } from "../changeset-release.js";
2
+ import { parseChangesetVersionArgs, changesetVersionArgs, } from "./changeset-args.js";
3
+ export default {
4
+ name: 'changeset-version',
5
+ usage: 'changeset-version [--dry-run] [--date <YYYY-MM-DD>]',
6
+ summary: 'Apply pending version bumps and changelog entries.',
7
+ help: `Options:
8
+ --dry-run Print the release plan without writing files
9
+ --date <YYYY-MM-DD> Changelog date (default: today)
10
+
11
+ Updates configured version files, prepends changelog entries and removes the
12
+ applied changeset files.`,
13
+ options: changesetVersionArgs,
14
+ async run({ values, cwd, configFile, logger }) {
15
+ const args = parseChangesetVersionArgs(values);
16
+ const result = await versionChangesets({
17
+ cwd,
18
+ ...(configFile ? { configFile } : {}),
19
+ ...args,
20
+ });
21
+ result.releases.forEach((release) => logger.info(`${release.package.name}: ${release.currentVersion} → ${release.nextVersion} (${release.bump})`));
22
+ if (!result.releases.length) {
23
+ logger.info('No pending package releases.');
24
+ }
25
+ return {
26
+ exitCode: 0,
27
+ result: {
28
+ date: result.date,
29
+ changed: result.changed,
30
+ releases: result.releases.map((item) => ({
31
+ package: item.package.name,
32
+ bump: item.bump,
33
+ currentVersion: item.currentVersion,
34
+ nextVersion: item.nextVersion,
35
+ })),
36
+ },
37
+ };
38
+ },
39
+ };
@@ -11,6 +11,8 @@ export interface CommandContext {
11
11
  positionals: string[];
12
12
  /** Working directory that relative paths resolve against. */
13
13
  cwd: string;
14
+ /** Explicit JavaScript release config path from --config, if supplied. */
15
+ configFile?: string;
14
16
  /** Logger for the command output. */
15
17
  logger: Logger;
16
18
  }
package/dist/index.d.ts CHANGED
@@ -14,6 +14,9 @@ export { ZIP_MTIME, ZIP_FILE_MODE, createZip } from './zip.ts';
14
14
  export { isUrl, downloadFile } from './download.ts';
15
15
  export { readZipEntries, getZipEntryErrors, extractZip } from './unzip.ts';
16
16
  export { GIT_TAG_FORMAT, VersionMismatchError, getGitTagVersion, findConstantValues, findConstantDefinitions, findVersionMismatches, getVersionMismatchProblems, } from './version-check.ts';
17
+ export { CHANGESET_BUMPS, parseChangeset, formatChangeset, getChangesetBump, getNextVersion, } from './changesets.ts';
18
+ export { addChangeset, getChangesetReleasePlan, getChangesetStatus, versionChangesets, tagChangesets, } from './changeset-release.ts';
19
+ export { defineConfig, packageJsonVersion, composerJsonVersion, wordpressPluginVersion, wordpressThemeVersion, wordpressStableTag, gitTagVersion, phpConstantVersion, loadChangesetConfig, } from './changeset-config.ts';
17
20
  export { Svn, SvnError, createSvnRunner, parseStatus, toSvnPath, } from './svn.ts';
18
21
  export { syncDirectory, copyFileIfChanged } from './sync.ts';
19
22
  export { ASSET_MIME_TYPES, SvnDeploy } from './svn-deploy.ts';
@@ -34,6 +37,9 @@ export type { FindMainPluginFileInput, HeaderValues, PackageMeta, ParseFileHeade
34
37
  export type { CreateZipInput } from './zip.ts';
35
38
  export type { ExtractZipInput, ZipEntryInfo, ZipEntryType } from './unzip.ts';
36
39
  export type { FindVersionMismatchesInput, GitTagInput, VersionCheckResult, VersionMismatch, } from './version-check.ts';
40
+ export type { Changeset, ChangesetBump, ChangesetPackages, ChangesetConfig, ChangesetPackageType, ChangesetPackage, PackageRelease, ChangesetReleasePlan, } from './changesets.ts';
41
+ export type { ChangesetRepository, ChangesetVersionInput, ChangesetTagInput, ChangesetTagResult, } from './changeset-release.ts';
42
+ export type { WpReleaseConfig, ChangesetPackageGroup, PackageVersionConfig, PackageVersionSource, PackageVersionTarget, PackageIdSource, NextVersionInput, PackageJsonVersionOptions, ComposerJsonVersionOptions, WordPressVersionFileOptions, GitTagVersionOptions, PhpConstantVersionOptions, LoadChangesetConfigInput, } from './changeset-config.ts';
37
43
  export type { SvnCheckoutInput, SvnCommandInput, SvnCommandOutput, SvnCommitInput, SvnCopyInput, SvnDepth, SvnOptions, SvnPathsInput, SvnPropsetInput, SvnRunner, SvnStatusEntry, SvnStatusType, SvnUpdateInput, } from './svn.ts';
38
44
  export type { SyncDirectoryInput, SyncResult } from './sync.ts';
39
45
  export type { SummaryContext } from './summary.ts';
package/dist/index.js CHANGED
@@ -14,6 +14,9 @@ export { ZIP_MTIME, ZIP_FILE_MODE, createZip } from "./zip.js";
14
14
  export { isUrl, downloadFile } from "./download.js";
15
15
  export { readZipEntries, getZipEntryErrors, extractZip } from "./unzip.js";
16
16
  export { GIT_TAG_FORMAT, VersionMismatchError, getGitTagVersion, findConstantValues, findConstantDefinitions, findVersionMismatches, getVersionMismatchProblems, } from "./version-check.js";
17
+ export { CHANGESET_BUMPS, parseChangeset, formatChangeset, getChangesetBump, getNextVersion, } from "./changesets.js";
18
+ export { addChangeset, getChangesetReleasePlan, getChangesetStatus, versionChangesets, tagChangesets, } from "./changeset-release.js";
19
+ export { defineConfig, packageJsonVersion, composerJsonVersion, wordpressPluginVersion, wordpressThemeVersion, wordpressStableTag, gitTagVersion, phpConstantVersion, loadChangesetConfig, } from "./changeset-config.js";
17
20
  export { Svn, SvnError, createSvnRunner, parseStatus, toSvnPath, } from "./svn.js";
18
21
  export { syncDirectory, copyFileIfChanged } from "./sync.js";
19
22
  export { ASSET_MIME_TYPES, SvnDeploy } from "./svn-deploy.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpelevator/wp-release",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Package, checksum, sign, verify and version-check WordPress plugins and themes, and deploy plugins to WordPress.org SVN",
5
5
  "license": "MIT",
6
6
  "repository": {