@savvy-web/silk-effects 5.1.3 → 5.2.1

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ChangesetConfigError } from "./errors/ChangesetConfigError.js";
2
- import { ChangesetConfigReader, ChangesetConfigReaderLive } from "./services/ChangesetConfigReader.js";
2
+ import { ChangesetConfigReader } from "./services/ChangesetConfigReader.js";
3
3
  import { PublishTargetBindingError } from "./errors/PublishTargetBindingError.js";
4
- import { ChangesetConfig, ChangesetConfigLive } from "./services/ChangesetConfig.js";
5
- import { PublishabilityDetectorAdaptiveLive, SilkPublishability, SilkPublishabilityDetectorLive, readTargetsBinding } from "./services/SilkPublishability.js";
4
+ import { ChangesetConfig } from "./services/ChangesetConfig.js";
5
+ import { SilkPublishability, readTargetsBinding } from "./services/SilkPublishability.js";
6
6
  import { changesets_exports } from "./changesets/index.js";
7
7
  import { commitlint_exports } from "./commitlint/index.js";
8
8
  import { BiomeSyncError } from "./errors/BiomeSyncError.js";
@@ -12,9 +12,9 @@ import { SavvyBaseSection, SavvyHooksSection, savvyBasePreamble, savvyHooksHygie
12
12
  import { lint_exports } from "./lint/index.js";
13
13
  import { repos_exports } from "./repos/index.js";
14
14
  import { AnalyzedWorkspace, SilkPublishConfig, WorkspaceAnalysis } from "./schemas/WorkspaceAnalysisSchemas.js";
15
- import { BiomeSchemaSync, BiomeSchemaSyncLive, buildSchemaUrl, extractSemver } from "./services/BiomeSchemaSync.js";
16
- import { ConfigDiscovery, ConfigDiscoveryLive } from "./services/ConfigDiscovery.js";
17
- import { SilkWorkspaceAnalyzer, SilkWorkspaceAnalyzerLive } from "./services/SilkWorkspaceAnalyzer.js";
15
+ import { BiomeSchemaSync, buildSchemaUrl, extractSemver } from "./services/BiomeSchemaSync.js";
16
+ import { ConfigDiscovery } from "./services/ConfigDiscovery.js";
17
+ import { SilkWorkspaceAnalyzer } from "./services/SilkWorkspaceAnalyzer.js";
18
18
  import { turbo_exports } from "./turbo/index.js";
19
19
 
20
- export { AnalyzedWorkspace, BiomeSchemaSync, BiomeSchemaSyncLive, BiomeSyncError, ChangesetConfig, ChangesetConfigError, ChangesetConfigLive, ChangesetConfigReader, ChangesetConfigReaderLive, changesets_exports as Changesets, commitlint_exports as Commitlint, ConfigDiscovery, ConfigDiscoveryLive, ConfigNotFoundError, lint_exports as Lint, PublishTargetBindingError, PublishabilityDetectorAdaptiveLive, repos_exports as Repos, SavvyBaseSection, SavvyHooksSection, SilkPublishConfig, SilkPublishability, SilkPublishabilityDetectorLive, SilkWorkspaceAnalyzer, SilkWorkspaceAnalyzerLive, turbo_exports as Turbo, WorkspaceAnalysis, WorkspaceAnalysisError, buildSchemaUrl, extractSemver, readTargetsBinding, savvyBasePreamble, savvyHooksHygiene, savvyToolSection };
20
+ export { AnalyzedWorkspace, BiomeSchemaSync, BiomeSyncError, ChangesetConfig, ChangesetConfigError, ChangesetConfigReader, changesets_exports as Changesets, commitlint_exports as Commitlint, ConfigDiscovery, ConfigNotFoundError, lint_exports as Lint, PublishTargetBindingError, repos_exports as Repos, SavvyBaseSection, SavvyHooksSection, SilkPublishConfig, SilkPublishability, SilkWorkspaceAnalyzer, turbo_exports as Turbo, WorkspaceAnalysis, WorkspaceAnalysisError, buildSchemaUrl, extractSemver, readTargetsBinding, savvyBasePreamble, savvyHooksHygiene, savvyToolSection };
@@ -163,7 +163,8 @@ var PnpmWorkspace = class PnpmWorkspace {
163
163
  let parsed = parseResult.success;
164
164
  if (!skipSort) parsed = PnpmWorkspace.sortContent(parsed);
165
165
  if (!skipSort || !skipFormat) {
166
- writeFileSync(filepath, await PnpmWorkspace.formatContent(parsed), "utf-8");
166
+ const formatted = await PnpmWorkspace.formatContent(parsed);
167
+ writeFileSync(filepath, formatted, "utf-8");
167
168
  return [];
168
169
  }
169
170
  return [];
@@ -101,11 +101,14 @@ var Yaml = class Yaml {
101
101
  * @param filepath - Path to the YAML file
102
102
  */
103
103
  static async formatFile(filepath) {
104
- writeFileSync(filepath, await format(readFileSync(filepath, "utf-8"), {
105
- ...await resolveConfig(filepath),
104
+ const content = readFileSync(filepath, "utf-8");
105
+ const prettierConfig = await resolveConfig(filepath);
106
+ const formatted = await format(content, {
107
+ ...prettierConfig,
106
108
  filepath,
107
109
  parser: "yaml"
108
- }), "utf-8");
110
+ });
111
+ writeFileSync(filepath, formatted, "utf-8");
109
112
  }
110
113
  /**
111
114
  * Validate a YAML file using yaml-lint.
@@ -115,7 +118,8 @@ var Yaml = class Yaml {
115
118
  * @throws Error if the YAML is invalid
116
119
  */
117
120
  static async validateFile(filepath, schema) {
118
- await lint(readFileSync(filepath, "utf-8"), schema ? { schema } : void 0);
121
+ const content = readFileSync(filepath, "utf-8");
122
+ await lint(content, schema ? { schema } : void 0);
119
123
  }
120
124
  /**
121
125
  * Create a handler that returns a CLI command to format YAML files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvy-web/silk-effects",
3
- "version": "5.1.3",
3
+ "version": "5.2.1",
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",
@@ -33,15 +33,15 @@
33
33
  "@changesets/config": "^4.0.0-next.6",
34
34
  "@changesets/get-github-info": "^1.0.0-next.4",
35
35
  "@changesets/get-release-plan": "^5.0.0-next.9",
36
- "@effected/commands": "^0.2.0",
37
- "@effected/git": "^0.5.1",
38
- "@effected/glob": "^0.2.1",
39
- "@effected/jsonc": "^0.5.1",
40
- "@effected/package-json": "^0.6.1",
41
- "@effected/templates": "^0.1.0",
42
- "@effected/walker": "^0.3.3",
43
- "@effected/workspaces": "^0.9.1",
44
- "@effected/yaml": "^0.6.0",
36
+ "@effected/commands": "^0.2.1",
37
+ "@effected/git": "^0.5.2",
38
+ "@effected/glob": "^0.2.2",
39
+ "@effected/jsonc": "^0.5.2",
40
+ "@effected/package-json": "^0.7.2",
41
+ "@effected/templates": "^0.1.1",
42
+ "@effected/walker": "^0.3.4",
43
+ "@effected/workspaces": "^0.9.4",
44
+ "@effected/yaml": "^0.6.1",
45
45
  "@manypkg/get-packages": "^3.1.0",
46
46
  "mdast-util-heading-range": "^4.0.0",
47
47
  "mdast-util-to-string": "^4.0.0",
package/repos/index.js CHANGED
@@ -3,8 +3,8 @@ import { MANIFEST_PATH, REPOS_DIR } from "./constants.js";
3
3
  import { GitSubmoduleError, GitSubmoduleErrorBase, NoteNotFoundError, NoteNotFoundErrorBase, RepoNotFoundError, RepoNotFoundErrorBase, ReposConfigError, ReposConfigErrorBase } from "./errors.js";
4
4
  import { RepoEntry, RepoName, RepoNote, RepoOrientation, ReposManifestFile } from "./schemas/manifest.js";
5
5
  import { RepoStatusEntry, ReposAddResult, ReposNoteResult, ReposPinResult, ReposStatusReport, ReposSyncReport } from "./schemas/reports.js";
6
- import { ReposConfigStore, ReposConfigStoreLive } from "./services/config-store.js";
7
- import { ReposManager, ReposManagerLive, STALE_LOCK_MAX_AGE_MS } from "./services/manager.js";
6
+ import { ReposConfigStore } from "./services/config-store.js";
7
+ import { ReposManager, STALE_LOCK_MAX_AGE_MS } from "./services/manager.js";
8
8
 
9
9
  //#region src/repos/index.ts
10
10
  var repos_exports = /* @__PURE__ */ __exportAll({
@@ -26,9 +26,7 @@ var repos_exports = /* @__PURE__ */ __exportAll({
26
26
  ReposConfigError: () => ReposConfigError,
27
27
  ReposConfigErrorBase: () => ReposConfigErrorBase,
28
28
  ReposConfigStore: () => ReposConfigStore,
29
- ReposConfigStoreLive: () => ReposConfigStoreLive,
30
29
  ReposManager: () => ReposManager,
31
- ReposManagerLive: () => ReposManagerLive,
32
30
  ReposManifestFile: () => ReposManifestFile,
33
31
  ReposNoteResult: () => ReposNoteResult,
34
32
  ReposPinResult: () => ReposPinResult,
@@ -38,4 +36,4 @@ var repos_exports = /* @__PURE__ */ __exportAll({
38
36
  });
39
37
 
40
38
  //#endregion
41
- export { GitSubmoduleError, GitSubmoduleErrorBase, MANIFEST_PATH, NoteNotFoundError, NoteNotFoundErrorBase, REPOS_DIR, RepoEntry, RepoName, RepoNotFoundError, RepoNotFoundErrorBase, RepoNote, RepoOrientation, RepoStatusEntry, ReposAddResult, ReposConfigError, ReposConfigErrorBase, ReposConfigStore, ReposConfigStoreLive, ReposManager, ReposManagerLive, ReposManifestFile, ReposNoteResult, ReposPinResult, ReposStatusReport, ReposSyncReport, STALE_LOCK_MAX_AGE_MS, repos_exports };
39
+ export { GitSubmoduleError, GitSubmoduleErrorBase, MANIFEST_PATH, NoteNotFoundError, NoteNotFoundErrorBase, REPOS_DIR, RepoEntry, RepoName, RepoNotFoundError, RepoNotFoundErrorBase, RepoNote, RepoOrientation, RepoStatusEntry, ReposAddResult, ReposConfigError, ReposConfigErrorBase, ReposConfigStore, ReposManager, ReposManifestFile, ReposNoteResult, ReposPinResult, ReposStatusReport, ReposSyncReport, STALE_LOCK_MAX_AGE_MS, repos_exports };
@@ -8,75 +8,76 @@ import { Context, Effect, FileSystem, Layer, Path, Schema } from "effect";
8
8
  * Reads, validates, and writes the .repos/config.json manifest.
9
9
  * @public
10
10
  */
11
- var ReposConfigStore = class extends Context.Service()("@savvy-web/silk-effects/ReposConfigStore") {};
12
- /**
13
- * Live layer over the core FileSystem.
14
- * @public
15
- */
16
- const ReposConfigStoreLive = Layer.effect(ReposConfigStore, Effect.gen(function* () {
17
- const fs = yield* FileSystem.FileSystem;
18
- const path = yield* Path.Path;
19
- const manifestPath = (root) => path.join(root, MANIFEST_PATH);
20
- const exists = (root) => fs.exists(manifestPath(root)).pipe(Effect.orElseSucceed(() => false));
21
- const read = (root) => Effect.gen(function* () {
22
- if (!(yield* fs.exists(manifestPath(root)).pipe(Effect.mapError((cause) => new ReposConfigError({
23
- path: manifestPath(root),
24
- reason: `stat failed: ${String(cause)}`,
25
- kind: "invalid"
26
- }))))) return yield* Effect.fail(new ReposConfigError({
27
- path: manifestPath(root),
28
- reason: "no such file",
29
- kind: "missing"
30
- }));
31
- const text = yield* fs.readFileString(manifestPath(root)).pipe(Effect.mapError((cause) => new ReposConfigError({
32
- path: manifestPath(root),
33
- reason: String(cause),
34
- kind: "invalid"
35
- })));
36
- const json = yield* Effect.try({
37
- try: () => JSON.parse(text),
38
- catch: (cause) => new ReposConfigError({
11
+ var ReposConfigStore = class extends Context.Service()("@savvy-web/silk-effects/ReposConfigStore") {
12
+ /**
13
+ * Production layer over the core FileSystem.
14
+ * @public
15
+ */
16
+ static layer = Layer.effect(this, Effect.gen(function* () {
17
+ const fs = yield* FileSystem.FileSystem;
18
+ const path = yield* Path.Path;
19
+ const manifestPath = (root) => path.join(root, MANIFEST_PATH);
20
+ const exists = (root) => fs.exists(manifestPath(root)).pipe(Effect.orElseSucceed(() => false));
21
+ const read = (root) => Effect.gen(function* () {
22
+ if (!(yield* fs.exists(manifestPath(root)).pipe(Effect.mapError((cause) => new ReposConfigError({
23
+ path: manifestPath(root),
24
+ reason: `stat failed: ${String(cause)}`,
25
+ kind: "invalid"
26
+ }))))) return yield* Effect.fail(new ReposConfigError({
27
+ path: manifestPath(root),
28
+ reason: "no such file",
29
+ kind: "missing"
30
+ }));
31
+ const text = yield* fs.readFileString(manifestPath(root)).pipe(Effect.mapError((cause) => new ReposConfigError({
32
+ path: manifestPath(root),
33
+ reason: String(cause),
34
+ kind: "invalid"
35
+ })));
36
+ const json = yield* Effect.try({
37
+ try: () => JSON.parse(text),
38
+ catch: (cause) => new ReposConfigError({
39
+ path: manifestPath(root),
40
+ reason: `invalid JSON: ${String(cause)}`,
41
+ kind: "invalid"
42
+ })
43
+ });
44
+ return yield* Schema.decodeUnknownEffect(ReposManifestFile)(json).pipe(Effect.mapError((cause) => new ReposConfigError({
45
+ path: manifestPath(root),
46
+ reason: String(cause),
47
+ kind: "invalid"
48
+ })));
49
+ });
50
+ const write = (root, manifest) => Effect.gen(function* () {
51
+ const dir = path.join(root, REPOS_DIR);
52
+ yield* fs.makeDirectory(dir, { recursive: true }).pipe(Effect.mapError((cause) => new ReposConfigError({
53
+ path: manifestPath(root),
54
+ reason: `mkdir failed: ${String(cause)}`,
55
+ kind: "invalid"
56
+ })));
57
+ const encoded = yield* Schema.encodeEffect(ReposManifestFile)(manifest).pipe(Effect.mapError((cause) => new ReposConfigError({
58
+ path: manifestPath(root),
59
+ reason: String(cause),
60
+ kind: "invalid"
61
+ })));
62
+ const tmpPath = `${manifestPath(root)}.tmp`;
63
+ yield* fs.writeFileString(tmpPath, `${JSON.stringify(encoded, null, " ")}\n`).pipe(Effect.mapError((cause) => new ReposConfigError({
64
+ path: manifestPath(root),
65
+ reason: String(cause),
66
+ kind: "invalid"
67
+ })));
68
+ yield* fs.rename(tmpPath, manifestPath(root)).pipe(Effect.mapError((cause) => new ReposConfigError({
39
69
  path: manifestPath(root),
40
- reason: `invalid JSON: ${String(cause)}`,
70
+ reason: `rename failed: ${String(cause)}`,
41
71
  kind: "invalid"
42
- })
72
+ })));
43
73
  });
44
- return yield* Schema.decodeUnknownEffect(ReposManifestFile)(json).pipe(Effect.mapError((cause) => new ReposConfigError({
45
- path: manifestPath(root),
46
- reason: String(cause),
47
- kind: "invalid"
48
- })));
49
- });
50
- const write = (root, manifest) => Effect.gen(function* () {
51
- const dir = path.join(root, REPOS_DIR);
52
- yield* fs.makeDirectory(dir, { recursive: true }).pipe(Effect.mapError((cause) => new ReposConfigError({
53
- path: manifestPath(root),
54
- reason: `mkdir failed: ${String(cause)}`,
55
- kind: "invalid"
56
- })));
57
- const encoded = yield* Schema.encodeEffect(ReposManifestFile)(manifest).pipe(Effect.mapError((cause) => new ReposConfigError({
58
- path: manifestPath(root),
59
- reason: String(cause),
60
- kind: "invalid"
61
- })));
62
- const tmpPath = `${manifestPath(root)}.tmp`;
63
- yield* fs.writeFileString(tmpPath, `${JSON.stringify(encoded, null, " ")}\n`).pipe(Effect.mapError((cause) => new ReposConfigError({
64
- path: manifestPath(root),
65
- reason: String(cause),
66
- kind: "invalid"
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
- });
74
- return {
75
- exists,
76
- read,
77
- write
78
- };
79
- }));
74
+ return {
75
+ exists,
76
+ read,
77
+ write
78
+ };
79
+ }));
80
+ };
80
81
 
81
82
  //#endregion
82
- export { ReposConfigStore, ReposConfigStoreLive };
83
+ export { ReposConfigStore };