@wpelevator/wp-release 0.5.0 → 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 +67 -0
- 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 +28 -7
- 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/command.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
|
@@ -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,25 @@
|
|
|
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 'github-release': {
|
|
14
|
+
readonly type: "boolean";
|
|
15
|
+
};
|
|
16
|
+
readonly since: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
run({ values, cwd, configFile, logger }: import("./command.ts").CommandContext): Promise<{
|
|
21
|
+
exitCode: number;
|
|
22
|
+
result: import("../changeset-release.ts").ChangesetTagResult;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
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] [--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
|
+
--since <ref> Tag packages changed since this git ref
|
|
10
|
+
--push Push newly created tags to origin
|
|
11
|
+
--github-release Create a GitHub Release for each tag
|
|
12
|
+
|
|
13
|
+
Tags are created only when absent, and GitHub Releases are created only when
|
|
14
|
+
missing, so rerunning after a partial failure is safe. --github-release also
|
|
15
|
+
requires --push.`,
|
|
16
|
+
options: changesetTagArgs,
|
|
17
|
+
async run({ values, cwd, configFile, logger }) {
|
|
18
|
+
const args = parseChangesetTagArgs(values);
|
|
19
|
+
const result = await tagChangesets({
|
|
20
|
+
cwd,
|
|
21
|
+
...(configFile ? { configFile } : {}),
|
|
22
|
+
...args,
|
|
23
|
+
});
|
|
24
|
+
result.tags.forEach((item) => logger.info(`${item.created ? 'Created' : 'Exists'} ${item.tag}`));
|
|
25
|
+
return { exitCode: 0, result };
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -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