@joystick.js/cli-canary 0.0.0-canary.171 → 0.0.0-canary.173

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.
@@ -145,7 +145,7 @@ const handleServerProcessMessages = () => {
145
145
  throw new Error(`[dev.handleServerProcessMessages] ${exception.message}`);
146
146
  }
147
147
  };
148
- const handleServerProcessSTDIO = () => {
148
+ const handleServerProcessSTDIO = (options = {}) => {
149
149
  try {
150
150
  if (process.serverProcess) {
151
151
  process.serverProcess.on("error", (error) => {
@@ -153,7 +153,7 @@ const handleServerProcessSTDIO = () => {
153
153
  });
154
154
  process.serverProcess.stdout.on("data", (data) => {
155
155
  const message = data.toString();
156
- if (message && message.includes("App running at:")) {
156
+ if (message && message.includes("App running at:") && !options?.watch) {
157
157
  process.loader.stable(message);
158
158
  } else {
159
159
  if (message && !message.includes("BUILD_ERROR")) {
@@ -272,6 +272,7 @@ const handleRestartApplicationProcess = async (options = {}) => {
272
272
  const handleStartAppServer = async (options = {}) => {
273
273
  try {
274
274
  const serverProcess = await startApp({
275
+ watch: options?.watch,
275
276
  nodeMajorVersion: options?.nodeMajorVersion,
276
277
  port: options?.port,
277
278
  sessionsBeforeHMRUpdate: options?.sessionsBeforeHMRUpdate
@@ -279,12 +280,12 @@ const handleStartAppServer = async (options = {}) => {
279
280
  if (serverProcess) {
280
281
  processIds.push(serverProcess.pid);
281
282
  process.serverProcess = serverProcess;
282
- handleServerProcessSTDIO();
283
- handleServerProcessMessages();
283
+ handleServerProcessSTDIO(options);
284
+ handleServerProcessMessages(options);
284
285
  }
285
286
  } catch (exception) {
286
287
  console.warn(exception);
287
- throw new Error(`[actionName.handleStartAppServer] ${exception.message}`);
288
+ throw new Error(`[dev.handleStartAppServer] ${exception.message}`);
288
289
  }
289
290
  };
290
291
  const handleNotifyHMRClients = async (indexHTMLChanged = false) => {
@@ -1,8 +1,10 @@
1
1
  import child_process from "child_process";
2
2
  import path from "path";
3
- const handleStartServerProcess = (execArgv = {}, sessionsBeforeHMRUpdate = "{}") => {
3
+ const handleStartServerProcess = (execArgv = {}, options = {}) => {
4
4
  try {
5
- process.loader.text("Starting app...");
5
+ if (!options?.watch) {
6
+ process.loader.text("Starting app...");
7
+ }
6
8
  return child_process.fork(
7
9
  path.resolve(".joystick/build/index.server.js"),
8
10
  [],
@@ -18,7 +20,7 @@ const handleStartServerProcess = (execArgv = {}, sessionsBeforeHMRUpdate = "{}")
18
20
  ROOT_URL: process.env.ROOT_URL,
19
21
  PORT: process.env.PORT,
20
22
  JOYSTICK_SETTINGS: process.env.JOYSTICK_SETTINGS,
21
- HMR_SESSIONS: sessionsBeforeHMRUpdate
23
+ HMR_SESSIONS: options?.sessionsBeforeHMRUpdate || "{}"
22
24
  }
23
25
  }
24
26
  );
@@ -56,7 +58,7 @@ const startApp = (options, { resolve, reject }) => {
56
58
  try {
57
59
  validateOptions(options);
58
60
  const execArgv = getExecArgs(options?.nodeMajorVersion);
59
- const serverProcess = handleStartServerProcess(execArgv, options?.sessionsBeforeHMRUpdate);
61
+ const serverProcess = handleStartServerProcess(execArgv, options);
60
62
  return resolve(serverProcess);
61
63
  } catch (exception) {
62
64
  reject(`[startApp] ${exception.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
- "version": "0.0.0-canary.171",
3
+ "version": "0.0.0-canary.173",
4
4
  "type": "module",
5
5
  "description": "CLI for the Joystick JavaScript framework.",
6
6
  "main": "development.js",
@@ -175,7 +175,7 @@ const handleServerProcessMessages = () => {
175
175
  }
176
176
  };
177
177
 
178
- const handleServerProcessSTDIO = () => {
178
+ const handleServerProcessSTDIO = (options = {}) => {
179
179
  try {
180
180
  if (process.serverProcess) {
181
181
  process.serverProcess.on("error", (error) => {
@@ -185,7 +185,7 @@ const handleServerProcessSTDIO = () => {
185
185
  process.serverProcess.stdout.on("data", (data) => {
186
186
  const message = data.toString();
187
187
 
188
- if (message && message.includes("App running at:")) {
188
+ if (message && message.includes("App running at:") && !options?.watch) {
189
189
  process.loader.stable(message);
190
190
  } else {
191
191
  if (message && !message.includes("BUILD_ERROR")) {
@@ -334,6 +334,7 @@ const handleRestartApplicationProcess = async (options = {}) => {
334
334
  const handleStartAppServer = async (options = {}) => {
335
335
  try {
336
336
  const serverProcess = await startApp({
337
+ watch: options?.watch,
337
338
  nodeMajorVersion: options?.nodeMajorVersion,
338
339
  port: options?.port,
339
340
  sessionsBeforeHMRUpdate: options?.sessionsBeforeHMRUpdate,
@@ -342,12 +343,12 @@ const handleStartAppServer = async (options = {}) => {
342
343
  if (serverProcess) {
343
344
  processIds.push(serverProcess.pid);
344
345
  process.serverProcess = serverProcess;
345
- handleServerProcessSTDIO();
346
- handleServerProcessMessages();
346
+ handleServerProcessSTDIO(options);
347
+ handleServerProcessMessages(options);
347
348
  }
348
349
  } catch (exception) {
349
350
  console.warn(exception);
350
- throw new Error(`[actionName.handleStartAppServer] ${exception.message}`);
351
+ throw new Error(`[dev.handleStartAppServer] ${exception.message}`);
351
352
  }
352
353
  };
353
354
 
@@ -1,9 +1,11 @@
1
1
  import child_process from "child_process";
2
2
  import path from "path";
3
3
 
4
- const handleStartServerProcess = (execArgv = {}, sessionsBeforeHMRUpdate = '{}') => {
4
+ const handleStartServerProcess = (execArgv = {}, options = {}) => {
5
5
  try {
6
- process.loader.text('Starting app...');
6
+ if (!options?.watch) {
7
+ process.loader.text('Starting app...');
8
+ }
7
9
 
8
10
  return child_process.fork(
9
11
  path.resolve(".joystick/build/index.server.js"),
@@ -20,7 +22,7 @@ const handleStartServerProcess = (execArgv = {}, sessionsBeforeHMRUpdate = '{}')
20
22
  ROOT_URL: process.env.ROOT_URL,
21
23
  PORT: process.env.PORT,
22
24
  JOYSTICK_SETTINGS: process.env.JOYSTICK_SETTINGS,
23
- HMR_SESSIONS: sessionsBeforeHMRUpdate,
25
+ HMR_SESSIONS: options?.sessionsBeforeHMRUpdate || '{}',
24
26
  },
25
27
  }
26
28
  );
@@ -65,7 +67,7 @@ const startApp = (options, { resolve, reject }) => {
65
67
  validateOptions(options);
66
68
 
67
69
  const execArgv = getExecArgs(options?.nodeMajorVersion);
68
- const serverProcess = handleStartServerProcess(execArgv, options?.sessionsBeforeHMRUpdate);
70
+ const serverProcess = handleStartServerProcess(execArgv, options);
69
71
 
70
72
  return resolve(serverProcess);
71
73
  } catch (exception) {