@savvy-web/silk-effects 11.0.1 → 11.0.2
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/silk-effects",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared Effect library for Silk Suite conventions",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/systems/tree/main/packages/silk-effects",
|
|
@@ -37,23 +37,24 @@
|
|
|
37
37
|
"@changesets/get-release-plan": "^5.0.2",
|
|
38
38
|
"@changesets/pre": "^3.0.0",
|
|
39
39
|
"@changesets/read": "^1.0.1",
|
|
40
|
+
"@effected/files": "^0.1.0",
|
|
40
41
|
"@effected/github-references": "^0.14.0",
|
|
41
|
-
"@effected/glob": "^0.
|
|
42
|
-
"@effected/jsonc": "^0.
|
|
43
|
-
"@effected/markdown": "^0.
|
|
44
|
-
"@effected/package-json": "^0.
|
|
45
|
-
"@effected/toml": "^0.19.
|
|
46
|
-
"@effected/walker": "^0.25.
|
|
47
|
-
"@effected/yaml": "^0.
|
|
42
|
+
"@effected/glob": "^0.19.0",
|
|
43
|
+
"@effected/jsonc": "^0.24.0",
|
|
44
|
+
"@effected/markdown": "^0.27.0",
|
|
45
|
+
"@effected/package-json": "^0.30.0",
|
|
46
|
+
"@effected/toml": "^0.19.1",
|
|
47
|
+
"@effected/walker": "^0.25.1",
|
|
48
|
+
"@effected/yaml": "^0.29.0",
|
|
48
49
|
"@manypkg/get-packages": "^3.1.0",
|
|
49
|
-
"@savvy-web/silk-core": "^0.6.
|
|
50
|
+
"@savvy-web/silk-core": "^0.6.2",
|
|
50
51
|
"shell-quote": "^1.12.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
54
|
"@effected/commands": "^0.20.0",
|
|
54
55
|
"@effected/git": "^0.30.0",
|
|
55
|
-
"@effected/templates": "^0.
|
|
56
|
-
"@effected/workspaces": "^0.
|
|
56
|
+
"@effected/templates": "^0.18.0",
|
|
57
|
+
"@effected/workspaces": "^0.43.0",
|
|
57
58
|
"effect": "~4.1.2"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -2,6 +2,7 @@ import { MANIFEST_PATH, REPOS_DIR } from "../constants.js";
|
|
|
2
2
|
import { ReposConfigError } from "../errors.js";
|
|
3
3
|
import { ReposManifestFile } from "../schemas/manifest.js";
|
|
4
4
|
import { Clock, Context, Effect, FileSystem, Layer, Option, Path, Schedule, Schema } from "effect";
|
|
5
|
+
import { AtomicFile } from "@effected/files";
|
|
5
6
|
|
|
6
7
|
// src/repos/services/config-store.ts
|
|
7
8
|
/**
|
|
@@ -59,17 +60,11 @@ var ReposConfigStore = class extends Context.Service()("@savvy-web/silk-effects/
|
|
|
59
60
|
reason: String(cause),
|
|
60
61
|
kind: "invalid"
|
|
61
62
|
})));
|
|
62
|
-
|
|
63
|
-
yield* fs.writeFileString(tmpPath, `${JSON.stringify(encoded, null, " ")}\n`).pipe(Effect.mapError((cause) => new ReposConfigError({
|
|
63
|
+
yield* AtomicFile.write(manifestPath(root), `${JSON.stringify(encoded, null, " ")}\n`).pipe(Effect.provideService(FileSystem.FileSystem, fs), Effect.provideService(Path.Path, path), Effect.mapError((cause) => new ReposConfigError({
|
|
64
64
|
path: manifestPath(root),
|
|
65
65
|
reason: String(cause),
|
|
66
66
|
kind: "invalid"
|
|
67
67
|
})));
|
|
68
|
-
yield* fs.rename(tmpPath, manifestPath(root)).pipe(Effect.mapError((cause) => new ReposConfigError({
|
|
69
|
-
path: manifestPath(root),
|
|
70
|
-
reason: `rename failed: ${String(cause)}`,
|
|
71
|
-
kind: "invalid"
|
|
72
|
-
})));
|
|
73
68
|
});
|
|
74
69
|
const lockSchedule = Schedule.exponential("25 millis").pipe(Schedule.upTo({ duration: "2 seconds" }));
|
|
75
70
|
const LOCK_MAX_AGE_MS = 6e4;
|
package/repos/services/drift.js
CHANGED
|
@@ -72,7 +72,7 @@ var ReposDrift = class extends Context.Service()("@savvy-web/silk-effects/ReposD
|
|
|
72
72
|
*/
|
|
73
73
|
const localRegistrationDrifts = (root, manifestEntries) => Effect.gen(function* () {
|
|
74
74
|
const found = [];
|
|
75
|
-
const configEntries = yield* git.configList(root).pipe(Effect.mapError(asSubmoduleError("git config --list", root)));
|
|
75
|
+
const configEntries = yield* git.configList(root, { scope: "local" }).pipe(Effect.mapError(asSubmoduleError("git config --local --list", root)));
|
|
76
76
|
const registeredNames = new Set(configEntries.map((configEntry) => submoduleNameFromKey(configEntry.key)).filter((registeredName) => registeredName !== void 0));
|
|
77
77
|
const modulesRoot = path.join(root, ".git", "modules");
|
|
78
78
|
const canonicalNames = new Set(manifestEntries.map(([name]) => `${REPOS_DIR}/${name}`));
|
|
@@ -5,7 +5,7 @@ import { ReposConfigStore } from "./config-store.js";
|
|
|
5
5
|
import { submoduleNameFromKey } from "./drift.js";
|
|
6
6
|
import { ReposLockdown, resolveModuleDir } from "./lockdown.js";
|
|
7
7
|
import { Clock, Context, Effect, Exit, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
|
|
8
|
-
import { Git, GitConfig,
|
|
8
|
+
import { Git, GitConfig, GitRemote, Gitmodules, LsRemoteEntry } from "@effected/git";
|
|
9
9
|
import { Digest } from "effect/crypto";
|
|
10
10
|
|
|
11
11
|
// src/repos/services/manager.ts
|
|
@@ -662,34 +662,6 @@ var ReposManager = class extends Context.Service()("@savvy-web/silk-effects/Repo
|
|
|
662
662
|
stillDirty
|
|
663
663
|
};
|
|
664
664
|
});
|
|
665
|
-
/**
|
|
666
|
-
* Resolve the file git's `--local` scope actually targets for `root`.
|
|
667
|
-
* A plain checkout is `<root>/.git/config`; a LINKED WORKTREE's
|
|
668
|
-
* `<root>/.git` is a pointer FILE whose `gitdir:` names
|
|
669
|
-
* `.git/worktrees/<name>`, and the local config git uses there is the
|
|
670
|
-
* SHARED one at the main gitdir named by that dir's `commondir` file.
|
|
671
|
-
* Every unreadable/malformed step degrades to the plain
|
|
672
|
-
* `<root>/.git/config` path rather than failing — the same
|
|
673
|
-
* never-fails posture as `resolveModuleDir`.
|
|
674
|
-
*/
|
|
675
|
-
const resolveLocalConfigPath = (root) => Effect.gen(function* () {
|
|
676
|
-
const dotGit = path.join(root, ".git");
|
|
677
|
-
const fallback = path.join(dotGit, "config");
|
|
678
|
-
const info = yield* fs.stat(dotGit).pipe(Effect.option);
|
|
679
|
-
if (Option.isNone(info) || info.value.type === "Directory") return fallback;
|
|
680
|
-
const content = yield* fs.readFileString(dotGit).pipe(Effect.option);
|
|
681
|
-
if (Option.isNone(content)) return fallback;
|
|
682
|
-
const gitFile = GitFile.parseResult(content.value);
|
|
683
|
-
if (Result.isFailure(gitFile)) return fallback;
|
|
684
|
-
const pointer = gitFile.success.gitdir;
|
|
685
|
-
const gitdir = path.isAbsolute(pointer) ? pointer : path.resolve(root, pointer);
|
|
686
|
-
const commondir = yield* fs.readFileString(path.join(gitdir, "commondir")).pipe(Effect.option);
|
|
687
|
-
if (Option.isSome(commondir)) {
|
|
688
|
-
const common = commondir.value.trim();
|
|
689
|
-
return path.join(path.isAbsolute(common) ? common : path.resolve(gitdir, common), "config");
|
|
690
|
-
}
|
|
691
|
-
return path.join(gitdir, "config");
|
|
692
|
-
});
|
|
693
665
|
const deregister = (root, section) => Effect.gen(function* () {
|
|
694
666
|
if (!section.startsWith(`${".repos"}/`) || section === `${".repos"}/`) return yield* Effect.fail(new ReposConfigError({
|
|
695
667
|
path: MANIFEST_PATH,
|
|
@@ -702,12 +674,11 @@ var ReposManager = class extends Context.Service()("@savvy-web/silk-effects/Repo
|
|
|
702
674
|
reason: `"${section}" is the canonical registration of manifest entry "${name}" — deregister clears STALE registrations only; use remove to unvendor, or sync to reconcile`,
|
|
703
675
|
kind: "invalid"
|
|
704
676
|
}));
|
|
705
|
-
const
|
|
706
|
-
const configEntries = yield* git.configList(root, { file: localConfigPath }).pipe(Effect.mapError(asSubmoduleError(`git config -f ${localConfigPath} --list`, root)));
|
|
677
|
+
const configEntries = yield* git.configList(root, { scope: "local" }).pipe(Effect.mapError(asSubmoduleError("git config --local --list", root)));
|
|
707
678
|
const registeredNames = new Set(configEntries.map((configEntry) => submoduleNameFromKey(configEntry.key)).filter((registeredName) => registeredName !== void 0));
|
|
708
679
|
const removedKeys = configEntries.map((configEntry) => configEntry.key).filter((key) => submoduleNameFromKey(key) === section);
|
|
709
680
|
if (removedKeys.length === 0) return yield* Effect.fail(new ReposConfigError({
|
|
710
|
-
path:
|
|
681
|
+
path: path.join(root, ".git", "config"),
|
|
711
682
|
reason: `no submodule.${section} section registered in the local git config — nothing to deregister`,
|
|
712
683
|
kind: "invalid"
|
|
713
684
|
}));
|