@dxos/lock-file 0.1.55-main.ff36828 → 0.1.55
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/node/meta.json +1 -1
- package/package.json +4 -4
- package/src/lock-file.test.ts +12 -3
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/common/lock-file/src/lock-file.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/common/lock-file/src/lock-file.ts":{"bytes":4094,"imports":[{"path":"fs-ext","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true}]},"packages/common/lock-file/src/index.ts":{"bytes":460,"imports":[{"path":"packages/common/lock-file/src/lock-file.ts","kind":"import-statement","original":"./lock-file"}]}},"outputs":{"packages/common/lock-file/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2245},"packages/common/lock-file/dist/lib/node/index.cjs":{"imports":[{"path":"fs-ext","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:fs/promises","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/common/lock-file/src/index.ts","inputs":{"packages/common/lock-file/src/index.ts":{"bytesInOutput":121},"packages/common/lock-file/src/lock-file.ts":{"bytesInOutput":1032}},"bytes":2179}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/lock-file",
|
|
3
|
-
"version": "0.1.55
|
|
3
|
+
"version": "0.1.55",
|
|
4
4
|
"description": "Lock file .",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"fs-ext": "^2.0.0",
|
|
17
|
-
"@dxos/async": "0.1.55
|
|
18
|
-
"@dxos/log": "0.1.55
|
|
19
|
-
"@dxos/node-std": "0.1.55
|
|
17
|
+
"@dxos/async": "0.1.55",
|
|
18
|
+
"@dxos/log": "0.1.55",
|
|
19
|
+
"@dxos/node-std": "0.1.55"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/fs-ext": "^2.0.0",
|
package/src/lock-file.test.ts
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import chai, { expect } from 'chai';
|
|
6
6
|
import chaiAsPromised from 'chai-as-promised';
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
8
9
|
import { join } from 'node:path';
|
|
9
10
|
|
|
10
|
-
import { sleep } from '@dxos/async';
|
|
11
|
+
import { Trigger, sleep } from '@dxos/async';
|
|
11
12
|
import { describe, test } from '@dxos/test';
|
|
12
13
|
|
|
13
14
|
import { LockFile } from './lock-file';
|
|
@@ -33,13 +34,21 @@ describe('LockFile', () => {
|
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
// Wait for process to start
|
|
36
|
-
|
|
37
|
+
const trigger = new Trigger();
|
|
38
|
+
const intervalId = setInterval(() => {
|
|
39
|
+
if (existsSync(filename)) {
|
|
40
|
+
trigger.wake();
|
|
41
|
+
}
|
|
42
|
+
}, 100);
|
|
43
|
+
await trigger.wait({ timeout: 1_000 });
|
|
44
|
+
clearInterval(intervalId);
|
|
45
|
+
|
|
37
46
|
await expect(LockFile.acquire(filename)).to.be.rejected;
|
|
38
47
|
|
|
39
48
|
processHandle.kill();
|
|
40
49
|
|
|
41
50
|
// Wait for process to be killed
|
|
42
|
-
await sleep(
|
|
51
|
+
await sleep(400);
|
|
43
52
|
|
|
44
53
|
const handle = await LockFile.acquire(filename);
|
|
45
54
|
await LockFile.release(handle);
|