@joystick.js/cli-canary 0.0.0-canary.172 → 0.0.0-canary.174
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/lib/dev/index.js +1 -0
- package/dist/lib/dev/startApp.js +72 -0
- package/package.json +1 -1
- package/src/lib/dev/index.js +2 -0
- package/src/lib/dev/startApp.js +1 -1
package/dist/lib/dev/index.js
CHANGED
|
@@ -534,6 +534,7 @@ const dev = async (options, { resolve, reject }) => {
|
|
|
534
534
|
if (options?.environment === "test") {
|
|
535
535
|
process.loader.stop();
|
|
536
536
|
const databaseProcessIds = getDatabaseProcessIds();
|
|
537
|
+
console.log(process.serverProcess);
|
|
537
538
|
await runTests({
|
|
538
539
|
watch: options?.watch,
|
|
539
540
|
__dirname,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import child_process from "child_process";
|
|
2
|
+
import path from "path";
|
|
3
|
+
const handleStartServerProcess = (execArgv = {}, options = {}) => {
|
|
4
|
+
try {
|
|
5
|
+
if (!options?.watch) {
|
|
6
|
+
process.loader.text("Starting app...");
|
|
7
|
+
}
|
|
8
|
+
return child_process.fork(
|
|
9
|
+
path.resolve(".joystick/build/index.server.js"),
|
|
10
|
+
[],
|
|
11
|
+
{
|
|
12
|
+
execArgv,
|
|
13
|
+
// NOTE: Pipe stdin, stdout, and stderr. IPC establishes a message channel so we
|
|
14
|
+
// communicate with the child_process.
|
|
15
|
+
silent: true,
|
|
16
|
+
env: {
|
|
17
|
+
FORCE_COLOR: "1",
|
|
18
|
+
LOGS_PATH: process.env.LOGS_PATH,
|
|
19
|
+
NODE_ENV: process.env.NODE_ENV,
|
|
20
|
+
ROOT_URL: process.env.ROOT_URL,
|
|
21
|
+
PORT: process.env.PORT,
|
|
22
|
+
JOYSTICK_SETTINGS: process.env.JOYSTICK_SETTINGS,
|
|
23
|
+
HMR_SESSIONS: options?.sessionsBeforeHMRUpdate || "{}"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
} catch (exception) {
|
|
28
|
+
throw new Error(`[startApp.handleStartServerProcess] ${exception.message}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const getExecArgs = (nodeMajorVersion = 0) => {
|
|
32
|
+
try {
|
|
33
|
+
const execArgv = ["--no-warnings"];
|
|
34
|
+
if (nodeMajorVersion < 19) {
|
|
35
|
+
execArgv.push("--experimental-specifier-resolution=node");
|
|
36
|
+
}
|
|
37
|
+
if (process.env.NODE_ENV === "development" && process.env.IS_DEBUG_MODE === "true") {
|
|
38
|
+
execArgv.push("--inspect");
|
|
39
|
+
}
|
|
40
|
+
return execArgv;
|
|
41
|
+
} catch (exception) {
|
|
42
|
+
throw new Error(`[startApp.getExecArgs] ${exception.message}`);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const validateOptions = (options) => {
|
|
46
|
+
try {
|
|
47
|
+
if (!options)
|
|
48
|
+
throw new Error("options object is required.");
|
|
49
|
+
if (!options.nodeMajorVersion)
|
|
50
|
+
throw new Error("options.nodeMajorVersion is required.");
|
|
51
|
+
if (!options.port)
|
|
52
|
+
throw new Error("options.port is required.");
|
|
53
|
+
} catch (exception) {
|
|
54
|
+
throw new Error(`[startApp.validateOptions] ${exception.message}`);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const startApp = (options, { resolve, reject }) => {
|
|
58
|
+
try {
|
|
59
|
+
validateOptions(options);
|
|
60
|
+
const execArgv = getExecArgs(options?.nodeMajorVersion);
|
|
61
|
+
const serverProcess = handleStartServerProcess(execArgv, options);
|
|
62
|
+
return resolve(serverProcess);
|
|
63
|
+
} catch (exception) {
|
|
64
|
+
reject(`[startApp] ${exception.message}`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var startApp_default = (options) => new Promise((resolve, reject) => {
|
|
68
|
+
startApp(options, { resolve, reject });
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
startApp_default as default
|
|
72
|
+
};
|
package/package.json
CHANGED
package/src/lib/dev/index.js
CHANGED
package/src/lib/dev/startApp.js
CHANGED
|
@@ -22,7 +22,7 @@ const handleStartServerProcess = (execArgv = {}, options = {}) => {
|
|
|
22
22
|
ROOT_URL: process.env.ROOT_URL,
|
|
23
23
|
PORT: process.env.PORT,
|
|
24
24
|
JOYSTICK_SETTINGS: process.env.JOYSTICK_SETTINGS,
|
|
25
|
-
HMR_SESSIONS: options
|
|
25
|
+
HMR_SESSIONS: options?.sessionsBeforeHMRUpdate || '{}',
|
|
26
26
|
},
|
|
27
27
|
}
|
|
28
28
|
);
|