@wpelevator/wp-release 0.9.0 → 0.11.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.
Files changed (43) hide show
  1. package/README.md +101 -4
  2. package/dist/changelog.d.ts +45 -0
  3. package/dist/changelog.js +246 -0
  4. package/dist/changeset-config.d.ts +75 -0
  5. package/dist/changeset-config.js +48 -0
  6. package/dist/changeset-dependents.d.ts +132 -0
  7. package/dist/changeset-dependents.js +540 -0
  8. package/dist/changeset-files.d.ts +41 -0
  9. package/dist/changeset-files.js +100 -0
  10. package/dist/changeset-packages.d.ts +59 -0
  11. package/dist/changeset-packages.js +186 -0
  12. package/dist/changeset-release.d.ts +155 -18
  13. package/dist/changeset-release.js +366 -1090
  14. package/dist/changesets.d.ts +2 -0
  15. package/dist/commands/changeset-args.d.ts +5 -4
  16. package/dist/commands/changeset-args.js +2 -5
  17. package/dist/commands/changeset-status.d.ts +2 -0
  18. package/dist/commands/changeset-status.js +6 -2
  19. package/dist/commands/changeset-tag.d.ts +0 -3
  20. package/dist/commands/changeset-tag.js +8 -10
  21. package/dist/commands/changeset-version.d.ts +3 -0
  22. package/dist/commands/changeset-version.js +2 -1
  23. package/dist/file-journal.d.ts +22 -0
  24. package/dist/file-journal.js +56 -0
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +1 -1
  27. package/dist/json-files.d.ts +15 -0
  28. package/dist/json-files.js +35 -0
  29. package/dist/package-meta.js +1 -3
  30. package/dist/regexp.d.ts +7 -0
  31. package/dist/regexp.js +9 -0
  32. package/dist/release-repository.d.ts +102 -0
  33. package/dist/release-repository.js +159 -0
  34. package/dist/release-tags.d.ts +56 -0
  35. package/dist/release-tags.js +89 -0
  36. package/dist/tag-format.d.ts +20 -0
  37. package/dist/tag-format.js +51 -0
  38. package/dist/version-check.js +1 -3
  39. package/dist/version-files.d.ts +36 -0
  40. package/dist/version-files.js +195 -0
  41. package/dist/versions.d.ts +25 -0
  42. package/dist/versions.js +74 -0
  43. package/package.json +3 -1
