@okfit/profiles 0.11.0 → 0.12.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/Derivation.js +7 -14
- package/package.json +6 -3
package/Derivation.js
CHANGED
|
@@ -2,9 +2,10 @@ import { body } from "./internal/body.js";
|
|
|
2
2
|
import { Canonical } from "./Canonical.js";
|
|
3
3
|
import { GitHistory } from "./GitHistory.js";
|
|
4
4
|
import { Actor, OkfitConfig } from "@okfit/core";
|
|
5
|
-
import {
|
|
5
|
+
import { DateTime, Duration, Effect, FileSystem, Option, Path, Schema } from "effect";
|
|
6
6
|
import { Git } from "@effected/git";
|
|
7
|
-
import
|
|
7
|
+
import { JsoncFingerprint } from "@effected/jsonc";
|
|
8
|
+
import { Walker } from "@effected/walker";
|
|
8
9
|
|
|
9
10
|
// src/Derivation.ts
|
|
10
11
|
/**
|
|
@@ -62,11 +63,7 @@ var HumanActorNotAllowedError = class extends Schema.TaggedError()("HumanActorNo
|
|
|
62
63
|
const HUMAN_PREFIX = "human:";
|
|
63
64
|
const FALLBACK_STALE_AFTER = Duration.days(90);
|
|
64
65
|
const decodeActor = Schema.decodeSync(Actor);
|
|
65
|
-
const digestFull = (text) =>
|
|
66
|
-
const bytes = yield* (yield* Crypto.Crypto).digest("SHA-256", new TextEncoder().encode(text));
|
|
67
|
-
return Hex.encode(bytes);
|
|
68
|
-
});
|
|
69
|
-
/** 16-hex okfit digest (spec section 3): the first 64 bits of SHA-256. */
|
|
66
|
+
const digestFull = (text) => JsoncFingerprint.hashText(text);
|
|
70
67
|
const digest = (text) => Effect.map(digestFull(text), (hex) => hex.slice(0, 16));
|
|
71
68
|
const bodyDigest = (source) => digest(body(source));
|
|
72
69
|
const contentDigest = (raw, source) => digest(Canonical.contentInput(raw, source));
|
|
@@ -175,13 +172,9 @@ var Derivation = class Derivation {
|
|
|
175
172
|
static worktreeRoot = Effect.fn("Derivation.worktreeRoot")(function* (start) {
|
|
176
173
|
const fs = yield* FileSystem.FileSystem;
|
|
177
174
|
const path = yield* Path.Path;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const parent = path.dirname(dir);
|
|
182
|
-
if (parent === dir) return void 0;
|
|
183
|
-
dir = parent;
|
|
184
|
-
}
|
|
175
|
+
const dirs = yield* Walker.ascend(path.resolve(start));
|
|
176
|
+
const root = yield* Walker.findRoot(dirs, (dir) => fs.exists(path.join(dir, ".git")));
|
|
177
|
+
return Option.getOrUndefined(root);
|
|
185
178
|
});
|
|
186
179
|
/**
|
|
187
180
|
* Spec 5.4 rule 2 as P-2 (DERIVE option C). Steps:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okfit/profiles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Named OKF configuration profiles for okfit, starting with the software-project profile.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,9 +35,12 @@
|
|
|
35
35
|
"./package.json": "./package.json"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@effected/git": "^0.
|
|
38
|
+
"@effected/git": "^0.26.0",
|
|
39
|
+
"@effected/glob": "^0.15.0",
|
|
40
|
+
"@effected/jsonc": "^0.20.0",
|
|
39
41
|
"@effected/markdown": "^0.23.0",
|
|
40
|
-
"@
|
|
42
|
+
"@effected/walker": "^0.21.0",
|
|
43
|
+
"@okfit/core": "^0.11.7",
|
|
41
44
|
"effect": "^4.0.0"
|
|
42
45
|
},
|
|
43
46
|
"engines": {
|