eddev 2.0.0-beta.20 → 2.0.0-beta.22
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/dist/node/cli/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ import { bootCLIUI } from "./display/boot-cli-app.js";
|
|
|
17
17
|
import { VERSION } from "./version.js";
|
|
18
18
|
import { buildVinxi } from "../compiler/build-vinxi.js";
|
|
19
19
|
import { createConsole } from "../utils/stateful-log.js";
|
|
20
|
+
import { join } from "path";
|
|
20
21
|
importDotEnv();
|
|
21
22
|
const program = new Command()
|
|
22
23
|
.version(VERSION)
|
|
@@ -29,12 +30,16 @@ program
|
|
|
29
30
|
.command("dev")
|
|
30
31
|
.description("Run in dev mode")
|
|
31
32
|
.option("-m, --mode <mode>", "Comma separated list of modes, or a single mode.", "frontend,admin,graphql,serverless")
|
|
33
|
+
.option("--fast", "Shorthand for --mode graphql,serverless", false)
|
|
32
34
|
.option("--verbose", "Show extra debugging info", false)
|
|
33
35
|
.action(async (options) => {
|
|
34
36
|
process.env["NODE_ENV"] = "development";
|
|
35
37
|
/** Ignore self-signed certificate errors in dev mode */
|
|
36
38
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
37
39
|
serverlessLog.info(chalk.yellowBright(`⚡️ ED. Stack v${VERSION}`));
|
|
40
|
+
if (options.fast) {
|
|
41
|
+
options.mode = "graphql,serverless";
|
|
42
|
+
}
|
|
38
43
|
const tasks = {
|
|
39
44
|
admin: !options.mode || options.mode.includes("admin"),
|
|
40
45
|
frontend: !options.mode || options.mode.includes("frontend"),
|
|
@@ -179,6 +184,30 @@ program
|
|
|
179
184
|
console.log("Done building SPA WordPress");
|
|
180
185
|
}
|
|
181
186
|
});
|
|
187
|
+
program
|
|
188
|
+
.command("preview")
|
|
189
|
+
.description("Run a local production build, which was previously built with `eddev build --serverless`")
|
|
190
|
+
.option("--host", "Hostname to serve the application", "127.0.0.1")
|
|
191
|
+
.option("--port", "Port to serve the application", "3000")
|
|
192
|
+
.action(async (options) => {
|
|
193
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
194
|
+
process.env["NODE_ENV"] = "production";
|
|
195
|
+
process.env["HOST"] = options.host;
|
|
196
|
+
process.env["PORT"] = options.port;
|
|
197
|
+
init(options.verbose);
|
|
198
|
+
configureCliMode({
|
|
199
|
+
interactive: true,
|
|
200
|
+
readonly: false,
|
|
201
|
+
exitOnValidationError: true,
|
|
202
|
+
detailed: true,
|
|
203
|
+
verbose: options.verbose,
|
|
204
|
+
watch: false,
|
|
205
|
+
rootDir: process.cwd(),
|
|
206
|
+
});
|
|
207
|
+
const entry = ".output/server/index.mjs";
|
|
208
|
+
console.info("Looking for production serverless build in: " + entry + "...");
|
|
209
|
+
await import(join(process.cwd(), ".output/server/index.mjs"));
|
|
210
|
+
});
|
|
182
211
|
program
|
|
183
212
|
.command("info")
|
|
184
213
|
.description("Return info about this project")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.22";
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.22";
|
|
@@ -33,13 +33,13 @@ export class Project {
|
|
|
33
33
|
reportPluginCompatibility = false;
|
|
34
34
|
constructor(opts) {
|
|
35
35
|
this.rootDir = opts.rootDir;
|
|
36
|
-
this.origin = ProjectEnvUtils.
|
|
36
|
+
this.origin = ProjectEnvUtils.getSafe("SITE_URL") ?? "";
|
|
37
37
|
this.reportPluginCompatibility = opts.reportPluginCompatibility || false;
|
|
38
38
|
this.blocks = loadBlockManifest(this);
|
|
39
39
|
this.views = loadViewManifest(this);
|
|
40
40
|
this.fields = loadFieldManifest(this);
|
|
41
41
|
this.widgets = loadWidgetManifest(this);
|
|
42
|
-
this.wp = new WPInfo(
|
|
42
|
+
this.wp = new WPInfo(this.origin);
|
|
43
43
|
}
|
|
44
44
|
async load() {
|
|
45
45
|
console.setWorking(true);
|
|
@@ -6,6 +6,9 @@ export class WPInfo {
|
|
|
6
6
|
this.siteUrl = siteUrl;
|
|
7
7
|
}
|
|
8
8
|
async getInfo(force = false) {
|
|
9
|
+
if (!this.siteUrl) {
|
|
10
|
+
throw new Error("Attempted to get site info from WordPress, but SITE_URL was not present in the environment.");
|
|
11
|
+
}
|
|
9
12
|
if (this.cached && !force)
|
|
10
13
|
return this.cached;
|
|
11
14
|
const url = resolveURL(this.siteUrl, "/wp-json/ed/v1/dev/site-info");
|