@wpelevator/wp-release 0.0.0-stage → 0.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +316 -2
  3. package/dist/bin/wp-release.d.ts +2 -0
  4. package/dist/bin/wp-release.js +3 -0
  5. package/dist/checksums.d.ts +138 -0
  6. package/dist/checksums.js +216 -0
  7. package/dist/cli.d.ts +42 -0
  8. package/dist/cli.js +163 -0
  9. package/dist/commands/args.d.ts +81 -0
  10. package/dist/commands/args.js +116 -0
  11. package/dist/commands/checksums.d.ts +34 -0
  12. package/dist/commands/checksums.js +76 -0
  13. package/dist/commands/command.d.ts +63 -0
  14. package/dist/commands/command.js +33 -0
  15. package/dist/commands/deploy-svn.d.ts +74 -0
  16. package/dist/commands/deploy-svn.js +103 -0
  17. package/dist/commands/verify.d.ts +27 -0
  18. package/dist/commands/verify.js +60 -0
  19. package/dist/commands/version-check.d.ts +38 -0
  20. package/dist/commands/version-check.js +80 -0
  21. package/dist/commands/zip.d.ts +41 -0
  22. package/dist/commands/zip.js +138 -0
  23. package/dist/deploy-options.d.ts +136 -0
  24. package/dist/deploy-options.js +168 -0
  25. package/dist/errors.d.ts +16 -0
  26. package/dist/errors.js +16 -0
  27. package/dist/file-selection.d.ts +78 -0
  28. package/dist/file-selection.js +133 -0
  29. package/dist/filename.d.ts +17 -0
  30. package/dist/filename.js +23 -0
  31. package/dist/index.d.ts +30 -0
  32. package/dist/index.js +15 -0
  33. package/dist/logger.d.ts +42 -0
  34. package/dist/logger.js +56 -0
  35. package/dist/package-meta.d.ts +112 -0
  36. package/dist/package-meta.js +222 -0
  37. package/dist/svn-deploy.d.ts +208 -0
  38. package/dist/svn-deploy.js +485 -0
  39. package/dist/svn.d.ts +209 -0
  40. package/dist/svn.js +298 -0
  41. package/dist/sync.d.ts +32 -0
  42. package/dist/sync.js +90 -0
  43. package/dist/unzip.d.ts +45 -0
  44. package/dist/unzip.js +121 -0
  45. package/dist/version-check.d.ts +75 -0
  46. package/dist/version-check.js +193 -0
  47. package/dist/zip.d.ts +32 -0
  48. package/dist/zip.js +53 -0
  49. package/package.json +61 -5
