@dxos/phoenix 0.8.4-main.67995b8 → 0.8.4-main.69d29f4

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/package.json CHANGED
@@ -1,18 +1,22 @@
1
1
  {
2
2
  "name": "@dxos/phoenix",
3
- "version": "0.8.4-main.67995b8",
3
+ "version": "0.8.4-main.69d29f4",
4
4
  "description": "Basic node daemon.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "sideEffects": true,
10
14
  "type": "module",
11
15
  "exports": {
12
16
  ".": {
17
+ "source": "./src/index.ts",
13
18
  "types": "./dist/types/src/index.d.ts",
14
- "node": "./dist/lib/node-esm/index.mjs",
15
- "source": "./src/index.ts"
19
+ "node": "./dist/lib/node-esm/index.mjs"
16
20
  }
17
21
  },
18
22
  "types": "dist/types/src/index.d.ts",
@@ -26,10 +30,10 @@
26
30
  ],
27
31
  "dependencies": {
28
32
  "pkg-up": "^3.1.0",
29
- "@dxos/async": "0.8.4-main.67995b8",
30
- "@dxos/invariant": "0.8.4-main.67995b8",
31
- "@dxos/log": "0.8.4-main.67995b8",
32
- "@dxos/node-std": "0.8.4-main.67995b8"
33
+ "@dxos/invariant": "0.8.4-main.69d29f4",
34
+ "@dxos/async": "0.8.4-main.69d29f4",
35
+ "@dxos/node-std": "0.8.4-main.69d29f4",
36
+ "@dxos/log": "0.8.4-main.69d29f4"
33
37
  },
34
38
  "publishConfig": {
35
39
  "access": "public"
@@ -5,14 +5,15 @@
5
5
  import { spawn } from 'node:child_process';
6
6
  import { existsSync, readFileSync } from 'node:fs';
7
7
  import { join } from 'node:path';
8
- import { onTestFinished, describe, expect, test } from 'vitest';
8
+
9
+ import { describe, expect, onTestFinished, test } from 'vitest';
9
10
 
10
11
  import { Trigger } from '@dxos/async';
11
12
 
12
13
  import { Phoenix } from './phoenix';
13
14
  import { TEST_DIR, clearFiles, neverEndingProcess } from './testing-utils';
14
15
 
15
- describe('DaemonManager', () => {
16
+ describe.skipIf(process.env.CI)('DaemonManager', () => {
16
17
  test('kill process by pid', async () => {
17
18
  const child = spawn('node', ['-e', `(${neverEndingProcess.toString()})()`]);
18
19
  const trigger = new Trigger();
@@ -21,7 +22,6 @@ describe('DaemonManager', () => {
21
22
  });
22
23
 
23
24
  process.kill(child.pid!, 'SIGKILL');
24
-
25
25
  await trigger.wait({ timeout: 1_000 });
26
26
  });
27
27
 
@@ -56,7 +56,6 @@ describe('DaemonManager', () => {
56
56
  expect(info.profile).to.equal(runId);
57
57
 
58
58
  await Phoenix.stop(pidFile);
59
-
60
59
  await expect.poll(() => readFileSync(logFile, { encoding: 'utf-8' })).toContain('Stopped with exit code');
61
60
  }
62
61
  });
package/src/phoenix.ts CHANGED
@@ -5,13 +5,14 @@
5
5
  import { fork } from 'node:child_process';
6
6
  import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
7
7
  import { dirname, join } from 'node:path';
8
+
8
9
  import pkgUp from 'pkg-up';
9
10
 
10
11
  import { invariant } from '@dxos/invariant';
11
12
  import { log } from '@dxos/log';
12
13
 
13
14
  import { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';
14
- import { type ProcessInfo, type WatchDogParams } from './watchdog';
15
+ import { type ProcessInfo, type WatchDogProps } from './watchdog';
15
16
 
16
17
  const scriptDir = typeof __dirname === 'string' ? __dirname : dirname(new URL(import.meta.url).pathname);
17
18
 
@@ -22,7 +23,7 @@ export class Phoenix {
22
23
  /**
23
24
  * Starts detached watchdog process which starts and monitors selected command.
24
25
  */
25
- static async start(params: WatchDogParams): Promise<ProcessInfo> {
26
+ static async start(params: WatchDogProps): Promise<ProcessInfo> {
26
27
  {
27
28
  // Clear stale pid file.
28
29
  if (existsSync(params.pidFile)) {
@@ -4,12 +4,13 @@
4
4
 
5
5
  import { existsSync } from 'node:fs';
6
6
  import { join } from 'node:path';
7
- import { onTestFinished, describe, expect, test } from 'vitest';
7
+
8
+ import { describe, expect, onTestFinished, test } from 'vitest';
8
9
 
9
10
  import { TEST_DIR, clearFiles, neverEndingProcess } from './testing-utils';
10
11
  import { WatchDog } from './watchdog';
11
12
 
12
- describe('WatchDog', () => {
13
+ describe.skipIf(process.env.CI)('WatchDog', () => {
13
14
  test('Start/stop process', async () => {
14
15
  const runId = Math.random();
15
16
  const pidFile = join(TEST_DIR, `pid-${runId}.pid`);
@@ -26,8 +27,8 @@ describe('WatchDog', () => {
26
27
  });
27
28
 
28
29
  expect(existsSync(pidFile)).to.be.false;
29
- await watchDog.start();
30
30
 
31
+ await watchDog.start();
31
32
  expect(existsSync(pidFile)).to.be.true;
32
33
 
33
34
  await watchDog.kill();
package/src/watchdog.ts CHANGED
@@ -12,14 +12,14 @@ import { log } from '@dxos/log';
12
12
 
13
13
  import { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';
14
14
 
15
- export type ProcessInfo = WatchDogParams & {
15
+ export type ProcessInfo = WatchDogProps & {
16
16
  pid?: number;
17
17
  started?: number;
18
18
  restarts?: number;
19
19
  running?: boolean;
20
20
  };
21
21
 
22
- export type WatchDogParams = {
22
+ export type WatchDogProps = {
23
23
  profile?: string; // Human readable process identifier
24
24
  pidFile: string; // Path to PID file
25
25
 
@@ -56,7 +56,7 @@ export class WatchDog {
56
56
  private _child?: ChildProcessWithoutNullStreams;
57
57
  private _restarts = 0;
58
58
 
59
- constructor(private readonly _params: WatchDogParams) {}
59
+ constructor(private readonly _params: WatchDogProps) {}
60
60
 
61
61
  @synchronized
62
62
  async start(): Promise<void> {