@wpelevator/wp-release 0.15.0 → 0.17.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 +366 -39
- package/dist/changeset-config.d.ts +8 -0
- package/dist/changeset-config.js +3 -0
- package/dist/changeset-release.d.ts +9 -3
- package/dist/changeset-release.js +23 -14
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +12 -0
- package/dist/commands/artifact-signing.d.ts +20 -0
- package/dist/commands/artifact-signing.js +42 -0
- package/dist/commands/build.d.ts +32 -0
- package/dist/commands/build.js +91 -0
- package/dist/commands/changeset-add.d.ts +55 -6
- package/dist/commands/changeset-add.js +12 -3
- package/dist/commands/changeset-args.js +2 -2
- package/dist/commands/changeset-project-args.d.ts +63 -0
- package/dist/commands/changeset-project-args.js +114 -0
- package/dist/commands/changeset-status.d.ts +50 -1
- package/dist/commands/changeset-status.js +4 -2
- package/dist/commands/changeset-tag.d.ts +55 -6
- package/dist/commands/changeset-tag.js +7 -4
- package/dist/commands/changeset-version.d.ts +55 -6
- package/dist/commands/changeset-version.js +4 -2
- package/dist/commands/checksums.d.ts +4 -1
- package/dist/commands/checksums.js +27 -6
- package/dist/commands/i18n-audit.d.ts +2 -0
- package/dist/commands/i18n-audit.js +2 -0
- package/dist/commands/i18n-compile.d.ts +6 -0
- package/dist/commands/i18n-compile.js +76 -0
- package/dist/commands/i18n-json.d.ts +2 -0
- package/dist/commands/i18n-json.js +2 -0
- package/dist/commands/i18n-mo.d.ts +2 -0
- package/dist/commands/i18n-mo.js +2 -0
- package/dist/commands/i18n-php.d.ts +2 -0
- package/dist/commands/i18n-php.js +2 -0
- package/dist/commands/i18n-pot.d.ts +2 -0
- package/dist/commands/i18n-pot.js +2 -0
- package/dist/commands/i18n.d.ts +12 -0
- package/dist/commands/i18n.js +174 -0
- package/dist/commands/package-source.d.ts +43 -0
- package/dist/commands/package-source.js +101 -0
- package/dist/commands/verify.d.ts +7 -1
- package/dist/commands/verify.js +53 -17
- package/dist/commands/zip.d.ts +20 -8
- package/dist/commands/zip.js +109 -124
- package/dist/i18n/atomic-output.d.ts +23 -0
- package/dist/i18n/atomic-output.js +90 -0
- package/dist/i18n/audit.d.ts +7 -0
- package/dist/i18n/audit.js +69 -0
- package/dist/i18n/catalog.d.ts +54 -0
- package/dist/i18n/catalog.js +86 -0
- package/dist/i18n/compile.d.ts +27 -0
- package/dist/i18n/compile.js +71 -0
- package/dist/i18n/extraction.d.ts +45 -0
- package/dist/i18n/extraction.js +105 -0
- package/dist/i18n/files.d.ts +7 -0
- package/dist/i18n/files.js +45 -0
- package/dist/i18n/generate.d.ts +49 -0
- package/dist/i18n/generate.js +240 -0
- package/dist/i18n/javascript.d.ts +7 -0
- package/dist/i18n/javascript.js +143 -0
- package/dist/i18n/metadata.d.ts +16 -0
- package/dist/i18n/metadata.js +117 -0
- package/dist/i18n/options.d.ts +52 -0
- package/dist/i18n/options.js +156 -0
- package/dist/i18n/packages.d.ts +24 -0
- package/dist/i18n/packages.js +86 -0
- package/dist/i18n/php.d.ts +9 -0
- package/dist/i18n/php.js +238 -0
- package/dist/i18n/placeholders.d.ts +9 -0
- package/dist/i18n/placeholders.js +13 -0
- package/dist/i18n/po.d.ts +24 -0
- package/dist/i18n/po.js +180 -0
- package/dist/i18n/pot.d.ts +16 -0
- package/dist/i18n/pot.js +119 -0
- package/dist/i18n/translation-json.d.ts +14 -0
- package/dist/i18n/translation-json.js +96 -0
- package/dist/i18n/translation-php.d.ts +6 -0
- package/dist/i18n/translation-php.js +35 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +16 -0
- package/dist/integrity.d.ts +33 -0
- package/dist/integrity.js +115 -0
- package/dist/output-files.d.ts +7 -0
- package/dist/output-files.js +25 -0
- package/dist/package-build.d.ts +33 -0
- package/dist/package-build.js +112 -0
- package/dist/package-files.d.ts +25 -0
- package/dist/package-files.js +24 -0
- package/dist/package-zip.d.ts +14 -2
- package/dist/package-zip.js +129 -38
- package/dist/release-tags.js +6 -0
- package/dist/single-project.d.ts +32 -0
- package/dist/single-project.js +144 -0
- package/dist/summary.d.ts +9 -0
- package/dist/summary.js +25 -0
- package/dist/zip.d.ts +3 -0
- package/dist/zip.js +16 -6
- package/package.json +20 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { packageJsonVersion, composerJsonVersion, wordpressPluginVersion, wordpressThemeVersion, wordpressStableTag, phpConstantVersion, gitTagVersion, } from "../changeset-config.js";
|
|
2
|
+
import { ValidationError } from "../errors.js";
|
|
3
|
+
import { getBoolean, getString, getStrings } from "./command.js";
|
|
4
|
+
export const changesetProjectArgs = {
|
|
5
|
+
'version-package-json': { type: 'string', multiple: true },
|
|
6
|
+
'version-composer-json': { type: 'string', multiple: true },
|
|
7
|
+
'version-wordpress-plugin': { type: 'string', multiple: true },
|
|
8
|
+
'version-wordpress-theme': { type: 'string', multiple: true },
|
|
9
|
+
'version-wordpress-stable-tag': { type: 'string', multiple: true },
|
|
10
|
+
'version-php-constant': { type: 'string', multiple: true },
|
|
11
|
+
'version-git-tag': { type: 'string', multiple: true },
|
|
12
|
+
'version-from': { type: 'string' },
|
|
13
|
+
'base-branch': { type: 'string' },
|
|
14
|
+
remote: { type: 'string' },
|
|
15
|
+
'changesets-dir': { type: 'string' },
|
|
16
|
+
'readme-changelog': { type: 'boolean' },
|
|
17
|
+
'no-readme-changelog': { type: 'boolean' },
|
|
18
|
+
'changelog-insert-after': { type: 'string' },
|
|
19
|
+
};
|
|
20
|
+
export const changesetProjectHelp = `
|
|
21
|
+
Single-project options (without a release config file):
|
|
22
|
+
--version-package-json <file> npm version source/target (repeatable)
|
|
23
|
+
--version-composer-json <file> Composer source/target (repeatable)
|
|
24
|
+
--version-wordpress-plugin <file> Plugin header source/target (repeatable)
|
|
25
|
+
--version-wordpress-theme <file> Theme header source/target (repeatable)
|
|
26
|
+
--version-wordpress-stable-tag <file> Readme Stable tag source/target (repeatable)
|
|
27
|
+
--version-php-constant <file>#<constant> PHP constant source/target (repeatable)
|
|
28
|
+
--version-git-tag <pattern> Git tag source only; use {version}
|
|
29
|
+
--version-from <kind>[:<file>] Choose the source; constants use file#constant
|
|
30
|
+
--base-branch <branch> Default comparison branch on the remote
|
|
31
|
+
--remote <name> Git remote (default: origin)
|
|
32
|
+
--changesets-dir <dir> Changeset directory (default: .changeset)
|
|
33
|
+
--readme-changelog / --no-readme-changelog
|
|
34
|
+
Enable/disable readme changelog updates
|
|
35
|
+
--changelog-insert-after <marker> Insert changelog entries after this marker
|
|
36
|
+
|
|
37
|
+
Explicit descriptors define all version targets. Without them, detect one root
|
|
38
|
+
project. A unique non-Stable-tag descriptor is the inferred source; otherwise
|
|
39
|
+
pass --version-from, qualifying it with :file when its kind is repeated.
|
|
40
|
+
Use the same project options for every changeset command.`;
|
|
41
|
+
/**
|
|
42
|
+
* Parse shared single-project settings; operation flags stay command-specific.
|
|
43
|
+
*
|
|
44
|
+
* @param values Parsed command arguments.
|
|
45
|
+
* @return Fallback settings when explicitly supplied.
|
|
46
|
+
*/
|
|
47
|
+
export function parseChangesetProjectArgs(values) {
|
|
48
|
+
const options = {};
|
|
49
|
+
const versions = [];
|
|
50
|
+
const factories = {
|
|
51
|
+
'package-json': packageJsonVersion,
|
|
52
|
+
'composer-json': composerJsonVersion,
|
|
53
|
+
'wordpress-plugin': wordpressPluginVersion,
|
|
54
|
+
'wordpress-theme': wordpressThemeVersion,
|
|
55
|
+
'wordpress-stable-tag': wordpressStableTag,
|
|
56
|
+
};
|
|
57
|
+
for (const [kind, factory] of Object.entries(factories)) {
|
|
58
|
+
for (const file of getStrings(values, `version-${kind}`)) {
|
|
59
|
+
if (!file.trim()) {
|
|
60
|
+
throw new ValidationError(`--version-${kind} <file> must not be empty.`);
|
|
61
|
+
}
|
|
62
|
+
versions.push(factory({ file }));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const value of getStrings(values, 'version-php-constant')) {
|
|
66
|
+
const separator = value.lastIndexOf('#');
|
|
67
|
+
const file = value.slice(0, separator);
|
|
68
|
+
const constant = value.slice(separator + 1);
|
|
69
|
+
if (separator < 1 ||
|
|
70
|
+
!file.trim() ||
|
|
71
|
+
!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(constant)) {
|
|
72
|
+
throw new ValidationError('--version-php-constant must be <file>#<constant>, for example plugin.php#PLUGIN_VERSION.');
|
|
73
|
+
}
|
|
74
|
+
versions.push(phpConstantVersion({ file, constant }));
|
|
75
|
+
}
|
|
76
|
+
const patterns = getStrings(values, 'version-git-tag');
|
|
77
|
+
if (patterns.length > 1) {
|
|
78
|
+
throw new ValidationError('--version-git-tag accepts one source pattern.');
|
|
79
|
+
}
|
|
80
|
+
for (const pattern of patterns) {
|
|
81
|
+
if (!pattern.trim() || !pattern.includes('{version}')) {
|
|
82
|
+
throw new ValidationError('--version-git-tag <pattern> must contain {version}.');
|
|
83
|
+
}
|
|
84
|
+
versions.push(gitTagVersion({ pattern }));
|
|
85
|
+
}
|
|
86
|
+
if (versions.length) {
|
|
87
|
+
options.versions = versions;
|
|
88
|
+
}
|
|
89
|
+
const strings = {
|
|
90
|
+
'version-from': 'versionFrom',
|
|
91
|
+
'base-branch': 'baseBranch',
|
|
92
|
+
remote: 'remote',
|
|
93
|
+
'changesets-dir': 'changesets',
|
|
94
|
+
'changelog-insert-after': 'changelogInsertAfter',
|
|
95
|
+
};
|
|
96
|
+
for (const [flag, key] of Object.entries(strings)) {
|
|
97
|
+
const value = getString(values, flag);
|
|
98
|
+
if (undefined !== value) {
|
|
99
|
+
if (!value.trim()) {
|
|
100
|
+
throw new ValidationError(`--${flag} must not be empty.`);
|
|
101
|
+
}
|
|
102
|
+
options[key] = value;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (getBoolean(values, 'readme-changelog') &&
|
|
106
|
+
getBoolean(values, 'no-readme-changelog')) {
|
|
107
|
+
throw new ValidationError('--readme-changelog cannot be combined with --no-readme-changelog.');
|
|
108
|
+
}
|
|
109
|
+
if (getBoolean(values, 'readme-changelog') ||
|
|
110
|
+
getBoolean(values, 'no-readme-changelog')) {
|
|
111
|
+
options.readmeChangelog = getBoolean(values, 'readme-changelog');
|
|
112
|
+
}
|
|
113
|
+
return Object.keys(options).length ? { singleProject: options } : {};
|
|
114
|
+
}
|
|
@@ -22,7 +22,56 @@ declare const _default: {
|
|
|
22
22
|
summary: string;
|
|
23
23
|
help: string;
|
|
24
24
|
options: {
|
|
25
|
-
|
|
25
|
+
'version-package-json': {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly multiple: true;
|
|
28
|
+
};
|
|
29
|
+
'version-composer-json': {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly multiple: true;
|
|
32
|
+
};
|
|
33
|
+
'version-wordpress-plugin': {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly multiple: true;
|
|
36
|
+
};
|
|
37
|
+
'version-wordpress-theme': {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly multiple: true;
|
|
40
|
+
};
|
|
41
|
+
'version-wordpress-stable-tag': {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly multiple: true;
|
|
44
|
+
};
|
|
45
|
+
'version-php-constant': {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly multiple: true;
|
|
48
|
+
};
|
|
49
|
+
'version-git-tag': {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly multiple: true;
|
|
52
|
+
};
|
|
53
|
+
'version-from': {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
};
|
|
56
|
+
'base-branch': {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
};
|
|
59
|
+
remote: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
'changesets-dir': {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
};
|
|
65
|
+
'readme-changelog': {
|
|
66
|
+
readonly type: "boolean";
|
|
67
|
+
};
|
|
68
|
+
'no-readme-changelog': {
|
|
69
|
+
readonly type: "boolean";
|
|
70
|
+
};
|
|
71
|
+
'changelog-insert-after': {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
};
|
|
74
|
+
since: {
|
|
26
75
|
readonly type: "string";
|
|
27
76
|
};
|
|
28
77
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { changesetProjectArgs, changesetProjectHelp, parseChangesetProjectArgs, } from "./changeset-project-args.js";
|
|
1
2
|
import { getChangesetStatus } from "../changeset-release.js";
|
|
2
3
|
import { changesetStatusArgs, parseChangesetStatusArgs, } from "./changeset-args.js";
|
|
3
4
|
export default {
|
|
@@ -8,12 +9,13 @@ export default {
|
|
|
8
9
|
--since <ref> Compare changed files with this git ref (for CI)
|
|
9
10
|
|
|
10
11
|
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,
|
|
12
|
+
An empty changeset added since the comparison base counts as an explicit no-release decision.${changesetProjectHelp}`,
|
|
13
|
+
options: { ...changesetStatusArgs, ...changesetProjectArgs },
|
|
13
14
|
async run({ values, cwd, configFile, tagFormat, logger }) {
|
|
14
15
|
const { since } = parseChangesetStatusArgs(values);
|
|
15
16
|
const result = await getChangesetStatus({
|
|
16
17
|
cwd,
|
|
18
|
+
...parseChangesetProjectArgs(values),
|
|
17
19
|
...(configFile ? { configFile } : {}),
|
|
18
20
|
...(tagFormat ? { tagFormat } : {}),
|
|
19
21
|
...(since ? { since } : {}),
|
|
@@ -4,23 +4,72 @@ declare const _default: {
|
|
|
4
4
|
summary: string;
|
|
5
5
|
help: string;
|
|
6
6
|
options: {
|
|
7
|
-
|
|
7
|
+
'version-package-json': {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly multiple: true;
|
|
10
|
+
};
|
|
11
|
+
'version-composer-json': {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly multiple: true;
|
|
14
|
+
};
|
|
15
|
+
'version-wordpress-plugin': {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly multiple: true;
|
|
18
|
+
};
|
|
19
|
+
'version-wordpress-theme': {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly multiple: true;
|
|
22
|
+
};
|
|
23
|
+
'version-wordpress-stable-tag': {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly multiple: true;
|
|
26
|
+
};
|
|
27
|
+
'version-php-constant': {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly multiple: true;
|
|
30
|
+
};
|
|
31
|
+
'version-git-tag': {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly multiple: true;
|
|
34
|
+
};
|
|
35
|
+
'version-from': {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
};
|
|
38
|
+
'base-branch': {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
};
|
|
41
|
+
remote: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
};
|
|
44
|
+
'changesets-dir': {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
'readme-changelog': {
|
|
48
|
+
readonly type: "boolean";
|
|
49
|
+
};
|
|
50
|
+
'no-readme-changelog': {
|
|
51
|
+
readonly type: "boolean";
|
|
52
|
+
};
|
|
53
|
+
'changelog-insert-after': {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
};
|
|
56
|
+
push: {
|
|
8
57
|
readonly type: "boolean";
|
|
9
58
|
};
|
|
10
|
-
|
|
59
|
+
'dry-run': {
|
|
11
60
|
readonly type: "boolean";
|
|
12
61
|
};
|
|
13
|
-
|
|
62
|
+
untagged: {
|
|
14
63
|
readonly type: "boolean";
|
|
15
64
|
};
|
|
16
|
-
|
|
65
|
+
since: {
|
|
17
66
|
readonly type: "string";
|
|
18
67
|
};
|
|
19
|
-
|
|
68
|
+
package: {
|
|
20
69
|
readonly type: "string";
|
|
21
70
|
readonly multiple: true;
|
|
22
71
|
};
|
|
23
|
-
|
|
72
|
+
version: {
|
|
24
73
|
readonly type: "string";
|
|
25
74
|
};
|
|
26
75
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { changesetProjectArgs, changesetProjectHelp, parseChangesetProjectArgs, } from "./changeset-project-args.js";
|
|
1
2
|
import { tagChangesets } from "../changeset-release.js";
|
|
2
3
|
import { parseChangesetTagArgs, changesetTagArgs } from "./changeset-args.js";
|
|
3
4
|
import { getChangesetTagSummary, getTagStatus } from "../summary.js";
|
|
@@ -12,8 +13,9 @@ export default {
|
|
|
12
13
|
--since <ref> Tag packages changed since this git ref
|
|
13
14
|
--package <name> Tag only this package, by identifier or path under
|
|
14
15
|
the configured root (repeatable)
|
|
15
|
-
--version <version> Fail unless the
|
|
16
|
-
the version to tag for packages versioned by git tags
|
|
16
|
+
--version <version> Fail unless the selected package is at this version;
|
|
17
|
+
the version to tag for packages versioned by git tags.
|
|
18
|
+
A sole root package is selected without --package
|
|
17
19
|
--push Push newly created tags to the configured remote
|
|
18
20
|
(default: origin), one at a time
|
|
19
21
|
|
|
@@ -22,12 +24,13 @@ safe. Before a tag is created, every configured version target must match the
|
|
|
22
24
|
version. With --json or --github-output, each tag comes with the title, notes
|
|
23
25
|
and pre-release flag of its release, for a workflow step that creates the
|
|
24
26
|
GitHub Release. --untagged lists only the releases that still need a tag, for
|
|
25
|
-
example to release each of them with a separate workflow
|
|
26
|
-
options: changesetTagArgs,
|
|
27
|
+
example to release each of them with a separate workflow.${changesetProjectHelp}`,
|
|
28
|
+
options: { ...changesetTagArgs, ...changesetProjectArgs },
|
|
27
29
|
async run({ values, cwd, configFile, tagFormat, logger }) {
|
|
28
30
|
const args = parseChangesetTagArgs(values);
|
|
29
31
|
const result = await tagChangesets({
|
|
30
32
|
cwd,
|
|
33
|
+
...parseChangesetProjectArgs(values),
|
|
31
34
|
...(configFile ? { configFile } : {}),
|
|
32
35
|
...(tagFormat ? { tagFormat } : {}),
|
|
33
36
|
...args,
|
|
@@ -16,23 +16,72 @@ declare const _default: {
|
|
|
16
16
|
summary: string;
|
|
17
17
|
help: string;
|
|
18
18
|
options: {
|
|
19
|
-
|
|
19
|
+
'version-package-json': {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly multiple: true;
|
|
22
|
+
};
|
|
23
|
+
'version-composer-json': {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly multiple: true;
|
|
26
|
+
};
|
|
27
|
+
'version-wordpress-plugin': {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly multiple: true;
|
|
30
|
+
};
|
|
31
|
+
'version-wordpress-theme': {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly multiple: true;
|
|
34
|
+
};
|
|
35
|
+
'version-wordpress-stable-tag': {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
readonly multiple: true;
|
|
38
|
+
};
|
|
39
|
+
'version-php-constant': {
|
|
40
|
+
readonly type: "string";
|
|
41
|
+
readonly multiple: true;
|
|
42
|
+
};
|
|
43
|
+
'version-git-tag': {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly multiple: true;
|
|
46
|
+
};
|
|
47
|
+
'version-from': {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
};
|
|
50
|
+
'base-branch': {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
remote: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
};
|
|
56
|
+
'changesets-dir': {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
};
|
|
59
|
+
'readme-changelog': {
|
|
60
|
+
readonly type: "boolean";
|
|
61
|
+
};
|
|
62
|
+
'no-readme-changelog': {
|
|
63
|
+
readonly type: "boolean";
|
|
64
|
+
};
|
|
65
|
+
'changelog-insert-after': {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
};
|
|
68
|
+
'dry-run': {
|
|
20
69
|
readonly type: "boolean";
|
|
21
70
|
};
|
|
22
|
-
|
|
71
|
+
date: {
|
|
23
72
|
readonly type: "string";
|
|
24
73
|
};
|
|
25
|
-
|
|
74
|
+
package: {
|
|
26
75
|
readonly type: "string";
|
|
27
76
|
readonly multiple: true;
|
|
28
77
|
};
|
|
29
|
-
|
|
78
|
+
'no-dependents': {
|
|
30
79
|
readonly type: "boolean";
|
|
31
80
|
};
|
|
32
|
-
|
|
81
|
+
prerelease: {
|
|
33
82
|
readonly type: "string";
|
|
34
83
|
};
|
|
35
|
-
|
|
84
|
+
snapshot: {
|
|
36
85
|
readonly type: "string";
|
|
37
86
|
};
|
|
38
87
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { changesetProjectArgs, changesetProjectHelp, parseChangesetProjectArgs, } from "./changeset-project-args.js";
|
|
1
2
|
import { versionChangesets } from "../changeset-release.js";
|
|
2
3
|
import { getChangesetVersionSummary } from "../summary.js";
|
|
3
4
|
import { parseChangesetVersionArgs, changesetVersionArgs, } from "./changeset-args.js";
|
|
@@ -26,12 +27,13 @@ since the pre-release consumes the changesets that the stable release needs.
|
|
|
26
27
|
The readme Stable tag keeps the last stable version.
|
|
27
28
|
|
|
28
29
|
With --snapshot, build and publish the versioned files without committing
|
|
29
|
-
them, for example to test a pull request
|
|
30
|
-
options: changesetVersionArgs,
|
|
30
|
+
them, for example to test a pull request.${changesetProjectHelp}`,
|
|
31
|
+
options: { ...changesetVersionArgs, ...changesetProjectArgs },
|
|
31
32
|
async run({ values, cwd, configFile, tagFormat, logger }) {
|
|
32
33
|
const args = parseChangesetVersionArgs(values);
|
|
33
34
|
const result = await versionChangesets({
|
|
34
35
|
cwd,
|
|
36
|
+
...parseChangesetProjectArgs(values),
|
|
35
37
|
...(configFile ? { configFile } : {}),
|
|
36
38
|
...(tagFormat ? { tagFormat } : {}),
|
|
37
39
|
...args,
|
|
@@ -27,10 +27,13 @@ declare const _default: {
|
|
|
27
27
|
'filename-format': {
|
|
28
28
|
type: "string";
|
|
29
29
|
};
|
|
30
|
+
'checksums-format': {
|
|
31
|
+
type: "string";
|
|
32
|
+
};
|
|
30
33
|
output: {
|
|
31
34
|
type: "string";
|
|
32
35
|
};
|
|
33
36
|
};
|
|
34
|
-
run({ values, positionals, cwd, logger, }: import("./command.ts").CommandContext): Promise<CommandOutcome<ChecksumsResult>>;
|
|
37
|
+
run({ values, positionals, cwd, configFile, logger, }: import("./command.ts").CommandContext): Promise<CommandOutcome<ChecksumsResult>>;
|
|
35
38
|
};
|
|
36
39
|
export default _default;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ValidationError } from "../errors.js";
|
|
2
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, basename, resolve } from 'node:path';
|
|
4
|
+
import { loadChangesetConfig } from "../changeset-config.js";
|
|
5
|
+
import { resolveManifestCodec, encodeIntegrity } from "../integrity.js";
|
|
6
|
+
import { CHECKSUMS_EXTENSION, createChecksums } from "../checksums.js";
|
|
7
|
+
import { isErrorCode, ignoreOwnFile, ignoreOwnSignature, loadFileRules, resolveFileSelection, } from "../file-selection.js";
|
|
4
8
|
import { FILENAME_FORMAT, formatFilename } from "../filename.js";
|
|
5
9
|
import { readPackageMeta } from "../package-meta.js";
|
|
6
10
|
import { getChecksumsSummary } from "../summary.js";
|
|
@@ -15,6 +19,7 @@ export default {
|
|
|
15
19
|
accepted as --source-dir <dir>
|
|
16
20
|
|
|
17
21
|
Options:
|
|
22
|
+
--checksums-format <name> wordpress-json (default) or sha256sum
|
|
18
23
|
--output <file> Manifest file (default: the --filename-format name
|
|
19
24
|
in the current directory)
|
|
20
25
|
--slug <slug> Plugin or theme slug (default: project directory name)
|
|
@@ -40,22 +45,27 @@ matches the ZIP contents.`,
|
|
|
40
45
|
version: { type: 'string' },
|
|
41
46
|
type: { type: 'string' },
|
|
42
47
|
'filename-format': { type: 'string' },
|
|
48
|
+
'checksums-format': { type: 'string' },
|
|
43
49
|
output: { type: 'string' },
|
|
44
50
|
...sourceDirArgs,
|
|
45
51
|
...fileSelectionArgs,
|
|
46
52
|
force: { type: 'boolean' },
|
|
47
53
|
},
|
|
48
|
-
async run({ values, positionals, cwd, logger, }) {
|
|
54
|
+
async run({ values, positionals, cwd, configFile, logger, }) {
|
|
49
55
|
const sourceDir = resolve(cwd, getSourceDirArg(values, positionals));
|
|
50
56
|
const slug = getString(values, 'slug') ?? basename(cwd);
|
|
51
57
|
await checkDirectory(sourceDir);
|
|
52
58
|
const meta = await readPackageMeta({ dir: sourceDir, slug });
|
|
53
59
|
const version = getString(values, 'version') ?? meta?.version ?? null;
|
|
54
60
|
const filename = formatFilename(getString(values, 'filename-format') ?? FILENAME_FORMAT, { slug, version });
|
|
61
|
+
const loaded = await loadChangesetConfig({ cwd, configFile });
|
|
62
|
+
const codec = resolveManifestCodec(getString(values, 'checksums-format') ?? loaded?.config.integrity?.codec);
|
|
55
63
|
const checksumsPath = resolveOutput({
|
|
56
64
|
cwd,
|
|
57
65
|
output: getString(values, 'output'),
|
|
58
|
-
filename:
|
|
66
|
+
filename: codec.id === 'wordpress-json'
|
|
67
|
+
? filename + CHECKSUMS_EXTENSION
|
|
68
|
+
: codec.filename,
|
|
59
69
|
});
|
|
60
70
|
const selection = resolveFileSelection({
|
|
61
71
|
cwd,
|
|
@@ -71,7 +81,18 @@ matches the ZIP contents.`,
|
|
|
71
81
|
type: getString(values, 'type') ?? meta?.type,
|
|
72
82
|
});
|
|
73
83
|
const files = Object.keys(manifest.files).length;
|
|
74
|
-
await
|
|
84
|
+
await mkdir(dirname(checksumsPath), { recursive: true });
|
|
85
|
+
try {
|
|
86
|
+
await writeFile(checksumsPath, await encodeIntegrity(codec, manifest), {
|
|
87
|
+
flag: getBoolean(values, 'force') ? 'w' : 'wx',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (isErrorCode(error, 'EEXIST')) {
|
|
92
|
+
throw new ValidationError(`${checksumsPath} already exists, pass --force to overwrite it.`);
|
|
93
|
+
}
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
75
96
|
logger.debug(`Hashed ${files} files in ${sourceDir}.`);
|
|
76
97
|
logger.info(checksumsPath);
|
|
77
98
|
logger.summary((context) => getChecksumsSummary(context, { checksumsPath, files }));
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { compileTranslations } from "../i18n/compile.js";
|
|
3
|
+
import { ValidationError } from "../errors.js";
|
|
4
|
+
import { readJson } from "../json-files.js";
|
|
5
|
+
import { getBoolean, getString } from "./command.js";
|
|
6
|
+
/**
|
|
7
|
+
* Flat compiler adapters: translated PO input, independent of package/source discovery.
|
|
8
|
+
* @param format
|
|
9
|
+
*/
|
|
10
|
+
export function createI18nCompileCommand(format) {
|
|
11
|
+
return {
|
|
12
|
+
name: `i18n-${format}`,
|
|
13
|
+
usage: `i18n-${format} <file.po> [options]`,
|
|
14
|
+
summary: `Compile translated PO into ${'php' === format ? 'WordPress .l10n.php' : format.toUpperCase()} files.`,
|
|
15
|
+
help: `Options:
|
|
16
|
+
--output <path> Output file (${format === 'json' ? 'directory for JSON' : 'defaults beside the PO'})
|
|
17
|
+
--check Compare generated bytes without writing
|
|
18
|
+
${'json' === format
|
|
19
|
+
? ' --domain <domain> Required text domain\n --map <file.json> Source paths to runtime script path arrays (many-to-many)'
|
|
20
|
+
: ''}
|
|
21
|
+
|
|
22
|
+
Requires Language and Plural-Forms headers. Fuzzy, obsolete and untranslated
|
|
23
|
+
entries are excluded. Input PO files are never changed. No PHP/WP-CLI runtime
|
|
24
|
+
is needed; compilation validates data before independent atomic output writes.`,
|
|
25
|
+
options: {
|
|
26
|
+
output: { type: 'string' },
|
|
27
|
+
check: { type: 'boolean' },
|
|
28
|
+
...('json' === format
|
|
29
|
+
? {
|
|
30
|
+
domain: { type: 'string' },
|
|
31
|
+
map: { type: 'string' },
|
|
32
|
+
}
|
|
33
|
+
: {}),
|
|
34
|
+
},
|
|
35
|
+
async run({ values, positionals, cwd, logger }) {
|
|
36
|
+
if (1 !== positionals.length || !positionals[0]?.trim()) {
|
|
37
|
+
throw new ValidationError(`i18n-${format} requires exactly one input PO file.`);
|
|
38
|
+
}
|
|
39
|
+
const output = getString(values, 'output');
|
|
40
|
+
const map = getString(values, 'map');
|
|
41
|
+
if ('' === output?.trim() || '' === map?.trim()) {
|
|
42
|
+
throw new ValidationError('--output and --map paths must not be empty.');
|
|
43
|
+
}
|
|
44
|
+
let scriptMap;
|
|
45
|
+
if (map) {
|
|
46
|
+
const parsed = await readJson(resolve(cwd, map));
|
|
47
|
+
if (!parsed ||
|
|
48
|
+
'object' !== typeof parsed ||
|
|
49
|
+
Array.isArray(parsed)) {
|
|
50
|
+
throw new ValidationError('The script map must be an object of source paths to runtime path arrays.');
|
|
51
|
+
}
|
|
52
|
+
scriptMap = parsed;
|
|
53
|
+
}
|
|
54
|
+
const result = await compileTranslations({
|
|
55
|
+
sourcePath: resolve(cwd, positionals[0]),
|
|
56
|
+
format,
|
|
57
|
+
...(output ? { outputPath: resolve(cwd, output) } : {}),
|
|
58
|
+
domain: getString(values, 'domain'),
|
|
59
|
+
scriptMap,
|
|
60
|
+
check: getBoolean(values, 'check'),
|
|
61
|
+
});
|
|
62
|
+
const stale = result.outputs.filter((outputFile) => !outputFile.current);
|
|
63
|
+
for (const outputFile of result.outputs) {
|
|
64
|
+
logger.info(outputFile.outputPath);
|
|
65
|
+
}
|
|
66
|
+
for (const outputFile of stale) {
|
|
67
|
+
logger.error('Translation output is missing or stale.', {
|
|
68
|
+
file: outputFile.outputPath,
|
|
69
|
+
title: 'stale-translation',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
logger.summary(() => `### wp-release i18n-${format}\n\n${result.messages} translated messages for ${result.locale}; ${result.outputs.length} outputs.\n`);
|
|
73
|
+
return { exitCode: stale.length ? 2 : 0, result };
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PackagePotResult } from '../i18n/generate.ts';
|
|
2
|
+
import type { Command } from './command.ts';
|
|
3
|
+
export interface I18nCommandResult {
|
|
4
|
+
packages: Array<PackagePotResult & {
|
|
5
|
+
package?: string;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Small command adapters share selection/reporting; domain logic stays in the library.
|
|
10
|
+
* @param operation
|
|
11
|
+
*/
|
|
12
|
+
export declare function createI18nCommand(operation: 'pot' | 'audit'): Command;
|