@nubbin/store-fs 0.1.0-rc.6 → 0.1.0
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 +1 -1
- package/dist/index.js +9 -3
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ async function fsManifest(root) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// src/fsPublish.ts
|
|
42
|
-
import { parseMatchKind } from "@nubbin/core";
|
|
42
|
+
import { NubbinIssueCode, parseMatchKind, refuse } from "@nubbin/core";
|
|
43
43
|
|
|
44
44
|
// src/pointerPath.ts
|
|
45
45
|
import { join as join3 } from "path";
|
|
@@ -57,9 +57,11 @@ function pointerPath(root, route) {
|
|
|
57
57
|
// src/writeJsonAtomic.ts
|
|
58
58
|
import { mkdir, rename, writeFile } from "fs/promises";
|
|
59
59
|
import { dirname } from "path";
|
|
60
|
+
var writes = 0;
|
|
60
61
|
async function writeJsonAtomic(filePath, value) {
|
|
61
62
|
await mkdir(dirname(filePath), { recursive: true });
|
|
62
|
-
|
|
63
|
+
writes += 1;
|
|
64
|
+
const temp = `${filePath}.${process.pid}.${writes}.tmp`;
|
|
63
65
|
await writeFile(temp, JSON.stringify(value, null, 2));
|
|
64
66
|
await rename(temp, filePath);
|
|
65
67
|
}
|
|
@@ -67,7 +69,11 @@ async function writeJsonAtomic(filePath, value) {
|
|
|
67
69
|
// src/fsPublish.ts
|
|
68
70
|
async function fsPublish(root, route, hash) {
|
|
69
71
|
if (!await readJsonOrNull(artifactPath(root, hash))) {
|
|
70
|
-
|
|
72
|
+
refuse(
|
|
73
|
+
NubbinIssueCode.ArtifactNotStored,
|
|
74
|
+
`cannot publish ${route}: artifact ${hash} is not in the store`,
|
|
75
|
+
route
|
|
76
|
+
);
|
|
71
77
|
}
|
|
72
78
|
const pointer = {
|
|
73
79
|
route,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubbin/store-fs",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "The reference artifact store for Nubbin: one file per artifact, one pointer file per route, and no aggregate to lose a write.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nubbin",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nubbin/core": "0.1.0
|
|
35
|
+
"@nubbin/core": "0.1.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "25.9.2",
|