@@ -0,0 +1,41 @@
1
+ import type { Changeset, ChangesetBump } from './changesets.ts';
2
+ import type { FileJournal } from './file-journal.ts';
3
+ import type { ReleaseRepository } from './release-repository.ts';
4
+ /**
5
+ * Read the pending changesets of a directory, skipping its README.
6
+ *
7
+ * @param directory Changeset directory.
8
+ * @return Changesets sorted by file name, empty without the directory.
9
+ */
10
+ export declare function readChangesets(directory: string): Promise<Changeset[]>;
11
+ /**
12
+ * Pick the changesets that were added or changed since a ref.
13
+ *
14
+ * @param repository Repository of the changesets.
15
+ * @param directory Changeset directory.
16
+ * @param changesets Pending changesets.
17
+ * @param since Base ref, like origin/main.
18
+ * @return Changesets of the diff.
19
+ */
20
+ export declare function readChangesetsSince(repository: ReleaseRepository, directory: string, changesets: Changeset[], since: string): Promise<Changeset[]>;
21
+ /**
22
+ * Create a Changesets-compatible Markdown file.
23
+ *
24
+ * @param directory Changeset directory, created when missing.
25
+ * @param packages Bump of each package.
26
+ * @param summary Changelog summary.
27
+ * @param name File name without the extension, random by default.
28
+ * @return Created file path.
29
+ * @throws {ValidationError} If the file already exists.
30
+ */
31
+ export declare function writeChangeset(directory: string, packages: Record<string, ChangesetBump>, summary: string, name?: string): Promise<string>;
32
+ /**
33
+ * Remove an applied changeset, or only the applied packages from a changeset
34
+ * that names other packages too, so that their releases keep its summary.
35
+ *
36
+ * @param file Changeset file.
37
+ * @param changeset Parsed changeset.
38
+ * @param applied Versioned packages, or undefined when all were versioned.
39
+ * @param journal File journal for rolling back.
40
+ */
41
+ export declare function consumeChangeset(file: string, changeset: Changeset, applied: string[] | undefined, journal: FileJournal): Promise<void>;
@@ -0,0 +1,100 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { access, mkdir, readdir, readFile, rm, writeFile, } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { formatChangeset, parseChangeset } from "./changesets.js";
5
+ import { ValidationError } from "./errors.js";
6
+ /**
7
+ * Read the pending changesets of a directory, skipping its README.
8
+ *
9
+ * @param directory Changeset directory.
10
+ * @return Changesets sorted by file name, empty without the directory.
11
+ */
12
+ export async function readChangesets(directory) {
13
+ let entries;
14
+ try {
15
+ entries = await readdir(directory);
16
+ }
17
+ catch (error) {
18
+ if ('ENOENT' === error.code) {
19
+ return [];
20
+ }
21
+ throw error;
22
+ }
23
+ return Promise.all(entries
24
+ .filter((name) => name.endsWith('.md') && !name.startsWith('README'))
25
+ .sort()
26
+ .map(async (name) => parseChangeset(await readFile(path.join(directory, name), 'utf8'), name)));
27
+ }
28
+ /**
29
+ * Pick the changesets that were added or changed since a ref.
30
+ *
31
+ * @param repository Repository of the changesets.
32
+ * @param directory Changeset directory.
33
+ * @param changesets Pending changesets.
34
+ * @param since Base ref, like origin/main.
35
+ * @return Changesets of the diff.
36
+ */
37
+ export async function readChangesetsSince(repository, directory, changesets, since) {
38
+ const relativeDirectory = repository.relativePath(directory);
39
+ const changedFiles = new Set(await repository.getChangedFiles(since, {
40
+ directory,
41
+ diffFilter: 'ACMR',
42
+ }));
43
+ return changesets.filter((changeset) => changedFiles.has(path.posix.join(relativeDirectory, changeset.fileName)));
44
+ }
45
+ /**
46
+ * Create a Changesets-compatible Markdown file.
47
+ *
48
+ * @param directory Changeset directory, created when missing.
49
+ * @param packages Bump of each package.
50
+ * @param summary Changelog summary.
51
+ * @param name File name without the extension, random by default.
52
+ * @return Created file path.
53
+ * @throws {ValidationError} If the file already exists.
54
+ */
55
+ export async function writeChangeset(directory, packages, summary, name) {
56
+ await mkdir(directory, { recursive: true });
57
+ const fileName = `${name ?? randomUUID().slice(0, 8)}.md`;
58
+ const file = path.join(directory, fileName);
59
+ let exists = false;
60
+ try {
61
+ await access(file);
62
+ exists = true;
63
+ }
64
+ catch (error) {
65
+ if ('ENOENT' !== error.code) {
66
+ throw error;
67
+ }
68
+ }
69
+ if (exists) {
70
+ throw new ValidationError(`Changeset ${fileName} already exists.`);
71
+ }
72
+ const entries = Object.entries(packages)
73
+ .sort((a, b) => a[0].localeCompare(b[0]))
74
+ .map(([pkg, bump]) => `${JSON.stringify(pkg)}: ${bump}`)
75
+ .join('\n');
76
+ await writeFile(file, `---\n${entries}\n---\n\n${summary.trim()}\n`);
77
+ return file;
78
+ }
79
+ /**
80
+ * Remove an applied changeset, or only the applied packages from a changeset
81
+ * that names other packages too, so that their releases keep its summary.
82
+ *
83
+ * @param file Changeset file.
84
+ * @param changeset Parsed changeset.
85
+ * @param applied Versioned packages, or undefined when all were versioned.
86
+ * @param journal File journal for rolling back.
87
+ */
88
+ export async function consumeChangeset(file, changeset, applied, journal) {
89
+ const remaining = Object.entries(changeset.packages).filter(([name]) => undefined !== applied && !applied.includes(name));
90
+ await journal.remember(file);
91
+ if (remaining.length) {
92
+ await writeFile(file, formatChangeset({
93
+ packages: Object.fromEntries(remaining),
94
+ summary: changeset.summary,
95
+ }));
96
+ }
97
+ else {
98
+ await rm(file);
99
+ }
100
+ }
@@ -0,0 +1,59 @@
1
+ import type { ChangesetConfig, ChangesetPackageGroup } from './changeset-config.ts';
2
+ import type { ChangesetPackage } from './changesets.ts';
3
+ import type { ReleaseRepository } from './release-repository.ts';
4
+ /**
5
+ * A discovered package with the configuration of its package group.
6
+ */
7
+ export interface ConfiguredPackage extends ChangesetPackage {
8
+ group: ChangesetPackageGroup;
9
+ versionConfig: ChangesetPackageGroup['version'];
10
+ }
11
+ export interface ChangedPackages {
12
+ /** Packages with changed files, in the configured order. */
13
+ packages: ConfiguredPackage[];
14
+ /** Changed files relative to the repository root, by package name. */
15
+ filesByPackage: Record<string, string[]>;
16
+ }
17
+ /**
18
+ * Find the packages of the configured package groups, with their current
19
+ * versions.
20
+ *
21
+ * @param repository Repository the packages are in.
22
+ * @param config Repository release configuration.
23
+ * @return Packages in the configured order.
24
+ * @throws {ValidationError} For a glob without matches or a duplicate package name.
25
+ */
26
+ export declare function discoverPackages(repository: ReleaseRepository, config: ChangesetConfig): Promise<ConfiguredPackage[]>;
27
+ /**
28
+ * Fail for package names that aren't configured.
29
+ *
30
+ * @param packages Discovered packages.
31
+ * @param names Package names to check.
32
+ * @throws {ValidationError} For the first unknown package.
33
+ */
34
+ export declare function assertKnownPackages(packages: ChangesetPackage[], names: string[]): void;
35
+ /**
36
+ * Find the packages with files changed between the merge base of a ref and
37
+ * HEAD.
38
+ *
39
+ * @param repository Repository the packages are in.
40
+ * @param packages Discovered packages.
41
+ * @param since Base ref, like origin/main.
42
+ * @return Changed packages and their changed files.
43
+ */
44
+ export declare function getChangedPackages(repository: ReleaseRepository, packages: ConfiguredPackage[], since: string): Promise<ChangedPackages>;
45
+ /**
46
+ * Remove the release configuration from a package passed to config callbacks.
47
+ *
48
+ * @param pkg Configured package.
49
+ * @return Package without its group configuration.
50
+ */
51
+ export declare function toChangesetPackage(pkg: ConfiguredPackage): ChangesetPackage;
52
+ /**
53
+ * Convert a package glob to a regular expression, where * and ? match within
54
+ * a path segment and ** matches any number of segments.
55
+ *
56
+ * @param glob Glob relative to the package root, like `plugins/*`.
57
+ * @return Anchored regular expression.
58
+ */
59
+ export declare function globRegExp(glob: string): RegExp;
@@ -0,0 +1,186 @@
1
+ import { readdir } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { ValidationError } from "./errors.js";
4
+ import { readJson } from "./json-files.js";
5
+ import { readVersion } from "./version-files.js";
6
+ /** Directories that never contain configured packages. */
7
+ const SKIPPED_DIRECTORIES = ['.git', 'node_modules', 'vendor', 'dist'];
8
+ /**
9
+ * Find the packages of the configured package groups, with their current
10
+ * versions.
11
+ *
12
+ * @param repository Repository the packages are in.
13
+ * @param config Repository release configuration.
14
+ * @return Packages in the configured order.
15
+ * @throws {ValidationError} For a glob without matches or a duplicate package name.
16
+ */
17
+ export async function discoverPackages(repository, config) {
18
+ const root = path.resolve(repository.cwd, config.root ?? '.');
19
+ const packages = [];
20
+ const hasRecursiveGlob = config.packages.some((item) => item.glob.split('/').includes('**'));
21
+ const directories = await findDirectories(root, '', hasRecursiveGlob
22
+ ? Infinity
23
+ : Math.max(1, ...config.packages.map((item) => item.glob.split('/').length + 2)));
24
+ for (const group of config.packages) {
25
+ const matcher = globRegExp(group.glob);
26
+ const candidates = matcher.test('.')
27
+ ? ['.', ...directories]
28
+ : directories;
29
+ const matches = candidates
30
+ .filter((item) => matcher.test(item) &&
31
+ !(group.exclude ?? []).some((excluded) => globRegExp(excluded).test(item)))
32
+ .sort();
33
+ if (!matches.length) {
34
+ throw new ValidationError(`Package glob "${group.glob}" did not match any directories under ${root}.`);
35
+ }
36
+ for (const relativePath of matches) {
37
+ const directory = path.join(root, relativePath);
38
+ const name = await packageName(directory, relativePath, group.idFrom ?? 'path');
39
+ const currentVersion = await readVersion(repository, directory, group.version.from, relativePath, group.tagType);
40
+ if (packages.some((pkg) => pkg.name === name)) {
41
+ throw new ValidationError(`Package identifier "${name}" is configured more than once.`);
42
+ }
43
+ packages.push({
44
+ name,
45
+ directory,
46
+ path: relativePath,
47
+ type: packageType(group),
48
+ currentVersion,
49
+ group,
50
+ versionConfig: group.version,
51
+ });
52
+ }
53
+ }
54
+ return packages;
55
+ }
56
+ /**
57
+ * Fail for package names that aren't configured.
58
+ *
59
+ * @param packages Discovered packages.
60
+ * @param names Package names to check.
61
+ * @throws {ValidationError} For the first unknown package.
62
+ */
63
+ export function assertKnownPackages(packages, names) {
64
+ names.forEach((name) => {
65
+ if (!packages.some((pkg) => pkg.name === name)) {
66
+ throw new ValidationError(`Unknown package "${name}".`);
67
+ }
68
+ });
69
+ }
70
+ /**
71
+ * Find the packages with files changed between the merge base of a ref and
72
+ * HEAD.
73
+ *
74
+ * @param repository Repository the packages are in.
75
+ * @param packages Discovered packages.
76
+ * @param since Base ref, like origin/main.
77
+ * @return Changed packages and their changed files.
78
+ */
79
+ export async function getChangedPackages(repository, packages, since) {
80
+ const changedFiles = await repository.getChangedFiles(since);
81
+ const filesByPackage = {};
82
+ const changed = packages.filter((pkg) => {
83
+ const packageFromRepo = repository.relativePath(pkg.directory);
84
+ // Every file belongs to a package at the repository root.
85
+ const matchingFiles = '' === packageFromRepo
86
+ ? changedFiles
87
+ : changedFiles.filter((file) => file === packageFromRepo ||
88
+ file.startsWith(`${packageFromRepo}/`));
89
+ if (matchingFiles.length) {
90
+ filesByPackage[pkg.name] = matchingFiles;
91
+ }
92
+ return matchingFiles.length > 0;
93
+ });
94
+ return { packages: changed, filesByPackage };
95
+ }
96
+ /**
97
+ * Remove the release configuration from a package passed to config callbacks.
98
+ *
99
+ * @param pkg Configured package.
100
+ * @return Package without its group configuration.
101
+ */
102
+ export function toChangesetPackage(pkg) {
103
+ return {
104
+ name: pkg.name,
105
+ directory: pkg.directory,
106
+ path: pkg.path,
107
+ type: pkg.type,
108
+ currentVersion: pkg.currentVersion,
109
+ };
110
+ }
111
+ /**
112
+ * Convert a package glob to a regular expression, where * and ? match within
113
+ * a path segment and ** matches any number of segments.
114
+ *
115
+ * @param glob Glob relative to the package root, like `plugins/*`.
116
+ * @return Anchored regular expression.
117
+ */
118
+ export function globRegExp(glob) {
119
+ const escaped = glob
120
+ .split('/')
121
+ .map((part) => {
122
+ if ('**' === part) {
123
+ return '.*';
124
+ }
125
+ return part
126
+ .replaceAll(/[.+^${}()|[\]\\]/g, '\\$&')
127
+ .replaceAll('*', '[^/]*')
128
+ .replaceAll('?', '[^/]');
129
+ })
130
+ .join('/');
131
+ return new RegExp(`^${escaped}$`);
132
+ }
133
+ async function findDirectories(root, prefix = '', maxDepth = 5) {
134
+ let entries;
135
+ try {
136
+ entries = await readdir(path.join(root, prefix), {
137
+ withFileTypes: true,
138
+ });
139
+ }
140
+ catch (error) {
141
+ if ('ENOENT' === error.code) {
142
+ return [];
143
+ }
144
+ throw error;
145
+ }
146
+ const directories = entries.filter((item) => item.isDirectory() && !SKIPPED_DIRECTORIES.includes(item.name));
147
+ if (prefix.split(path.sep).filter(Boolean).length >= maxDepth) {
148
+ return directories.map((item) => path.join(prefix, item.name));
149
+ }
150
+ const children = await Promise.all(directories.map((item) => findDirectories(root, path.join(prefix, item.name), maxDepth)));
151
+ return [
152
+ ...directories.map((item) => path.join(prefix, item.name)),
153
+ ...children.flat(),
154
+ ];
155
+ }
156
+ async function packageName(directory, relativePath, idFrom) {
157
+ if ('path' === idFrom) {
158
+ if ('.' === relativePath) {
159
+ return path.basename(directory);
160
+ }
161
+ return relativePath.split(path.sep).join('/');
162
+ }
163
+ const [file, field] = idFrom.split('#');
164
+ if (!file || !field) {
165
+ throw new ValidationError(`Invalid package identifier source "${idFrom}".`);
166
+ }
167
+ const manifest = await readJson(path.join(directory, file));
168
+ const name = manifest[field];
169
+ if ('string' !== typeof name || !name.trim()) {
170
+ throw new ValidationError(`Expected ${file}#${field} in ${directory}.`);
171
+ }
172
+ return name;
173
+ }
174
+ function packageType(group) {
175
+ const kind = group.version.from.kind;
176
+ if ('wordpress-plugin-header' === kind) {
177
+ return 'plugin';
178
+ }
179
+ if ('wordpress-theme-header' === kind) {
180
+ return 'theme';
181
+ }
182
+ if ('package-json' === kind) {
183
+ return 'npm';
184
+ }
185
+ return 'other';
186
+ }
@@ -1,14 +1,31 @@
1
- import type { Changeset, ChangesetPackage, ChangesetReleasePlan, PackageRelease, VersionedRelease } from './changesets.ts';
1
+ import type { Changeset, ChangesetBump, ChangesetPackage, ChangesetReleasePlan, PackageRelease, VersionedRelease } from './changesets.ts';
2
+ import type { GitRunner } from './git.ts';
3
+ import { ReleaseRepository } from './release-repository.ts';
2
4
  export interface ChangesetRepository {
3
5
  cwd: string;
4
6
  configFile?: string;
5
7
  }
