@whoz-oss/coday-server 0.0.0-workstream-forge.142 → 0.0.0-workstream-setup.10

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.
Files changed (3) hide show
  1. package/bin.js +13 -3
  2. package/package.json +1 -1
  3. package/server.js +63 -56
package/bin.js CHANGED
@@ -6,15 +6,25 @@ import { fileURLToPath } from 'url';
6
6
  const __filename = fileURLToPath(import.meta.url);
7
7
  const __dirname = dirname(__filename);
8
8
 
9
+ /**
10
+ * `coday-server [provision|agentos|factory|server] [--configDir <dir>] ...`
11
+ *
12
+ * Runs the compiled server bundle with the given arguments. Without a command it runs everything in
13
+ * one process (Express + AgentOS + Factory). The Nx tasks of the generated runtime workspace call
14
+ * the commands (see apps/web).
15
+ */
9
16
  const serverPath = resolve(__dirname, 'server.js');
10
17
  const args = process.argv.slice(2);
11
18
 
12
- // Run the compiled JavaScript server
13
- const child = spawn('node', [serverPath, ...args], {
19
+ // No shell: the arguments (paths with spaces) must reach the server untouched.
20
+ const child = spawn(process.execPath, [serverPath, ...args], {
14
21
  stdio: 'inherit',
15
- shell: true
16
22
  });
17
23
 
24
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
25
+ process.on(signal, () => child.kill(signal));
26
+ }
27
+
18
28
  child.on('exit', (code) => {
19
29
  process.exit(code || 0);
20
30
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-server",
3
- "version": "0.0.0-workstream-forge.142",
3
+ "version": "0.0.0-workstream-setup.10",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "main": "server/server.js",