pressship 0.1.12 → 0.1.13
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 +13 -0
- package/assets/web/app.js +6425 -0
- package/assets/web/harness-sdk-icon-mono.svg +33 -0
- package/assets/web/harness-sdk-icon.svg +120 -0
- package/assets/web/index.html +392 -0
- package/assets/web/style.css +6454 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -1
- package/dist/plugin/demo.d.ts +75 -4
- package/dist/plugin/demo.js +520 -31
- package/dist/plugin/demo.js.map +1 -1
- package/dist/utils/paths.d.ts +5 -0
- package/dist/utils/paths.js +15 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/web/ai-assistance.d.ts +70 -0
- package/dist/web/ai-assistance.js +262 -0
- package/dist/web/ai-assistance.js.map +1 -0
- package/dist/web/index.d.ts +9 -0
- package/dist/web/index.js +34 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/jobs.d.ts +33 -0
- package/dist/web/jobs.js +155 -0
- package/dist/web/jobs.js.map +1 -0
- package/dist/web/open-url.d.ts +1 -0
- package/dist/web/open-url.js +13 -0
- package/dist/web/open-url.js.map +1 -0
- package/dist/web/plugin-check-state.d.ts +47 -0
- package/dist/web/plugin-check-state.js +107 -0
- package/dist/web/plugin-check-state.js.map +1 -0
- package/dist/web/plugin-check.d.ts +11 -0
- package/dist/web/plugin-check.js +124 -0
- package/dist/web/plugin-check.js.map +1 -0
- package/dist/web/ports.d.ts +2 -0
- package/dist/web/ports.js +38 -0
- package/dist/web/ports.js.map +1 -0
- package/dist/web/registry.d.ts +49 -0
- package/dist/web/registry.js +106 -0
- package/dist/web/registry.js.map +1 -0
- package/dist/web/release.d.ts +87 -0
- package/dist/web/release.js +413 -0
- package/dist/web/release.js.map +1 -0
- package/dist/web/server.d.ts +24 -0
- package/dist/web/server.js +1419 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/settings.d.ts +36 -0
- package/dist/web/settings.js +72 -0
- package/dist/web/settings.js.map +1 -0
- package/dist/web/version-state.d.ts +28 -0
- package/dist/web/version-state.js +114 -0
- package/dist/web/version-state.js.map +1 -0
- package/dist/wordpress-org/publish.d.ts +1 -0
- package/dist/wordpress-org/publish.js +4 -2
- package/dist/wordpress-org/publish.js.map +1 -1
- package/dist/wordpress-org/submit.d.ts +1 -0
- package/dist/wordpress-org/submit.js +7 -5
- package/dist/wordpress-org/submit.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { discoverPluginProject } from "../plugin/discover.js";
|
|
6
|
+
import { localPluginInfo } from "../plugin/info.js";
|
|
7
|
+
import { ensureConfigDir, getLegacyWebLocalPluginsPath, getWebLocalPluginsPath, pathExists } from "../utils/paths.js";
|
|
8
|
+
const localPluginSourceSchema = z.enum(["manual", "clone"]);
|
|
9
|
+
const localPluginEntrySchema = z.object({
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
path: z.string().min(1),
|
|
12
|
+
source: localPluginSourceSchema,
|
|
13
|
+
slug: z.string().min(1),
|
|
14
|
+
name: z.string().min(1),
|
|
15
|
+
addedAt: z.string().min(1),
|
|
16
|
+
updatedAt: z.string().min(1)
|
|
17
|
+
});
|
|
18
|
+
const localPluginRegistrySchema = z.object({
|
|
19
|
+
version: z.literal(1),
|
|
20
|
+
plugins: z.array(localPluginEntrySchema)
|
|
21
|
+
});
|
|
22
|
+
export async function readLocalPluginRegistry() {
|
|
23
|
+
const registryPath = pathExists(getWebLocalPluginsPath()) ? getWebLocalPluginsPath() : getLegacyWebLocalPluginsPath();
|
|
24
|
+
if (!pathExists(registryPath)) {
|
|
25
|
+
return emptyRegistry();
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return localPluginRegistrySchema.parse(JSON.parse(await readFile(registryPath, "utf8")));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return emptyRegistry();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function writeLocalPluginRegistry(registry) {
|
|
35
|
+
await ensureConfigDir();
|
|
36
|
+
await writeFile(getWebLocalPluginsPath(), `${JSON.stringify(registry, null, 2)}\n`, { mode: 0o600 });
|
|
37
|
+
}
|
|
38
|
+
export async function listLocalPlugins() {
|
|
39
|
+
const registry = await readLocalPluginRegistry();
|
|
40
|
+
return Promise.all(registry.plugins.map(enrichLocalPlugin));
|
|
41
|
+
}
|
|
42
|
+
export async function getLocalPlugin(id) {
|
|
43
|
+
const registry = await readLocalPluginRegistry();
|
|
44
|
+
const entry = registry.plugins.find((plugin) => plugin.id === id);
|
|
45
|
+
return entry ? enrichLocalPlugin(entry) : undefined;
|
|
46
|
+
}
|
|
47
|
+
export async function addLocalPluginPath(pluginPath, source = "manual") {
|
|
48
|
+
const rootPath = path.resolve(pluginPath);
|
|
49
|
+
const project = await discoverPluginProject(rootPath);
|
|
50
|
+
const now = new Date().toISOString();
|
|
51
|
+
const registry = await readLocalPluginRegistry();
|
|
52
|
+
const id = pluginPathId(project.rootDir);
|
|
53
|
+
const existing = registry.plugins.find((plugin) => plugin.id === id);
|
|
54
|
+
const entry = {
|
|
55
|
+
id,
|
|
56
|
+
path: project.rootDir,
|
|
57
|
+
source,
|
|
58
|
+
slug: project.slug,
|
|
59
|
+
name: project.headers.pluginName,
|
|
60
|
+
addedAt: existing?.addedAt ?? now,
|
|
61
|
+
updatedAt: now
|
|
62
|
+
};
|
|
63
|
+
await writeLocalPluginRegistry({
|
|
64
|
+
version: 1,
|
|
65
|
+
plugins: [...registry.plugins.filter((plugin) => plugin.id !== id), entry].sort((a, b) => a.name.localeCompare(b.name))
|
|
66
|
+
});
|
|
67
|
+
return enrichLocalPlugin(entry);
|
|
68
|
+
}
|
|
69
|
+
export async function removeLocalPlugin(id) {
|
|
70
|
+
const registry = await readLocalPluginRegistry();
|
|
71
|
+
const plugins = registry.plugins.filter((plugin) => plugin.id !== id);
|
|
72
|
+
if (plugins.length === registry.plugins.length) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
await writeLocalPluginRegistry({ version: 1, plugins });
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
export function pluginPathId(pluginPath) {
|
|
79
|
+
return createHash("sha256").update(path.resolve(pluginPath)).digest("hex").slice(0, 24);
|
|
80
|
+
}
|
|
81
|
+
function emptyRegistry() {
|
|
82
|
+
return { version: 1, plugins: [] };
|
|
83
|
+
}
|
|
84
|
+
async function enrichLocalPlugin(entry) {
|
|
85
|
+
if (!pathExists(entry.path)) {
|
|
86
|
+
return { ...entry, exists: false, error: "Plugin path no longer exists." };
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
const project = await discoverPluginProject(entry.path);
|
|
90
|
+
return {
|
|
91
|
+
...entry,
|
|
92
|
+
exists: true,
|
|
93
|
+
slug: project.slug,
|
|
94
|
+
name: project.headers.pluginName,
|
|
95
|
+
info: localPluginInfo(project)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return {
|
|
100
|
+
...entry,
|
|
101
|
+
exists: true,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/web/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAA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CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { WebJobContext } from "./jobs.js";
|
|
2
|
+
export type ReleaseTag = {
|
|
3
|
+
name: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
isCurrent: boolean;
|
|
6
|
+
isUncommitted: boolean;
|
|
7
|
+
isTrunk?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ReleaseTagList = {
|
|
10
|
+
slug: string;
|
|
11
|
+
svnRootDir?: string;
|
|
12
|
+
currentRef?: string;
|
|
13
|
+
trunk?: ReleaseTag;
|
|
14
|
+
tags: ReleaseTag[];
|
|
15
|
+
source: "local" | "remote" | "unknown";
|
|
16
|
+
};
|
|
17
|
+
export type ReleaseSwitchConflictResolution = "override" | "revert";
|
|
18
|
+
export type ReleaseSwitchTagOptions = {
|
|
19
|
+
conflictResolution?: ReleaseSwitchConflictResolution;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Lists tag information for the plugin under `pluginPath`.
|
|
23
|
+
*
|
|
24
|
+
* When the plugin has a local SVN working copy, this returns the union of:
|
|
25
|
+
* - the on-disk `tags/<name>` folders (so we can flag uncommitted local-only
|
|
26
|
+
* tags), and
|
|
27
|
+
* - the remote `https://plugins.svn.wordpress.org/<slug>/tags/` listing (so
|
|
28
|
+
* we can flag tags that exist remotely but are not yet on disk).
|
|
29
|
+
*
|
|
30
|
+
* When no local SVN working copy exists, it falls back to the remote tags only.
|
|
31
|
+
*/
|
|
32
|
+
export declare function listReleaseTags(pluginPath: string): Promise<ReleaseTagList>;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new local SVN tag by `svn copy trunk tags/<name>`. Requires that
|
|
35
|
+
* the plugin has a local SVN working copy (otherwise the user has nothing to
|
|
36
|
+
* tag locally). The created tag is *uncommitted* — `pressship release` is what
|
|
37
|
+
* pushes it to the remote.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createReleaseTag(pluginPath: string, name: string): Promise<ReleaseTag>;
|
|
40
|
+
/**
|
|
41
|
+
* Removes a local-only (uncommitted) tag folder. Refuses to touch committed
|
|
42
|
+
* remote tags — those must go through `svn delete + svn commit` from the CLI.
|
|
43
|
+
*/
|
|
44
|
+
export declare function deleteReleaseTag(pluginPath: string, name: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Switches the plugin working copy to point at the given tag (or trunk). Runs
|
|
47
|
+
* `svn switch` so that subsequent edits land on the target ref. Streams output
|
|
48
|
+
* back through the supplied job context so the user sees what svn is doing.
|
|
49
|
+
*/
|
|
50
|
+
export declare function switchReleaseTag(pluginPath: string, name: string, context: WebJobContext, options?: ReleaseSwitchTagOptions): Promise<{
|
|
51
|
+
ref: string;
|
|
52
|
+
workingCopy: string;
|
|
53
|
+
}>;
|
|
54
|
+
export type ReleaseBoardEntry = {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
path: string;
|
|
59
|
+
exists: boolean;
|
|
60
|
+
error?: string;
|
|
61
|
+
localVersion?: string;
|
|
62
|
+
readmeStableTag?: string;
|
|
63
|
+
remoteVersion?: string;
|
|
64
|
+
latestSvnTag?: string;
|
|
65
|
+
statuses: string[];
|
|
66
|
+
releaseBlocked: boolean;
|
|
67
|
+
messages: string[];
|
|
68
|
+
};
|
|
69
|
+
export declare class ReleaseError extends Error {
|
|
70
|
+
readonly status: number;
|
|
71
|
+
readonly code: string;
|
|
72
|
+
constructor(message: string, status?: number, code?: string);
|
|
73
|
+
}
|
|
74
|
+
export declare class ReleaseSwitchConflictError extends ReleaseError {
|
|
75
|
+
readonly ref: string;
|
|
76
|
+
readonly workingCopy: string;
|
|
77
|
+
readonly output: string;
|
|
78
|
+
constructor(ref: string, workingCopy: string, output: string);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Sets an explicit plugin version both in the main file header and (when the
|
|
82
|
+
* plugin has one) the readme stable tag. Mirrors what `bumpLocalPluginVersion`
|
|
83
|
+
* in server.ts does, but accepts an arbitrary string instead of patch/minor/
|
|
84
|
+
* major. Validates the version shape so we don't write something readme will
|
|
85
|
+
* reject.
|
|
86
|
+
*/
|
|
87
|
+
export declare function isValidExplicitVersion(value: string): boolean;
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { execa } from "execa";
|
|
2
|
+
import { mkdir, readdir, rm } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { discoverPluginProject, resolvePluginProjectPath } from "../plugin/discover.js";
|
|
5
|
+
import { isSvnAvailable } from "../svn/subversion.js";
|
|
6
|
+
import { pathExists } from "../utils/paths.js";
|
|
7
|
+
/**
|
|
8
|
+
* Lists tag information for the plugin under `pluginPath`.
|
|
9
|
+
*
|
|
10
|
+
* When the plugin has a local SVN working copy, this returns the union of:
|
|
11
|
+
* - the on-disk `tags/<name>` folders (so we can flag uncommitted local-only
|
|
12
|
+
* tags), and
|
|
13
|
+
* - the remote `https://plugins.svn.wordpress.org/<slug>/tags/` listing (so
|
|
14
|
+
* we can flag tags that exist remotely but are not yet on disk).
|
|
15
|
+
*
|
|
16
|
+
* When no local SVN working copy exists, it falls back to the remote tags only.
|
|
17
|
+
*/
|
|
18
|
+
export async function listReleaseTags(pluginPath) {
|
|
19
|
+
const projectPath = resolvePluginProjectPath(pluginPath);
|
|
20
|
+
const project = await discoverPluginProject(projectPath.rootDir);
|
|
21
|
+
const svnRootDir = projectPath.svnRootDir;
|
|
22
|
+
const currentRef = await readCurrentSvnRef(projectPath.rootDir, svnRootDir);
|
|
23
|
+
const localTags = await readLocalTagFolders(svnRootDir);
|
|
24
|
+
const remoteTags = await readRemoteTagList(project.slug);
|
|
25
|
+
const trunkTag = svnRootDir
|
|
26
|
+
? {
|
|
27
|
+
name: "trunk",
|
|
28
|
+
path: path.join(svnRootDir, "trunk"),
|
|
29
|
+
isCurrent: currentRef === "trunk" || currentRef === undefined,
|
|
30
|
+
isUncommitted: false,
|
|
31
|
+
isTrunk: true
|
|
32
|
+
}
|
|
33
|
+
: undefined;
|
|
34
|
+
const allNames = new Set([...localTags.map((entry) => entry.name), ...remoteTags]);
|
|
35
|
+
const tags = Array.from(allNames)
|
|
36
|
+
.filter((name) => name && name !== "trunk")
|
|
37
|
+
.map((name) => {
|
|
38
|
+
const localEntry = localTags.find((entry) => entry.name === name);
|
|
39
|
+
const remoteHas = remoteTags.includes(name);
|
|
40
|
+
return {
|
|
41
|
+
name,
|
|
42
|
+
path: localEntry?.path,
|
|
43
|
+
isCurrent: currentRef === name,
|
|
44
|
+
isUncommitted: Boolean(localEntry) && !remoteHas
|
|
45
|
+
};
|
|
46
|
+
})
|
|
47
|
+
.sort((a, b) => compareTagNames(a.name, b.name));
|
|
48
|
+
let source;
|
|
49
|
+
if (svnRootDir) {
|
|
50
|
+
source = "local";
|
|
51
|
+
}
|
|
52
|
+
else if (remoteTags.length > 0) {
|
|
53
|
+
source = "remote";
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
source = "unknown";
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
slug: project.slug,
|
|
60
|
+
svnRootDir,
|
|
61
|
+
currentRef,
|
|
62
|
+
trunk: trunkTag,
|
|
63
|
+
tags,
|
|
64
|
+
source
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new local SVN tag by `svn copy trunk tags/<name>`. Requires that
|
|
69
|
+
* the plugin has a local SVN working copy (otherwise the user has nothing to
|
|
70
|
+
* tag locally). The created tag is *uncommitted* — `pressship release` is what
|
|
71
|
+
* pushes it to the remote.
|
|
72
|
+
*/
|
|
73
|
+
export async function createReleaseTag(pluginPath, name) {
|
|
74
|
+
const tagName = name.trim();
|
|
75
|
+
if (!tagName) {
|
|
76
|
+
throw new ReleaseError("Tag name is required.", 400);
|
|
77
|
+
}
|
|
78
|
+
if (!/^[A-Za-z0-9_.+\-]+$/.test(tagName)) {
|
|
79
|
+
throw new ReleaseError("Tag name may only contain letters, numbers, dots, underscores, hyphens, and pluses.", 400);
|
|
80
|
+
}
|
|
81
|
+
if (tagName === "trunk") {
|
|
82
|
+
throw new ReleaseError("Reserved tag name.", 400);
|
|
83
|
+
}
|
|
84
|
+
const svnRootDir = await requireLocalSvnRoot(pluginPath);
|
|
85
|
+
await ensureSvnAvailableForRelease();
|
|
86
|
+
await ensureTrunkExists(svnRootDir);
|
|
87
|
+
const targetPath = path.join(svnRootDir, "tags", tagName);
|
|
88
|
+
if (pathExists(targetPath)) {
|
|
89
|
+
throw new ReleaseError(`Tag ${tagName} already exists locally. Delete it first or choose a different name.`, 409);
|
|
90
|
+
}
|
|
91
|
+
if (await remoteTagExists(await readSlugFromWorkingCopy(svnRootDir, pluginPath), tagName)) {
|
|
92
|
+
throw new ReleaseError(`Tag ${tagName} already exists on WordPress.org SVN. Bump the plugin version before tagging.`, 409);
|
|
93
|
+
}
|
|
94
|
+
await mkdir(path.join(svnRootDir, "tags"), { recursive: true });
|
|
95
|
+
await runSvn(["copy", "trunk", `tags/${tagName}`], svnRootDir);
|
|
96
|
+
return {
|
|
97
|
+
name: tagName,
|
|
98
|
+
path: targetPath,
|
|
99
|
+
isCurrent: false,
|
|
100
|
+
isUncommitted: true
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Removes a local-only (uncommitted) tag folder. Refuses to touch committed
|
|
105
|
+
* remote tags — those must go through `svn delete + svn commit` from the CLI.
|
|
106
|
+
*/
|
|
107
|
+
export async function deleteReleaseTag(pluginPath, name) {
|
|
108
|
+
const tagName = name.trim();
|
|
109
|
+
if (!tagName || tagName === "trunk") {
|
|
110
|
+
throw new ReleaseError("Refusing to delete trunk.", 400);
|
|
111
|
+
}
|
|
112
|
+
const svnRootDir = await requireLocalSvnRoot(pluginPath);
|
|
113
|
+
const targetPath = path.join(svnRootDir, "tags", tagName);
|
|
114
|
+
if (!pathExists(targetPath)) {
|
|
115
|
+
throw new ReleaseError(`Tag ${tagName} does not exist locally.`, 404);
|
|
116
|
+
}
|
|
117
|
+
const slug = await readSlugFromWorkingCopy(svnRootDir, pluginPath);
|
|
118
|
+
if (await remoteTagExists(slug, tagName)) {
|
|
119
|
+
throw new ReleaseError(`Tag ${tagName} is published on WordPress.org SVN and cannot be deleted from Pressship Studio.`, 409);
|
|
120
|
+
}
|
|
121
|
+
await ensureSvnAvailableForRelease();
|
|
122
|
+
const status = await runSvn(["status", path.join("tags", tagName)], svnRootDir, { capture: true });
|
|
123
|
+
if (status.trim()) {
|
|
124
|
+
await runSvn(["revert", "--recursive", path.join("tags", tagName)], svnRootDir);
|
|
125
|
+
}
|
|
126
|
+
await rm(targetPath, { recursive: true, force: true });
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Switches the plugin working copy to point at the given tag (or trunk). Runs
|
|
130
|
+
* `svn switch` so that subsequent edits land on the target ref. Streams output
|
|
131
|
+
* back through the supplied job context so the user sees what svn is doing.
|
|
132
|
+
*/
|
|
133
|
+
export async function switchReleaseTag(pluginPath, name, context, options = {}) {
|
|
134
|
+
const tagName = name.trim();
|
|
135
|
+
if (!tagName) {
|
|
136
|
+
throw new ReleaseError("Tag name is required.", 400);
|
|
137
|
+
}
|
|
138
|
+
const projectPath = resolvePluginProjectPath(pluginPath);
|
|
139
|
+
const svnRootDir = projectPath.svnRootDir;
|
|
140
|
+
if (!svnRootDir) {
|
|
141
|
+
throw new ReleaseError("Switching tags requires a local SVN working copy. Clone the plugin with `pressship get` first.", 409);
|
|
142
|
+
}
|
|
143
|
+
await ensureSvnAvailableForRelease();
|
|
144
|
+
const project = await discoverPluginProject(projectPath.rootDir);
|
|
145
|
+
const slug = project.slug;
|
|
146
|
+
const refUrl = tagName === "trunk"
|
|
147
|
+
? `https://plugins.svn.wordpress.org/${slug}/trunk`
|
|
148
|
+
: `https://plugins.svn.wordpress.org/${slug}/tags/${tagName}`;
|
|
149
|
+
// Switching the working copy means changing which URL the *plugin rootDir*
|
|
150
|
+
// (i.e. the working trunk folder discovered by resolvePluginProjectPath)
|
|
151
|
+
// tracks. We never switch the `tags/<name>/` subfolder — that's just the
|
|
152
|
+
// local mirror of an immutable remote tag.
|
|
153
|
+
const workingCopy = projectPath.rootDir;
|
|
154
|
+
if (!pathExists(workingCopy)) {
|
|
155
|
+
throw new ReleaseError(`Working copy ${workingCopy} does not exist on disk.`, 404);
|
|
156
|
+
}
|
|
157
|
+
if (tagName !== "trunk") {
|
|
158
|
+
const localTagDir = path.join(svnRootDir, "tags", tagName);
|
|
159
|
+
if (!pathExists(localTagDir) && !(await remoteTagExists(slug, tagName))) {
|
|
160
|
+
throw new ReleaseError(`Tag ${tagName} does not exist locally or on WordPress.org SVN. Create it first.`, 404);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const status = await readSvnStatus(workingCopy, svnRootDir);
|
|
164
|
+
const shouldRevertBeforeSwitch = options.conflictResolution === "revert" || (!options.conflictResolution && status.trim());
|
|
165
|
+
if (shouldRevertBeforeSwitch) {
|
|
166
|
+
context.status(hasSvnStatusConflicts(status)
|
|
167
|
+
? "Existing SVN conflicts found; reverting the working copy before switching."
|
|
168
|
+
: "Reverting local SVN changes before switching versions.");
|
|
169
|
+
await runSvn(["revert", "--recursive", workingCopy], svnRootDir, { logger: context });
|
|
170
|
+
}
|
|
171
|
+
else if (options.conflictResolution === "override") {
|
|
172
|
+
context.status("Preparing to accept incoming SVN changes for conflicts.");
|
|
173
|
+
await runSvn(["resolve", "--accept", "theirs-conflict", "--depth", "infinity", workingCopy], svnRootDir, {
|
|
174
|
+
allowFailure: true,
|
|
175
|
+
logger: context
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const switchArgs = ["switch", "--ignore-ancestry", "--non-interactive"];
|
|
179
|
+
if (options.conflictResolution === "override") {
|
|
180
|
+
switchArgs.push("--force", "--accept", "theirs-conflict");
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
switchArgs.push("--accept", "theirs-conflict");
|
|
184
|
+
}
|
|
185
|
+
switchArgs.push(refUrl, workingCopy);
|
|
186
|
+
context.status(`Running svn switch ${refUrl} (working copy: ${workingCopy})`);
|
|
187
|
+
let output = "";
|
|
188
|
+
try {
|
|
189
|
+
output = await runSvn(switchArgs, svnRootDir, { logger: context });
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (!options.conflictResolution && isSvnConflictError(error)) {
|
|
193
|
+
context.status("SVN reported a conflict; reverting the working copy and retrying the switch.");
|
|
194
|
+
await runSvn(["revert", "--recursive", workingCopy], svnRootDir, { logger: context });
|
|
195
|
+
try {
|
|
196
|
+
output = await runSvn(switchArgs, svnRootDir, { logger: context });
|
|
197
|
+
}
|
|
198
|
+
catch (retryError) {
|
|
199
|
+
if (isSvnConflictError(retryError)) {
|
|
200
|
+
throw createSwitchConflictError(tagName, workingCopy, retryError instanceof Error ? retryError.message : String(retryError));
|
|
201
|
+
}
|
|
202
|
+
throw retryError;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!options.conflictResolution && isSvnConflictOutput(output)) {
|
|
210
|
+
context.status("SVN reported a conflict; reverting the working copy and retrying the switch.");
|
|
211
|
+
await runSvn(["revert", "--recursive", workingCopy], svnRootDir, { logger: context });
|
|
212
|
+
const retryOutput = await runSvn(switchArgs, svnRootDir, { logger: context });
|
|
213
|
+
if (isSvnConflictOutput(retryOutput)) {
|
|
214
|
+
throw createSwitchConflictError(tagName, workingCopy, retryOutput);
|
|
215
|
+
}
|
|
216
|
+
output = retryOutput;
|
|
217
|
+
}
|
|
218
|
+
context.log(`Working copy now tracks ${tagName === "trunk" ? "trunk" : `tags/${tagName}`}.`);
|
|
219
|
+
return { ref: tagName, workingCopy };
|
|
220
|
+
}
|
|
221
|
+
export class ReleaseError extends Error {
|
|
222
|
+
status;
|
|
223
|
+
code;
|
|
224
|
+
constructor(message, status = 500, code = "release_error") {
|
|
225
|
+
super(message);
|
|
226
|
+
this.status = status;
|
|
227
|
+
this.code = code;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export class ReleaseSwitchConflictError extends ReleaseError {
|
|
231
|
+
ref;
|
|
232
|
+
workingCopy;
|
|
233
|
+
output;
|
|
234
|
+
constructor(ref, workingCopy, output) {
|
|
235
|
+
super(`SVN reported conflicts while switching to ${ref === "trunk" ? "trunk" : `tags/${ref}`}. Choose how Pressship should resolve them.`, 409, "svn_switch_conflict");
|
|
236
|
+
this.ref = ref;
|
|
237
|
+
this.workingCopy = workingCopy;
|
|
238
|
+
this.output = output;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async function requireLocalSvnRoot(pluginPath) {
|
|
242
|
+
const projectPath = resolvePluginProjectPath(pluginPath);
|
|
243
|
+
const svnRootDir = projectPath.svnRootDir;
|
|
244
|
+
if (!svnRootDir || !pathExists(svnRootDir)) {
|
|
245
|
+
throw new ReleaseError("This action requires a local WordPress.org SVN working copy. Clone the plugin with `pressship get` first.", 409);
|
|
246
|
+
}
|
|
247
|
+
return svnRootDir;
|
|
248
|
+
}
|
|
249
|
+
async function ensureTrunkExists(svnRootDir) {
|
|
250
|
+
if (!pathExists(path.join(svnRootDir, "trunk"))) {
|
|
251
|
+
throw new ReleaseError("Could not find the trunk directory inside the SVN working copy. Run `pressship get <slug>` to refresh it.", 409);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
async function ensureSvnAvailableForRelease() {
|
|
255
|
+
if (!(await isSvnAvailable())) {
|
|
256
|
+
throw new ReleaseError("Subversion (`svn`) is required for tag management. Install it and try again.", 503);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async function readLocalTagFolders(svnRootDir) {
|
|
260
|
+
if (!svnRootDir) {
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
263
|
+
const tagsDir = path.join(svnRootDir, "tags");
|
|
264
|
+
if (!pathExists(tagsDir)) {
|
|
265
|
+
return [];
|
|
266
|
+
}
|
|
267
|
+
const entries = await readdir(tagsDir, { withFileTypes: true });
|
|
268
|
+
return entries
|
|
269
|
+
.filter((entry) => entry.isDirectory() && entry.name !== ".svn")
|
|
270
|
+
.map((entry) => ({ name: entry.name, path: path.join(tagsDir, entry.name) }));
|
|
271
|
+
}
|
|
272
|
+
async function readRemoteTagList(slug) {
|
|
273
|
+
if (!(await isSvnAvailable())) {
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
const result = await execa("svn", ["list", `https://plugins.svn.wordpress.org/${slug}/tags`], {
|
|
277
|
+
reject: false,
|
|
278
|
+
stdout: "pipe",
|
|
279
|
+
stderr: "pipe"
|
|
280
|
+
});
|
|
281
|
+
if (result.exitCode !== 0) {
|
|
282
|
+
return [];
|
|
283
|
+
}
|
|
284
|
+
return result.stdout
|
|
285
|
+
.split(/\r?\n/)
|
|
286
|
+
.map((line) => line.replace(/\/$/, "").trim())
|
|
287
|
+
.filter(Boolean);
|
|
288
|
+
}
|
|
289
|
+
async function readCurrentSvnRef(rootDir, svnRootDir) {
|
|
290
|
+
if (!svnRootDir) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
if (!(await isSvnAvailable())) {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
const result = await execa("svn", ["info", rootDir], {
|
|
297
|
+
reject: false,
|
|
298
|
+
stdout: "pipe",
|
|
299
|
+
stderr: "pipe"
|
|
300
|
+
});
|
|
301
|
+
if (result.exitCode !== 0) {
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
const match = result.stdout.match(/^URL:\s*(.+)$/im);
|
|
305
|
+
const url = match?.[1]?.trim();
|
|
306
|
+
if (!url) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
const tagMatch = url.match(/\/tags\/([^/]+)\/?$/);
|
|
310
|
+
if (tagMatch) {
|
|
311
|
+
return tagMatch[1];
|
|
312
|
+
}
|
|
313
|
+
if (/\/trunk\/?$/.test(url)) {
|
|
314
|
+
return "trunk";
|
|
315
|
+
}
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
async function readSlugFromWorkingCopy(svnRootDir, pluginPath) {
|
|
319
|
+
const projectPath = resolvePluginProjectPath(pluginPath);
|
|
320
|
+
const project = await discoverPluginProject(projectPath.rootDir);
|
|
321
|
+
return project.slug || path.basename(svnRootDir);
|
|
322
|
+
}
|
|
323
|
+
async function remoteTagExists(slug, tagName) {
|
|
324
|
+
if (!(await isSvnAvailable())) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
const result = await execa("svn", ["info", `https://plugins.svn.wordpress.org/${slug}/tags/${tagName}`], {
|
|
328
|
+
reject: false,
|
|
329
|
+
stdout: "pipe",
|
|
330
|
+
stderr: "pipe"
|
|
331
|
+
});
|
|
332
|
+
return result.exitCode === 0;
|
|
333
|
+
}
|
|
334
|
+
async function readSvnStatus(workingCopy, svnRootDir) {
|
|
335
|
+
return runSvn(["status", workingCopy], svnRootDir, { capture: true });
|
|
336
|
+
}
|
|
337
|
+
function hasSvnStatusConflicts(status) {
|
|
338
|
+
return status
|
|
339
|
+
.split(/\r?\n/)
|
|
340
|
+
.some((line) => line.length > 0 && line.slice(0, 7).includes("C"));
|
|
341
|
+
}
|
|
342
|
+
async function runSvn(args, cwd, options = {}) {
|
|
343
|
+
const result = await execa("svn", args, {
|
|
344
|
+
cwd,
|
|
345
|
+
reject: false,
|
|
346
|
+
stdout: "pipe",
|
|
347
|
+
stderr: "pipe"
|
|
348
|
+
}).catch((error) => {
|
|
349
|
+
if (isMissingSvnError(error)) {
|
|
350
|
+
throw new ReleaseError("`svn` is required for tag management. Install Subversion and try again.", 503);
|
|
351
|
+
}
|
|
352
|
+
throw error;
|
|
353
|
+
});
|
|
354
|
+
if (result.exitCode !== 0) {
|
|
355
|
+
const message = (result.stderr || result.stdout || `svn ${args.join(" ")} failed.`).trim();
|
|
356
|
+
options.logger?.log(message);
|
|
357
|
+
if (options.allowFailure) {
|
|
358
|
+
return message;
|
|
359
|
+
}
|
|
360
|
+
throw new ReleaseError(message, 500);
|
|
361
|
+
}
|
|
362
|
+
const output = `${result.stdout ?? ""}\n${result.stderr ?? ""}`.trim();
|
|
363
|
+
if (output && options.logger) {
|
|
364
|
+
options.logger.log(output);
|
|
365
|
+
}
|
|
366
|
+
return output;
|
|
367
|
+
}
|
|
368
|
+
function createSwitchConflictError(ref, workingCopy, output) {
|
|
369
|
+
return new ReleaseSwitchConflictError(ref, workingCopy, output);
|
|
370
|
+
}
|
|
371
|
+
function isSvnConflictError(error) {
|
|
372
|
+
return error instanceof ReleaseError && isSvnConflictOutput(error.message);
|
|
373
|
+
}
|
|
374
|
+
function isSvnConflictOutput(output) {
|
|
375
|
+
return /summary of conflicts|tree conflicts?|text conflicts?|svn:\s*E155015|conflict/i.test(output);
|
|
376
|
+
}
|
|
377
|
+
function isMissingSvnError(error) {
|
|
378
|
+
return (error instanceof Error &&
|
|
379
|
+
("code" in error
|
|
380
|
+
? error.code === "ENOENT"
|
|
381
|
+
: /ENOENT|not found/i.test(error.message)));
|
|
382
|
+
}
|
|
383
|
+
function compareTagNames(left, right) {
|
|
384
|
+
const leftParts = normalizeVersionParts(left);
|
|
385
|
+
const rightParts = normalizeVersionParts(right);
|
|
386
|
+
for (let index = 0; index < Math.max(leftParts.length, rightParts.length); index += 1) {
|
|
387
|
+
const diff = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
|
|
388
|
+
if (diff !== 0) {
|
|
389
|
+
return diff > 0 ? -1 : 1;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return left.localeCompare(right);
|
|
393
|
+
}
|
|
394
|
+
function normalizeVersionParts(value) {
|
|
395
|
+
return value
|
|
396
|
+
.trim()
|
|
397
|
+
.split(/[.-]/)
|
|
398
|
+
.map((part) => {
|
|
399
|
+
const parsed = Number.parseInt(part, 10);
|
|
400
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Sets an explicit plugin version both in the main file header and (when the
|
|
405
|
+
* plugin has one) the readme stable tag. Mirrors what `bumpLocalPluginVersion`
|
|
406
|
+
* in server.ts does, but accepts an arbitrary string instead of patch/minor/
|
|
407
|
+
* major. Validates the version shape so we don't write something readme will
|
|
408
|
+
* reject.
|
|
409
|
+
*/
|
|
410
|
+
export function isValidExplicitVersion(value) {
|
|
411
|
+
return /^\d+(\.\d+){0,3}(?:[-+][A-Za-z0-9.+\-]+)?$/.test(value.trim());
|
|
412
|
+
}
|
|
413
|
+
//# sourceMappingURL=release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/web/release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA0B/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,WAAW,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAE5E,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,UAAU,CAAC,C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,CAAC;AACnC,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC1C,OAAO,KAAK;SACT,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,CAAC;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,OAAO,4CAA4C,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Server } from "node:http";
|
|
2
|
+
import { WebJobManager } from "./jobs.js";
|
|
3
|
+
export type WebServerOptions = {
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: string | number;
|
|
6
|
+
noOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type PlaygroundInstance = {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
source: "local" | "wordpress.org";
|
|
13
|
+
url: string;
|
|
14
|
+
startedAt: string;
|
|
15
|
+
pid?: number;
|
|
16
|
+
};
|
|
17
|
+
export type StartedWebServer = {
|
|
18
|
+
server: Server;
|
|
19
|
+
url: string;
|
|
20
|
+
token: string;
|
|
21
|
+
jobs: WebJobManager;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
export declare function startWebServer(options?: WebServerOptions): Promise<StartedWebServer>;
|