@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/README.md +22 -22
- package/changesets/api/transformer.js +2 -1
- package/changesets/changelog/getReleaseLine.js +7 -4
- package/changesets/changelog/index.js +8 -6
- package/changesets/index.js +6 -11
- package/changesets/services/branch-analyzer.js +20 -19
- package/changesets/services/changelog.js +1 -1
- package/changesets/services/config-inspector.js +17 -17
- package/changesets/services/deps-regen.js +36 -34
- package/changesets/services/github.js +39 -40
- package/changesets/services/release-planner.js +7 -6
- package/changesets/utils/dependency-table.js +2 -1
- package/changesets/utils/jsonpath.js +5 -7
- package/changesets/utils/publishability.js +2 -2
- package/commitlint/detection/dco.js +2 -1
- package/commitlint/index.js +2 -1
- package/index.d.ts +224 -213
- package/index.js +7 -7
- package/lint/handlers/PnpmWorkspace.js +2 -1
- package/lint/handlers/Yaml.js +8 -4
- package/package.json +10 -10
- package/repos/index.js +3 -5
- package/repos/services/config-store.js +68 -67
- package/repos/services/manager.js +259 -258
- package/services/BiomeSchemaSync.js +65 -64
- package/services/ChangesetConfig.js +50 -50
- package/services/ChangesetConfigReader.js +59 -58
- package/services/ConfigDiscovery.js +42 -41
- package/services/SilkPublishability.js +54 -53
- package/services/SilkWorkspaceAnalyzer.js +110 -109
- package/turbo/index.js +2 -3
- package/turbo/services/TurboInspector.js +80 -79
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChangesetConfigError } from "./errors/ChangesetConfigError.js";
|
|
2
|
-
import { ChangesetConfigReader
|
|
2
|
+
import { ChangesetConfigReader } from "./services/ChangesetConfigReader.js";
|
|
3
3
|
import { PublishTargetBindingError } from "./errors/PublishTargetBindingError.js";
|
|
4
|
-
import { ChangesetConfig
|
|
5
|
-
import {
|
|
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,
|
|
16
|
-
import { ConfigDiscovery
|
|
17
|
-
import { SilkWorkspaceAnalyzer
|
|
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,
|
|
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
|
-
|
|
166
|
+
const formatted = await PnpmWorkspace.formatContent(parsed);
|
|
167
|
+
writeFileSync(filepath, formatted, "utf-8");
|
|
167
168
|
return [];
|
|
168
169
|
}
|
|
169
170
|
return [];
|
package/lint/handlers/Yaml.js
CHANGED
|
@@ -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
|
-
|
|
105
|
-
|
|
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
|
-
})
|
|
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
|
-
|
|
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
|
+
"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.
|
|
37
|
-
"@effected/git": "^0.5.
|
|
38
|
-
"@effected/glob": "^0.2.
|
|
39
|
-
"@effected/jsonc": "^0.5.
|
|
40
|
-
"@effected/package-json": "^0.
|
|
41
|
-
"@effected/templates": "^0.1.
|
|
42
|
-
"@effected/walker": "^0.3.
|
|
43
|
-
"@effected/workspaces": "^0.9.
|
|
44
|
-
"@effected/yaml": "^0.6.
|
|
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
|
|
7
|
-
import { ReposManager,
|
|
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,
|
|
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
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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: `
|
|
70
|
+
reason: `rename failed: ${String(cause)}`,
|
|
41
71
|
kind: "invalid"
|
|
42
|
-
})
|
|
72
|
+
})));
|
|
43
73
|
});
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
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
|
|
83
|
+
export { ReposConfigStore };
|