Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8973559ca | |||
| f6485830b8 | |||
| b9a06880b4 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,17 @@
|
||||
# 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
|
||||
|
||||
[compare changes](https://gitea.websimple.com/pascalmartineau/wpop/compare/v0.0.5...v0.0.6)
|
||||
|
||||
## v0.0.5
|
||||
|
||||
[compare changes](https://gitea.websimple.com/pascalmartineau/wpop/compare/v0.0.4...v0.0.5)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@lewebsimple/wpop",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.7",
|
||||
"description": "WordPress operations CLI for Websimple projects.",
|
||||
"license": "MIT",
|
||||
"author": "Pascal Martineau <pascal@lewebsimple.ca>",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { existsSync, mkdirSync, readdirSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { basename, join } from "node:path";
|
||||
import { consola } from "consola";
|
||||
import prompts from "prompts";
|
||||
import type { WPopContext } from "../lib/context";
|
||||
@@ -74,7 +74,7 @@ export async function sync(context: WPopContext, options: SyncOptions): Promise<
|
||||
|
||||
let localSiteurl: string | undefined;
|
||||
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) {
|
||||
@@ -382,6 +382,19 @@ async function runSearchReplace(
|
||||
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> {
|
||||
const result = await run(context, "wp", ["option", "get", option], {
|
||||
capture: true,
|
||||
|
||||
Reference in New Issue
Block a user