@wpelevator/wp-release 0.1.0 → 0.2.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 +6 -11
- package/dist/commands/deploy-svn.d.ts +0 -3
- package/dist/commands/deploy-svn.js +2 -8
- package/dist/deploy-options.d.ts +1 -7
- package/dist/deploy-options.js +2 -13
- package/dist/svn-deploy.d.ts +11 -4
- package/dist/svn-deploy.js +37 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ Each concept has one name, written in the syntax of each interface:
|
|
|
56
56
|
| Git tag to compare | `--git-tag <tag>` | | `gitTag` | Git tag checked by `version-check`. |
|
|
57
57
|
| SVN tag to create | `--svn-tag <version>` | `svn-tag` | `svnTag` | Tag written by `deploy-svn`, distinct from a git tag. |
|
|
58
58
|
| SVN repository | `--svn-url <url>` | `svn-url` | `svnUrl` | Deploy destination. |
|
|
59
|
+
| SVN credentials | `--svn-username <name>`, `SVN_USERNAME` and `SVN_PASSWORD` env vars | `svn-username`, `svn-password` | `svnUsername`, `svnPassword` | Needed only to commit. There's no password flag, since it would show in the process list; the action inputs and library options fall back to the env vars. |
|
|
59
60
|
| Assets sync | `--no-assets` to skip | `assets: false` to skip | `assets` | Booleans are positive in the library and the action; `--no-assets` is only the CLI negation, never `noAssets` or a `no-assets` input. |
|
|
60
61
|
|
|
61
62
|
CLI JSON results use camelCase keys like `zipPath`, and GitHub Action outputs use kebab-case like `zip-path`. Library classes are named after the capability (`SvnDeploy`, `Svn`) without repeating "release".
|
|
@@ -152,8 +153,7 @@ wp-release version-check --constant MY_PLUGIN_VERSION --git-tag v1.2.0
|
|
|
152
153
|
| Flag | Default | Writes |
|
|
153
154
|
|---|---|---|
|
|
154
155
|
| `--trunk` | off | Sync the full source directory to `trunk/` |
|
|
155
|
-
| `--
|
|
156
|
-
| `--svn-tag <version>` | off | Copy `trunk/` to `tags/<version>`; requires `--trunk`. A leading `v` is stripped, so `v1.2.0` creates `tags/1.2.0`. |
|
|
156
|
+
| `--svn-tag <version>` | off | Copy `trunk/` to `tags/<version>`. Without `--trunk`, the tag is copied from the repository's current `trunk/`. A leading `v` is stripped, so `v1.2.0` creates `tags/1.2.0`. |
|
|
157
157
|
| `--assets-dir <dir>` | not set | Sync this directory with banners, icons and screenshots to the SVN `assets/` directory. There's no default directory, so assets are only deployed when this is set, and it must exist. |
|
|
158
158
|
| `--no-assets` | | Skip the `--assets-dir` sync for one run, for example when a config always passes `--assets-dir`. |
|
|
159
159
|
|
|
@@ -163,9 +163,6 @@ Typical runs:
|
|
|
163
163
|
# Deploy 1.2.0 to trunk and the tag, and update the assets
|
|
164
164
|
wp-release deploy-svn dist --trunk --svn-tag 1.2.0 --assets-dir .wordpress-org
|
|
165
165
|
|
|
166
|
-
# Update only the readme between releases
|
|
167
|
-
wp-release deploy-svn dist --readme-only
|
|
168
|
-
|
|
169
166
|
# Update only the assets
|
|
170
167
|
wp-release deploy-svn --assets-dir .wordpress-org
|
|
171
168
|
|
|
@@ -176,9 +173,9 @@ wp-release deploy-svn --from-zip my-plugin.1.2.0.zip --trunk --svn-tag 1.2.0
|
|
|
176
173
|
How a deploy works:
|
|
177
174
|
|
|
178
175
|
1. The options are validated, including the slug, version and readme name, before they're used in URLs or paths.
|
|
179
|
-
2. With `--trunk`, the files must be a plugin whose `Version` header matches the version, and with `--svn-tag` the readme `Stable tag` must match too.
|
|
176
|
+
2. With `--trunk`, the files must be a plugin whose `Version` header matches the version, and with `--svn-tag` the readme `Stable tag` must match too. A tag-only run doesn't check the files, since it tags whatever is in `trunk/`. Nothing is checked out when a check fails.
|
|
180
177
|
3. The repository is checked out sparsely into a new temporary directory, with only the directories that the flags write to. A missing `assets/` (or `trunk/`, `tags/`) directory is created. The deploy stops when `tags/<version>` exists, unless `--force` replaces it.
|
|
181
|
-
4. The files are synced in Node.js, without `rsync`: new and changed files are copied, files that are no longer selected are deleted, and `svn add` and `svn delete` stage them, including files that svn ignores by default. `trunk/` is then copied to the tag with `svn copy
|
|
178
|
+
4. The files are synced in Node.js, without `rsync`: new and changed files are copied, files that are no longer selected are deleted, and `svn add` and `svn delete` stage them, including files that svn ignores by default. `trunk/` is then copied to the tag with `svn copy`, from the working copy when trunk was written and from the repository otherwise.
|
|
182
179
|
5. Asset images get `svn:mime-type` set for PNG, JPEG, GIF and SVG, the formats that WordPress.org documents for plugin assets. Other formats keep the type that svn assigns.
|
|
183
180
|
6. When `svn status` is empty, the deploy ends without a commit. A dry run logs the status and stops before the commit. Otherwise the changes are committed, and the temporary directory is always removed.
|
|
184
181
|
|
|
@@ -188,8 +185,6 @@ Credentials are only needed for the commit, not for dry runs, no-op runs or `fil
|
|
|
188
185
|
|
|
189
186
|
Validation:
|
|
190
187
|
|
|
191
|
-
- `--trunk` and `--readme-only` can't be combined.
|
|
192
|
-
- `--readme-only` is rejected when `GITHUB_REF` is a tag, since a readme-only update from a release tag usually means the build was forgotten.
|
|
193
188
|
- Pre-release versions like `1.0.0-rc.1` are never tagged.
|
|
194
189
|
- `--version` defaults to `--svn-tag`, then the `Version` header of the deployed files; when `--version` and `--svn-tag` are both set they must match.
|
|
195
190
|
- `--trunk` without `--svn-tag` works but warns, because trunk then differs from the stable tag that WordPress.org serves downloads from.
|
|
@@ -309,8 +304,8 @@ The `wpelevator-source` export condition points at `src/index.ts`. The tests and
|
|
|
309
304
|
|
|
310
305
|
| Tool | What it does | How `wp-release` differs |
|
|
311
306
|
|---|---|---|
|
|
312
|
-
| [10up WordPress.org plugin deploy](https://github.com/10up/action-wordpress-plugin-deploy) and [readme/asset update](https://github.com/10up/action-wordpress-plugin-asset-update) actions | Two separate GitHub Actions configured through env vars. A deploy always syncs the build to `trunk/` and copies it to the tag; readme and asset updates need the second action. Assets come from `.wordpress-org` by default, and files are selected with `.distignore` or `.gitattributes`. Files are synced with `rsync`. | One `deploy-svn` command with independent write flags, so a release, a
|
|
313
|
-
| [`grunt-wp-deploy`](https://github.com/stephenharris/grunt-wp-deploy) | Grunt task with `deploy_trunk` and `deploy_tag` booleans, interactive password prompts and a `Stable tag` check. | No Grunt dependency and never interactive.
|
|
307
|
+
| [10up WordPress.org plugin deploy](https://github.com/10up/action-wordpress-plugin-deploy) and [readme/asset update](https://github.com/10up/action-wordpress-plugin-asset-update) actions | Two separate GitHub Actions configured through env vars. A deploy always syncs the build to `trunk/` and copies it to the tag; readme and asset updates need the second action. Assets come from `.wordpress-org` by default, and files are selected with `.distignore` or `.gitattributes`. Files are synced with `rsync`. | One `deploy-svn` command with independent write flags, so a release, a tag-only run and an assets-only update are the same command with different flags. Runs locally and in any CI, not only GitHub Actions, and syncs in Node.js without `rsync`. Checks that the `Version` header, readme `Stable tag` and SVN tag agree before writing, which the 10up actions don't. Assets are deployed only when `--assets-dir` is passed, instead of always syncing `.wordpress-org` when it exists, so a plugin's own `assets/` folder is never uploaded by accident. Adds `--exclude` for patterns without an ignore file and `--from-zip` to deploy the exact files of a ZIP. |
|
|
308
|
+
| [`grunt-wp-deploy`](https://github.com/stephenharris/grunt-wp-deploy) | Grunt task with `deploy_trunk` and `deploy_tag` booleans, interactive password prompts and a `Stable tag` check. | No Grunt dependency and never interactive. Tagging is independent of syncing trunk, and assets are independent of both. |
|
|
314
309
|
| [codeinwp theme deploy](https://github.com/codeinwp/action-wordpress-theme-deploy) | Fork of the 10up plugin action that commits themes to the themes SVN repository. | Doesn't deploy themes. Theme releases are ZIP uploads on WordPress.org; `zip` builds the upload with the theme folder as the root. |
|
|
315
310
|
| [`wp dist-archive`](https://github.com/wp-cli/dist-archive-command) | WP-CLI command that zips a project using `.distignore`, with `--plugin-dirname` and `--filename-format`. | Same `.distignore` file and `{name}.{version}` style filename format, but needs only Node.js instead of PHP and WP-CLI. `.distignore` is matched with full gitignore syntax, including `!` negation, and `--distignore` / `--exclude` let you point at another ignore file or add patterns on the command line. Builds are reproducible, and `--checksums` writes a manifest next to the ZIP. |
|
|
316
311
|
| [`wp plugin verify-checksums`](https://developer.wordpress.org/cli/commands/plugin/verify-checksums/) | WP-CLI command that checks installed plugins against the WordPress.org checksums API. | Reads the same manifest format, but from a file, so it also works for plugins and themes that aren't hosted on WordPress.org and for build directories in CI. `checksums` writes the manifest that WordPress.org generates for its own plugins. |
|
|
@@ -19,7 +19,6 @@ export function getDeployInputFromArgs(input) {
|
|
|
19
19
|
slug: getString(values, 'slug'),
|
|
20
20
|
version: getString(values, 'version'),
|
|
21
21
|
trunk: flag('trunk'),
|
|
22
|
-
readmeOnly: flag('readme-only'),
|
|
23
22
|
svnTag: getString(values, 'svn-tag'),
|
|
24
23
|
assets: getBoolean(values, 'no-assets') ? false : undefined,
|
|
25
24
|
assetsDir: getString(values, 'assets-dir'),
|
|
@@ -28,7 +27,6 @@ export function getDeployInputFromArgs(input) {
|
|
|
28
27
|
...getFileSelectionInput(values),
|
|
29
28
|
svnUrl: getString(values, 'svn-url'),
|
|
30
29
|
svnUsername: getString(values, 'svn-username'),
|
|
31
|
-
gitRef: process.env.GITHUB_REF,
|
|
32
30
|
message: getString(values, 'message'),
|
|
33
31
|
force: flag('force'),
|
|
34
32
|
dryRun: flag('dry-run'),
|
|
@@ -44,9 +42,8 @@ export default {
|
|
|
44
42
|
|
|
45
43
|
Writes (none by default, assets only with --assets-dir):
|
|
46
44
|
--trunk Sync the full source directory to trunk/
|
|
47
|
-
--
|
|
48
|
-
|
|
49
|
-
A leading "v" is stripped.
|
|
45
|
+
--svn-tag <version> Copy trunk/ to tags/<version>, with or without
|
|
46
|
+
--trunk. A leading "v" is stripped.
|
|
50
47
|
--assets-dir <dir> Sync this directory with banners, icons and
|
|
51
48
|
screenshots to assets/
|
|
52
49
|
--no-assets Don't sync --assets-dir for this run
|
|
@@ -73,14 +70,11 @@ or rejected.
|
|
|
73
70
|
Examples:
|
|
74
71
|
wp-release deploy-svn dist --trunk --svn-tag 1.2.0 --assets-dir .wordpress-org
|
|
75
72
|
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
73
|
wp-release deploy-svn --assets-dir .wordpress-org
|
|
79
74
|
Update only the assets`,
|
|
80
75
|
options: {
|
|
81
76
|
...sourceDirArgs,
|
|
82
77
|
trunk: { type: 'boolean' },
|
|
83
|
-
'readme-only': { type: 'boolean' },
|
|
84
78
|
'svn-tag': { type: 'string' },
|
|
85
79
|
'assets-dir': { type: 'string' },
|
|
86
80
|
'no-assets': { type: 'boolean' },
|
package/dist/deploy-options.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ export interface DeployInput {
|
|
|
13
13
|
version?: string;
|
|
14
14
|
/** Sync the full source directory to trunk/. */
|
|
15
15
|
trunk?: boolean;
|
|
16
|
-
/** Sync only the readme to trunk/. */
|
|
17
|
-
readmeOnly?: boolean;
|
|
18
16
|
/** Copy trunk/ to tags/<svnTag>. */
|
|
19
17
|
svnTag?: string;
|
|
20
18
|
/** Sync the assets directory, defaults to on when assetsDir is set. */
|
|
@@ -37,8 +35,6 @@ export interface DeployInput {
|
|
|
37
35
|
svnUsername?: string;
|
|
38
36
|
/** SVN password, defaults to the SVN_PASSWORD env var. */
|
|
39
37
|
svnPassword?: string;
|
|
40
|
-
/** Git ref of the run, like refs/tags/1.2.0. */
|
|
41
|
-
gitRef?: string;
|
|
42
38
|
/** SVN commit message. */
|
|
43
39
|
message?: string;
|
|
44
40
|
/** Replace an existing tag. */
|
|
@@ -54,7 +50,6 @@ export interface DeployOptions extends FileSelection {
|
|
|
54
50
|
slug: string;
|
|
55
51
|
version: string | null;
|
|
56
52
|
trunk: boolean;
|
|
57
|
-
readmeOnly: boolean;
|
|
58
53
|
svnTag: string | null;
|
|
59
54
|
assets: boolean;
|
|
60
55
|
assetsDir: string | null;
|
|
@@ -65,7 +60,6 @@ export interface DeployOptions extends FileSelection {
|
|
|
65
60
|
svnUsername: string | null;
|
|
66
61
|
/** Never logged or printed. */
|
|
67
62
|
svnPassword: string | null;
|
|
68
|
-
gitRef: string | null;
|
|
69
63
|
message: string | null;
|
|
70
64
|
force: boolean;
|
|
71
65
|
dryRun: boolean;
|
|
@@ -123,7 +117,7 @@ export declare function getDeployOptionErrors(options: DeployOptions): string[];
|
|
|
123
117
|
*/
|
|
124
118
|
export declare function getDeployOptionWarnings(options: DeployOptions): string[];
|
|
125
119
|
/**
|
|
126
|
-
* Apply defaults to deploy options and validate them. Trunk
|
|
120
|
+
* Apply defaults to deploy options and validate them. Trunk and tag
|
|
127
121
|
* writes happen only when requested, and assets are synced whenever an
|
|
128
122
|
* assets directory is set, unless turned off. The version defaults to the
|
|
129
123
|
* SVN tag; without either, SvnDeploy reads the Version header of the
|
package/dist/deploy-options.js
CHANGED
|
@@ -62,13 +62,7 @@ function isValidFilename(name) {
|
|
|
62
62
|
*/
|
|
63
63
|
export function getDeployOptionErrors(options) {
|
|
64
64
|
const errors = [];
|
|
65
|
-
const {
|
|
66
|
-
if (svnTag && !trunk) {
|
|
67
|
-
errors.push('--svn-tag requires --trunk, since the tag is copied from trunk.');
|
|
68
|
-
}
|
|
69
|
-
if (trunk && readmeOnly) {
|
|
70
|
-
errors.push('Use either --trunk or --readme-only, not both.');
|
|
71
|
-
}
|
|
65
|
+
const { svnTag, version, assets, assetsDir, slug } = options;
|
|
72
66
|
if (svnTag && isPrerelease(svnTag)) {
|
|
73
67
|
errors.push(`Pre-release version ${svnTag} can't be tagged on WordPress.org.`);
|
|
74
68
|
}
|
|
@@ -81,9 +75,6 @@ export function getDeployOptionErrors(options) {
|
|
|
81
75
|
if (svnTag && version && svnTag !== version) {
|
|
82
76
|
errors.push(`SVN tag ${svnTag} doesn't match version ${version}.`);
|
|
83
77
|
}
|
|
84
|
-
if (readmeOnly && isTagRef(options.gitRef)) {
|
|
85
|
-
errors.push(`--readme-only isn't allowed when running for tag ${options.gitRef}. Did you mean --trunk --svn-tag?`);
|
|
86
|
-
}
|
|
87
78
|
if (assets && !assetsDir) {
|
|
88
79
|
errors.push('Syncing assets requires --assets-dir.');
|
|
89
80
|
}
|
|
@@ -118,7 +109,7 @@ export function getDeployOptionWarnings(options) {
|
|
|
118
109
|
return warnings;
|
|
119
110
|
}
|
|
120
111
|
/**
|
|
121
|
-
* Apply defaults to deploy options and validate them. Trunk
|
|
112
|
+
* Apply defaults to deploy options and validate them. Trunk and tag
|
|
122
113
|
* writes happen only when requested, and assets are synced whenever an
|
|
123
114
|
* assets directory is set, unless turned off. The version defaults to the
|
|
124
115
|
* SVN tag; without either, SvnDeploy reads the Version header of the
|
|
@@ -139,7 +130,6 @@ export function resolveDeployOptions(input = {}) {
|
|
|
139
130
|
slug,
|
|
140
131
|
version: input.version ? normalizeTag(input.version) : svnTag,
|
|
141
132
|
trunk: Boolean(input.trunk),
|
|
142
|
-
readmeOnly: Boolean(input.readmeOnly),
|
|
143
133
|
assets: input.assets ?? Boolean(assetsDir),
|
|
144
134
|
svnTag,
|
|
145
135
|
sourceDir,
|
|
@@ -155,7 +145,6 @@ export function resolveDeployOptions(input = {}) {
|
|
|
155
145
|
svnUrl: (input.svnUrl || SVN_URL).replace('{slug}', slug),
|
|
156
146
|
svnUsername: input.svnUsername || process.env.SVN_USERNAME || null,
|
|
157
147
|
svnPassword: input.svnPassword || process.env.SVN_PASSWORD || null,
|
|
158
|
-
gitRef: input.gitRef || null,
|
|
159
148
|
message: input.message || null,
|
|
160
149
|
force: Boolean(input.force),
|
|
161
150
|
dryRun: Boolean(input.dryRun),
|
package/dist/svn-deploy.d.ts
CHANGED
|
@@ -73,8 +73,7 @@ export declare class SvnDeploy {
|
|
|
73
73
|
/**
|
|
74
74
|
* Check the plugin files before anything is written. A trunk sync needs
|
|
75
75
|
* a plugin with a Version header that matches the version, and with an
|
|
76
|
-
* SVN tag also a readme Stable tag that matches.
|
|
77
|
-
* the readme.
|
|
76
|
+
* SVN tag also a readme Stable tag that matches.
|
|
78
77
|
*
|
|
79
78
|
* @throws {ValidationError} When the files or versions don't match.
|
|
80
79
|
*/
|
|
@@ -134,7 +133,9 @@ export declare class SvnDeploy {
|
|
|
134
133
|
*/
|
|
135
134
|
setAssetMimeTypes(): Promise<void>;
|
|
136
135
|
/**
|
|
137
|
-
* Copy trunk to the SVN tag, replacing an existing tag with force.
|
|
136
|
+
* Copy trunk to the SVN tag, replacing an existing tag with force. Trunk
|
|
137
|
+
* is copied from the working copy when this run writes to it, and from the
|
|
138
|
+
* repository otherwise, so that tagging doesn't need a trunk checkout.
|
|
138
139
|
*/
|
|
139
140
|
copyTag(): Promise<void>;
|
|
140
141
|
/**
|
|
@@ -183,7 +184,7 @@ export declare class SvnDeploy {
|
|
|
183
184
|
/**
|
|
184
185
|
* Check if the deploy reads plugin files, which assets-only runs don't.
|
|
185
186
|
*
|
|
186
|
-
* @return Whether trunk
|
|
187
|
+
* @return Whether trunk is written.
|
|
187
188
|
*/
|
|
188
189
|
needsFiles(): boolean;
|
|
189
190
|
/**
|
|
@@ -198,6 +199,12 @@ export declare class SvnDeploy {
|
|
|
198
199
|
* @return Rules description, empty without rules.
|
|
199
200
|
*/
|
|
200
201
|
describeRules(): string;
|
|
202
|
+
/**
|
|
203
|
+
* Get the repository URL of trunk.
|
|
204
|
+
*
|
|
205
|
+
* @return Trunk URL without a double slash.
|
|
206
|
+
*/
|
|
207
|
+
getTrunkUrl(): string;
|
|
201
208
|
/**
|
|
202
209
|
* Get the path of the tag in the working copy.
|
|
203
210
|
*
|
package/dist/svn-deploy.js
CHANGED
|
@@ -9,7 +9,7 @@ import { CredentialsError, ValidationError } from "./errors.js";
|
|
|
9
9
|
import { loadFileRules, selectFiles } from "./file-selection.js";
|
|
10
10
|
import { readPackageMeta } from "./package-meta.js";
|
|
11
11
|
import { Svn } from "./svn.js";
|
|
12
|
-
import {
|
|
12
|
+
import { syncDirectory } from "./sync.js";
|
|
13
13
|
import { extractZip } from "./unzip.js";
|
|
14
14
|
import { findVersionMismatches } from "./version-check.js";
|
|
15
15
|
/**
|
|
@@ -97,35 +97,27 @@ export class SvnDeploy {
|
|
|
97
97
|
/**
|
|
98
98
|
* Check the plugin files before anything is written. A trunk sync needs
|
|
99
99
|
* a plugin with a Version header that matches the version, and with an
|
|
100
|
-
* SVN tag also a readme Stable tag that matches.
|
|
101
|
-
* the readme.
|
|
100
|
+
* SVN tag also a readme Stable tag that matches.
|
|
102
101
|
*
|
|
103
102
|
* @throws {ValidationError} When the files or versions don't match.
|
|
104
103
|
*/
|
|
105
104
|
async checkVersions() {
|
|
106
|
-
const { trunk,
|
|
105
|
+
const { trunk, svnTag, slug } = this.options;
|
|
107
106
|
const sourceDir = this.filesDir ?? this.options.sourceDir;
|
|
108
|
-
if (trunk
|
|
107
|
+
if (trunk) {
|
|
109
108
|
const meta = await this.readPluginMeta(sourceDir);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
this.version = version;
|
|
122
|
-
if (mismatches.length) {
|
|
123
|
-
throw new ValidationError(mismatches
|
|
124
|
-
.map(({ message }) => message)
|
|
125
|
-
.join('\n'));
|
|
126
|
-
}
|
|
127
|
-
this.logger.info(`Deploying version ${version}.`);
|
|
109
|
+
const { version, mismatches } = await findVersionMismatches({
|
|
110
|
+
sourceDir,
|
|
111
|
+
meta,
|
|
112
|
+
slug,
|
|
113
|
+
version: this.options.version,
|
|
114
|
+
stableTag: Boolean(svnTag),
|
|
115
|
+
});
|
|
116
|
+
this.version = version;
|
|
117
|
+
if (mismatches.length) {
|
|
118
|
+
throw new ValidationError(mismatches.map(({ message }) => message).join('\n'));
|
|
128
119
|
}
|
|
120
|
+
this.logger.info(`Deploying version ${version}.`);
|
|
129
121
|
}
|
|
130
122
|
}
|
|
131
123
|
/**
|
|
@@ -195,7 +187,7 @@ export class SvnDeploy {
|
|
|
195
187
|
* additions, deletions and asset MIME types, then copy trunk to the tag.
|
|
196
188
|
*/
|
|
197
189
|
async sync() {
|
|
198
|
-
const { trunk,
|
|
190
|
+
const { trunk, assets } = this.options;
|
|
199
191
|
const workingCopy = this.getWorkingCopy();
|
|
200
192
|
const sourceDir = this.filesDir ?? this.options.sourceDir;
|
|
201
193
|
if (trunk) {
|
|
@@ -205,9 +197,6 @@ export class SvnDeploy {
|
|
|
205
197
|
targetDir: join(workingCopy, 'trunk'),
|
|
206
198
|
});
|
|
207
199
|
}
|
|
208
|
-
if (readmeOnly) {
|
|
209
|
-
await copyFileIfChanged(join(sourceDir, readme), join(workingCopy, 'trunk', readme));
|
|
210
|
-
}
|
|
211
200
|
if (assets) {
|
|
212
201
|
await this.syncAssets();
|
|
213
202
|
}
|
|
@@ -277,7 +266,9 @@ export class SvnDeploy {
|
|
|
277
266
|
}
|
|
278
267
|
}
|
|
279
268
|
/**
|
|
280
|
-
* Copy trunk to the SVN tag, replacing an existing tag with force.
|
|
269
|
+
* Copy trunk to the SVN tag, replacing an existing tag with force. Trunk
|
|
270
|
+
* is copied from the working copy when this run writes to it, and from the
|
|
271
|
+
* repository otherwise, so that tagging doesn't need a trunk checkout.
|
|
281
272
|
*/
|
|
282
273
|
async copyTag() {
|
|
283
274
|
const tagPath = this.getTagPath();
|
|
@@ -288,7 +279,7 @@ export class SvnDeploy {
|
|
|
288
279
|
}
|
|
289
280
|
if (tagPath) {
|
|
290
281
|
await this.svn.copy({
|
|
291
|
-
from: 'trunk',
|
|
282
|
+
from: this.needsFiles() ? 'trunk' : this.getTrunkUrl(),
|
|
292
283
|
to: tagPath,
|
|
293
284
|
cwd: workingCopy,
|
|
294
285
|
});
|
|
@@ -376,7 +367,7 @@ export class SvnDeploy {
|
|
|
376
367
|
* @return Planned changes, in order.
|
|
377
368
|
*/
|
|
378
369
|
getPlan() {
|
|
379
|
-
const { svnUrl, trunk,
|
|
370
|
+
const { svnUrl, trunk, assets, assetsDir, force } = this.options;
|
|
380
371
|
const tagPath = this.getTagPath();
|
|
381
372
|
const message = this.options.message ?? this.getDefaultMessage();
|
|
382
373
|
const plan = [
|
|
@@ -386,7 +377,6 @@ export class SvnDeploy {
|
|
|
386
377
|
tagPath && !force && `Stop if ${tagPath} already exists`,
|
|
387
378
|
tagPath && force && `Replace ${tagPath} if it exists`,
|
|
388
379
|
trunk && `Sync ${this.describeSource()} to trunk/`,
|
|
389
|
-
readmeOnly && `Copy ${readme} to trunk/`,
|
|
390
380
|
tagPath && `Copy trunk/ to ${tagPath}`,
|
|
391
381
|
assets && `Sync ${assetsDir} to assets/`,
|
|
392
382
|
this.options.dryRun
|
|
@@ -402,9 +392,9 @@ export class SvnDeploy {
|
|
|
402
392
|
* @return Relative paths with their SVN checkout depth.
|
|
403
393
|
*/
|
|
404
394
|
getCheckoutPaths() {
|
|
405
|
-
const { trunk,
|
|
395
|
+
const { trunk, svnTag, assets } = this.options;
|
|
406
396
|
const paths = [];
|
|
407
|
-
if (trunk
|
|
397
|
+
if (trunk) {
|
|
408
398
|
paths.push({ path: 'trunk', depth: 'infinity' });
|
|
409
399
|
}
|
|
410
400
|
if (svnTag) {
|
|
@@ -421,16 +411,16 @@ export class SvnDeploy {
|
|
|
421
411
|
* @return Whether to check out and commit.
|
|
422
412
|
*/
|
|
423
413
|
hasWrites() {
|
|
424
|
-
const { trunk,
|
|
425
|
-
return Boolean(trunk ||
|
|
414
|
+
const { trunk, svnTag, assets } = this.options;
|
|
415
|
+
return Boolean(trunk || svnTag || assets);
|
|
426
416
|
}
|
|
427
417
|
/**
|
|
428
418
|
* Check if the deploy reads plugin files, which assets-only runs don't.
|
|
429
419
|
*
|
|
430
|
-
* @return Whether trunk
|
|
420
|
+
* @return Whether trunk is written.
|
|
431
421
|
*/
|
|
432
422
|
needsFiles() {
|
|
433
|
-
return this.options.trunk
|
|
423
|
+
return this.options.trunk;
|
|
434
424
|
}
|
|
435
425
|
/**
|
|
436
426
|
* Describe the files that are synced, including the ignore rules.
|
|
@@ -458,6 +448,14 @@ export class SvnDeploy {
|
|
|
458
448
|
];
|
|
459
449
|
return rules.filter(Boolean).join(', ');
|
|
460
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Get the repository URL of trunk.
|
|
453
|
+
*
|
|
454
|
+
* @return Trunk URL without a double slash.
|
|
455
|
+
*/
|
|
456
|
+
getTrunkUrl() {
|
|
457
|
+
return `${this.options.svnUrl.replace(/\/+$/, '')}/trunk`;
|
|
458
|
+
}
|
|
461
459
|
/**
|
|
462
460
|
* Get the path of the tag in the working copy.
|
|
463
461
|
*
|
|
@@ -471,15 +469,11 @@ export class SvnDeploy {
|
|
|
471
469
|
return null;
|
|
472
470
|
}
|
|
473
471
|
getDefaultMessage() {
|
|
474
|
-
const { trunk,
|
|
472
|
+
const { trunk, svnTag, assets } = this.options;
|
|
475
473
|
if (svnTag) {
|
|
476
474
|
return `Release version ${svnTag}`;
|
|
477
475
|
}
|
|
478
|
-
const parts = [
|
|
479
|
-
trunk && 'trunk',
|
|
480
|
-
readmeOnly && 'readme',
|
|
481
|
-
assets && 'assets',
|
|
482
|
-
];
|
|
476
|
+
const parts = [trunk && 'trunk', assets && 'assets'];
|
|
483
477
|
return `Update ${parts.filter(Boolean).join(' and ')}`;
|
|
484
478
|
}
|
|
485
479
|
}
|
package/package.json
CHANGED