@evjs/cli 0.0.13 → 0.0.15
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 +1 -1
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Uses webpack Node API directly (no temp config files):
|
|
|
37
37
|
|
|
38
38
|
Runs webpack via Node API with `NODE_ENV=production`:
|
|
39
39
|
- `dist/client/` — optimized client assets with content hashes.
|
|
40
|
-
- `dist/server/main.[hash].js` — server bundle (entry discovered via `dist/manifest.json`).
|
|
40
|
+
- `dist/server/main.[hash].js` — server bundle (entry discovered via `dist/server/manifest.json`).
|
|
41
41
|
|
|
42
42
|
## Configuration
|
|
43
43
|
|
package/dist/index.js
CHANGED
|
@@ -32,20 +32,20 @@ export async function dev(userConfig, options) {
|
|
|
32
32
|
const handleServerBundleReady = () => {
|
|
33
33
|
if (apiStarted)
|
|
34
34
|
return;
|
|
35
|
-
const manifestPath = path.resolve(cwd, "dist/manifest.json");
|
|
35
|
+
const manifestPath = path.resolve(cwd, "dist/server/manifest.json");
|
|
36
36
|
if (!fs.existsSync(manifestPath))
|
|
37
37
|
return;
|
|
38
38
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
39
|
-
if (!manifest.
|
|
39
|
+
if (!manifest.entry)
|
|
40
40
|
return;
|
|
41
41
|
apiStarted = true;
|
|
42
42
|
const serverPort = config?.server?.dev?.port ?? CONFIG_DEFAULTS.serverPort;
|
|
43
|
-
const
|
|
44
|
-
const [
|
|
45
|
-
logger.info `Server bundle detected, starting ${
|
|
43
|
+
const runtimeConfig = config?.server?.runtime ?? "node";
|
|
44
|
+
const [runtime, ...runtimeExtraArgs] = runtimeConfig.split(/\s+/);
|
|
45
|
+
logger.info `Server bundle detected, starting ${runtime} API...`;
|
|
46
46
|
const bootstrapPath = path.resolve(cwd, "dist/server/_dev_start.cjs");
|
|
47
47
|
try {
|
|
48
|
-
const serverBundlePath = path.resolve(cwd, "dist/server", manifest.
|
|
48
|
+
const serverBundlePath = path.resolve(cwd, "dist/server", manifest.entry);
|
|
49
49
|
if (!fs.existsSync(path.dirname(bootstrapPath))) {
|
|
50
50
|
fs.mkdirSync(path.dirname(bootstrapPath), { recursive: true });
|
|
51
51
|
}
|
|
@@ -56,16 +56,16 @@ export async function dev(userConfig, options) {
|
|
|
56
56
|
`serve(app, { port: ${serverPort}, https: ${JSON.stringify(config.server.dev.https)} });`,
|
|
57
57
|
].join("\n"));
|
|
58
58
|
// node gets --watch flags; other runtimes use their own args as-is
|
|
59
|
-
const
|
|
59
|
+
const runtimeArgs = runtime === "node"
|
|
60
60
|
? [
|
|
61
61
|
"--watch",
|
|
62
62
|
"--watch-preserve-output",
|
|
63
|
-
...
|
|
63
|
+
...runtimeExtraArgs,
|
|
64
64
|
bootstrapPath,
|
|
65
65
|
]
|
|
66
|
-
: [...
|
|
66
|
+
: [...runtimeExtraArgs, bootstrapPath];
|
|
67
67
|
// Don't await execa here since it's a long-running watch process
|
|
68
|
-
execa(
|
|
68
|
+
execa(runtime, runtimeArgs, {
|
|
69
69
|
stdio: "inherit",
|
|
70
70
|
env: { ...process.env, NODE_ENV: "development" },
|
|
71
71
|
}).catch(() => {
|
|
@@ -73,7 +73,7 @@ export async function dev(userConfig, options) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
|
-
logger.error `Server
|
|
76
|
+
logger.error `Server runtime failed: ${err}`;
|
|
77
77
|
apiStarted = false;
|
|
78
78
|
}
|
|
79
79
|
};
|