2 Commits

Author SHA1 Message Date
b8973559ca chore(release): v0.0.7 2026-05-29 08:55:02 -04:00
f6485830b8 fix: local site url from env + cwd 2026-05-29 08:54:30 -04:00
3 changed files with 24 additions and 3 deletions

View File

@@ -1,5 +1,13 @@
# Changelog # Changelog
## v0.0.7
[compare changes](https://gitea.websimple.com/pascalmartineau/wpop/compare/v0.0.6...v0.0.7)
### 🩹 Fixes
- Local site url from env + cwd (f648583)
## v0.0.6 ## v0.0.6
[compare changes](https://gitea.websimple.com/pascalmartineau/wpop/compare/v0.0.5...v0.0.6) [compare changes](https://gitea.websimple.com/pascalmartineau/wpop/compare/v0.0.5...v0.0.6)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@lewebsimple/wpop", "name": "@lewebsimple/wpop",
"version": "0.0.6", "version": "0.0.7",
"description": "WordPress operations CLI for Websimple projects.", "description": "WordPress operations CLI for Websimple projects.",
"license": "MIT", "license": "MIT",
"author": "Pascal Martineau <pascal@lewebsimple.ca>", "author": "Pascal Martineau <pascal@lewebsimple.ca>",

View File

@@ -1,5 +1,5 @@
import { existsSync, mkdirSync, readdirSync } from "node:fs"; import { existsSync, mkdirSync, readdirSync } from "node:fs";
import { join } from "node:path"; import { basename, join } from "node:path";
import { consola } from "consola"; import { consola } from "consola";
import prompts from "prompts"; import prompts from "prompts";
import type { WPopContext } from "../lib/context"; import type { WPopContext } from "../lib/context";
@@ -74,7 +74,7 @@ export async function sync(context: WPopContext, options: SyncOptions): Promise<
let localSiteurl: string | undefined; let localSiteurl: string | undefined;
if (components.has("database") && !options.skipSearchReplace) { if (components.has("database") && !options.skipSearchReplace) {
localSiteurl = await readLocalOption(context, "siteurl"); localSiteurl = resolveLocalSiteurl(context) ?? (await readLocalOption(context, "siteurl"));
} }
for (const component of CONTENT_SYNC_COMPONENTS) { for (const component of CONTENT_SYNC_COMPONENTS) {
@@ -382,6 +382,19 @@ async function runSearchReplace(
await run(context, "wp", ["cache", "flush"], { cwd: context.cwd }); await run(context, "wp", ["cache", "flush"], { cwd: context.cwd });
} }
function resolveLocalSiteurl(context: WPopContext): string | undefined {
const protocol = process.env.WEBSIMPLE_STACK_PROTOCOL?.trim();
const domain = process.env.WEBSIMPLE_STACK_DOMAIN?.trim();
if (!protocol || !domain) {
return undefined;
}
const subdomain = basename(context.cwd);
if (!subdomain) {
return undefined;
}
return `${protocol}://${subdomain}.${domain}`;
}
async function readLocalOption(context: WPopContext, option: string): Promise<string | undefined> { async function readLocalOption(context: WPopContext, option: string): Promise<string | undefined> {
const result = await run(context, "wp", ["option", "get", option], { const result = await run(context, "wp", ["option", "get", option], {
capture: true, capture: true,