6
- export interface ChangesetVersionInput extends ChangesetRepository {
8
+ export interface ChangesetReleaseOptions extends ChangesetRepository {
9
+ /** Git runner, spawning git by default. */
10
+ git?: GitRunner;
11
+ }
12
+ export interface ChangesetAddOptions {
13
+ /** Bump of each package. */
14
+ packages: Record<string, ChangesetBump>;
15
+ /** Changelog summary. */
16
+ summary: string;
17
+ /** File name without the extension, random by default. */
18
+ name?: string;
19
+ }
20
+ export interface ChangesetVersionOptions {
7
21
  dryRun?: boolean;
8
22
  date?: string;
9
23
  /** Version only these packages, leaving the other changesets pending. */
10
24
  packages?: string[];
25
+ /** Whether the selected sources release their configured dependents; defaults to true. */
26
+ dependents?: boolean;
11
27
  }
28
+ export type ChangesetVersionInput = ChangesetRepository & ChangesetVersionOptions;
12
29
  /** Versioned releases, the applied changesets and whether files were changed. */
13
30
  export interface VersionChangesetsResult {
14
31
  changesets: Changeset[];
@@ -16,22 +33,24 @@ export interface VersionChangesetsResult {
16
33
  date: string;
17
34
  changed: boolean;
18
35
  }
19
- export interface ChangesetTagInput extends ChangesetRepository {
36
+ export interface ChangesetTagOptions {
20
37
  dryRun?: boolean;
21
38
  untagged?: boolean;
22
39
  push?: boolean;
23
- githubRelease?: boolean;
24
40
  since?: string;
25
41
  /** Tag only these packages. */
26
42
  packages?: string[];
27
43
  /** Expected version of the single package in `packages`. */
28
44
  version?: string;
29
45
  }
46
+ export type ChangesetTagInput = ChangesetRepository & ChangesetTagOptions;
30
47
  export interface ChangesetTagResult {
31
48
  tags: Array<{
32
49
  package: string;
33
50
  version: string;
34
51
  tag: string;
52
+ /** Release title, like `plugins/alpha@1.2.0`. */
53
+ title: string;
35
54
  previousTag?: string;
36
55
  prerelease: boolean;
37
56
  exists: boolean;
@@ -39,6 +58,136 @@ export interface ChangesetTagResult {
39
58
  notes: string;
40
59
  }>;
41
60
  }
61
+ export interface ChangesetStatusOptions {
62
+ /** Base ref to diff against, origin/<baseBranch> by default. */
63
+ since?: string;
64
+ }
65
+ export interface ChangesetStatusResult {
66
+ changesets: Changeset[];
67
+ releases: PackageRelease[];
68
+ changedPackages: string[];
69
+ changedPackageFiles: Record<string, string[]>;
70
+ missingChangesets: string[];
71
+ warnings: string[];
72
+ }
73
+ /**
74
+ * Changeset releases of a repository: recording changesets, versioning the
75
+ * packages they name and tagging the releases.
76
+ *
77
+ * Each operation loads the configuration, discovers the packages and reads the
78
+ * pending changesets again, so that one instance can version and then tag.
79
+ * Git runs through the injected runner.
80
+ */
81
+ export declare class ChangesetRelease {
82
+ readonly cwd: string;
83
+ readonly configFile: string | undefined;
84
+ readonly repository: ReleaseRepository;
85
+ /**
86
+ * @param options Repository root, config file and git runner.
87
+ */
88
+ constructor(options: ChangesetReleaseOptions);
89
+ /**
90
+ * Discover configured packages, pending changesets, and their proposed
91
+ * versions.
92
+ *
93
+ * @return A release plan; `undefined` when no config is present.
94
+ */
95
+ getPlan(): Promise<ChangesetReleasePlan | undefined>;
96
+ /**
97
+ * Discover the packages of the repository configuration.
98
+ *
99
+ * @return Packages in the configured order with their current versions.
100
+ * @throws {ValidationError} Without a config, or for an invalid one.
101
+ */
102
+ getPackages(): Promise<ChangesetPackage[]>;
103
+ /**
104
+ * Create a Changesets-compatible Markdown file.
105
+ *
106
+ * @param options Packages, summary and file name.
107
+ * @return Created file path.
108
+ * @throws {ValidationError} For unknown packages or an existing file.
109
+ */
110
+ add(options: ChangesetAddOptions): Promise<string>;
111
+ /**
112
+ * Apply pending package versions and changelogs. A failed run restores
113
+ * every file it changed.
114
+ *
115
+ * @param options Versioning options.
116
+ * @return Planned releases and whether files were changed.
117
+ * @throws {ValidationError} Without a config, or for an invalid plan.
118
+ */
119
+ version(options?: ChangesetVersionOptions): Promise<VersionChangesetsResult>;
120
+ /**
121
+ * Create missing release tags, optionally pushing them to the origin
122
+ * remote. Each tag comes with the title and notes of its release, for a
123
+ * workflow step to create the GitHub Release.
124
+ *
125
+ * @param options Tag options.
126
+ * @return Per-package tags and release notes.
127
+ * @throws {ValidationError} For conflicting options, unknown packages or version mismatches.
128
+ */
129
+ tag(options?: ChangesetTagOptions): Promise<ChangesetTagResult>;
130
+ /**
131
+ * Check whether changed files belong to packages without a changeset.
132
+ *
133
+ * @param options Base git ref.
134
+ * @return Changed packages and missing changeset identifiers.
135
+ * @throws {ValidationError} Without a config.
136
+ */
137
+ getStatus(options?: ChangesetStatusOptions): Promise<ChangesetStatusResult>;
138
+ /**
139
+ * Write the versions, dependency specs and changelogs of the releases and
140
+ * consume the applied changesets, restoring every changed file when a
141
+ * step fails.
142
+ *
143
+ * @param context Release context.
144
+ * @param plan Selected release plan.
145
+ * @param releases Releases with their changelog entries.
146
+ * @param date Release date, as YYYY-MM-DD.
147
+ * @param applied Versioned packages, or undefined when all were versioned.
148
+ */
149
+ private writeReleases;
150
+ /**
151
+ * Write the version, the dependency specs of bundled sources and the
152
+ * changelog of a release.
153
+ *
154
+ * @param context Release context.
155
+ * @param plan Selected release plan.
156
+ * @param release Release with its changelog entries.
157
+ * @param date Release date, as YYYY-MM-DD.
158
+ * @param journal File journal for rolling back.
159
+ */
160
+ private writeRelease;
161
+ /**
162
+ * Load the configuration, discover the packages and plan the releases of
163
+ * the pending changesets, including the releases of their dependents.
164
+ *
165
+ * @return Release context, undefined without a config.
166
+ * @throws {ValidationError} For an invalid config, plan or changeset.
167
+ */
168
+ private loadContext;
169
+ /**
170
+ * Load the release context of a repository that has to be configured.
171
+ *
172
+ * @return Release context.
173
+ * @throws {ValidationError} Without a config.
174
+ */
175
+ private requireContext;
176
+ /**
177
+ * Load the configuration of a repository that has to be configured.
178
+ *
179
+ * @return Repository release configuration.
180
+ * @throws {ValidationError} Without a config.
181
+ */
182
+ private requireConfig;
183
+ /**
184
+ * Get the directory of the changeset files.
185
+ *
186
+ * @param config Repository release configuration.
187
+ * @return Absolute directory path.
188
+ */
189
+ private getChangesetDirectory;
190
+ }
42
191
  /**
43
192
  * Discover configured packages, pending changesets, and their proposed versions.
44
193
  *
@@ -60,11 +209,7 @@ export declare function getChangesetPackages(input: ChangesetRepository): Promis
60
209
  * @param input Repository, packages and summary.
61
210
  * @return Created file path.
62
211
  */
63
- export declare function addChangeset(input: ChangesetRepository & {
64
- packages: Record<string, 'patch' | 'minor' | 'major'>;
65
- summary: string;
66
- name?: string;
67
- }): Promise<string>;
212
+ export declare function addChangeset(input: ChangesetRepository & ChangesetAddOptions): Promise<string>;
68
213
  /**
69
214
  * Apply pending package versions and changelogs.
70
215
  *
@@ -85,12 +230,4 @@ export declare function tagChangesets(input: ChangesetTagInput): Promise<Changes
85
230
  * @param input Repository and base git ref.
86
231
  * @return Changed packages and missing changeset identifiers.
87
232
  */
88
- export declare function getChangesetStatus(input: ChangesetRepository & {
89
- since?: string;
90
- }): Promise<{
91
- changesets: Changeset[];
92
- releases: PackageRelease[];
93
- changedPackages: string[];
94
- changedPackageFiles: Record<string, string[]>;
95
- missingChangesets: string[];
96
- }>;
233
+ export declare function getChangesetStatus(input: ChangesetRepository & ChangesetStatusOptions): Promise<ChangesetStatusResult>;