@@ -0,0 +1,76 @@
1
+ import { basename, resolve } from 'node:path';
2
+ import { CHECKSUMS_EXTENSION, createChecksums, writeChecksums, } from "../checksums.js";
3
+ import { loadFileRules, resolveFileSelection } from "../file-selection.js";
4
+ import { FILENAME_FORMAT, formatFilename } from "../filename.js";
5
+ import { readPackageMeta } from "../package-meta.js";
6
+ import { checkDirectory, fileSelectionArgs, getFileSelectionInput, getSourceDirArg, ignoreOwnFile, resolveOutput, sourceDirArgs, } from "./args.js";
7
+ import { getBoolean, getString } from "./command.js";
8
+ export default {
9
+ name: 'checksums',
10
+ usage: 'checksums [<source-dir>] [options]',
11
+ summary: 'Write the MD5 and SHA-256 hashes of every distributed file to a checksums manifest.',
12
+ help: `Arguments:
13
+ <source-dir> Plugin or theme directory (default: .), also
14
+ accepted as --source-dir <dir>
15
+
16
+ Options:
17
+ --output <file> Manifest file (default: the --filename-format name
18
+ in the current directory)
19
+ --slug <slug> Plugin or theme slug (default: project directory name)
20
+ --version <version> Version for the manifest and filename
21
+ (default: Version header)
22
+ --type <type> plugin or theme (default: detected from the
23
+ headers, else plugin)
24
+ --filename-format <format> Filename with {slug} and {version}, followed by
25
+ .checksums.json (default: {slug}.{version})
26
+ --distignore <file> Ignore file (default: <source-dir>/.distignore when present)
27
+ --no-distignore Don't read any ignore file
28
+ --exclude <patterns> Extra gitignore-style patterns, comma-separated or
29
+ repeated, like build/,assets/*,images/**/*
30
+ --force Overwrite an existing --output file
31
+
32
+ The manifest uses the WordPress.org plugin checksums format, with paths
33
+ relative to <source-dir>. Select the same files as "zip" so that the manifest
34
+ matches the ZIP contents.`,
35
+ options: {
36
+ slug: { type: 'string' },
37
+ version: { type: 'string' },
38
+ type: { type: 'string' },
39
+ 'filename-format': { type: 'string' },
40
+ output: { type: 'string' },
41
+ ...sourceDirArgs,
42
+ ...fileSelectionArgs,
43
+ force: { type: 'boolean' },
44
+ },
45
+ async run({ values, positionals, cwd, logger }) {
46
+ const sourceDir = resolve(cwd, getSourceDirArg(values, positionals));
47
+ const slug = getString(values, 'slug') ?? basename(cwd);
48
+ await checkDirectory(sourceDir);
49
+ const meta = await readPackageMeta({ dir: sourceDir, slug });
50
+ const version = getString(values, 'version') ?? meta?.version ?? null;
51
+ const filename = formatFilename(getString(values, 'filename-format') ?? FILENAME_FORMAT, { slug, version });
52
+ const checksumsPath = resolveOutput({
53
+ cwd,
54
+ output: getString(values, 'output'),
55
+ filename: filename + CHECKSUMS_EXTENSION,
56
+ });
57
+ const selection = resolveFileSelection({
58
+ cwd,
59
+ sourceDir,
60
+ ...getFileSelectionInput(values),
61
+ });
62
+ const rules = ignoreOwnFile(await loadFileRules(selection), sourceDir, checksumsPath);
63
+ const manifest = await createChecksums({
64
+ sourceDir,
65
+ rules,
66
+ slug,
67
+ version,
68
+ type: getString(values, 'type') ?? meta?.type,
69
+ });
70
+ const files = Object.keys(manifest.files).length;
71
+ await writeChecksums(checksumsPath, manifest, getBoolean(values, 'force'));
72
+ logger.debug(`Hashed ${files} files in ${sourceDir}.`);
73
+ logger.info(checksumsPath);
74
+ return { exitCode: 0, result: { checksumsPath, files } };
75
+ },
76
+ };
@@ -0,0 +1,63 @@
1
+ import type { ParseArgsOptionsConfig } from 'node:util';
2
+ import type { Logger } from '../logger.ts';
3
+ /**
4
+ * Parsed option values from node:util parseArgs().
5
+ */
6
+ export type ParsedValues = Record<string, string | boolean | Array<string | boolean> | undefined>;
7
+ export interface CommandContext {
8
+ /** Parsed option values. */
9
+ values: ParsedValues;
10
+ /** Positional arguments after the command name. */
11
+ positionals: string[];
12
+ /** Working directory that relative paths resolve against. */
13
+ cwd: string;
14
+ /** Logger for the command output. */
15
+ logger: Logger;
16
+ }
17
+ export interface CommandOutcome {
18
+ /** Process exit code. */
19
+ exitCode: number;
20
+ /** Result printed with --json. */
21
+ result: unknown;
22
+ }
23
+ /**
24
+ * CLI command definition.
25
+ */
26
+ export interface Command {
27
+ /** Command name, a single word or dashed words. */
28
+ name: string;
29
+ /** Usage line after "wp-release". */
30
+ usage: string;
31
+ /** One-line description. */
32
+ summary: string;
33
+ /** Help text for the arguments and options. */
34
+ help: string;
35
+ /** Options in node:util parseArgs() format. */
36
+ options?: ParseArgsOptionsConfig;
37
+ /** Run the command with the parsed arguments. */
38
+ run: (context: CommandContext) => Promise<CommandOutcome>;
39
+ }
40
+ /**
41
+ * Get a string option value.
42
+ *
43
+ * @param values Parsed option values.
44
+ * @param name Option name.
45
+ * @return Option value, or undefined when not set.
46
+ */
47
+ export declare function getString(values: ParsedValues, name: string): string | undefined;
48
+ /**
49
+ * Get a boolean option value.
50
+ *
51
+ * @param values Parsed option values.
52
+ * @param name Option name.
53
+ * @return Whether the option is set.
54
+ */
55
+ export declare function getBoolean(values: ParsedValues, name: string): boolean;
56
+ /**
57
+ * Get the values of a repeatable string option.
58
+ *
59
+ * @param values Parsed option values.
60
+ * @param name Option name.
61
+ * @return Option values, empty when not set.
62
+ */
63
+ export declare function getStrings(values: ParsedValues, name: string): string[];
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Get a string option value.
3
+ *
4
+ * @param values Parsed option values.
5
+ * @param name Option name.
6
+ * @return Option value, or undefined when not set.
7
+ */
8
+ export function getString(values, name) {
9
+ const value = values[name];
10
+ return 'string' === typeof value ? value : undefined;
11
+ }
12
+ /**
13
+ * Get a boolean option value.
14
+ *
15
+ * @param values Parsed option values.
16
+ * @param name Option name.
17
+ * @return Whether the option is set.
18
+ */
19
+ export function getBoolean(values, name) {
20
+ return true === values[name];
21
+ }
22
+ /**
23
+ * Get the values of a repeatable string option.
24
+ *
25
+ * @param values Parsed option values.
26
+ * @param name Option name.
27
+ * @return Option values, empty when not set.
28
+ */
29
+ export function getStrings(values, name) {
30
+ return [values[name]]
31
+ .flat()
32
+ .filter((value) => 'string' === typeof value);
33
+ }
@@ -0,0 +1,74 @@
1
+ import type { DeployInput } from '../deploy-options.ts';
2
+ import type { ParsedValues } from './command.ts';
3
+ export interface DeployArgsInput {
4
+ /** Parsed CLI values. */
5
+ values: ParsedValues;
6
+ /** Positional arguments. */
7
+ positionals: string[];
8
+ /** Working directory. */
9
+ cwd: string;
10
+ }
11
+ /**
12
+ * Map the parsed "deploy-svn" arguments to resolveDeployOptions() input.
13
+ * Flags that aren't passed stay undefined, so that the same defaults apply
14
+ * as for the GitHub Action inputs.
15
+ *
16
+ * @param input Parsed values, positionals and working directory.
17
+ * @return Deploy input.
18
+ */
19
+ export declare function getDeployInputFromArgs(input: DeployArgsInput): DeployInput;
20
+ declare const _default: {
21
+ name: string;
22
+ usage: string;
23
+ summary: string;
24
+ help: string;
25
+ options: {
26
+ 'svn-url': {
27
+ type: "string";
28
+ };
29
+ 'svn-username': {
30
+ type: "string";
31
+ };
32
+ message: {
33
+ type: "string";
34
+ };
35
+ force: {
36
+ type: "boolean";
37
+ };
38
+ 'dry-run': {
39
+ type: "boolean";
40
+ };
41
+ trunk: {
42
+ type: "boolean";
43
+ };
44
+ 'readme-only': {
45
+ type: "boolean";
46
+ };
47
+ 'svn-tag': {
48
+ type: "string";
49
+ };
50
+ 'assets-dir': {
51
+ type: "string";
52
+ };
53
+ 'no-assets': {
54
+ type: "boolean";
55
+ };
56
+ slug: {
57
+ type: "string";
58
+ };
59
+ version: {
60
+ type: "string";
61
+ };
62
+ readme: {
63
+ type: "string";
64
+ };
65
+ 'from-zip': {
66
+ type: "string";
67
+ };
68
+ };
69
+ run({ values, positionals, cwd, logger }: import("./command.ts").CommandContext): Promise<{
70
+ exitCode: number;
71
+ result: import("../svn-deploy.ts").DeployResult;
72
+ }>;
73
+ };
74
+ export default _default;
@@ -0,0 +1,103 @@
1
+ import { resolveDeployOptions } from "../deploy-options.js";
2
+ import { SvnDeploy } from "../svn-deploy.js";
3
+ import { fileSelectionArgs, getFileSelectionInput, getSourceDirArg, sourceDirArgs, } from "./args.js";
4
+ import { getBoolean, getString } from "./command.js";
5
+ /**
6
+ * Map the parsed "deploy-svn" arguments to resolveDeployOptions() input.
7
+ * Flags that aren't passed stay undefined, so that the same defaults apply
8
+ * as for the GitHub Action inputs.
9
+ *
10
+ * @param input Parsed values, positionals and working directory.
11
+ * @return Deploy input.
12
+ */
13
+ export function getDeployInputFromArgs(input) {
14
+ const { values, positionals, cwd } = input;
15
+ const flag = (name) => getBoolean(values, name) || undefined;
16
+ return {
17
+ cwd,
18
+ sourceDir: getSourceDirArg(values, positionals),
19
+ slug: getString(values, 'slug'),
20
+ version: getString(values, 'version'),
21
+ trunk: flag('trunk'),
22
+ readmeOnly: flag('readme-only'),
23
+ svnTag: getString(values, 'svn-tag'),
24
+ assets: getBoolean(values, 'no-assets') ? false : undefined,
25
+ assetsDir: getString(values, 'assets-dir'),
26
+ readme: getString(values, 'readme'),
27
+ fromZip: getString(values, 'from-zip'),
28
+ ...getFileSelectionInput(values),
29
+ svnUrl: getString(values, 'svn-url'),
30
+ svnUsername: getString(values, 'svn-username'),
31
+ gitRef: process.env.GITHUB_REF,
32
+ message: getString(values, 'message'),
33
+ force: flag('force'),
34
+ dryRun: flag('dry-run'),
35
+ };
36
+ }
37
+ export default {
38
+ name: 'deploy-svn',
39
+ usage: 'deploy-svn [<source-dir>] [options]',
40
+ summary: 'Deploy a plugin to the WordPress.org plugin SVN repository.',
41
+ help: `Arguments:
42
+ <source-dir> Directory with the plugin files (default: .), also
43
+ accepted as --source-dir <dir>
44
+
45
+ Writes (none by default, assets only with --assets-dir):
46
+ --trunk Sync the full source directory to trunk/
47
+ --readme-only Sync only the readme to trunk/ (not with --trunk)
48
+ --svn-tag <version> Copy trunk/ to tags/<version> (requires --trunk).
49
+ A leading "v" is stripped.
50
+ --assets-dir <dir> Sync this directory with banners, icons and
51
+ screenshots to assets/
52
+ --no-assets Don't sync --assets-dir for this run
53
+
54
+ Options:
55
+ --slug <slug> Plugin slug (default: project directory name)
56
+ --version <version> Version to check (default: --svn-tag, then the Version header)
57
+ --readme <file> Readme file (default: readme.txt)
58
+ --from-zip <file> Deploy the contents of a ZIP with a {slug}/ root folder
59
+ instead of <source-dir>
60
+ --distignore <file> Ignore file (default: <source-dir>/.distignore when present)
61
+ --no-distignore Don't read any ignore file
62
+ --exclude <patterns> Extra gitignore-style patterns, comma-separated or repeated
63
+ --svn-url <url> Repository URL with {slug}
64
+ (default: https://plugins.svn.wordpress.org/{slug}/)
65
+ --svn-username <name> SVN username (env: SVN_USERNAME, password: SVN_PASSWORD)
66
+ --message <text> Commit message
67
+ --force Replace an existing SVN tag
68
+ --dry-run Run everything except the commit
69
+
70
+ Credentials are only needed to commit. Exits with 3 when they're missing
71
+ or rejected.
72
+
73
+ Examples:
74
+ wp-release deploy-svn dist --trunk --svn-tag 1.2.0 --assets-dir .wordpress-org
75
+ Deploy 1.2.0 to trunk and the tag, and update the assets
76
+ wp-release deploy-svn dist --readme-only
77
+ Update only the readme
78
+ wp-release deploy-svn --assets-dir .wordpress-org
79
+ Update only the assets`,
80
+ options: {
81
+ ...sourceDirArgs,
82
+ trunk: { type: 'boolean' },
83
+ 'readme-only': { type: 'boolean' },
84
+ 'svn-tag': { type: 'string' },
85
+ 'assets-dir': { type: 'string' },
86
+ 'no-assets': { type: 'boolean' },
87
+ slug: { type: 'string' },
88
+ version: { type: 'string' },
89
+ readme: { type: 'string' },
90
+ 'from-zip': { type: 'string' },
91
+ ...fileSelectionArgs,
92
+ 'svn-url': { type: 'string' },
93
+ 'svn-username': { type: 'string' },
94
+ message: { type: 'string' },
95
+ force: { type: 'boolean' },
96
+ 'dry-run': { type: 'boolean' },
97
+ },
98
+ async run({ values, positionals, cwd, logger }) {
99
+ const options = resolveDeployOptions(getDeployInputFromArgs({ values, positionals, cwd }));
100
+ const result = await new SvnDeploy(options, logger).run();
101
+ return { exitCode: 0, result };
102
+ },
103
+ };
@@ -0,0 +1,27 @@
1
+ declare const _default: {
2
+ name: string;
3
+ usage: string;
4
+ summary: string;
5
+ help: string;
6
+ options: {
7
+ exclude: {
8
+ type: "string";
9
+ multiple: true;
10
+ };
11
+ checksums: {
12
+ type: "string";
13
+ };
14
+ };
15
+ run({ values, positionals, cwd, logger }: import("./command.ts").CommandContext): Promise<{
16
+ exitCode: number;
17
+ result: {
18
+ valid: boolean;
19
+ checksumsPath: string;
20
+ matched: number;
21
+ changed: string[];
22
+ missing: string[];
23
+ extra: string[];
24
+ };
25
+ }>;
26
+ };
27
+ export default _default;
@@ -0,0 +1,60 @@
1
+ import { resolve } from 'node:path';
2
+ import { readChecksums, verifyChecksums } from "../checksums.js";
3
+ import { loadFileRules, parseExclude } from "../file-selection.js";
4
+ import { ValidationError } from "../errors.js";
5
+ import { checkDirectory, getSourceDirArg, ignoreOwnFile, sourceDirArgs, } from "./args.js";
6
+ import { getString, getStrings } from "./command.js";
7
+ export default {
8
+ name: 'verify',
9
+ usage: 'verify [<source-dir>] --checksums <file> [options]',
10
+ summary: 'Check the files of a plugin or theme directory against a checksums manifest.',
11
+ help: `Arguments:
12
+ <source-dir> Plugin or theme directory (default: .), also
13
+ accepted as --source-dir <dir>
14
+
15
+ Options:
16
+ --checksums <file> Checksums manifest from "wp-release checksums" or the
17
+ WordPress.org checksums API (required)
18
+ --exclude <patterns> Gitignore-style patterns to skip in both the directory
19
+ and the manifest, comma-separated or repeated
20
+
21
+ Reports every changed, missing and extra file, and exits with 2 unless all
22
+ files match. Unlike "checksums" and "zip", verify doesn't read .distignore,
23
+ so that an ignore file inside the checked directory can't hide added files.
24
+ Use --exclude to skip files that aren't part of the release. A file matches when its SHA-256 equals the manifest, or its MD5
25
+ for manifests without SHA-256.`,
26
+ options: {
27
+ checksums: { type: 'string' },
28
+ ...sourceDirArgs,
29
+ exclude: { type: 'string', multiple: true },
30
+ },
31
+ async run({ values, positionals, cwd, logger }) {
32
+ const sourceDir = resolve(cwd, getSourceDirArg(values, positionals));
33
+ const checksums = getString(values, 'checksums');
34
+ if (!checksums) {
35
+ throw new ValidationError('Pass the checksums manifest with --checksums <file>.');
36
+ }
37
+ await checkDirectory(sourceDir);
38
+ const checksumsPath = resolve(cwd, checksums);
39
+ const manifest = await readChecksums(checksumsPath);
40
+ const rules = ignoreOwnFile(await loadFileRules({
41
+ exclude: parseExclude(getStrings(values, 'exclude')),
42
+ }), sourceDir, checksumsPath);
43
+ const { valid, matched, changed, missing, extra } = await verifyChecksums({ sourceDir, manifest, rules });
44
+ changed.forEach((file) => logger.error(`Changed: ${file}`));
45
+ missing.forEach((file) => logger.error(`Missing: ${file}`));
46
+ extra.forEach((file) => logger.error(`Not in the checksums: ${file}`));
47
+ logger.info(`${matched.length} files match, ${changed.length} changed, ${missing.length} missing and ${extra.length} extra in ${sourceDir}.`);
48
+ return {
49
+ exitCode: valid ? 0 : 2,
50
+ result: {
51
+ valid,
52
+ checksumsPath,
53
+ matched: matched.length,
54
+ changed,
55
+ missing,
56
+ extra,
57
+ },
58
+ };
59
+ },
60
+ };
@@ -0,0 +1,38 @@
1
+ declare const _default: {
2
+ name: string;
3
+ usage: string;
4
+ summary: string;
5
+ help: string;
6
+ options: {
7
+ slug: {
8
+ type: "string";
9
+ };
10
+ version: {
11
+ type: "string";
12
+ };
13
+ 'git-tag': {
14
+ type: "string";
15
+ };
16
+ 'git-tag-format': {
17
+ type: "string";
18
+ };
19
+ constant: {
20
+ type: "string";
21
+ multiple: true;
22
+ };
23
+ readme: {
24
+ type: "string";
25
+ };
26
+ 'no-stable-tag': {
27
+ type: "boolean";
28
+ };
29
+ };
30
+ run({ values, positionals, cwd, logger }: import("./command.ts").CommandContext): Promise<{
31
+ exitCode: number;
32
+ result: {
33
+ version: string | null;
34
+ mismatches: import("../version-check.ts").VersionMismatch[];
35
+ };
36
+ }>;
37
+ };
38
+ export default _default;
@@ -0,0 +1,80 @@
1
+ import { basename, resolve } from 'node:path';
2
+ import { isTagRef } from "../deploy-options.js";
3
+ import { ValidationError } from "../errors.js";
4
+ import { readPackageMeta } from "../package-meta.js";
5
+ import { GIT_TAG_FORMAT, findVersionMismatches } from "../version-check.js";
6
+ import { checkDirectory, getSourceDirArg, sourceDirArgs } from "./args.js";
7
+ import { getBoolean, getString, getStrings } from "./command.js";
8
+ /**
9
+ * Get the git tag to compare: --git-tag, or GITHUB_REF when it's a tag.
10
+ *
11
+ * @param gitTag The --git-tag value.
12
+ * @return Tag name or ref, or null without a tag.
13
+ */
14
+ function getGitTag(gitTag) {
15
+ const ref = process.env.GITHUB_REF;
16
+ return gitTag ?? (isTagRef(ref) ? ref ?? null : null);
17
+ }
18
+ export default {
19
+ name: 'version-check',
20
+ usage: 'version-check [<source-dir>] [options]',
21
+ summary: 'Check that the Version header, readme Stable tag, constants and git tag agree.',
22
+ help: `Arguments:
23
+ <source-dir> Plugin or theme directory (default: .), also
24
+ accepted as --source-dir <dir>
25
+
26
+ Options:
27
+ --slug <slug> Plugin or theme slug, for {slug} in the tag format
28
+ (default: project directory name)
29
+ --version <version> Expected version (default: Version header)
30
+ --git-tag <tag> Git tag to compare (default: GITHUB_REF when it is a tag)
31
+ --git-tag-format <format> Tag format with {slug} and {version} (default: {version}).
32
+ A leading "v" in the version is ignored.
33
+ --constant <NAME> PHP constant that must equal the version (repeatable)
34
+ --readme <file> Readme file (default: readme.txt, then readme.md)
35
+ --no-stable-tag Skip the readme Stable tag check
36
+
37
+ Reports every mismatch and exits with 2 unless all versions agree. Themes have
38
+ no Stable tag, so it's only checked for plugins.`,
39
+ options: {
40
+ slug: { type: 'string' },
41
+ version: { type: 'string' },
42
+ 'git-tag': { type: 'string' },
43
+ 'git-tag-format': { type: 'string' },
44
+ constant: { type: 'string', multiple: true },
45
+ readme: { type: 'string' },
46
+ 'no-stable-tag': { type: 'boolean' },
47
+ ...sourceDirArgs,
48
+ },
49
+ async run({ values, positionals, cwd, logger }) {
50
+ const sourceDir = resolve(cwd, getSourceDirArg(values, positionals));
51
+ const slug = getString(values, 'slug') ?? basename(cwd);
52
+ await checkDirectory(sourceDir);
53
+ const meta = await readPackageMeta({
54
+ dir: sourceDir,
55
+ slug,
56
+ readme: getString(values, 'readme'),
57
+ });
58
+ if (!meta) {
59
+ throw new ValidationError(`No plugin or theme headers found in ${sourceDir}.`);
60
+ }
61
+ const { version, mismatches } = await findVersionMismatches({
62
+ sourceDir,
63
+ meta,
64
+ slug,
65
+ version: getString(values, 'version'),
66
+ gitTag: getGitTag(getString(values, 'git-tag')),
67
+ gitTagFormat: getString(values, 'git-tag-format') ?? GIT_TAG_FORMAT,
68
+ constants: getStrings(values, 'constant'),
69
+ stableTag: !getBoolean(values, 'no-stable-tag'),
70
+ });
71
+ mismatches.forEach((mismatch) => logger.error(mismatch.message));
72
+ if (!mismatches.length) {
73
+ logger.info(`All versions match ${version}.`);
74
+ }
75
+ return {
76
+ exitCode: mismatches.length ? 2 : 0,
77
+ result: { version, mismatches },
78
+ };
79
+ },
80
+ };
@@ -0,0 +1,41 @@
1
+ declare const _default: {
2
+ name: string;
3
+ usage: string;
4
+ summary: string;
5
+ help: string;
6
+ options: {
7
+ checksums: {
8
+ type: "boolean";
9
+ };
10
+ force: {
11
+ type: "boolean";
12
+ };
13
+ slug: {
14
+ type: "string";
15
+ };
16
+ version: {
17
+ type: "string";
18
+ };
19
+ 'root-folder': {
20
+ type: "string";
21
+ };
22
+ 'no-root-folder': {
23
+ type: "boolean";
24
+ };
25
+ 'filename-format': {
26
+ type: "string";
27
+ };
28
+ output: {
29
+ type: "string";
30
+ };
31
+ };
32
+ run({ values, positionals, cwd, logger }: import("./command.ts").CommandContext): Promise<{
33
+ exitCode: number;
34
+ result: {
35
+ files: number;
36
+ checksumsPath?: string | undefined;
37
+ zipPath: string;
38
+ };
39
+ }>;
40
+ };
41
+ export default _default;