daemonize-process 4.1.3 → 4.1.4

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 CHANGED
@@ -10,14 +10,12 @@ Differences to the `daemon` module include:
10
10
  - Exposes all options of `child_process.spawn`.
11
11
  - Cleans up `process.env` after itself.
12
12
 
13
- ## Install
13
+ ## Usage
14
14
 
15
- ```console
16
- $ npm i daemonize-process
15
+ ```sh
16
+ pnpm add daemonize-process
17
17
  ```
18
18
 
19
- ## Examples
20
-
21
19
  ```js
22
20
  import {daemonizeProcess} from "daemonize-process";
23
21
 
@@ -39,6 +37,4 @@ The `options` object can contain any valid [`child_process.spawn` option](https:
39
37
 
40
38
  By default the standard streams of the child are ignored (e.g. attached to `/dev/null` or equivalent). If you need these streams, adjust the `stdio` option.
41
39
 
42
- ## License
43
-
44
40
  © [silverwind](https://github.com/silverwind), distributed under BSD licence
package/dist/index.js CHANGED
@@ -6,20 +6,16 @@ const id = "_DAEMONIZE_PROCESS";
6
6
  function daemonizeProcess(opts = {}) {
7
7
  if (id in env) delete env[id];
8
8
  else {
9
- const o = {
10
- env: Object.assign(env, opts.env, { [id]: "1" }),
9
+ const options = {
11
10
  cwd: cwd(),
12
11
  stdio: "ignore",
13
12
  detached: true,
14
- node: execPath,
15
- script: argv[1],
16
- arguments: argv.slice(2),
17
13
  exitCode: 0,
18
- ...opts
14
+ ...opts,
15
+ env: opts.env ? Object.assign(Object.create(opts.env), { [id]: "1" }) : Object.assign(env, { [id]: "1" })
19
16
  };
20
- const args = [o.script, ...o.arguments];
21
- spawn(o.node, args, o)?.unref?.();
22
- exit(o.exitCode);
17
+ spawn(opts.node ?? execPath, [opts.script ?? argv[1], ...opts.arguments ?? argv.slice(2)], options).unref();
18
+ exit(options.exitCode);
23
19
  }
24
20
  }
25
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daemonize-process",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "Daemonize the current Node.js process",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": {
@@ -21,18 +21,17 @@
21
21
  "bun": "*"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/node": "26.6.2",
24
+ "@types/node": "26.6.3",
25
25
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
26
- "eslint": "9.39.2",
27
- "eslint-config-silverwind": "151.0.0",
28
- "jest-extended": "7.0.0",
26
+ "eslint": "10.11.0",
27
+ "eslint-config-silverwind": "151.0.1",
29
28
  "tsdown": "0.23.0",
30
- "tsdown-config-silverwind": "4.1.1",
29
+ "tsdown-config-silverwind": "4.1.2",
31
30
  "typescript": "6.0.3",
32
- "typescript-config-silverwind": "21.0.0",
33
- "updates": "19.0.0",
34
- "updates-config-silverwind": "4.0.6",
35
- "versions": "15.5.0",
31
+ "typescript-config-silverwind": "21.0.1",
32
+ "updates": "19.0.2",
33
+ "updates-config-silverwind": "4.0.7",
34
+ "versions": "15.5.1",
36
35
  "vitest": "5.0.2"
37
36
  }
38
37
  }