tegami 1.0.1 → 1.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/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +5 -8
- package/dist/{draft-BqHcSCeX.js → draft-BLbt4bSG.js} +44 -18
- package/dist/generators/simple.d.ts +1 -1
- package/dist/{graph-gThXu8Cz.js → graph-BmXTJZxx.js} +18 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/{npm-1iEegfHg.js → npm-Cj685Ddn.js} +21 -24
- package/dist/plugins/cargo.d.ts +2 -97
- package/dist/plugins/cargo.js +256 -160
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +1 -2
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +1 -1
- package/dist/plugins/gitlab.d.ts +1 -1
- package/dist/plugins/gitlab.js +1 -1
- package/dist/plugins/go.d.ts +1 -1
- package/dist/plugins/go.js +3 -4
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/{types-DItu_YCc.d.ts → types-BoQR7Hlg.d.ts} +430 -8
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
package/dist/plugins/cargo.js
CHANGED
|
@@ -1,40 +1,76 @@
|
|
|
1
1
|
import { n as execFailure } from "../error-BhMYq9iW.js";
|
|
2
|
-
import { n as WorkspacePackage } from "../graph-
|
|
2
|
+
import { n as WorkspacePackage } from "../graph-BmXTJZxx.js";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
|
-
import
|
|
4
|
+
import path from "node:path";
|
|
5
5
|
import { x } from "tinyexec";
|
|
6
6
|
import * as semver$1 from "semver";
|
|
7
7
|
import z from "zod";
|
|
8
8
|
import { glob } from "tinyglobby";
|
|
9
9
|
import initToml, { edit, parse as parse$1 } from "@rainbowatcher/toml-edit-js";
|
|
10
10
|
//#region src/plugins/cargo/schema.ts
|
|
11
|
-
const
|
|
12
|
-
version: z.string(),
|
|
11
|
+
const baseDepSchema = z.object({
|
|
13
12
|
package: z.string().optional(),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
dependencies: z.record(z.string(), cargoDependencySchema).optional(),
|
|
18
|
-
"dev-dependencies": z.record(z.string(), cargoDependencySchema).optional(),
|
|
19
|
-
"build-dependencies": z.record(z.string(), cargoDependencySchema).optional()
|
|
13
|
+
features: z.array(z.string()).optional(),
|
|
14
|
+
optional: z.boolean().optional(),
|
|
15
|
+
"default-features": z.boolean().optional()
|
|
20
16
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
/** `{ workspace = true }` — inherit from `[workspace.dependencies]` */
|
|
18
|
+
const workspaceDependencySchema = baseDepSchema.extend({ workspace: z.literal(true) });
|
|
19
|
+
/** `{ path = "../lib" }` — optional `version` for publishing */
|
|
20
|
+
const pathDependencySchema = baseDepSchema.extend({
|
|
21
|
+
path: z.string(),
|
|
22
|
+
version: z.string().optional()
|
|
25
23
|
});
|
|
26
|
-
|
|
24
|
+
/** `{ git = "…" }` — exactly one of `branch`, `tag`, or `rev` in practice */
|
|
25
|
+
const gitDependencySchema = baseDepSchema.extend({
|
|
26
|
+
git: z.string(),
|
|
27
|
+
branch: z.string().optional(),
|
|
28
|
+
tag: z.string().optional(),
|
|
29
|
+
rev: z.string().optional(),
|
|
30
|
+
version: z.string().optional()
|
|
31
|
+
});
|
|
32
|
+
/** `{ version = "1.0" }` — crates.io or `[registries]` */
|
|
33
|
+
const registryDependencySchema = baseDepSchema.extend({
|
|
34
|
+
version: z.string(),
|
|
35
|
+
registry: z.string().optional()
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* @see https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html
|
|
39
|
+
*/
|
|
40
|
+
const cargoDependencySchema = z.union([
|
|
41
|
+
z.string(),
|
|
42
|
+
workspaceDependencySchema,
|
|
43
|
+
pathDependencySchema,
|
|
44
|
+
gitDependencySchema,
|
|
45
|
+
registryDependencySchema
|
|
46
|
+
]);
|
|
47
|
+
const cargoInheritSchema = z.looseObject({ workspace: z.literal(true) });
|
|
48
|
+
const cargoWorkspaceSchema = z.looseObject({
|
|
27
49
|
members: z.array(z.string()).optional(),
|
|
28
50
|
exclude: z.array(z.string()).optional(),
|
|
29
|
-
package: z.
|
|
51
|
+
package: z.looseObject({
|
|
52
|
+
version: z.string().optional(),
|
|
53
|
+
publish: z.boolean().optional()
|
|
54
|
+
}).optional(),
|
|
55
|
+
dependencies: z.record(z.string(), cargoDependencySchema).optional(),
|
|
56
|
+
"dev-dependencies": z.record(z.string(), cargoDependencySchema).optional(),
|
|
57
|
+
"build-dependencies": z.record(z.string(), cargoDependencySchema).optional()
|
|
30
58
|
});
|
|
31
|
-
const cargoManifestSchema = z.
|
|
32
|
-
package:
|
|
59
|
+
const cargoManifestSchema = z.looseObject({
|
|
60
|
+
package: z.looseObject({
|
|
61
|
+
name: z.string(),
|
|
62
|
+
version: z.string().or(cargoInheritSchema),
|
|
63
|
+
publish: z.boolean().or(cargoInheritSchema).optional()
|
|
64
|
+
}).optional(),
|
|
33
65
|
workspace: cargoWorkspaceSchema.optional(),
|
|
34
66
|
dependencies: z.record(z.string(), cargoDependencySchema).optional(),
|
|
35
67
|
"dev-dependencies": z.record(z.string(), cargoDependencySchema).optional(),
|
|
36
68
|
"build-dependencies": z.record(z.string(), cargoDependencySchema).optional(),
|
|
37
|
-
target: z.record(z.string(),
|
|
69
|
+
target: z.record(z.string(), z.looseObject({
|
|
70
|
+
dependencies: z.record(z.string(), cargoDependencySchema).optional(),
|
|
71
|
+
"dev-dependencies": z.record(z.string(), cargoDependencySchema).optional(),
|
|
72
|
+
"build-dependencies": z.record(z.string(), cargoDependencySchema).optional()
|
|
73
|
+
})).optional()
|
|
38
74
|
});
|
|
39
75
|
//#endregion
|
|
40
76
|
//#region src/plugins/cargo.ts
|
|
@@ -43,44 +79,61 @@ const DEP_FIELDS = [
|
|
|
43
79
|
"dev-dependencies",
|
|
44
80
|
"build-dependencies"
|
|
45
81
|
];
|
|
46
|
-
var
|
|
82
|
+
var CargoToml = class {
|
|
47
83
|
path;
|
|
48
|
-
manifest;
|
|
49
84
|
content;
|
|
50
|
-
|
|
85
|
+
data;
|
|
86
|
+
dependencies;
|
|
87
|
+
workspace;
|
|
88
|
+
constructor(path, content, data) {
|
|
89
|
+
this.path = path;
|
|
90
|
+
this.content = content;
|
|
91
|
+
this.data = data;
|
|
92
|
+
}
|
|
93
|
+
listDependencies(graph) {
|
|
94
|
+
return this.dependencies ??= listDependencies(graph, this);
|
|
95
|
+
}
|
|
96
|
+
patch(path, value) {
|
|
97
|
+
this.content = edit(this.content, path, value);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var CargoPackage = class extends WorkspacePackage {
|
|
101
|
+
path;
|
|
102
|
+
file;
|
|
51
103
|
manager = "cargo";
|
|
52
|
-
|
|
104
|
+
manifest;
|
|
105
|
+
constructor(path, file) {
|
|
53
106
|
super();
|
|
54
107
|
this.path = path;
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.workspaceManifest = workspaceManifest;
|
|
108
|
+
this.file = file;
|
|
109
|
+
this.manifest = file.data;
|
|
58
110
|
}
|
|
59
111
|
get name() {
|
|
60
|
-
return this.
|
|
112
|
+
return this.manifest.package.name;
|
|
61
113
|
}
|
|
62
114
|
get version() {
|
|
63
|
-
|
|
115
|
+
const packageVersion = this.manifest.package.version;
|
|
116
|
+
if (typeof packageVersion === "string") return packageVersion;
|
|
117
|
+
const inherited = this.file.workspace?.data.workspace.package;
|
|
118
|
+
if (packageVersion.workspace && inherited?.version) return inherited.version;
|
|
119
|
+
throw new Error(`Invalid Cargo.toml in "${this.path}".`);
|
|
64
120
|
}
|
|
65
121
|
setVersion(version) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
get workspaceVersion() {
|
|
79
|
-
return this.workspaceManifest?.workspace?.package?.version;
|
|
122
|
+
const packageInfo = this.manifest.package;
|
|
123
|
+
if (typeof packageInfo.version === "string") {
|
|
124
|
+
packageInfo.version = version;
|
|
125
|
+
this.file.patch("package.version", version);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (packageInfo.version.workspace && this.file.workspace?.data.workspace.package) {
|
|
129
|
+
this.file.workspace.data.workspace.package.version = version;
|
|
130
|
+
this.file.workspace.patch("workspace.package.version", version);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
throw new Error(`Invalid Cargo.toml in "${this.path}".`);
|
|
80
134
|
}
|
|
81
135
|
};
|
|
82
136
|
function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
83
|
-
let active = false;
|
|
84
137
|
return {
|
|
85
138
|
name: "cargo",
|
|
86
139
|
enforce: "pre",
|
|
@@ -88,34 +141,33 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
88
141
|
await initToml();
|
|
89
142
|
},
|
|
90
143
|
async resolve() {
|
|
91
|
-
await
|
|
92
|
-
|
|
144
|
+
const graph = await resolveCargoGraph(this.cwd);
|
|
145
|
+
if (graph.packages.size === 0) return;
|
|
146
|
+
this.cargo = { graph };
|
|
147
|
+
for (const pkg of graph.packages.values()) this.graph.add(pkg);
|
|
93
148
|
},
|
|
94
149
|
initDraft(plan) {
|
|
95
|
-
if (!
|
|
150
|
+
if (!this.cargo) return;
|
|
96
151
|
plan.addPolicy(depsPolicy(this, getBumpDepType));
|
|
97
152
|
},
|
|
98
153
|
async publishPreflight({ pkg }) {
|
|
99
|
-
if (!(pkg instanceof CargoPackage)) return;
|
|
154
|
+
if (!(pkg instanceof CargoPackage) || !this.cargo) return;
|
|
155
|
+
let shouldPublish = true;
|
|
156
|
+
if (typeof pkg.manifest.package.publish === "boolean") shouldPublish = pkg.manifest.package.publish;
|
|
157
|
+
else if (pkg.manifest.package.publish?.workspace) shouldPublish = pkg.file.workspace?.data.workspace?.package?.publish ?? shouldPublish;
|
|
100
158
|
const wait = [];
|
|
101
|
-
for (const {
|
|
102
|
-
if (!dep || typeof dep === "string" || !dep.path) continue;
|
|
103
|
-
const id = `cargo:${dep.package ?? rawName}`;
|
|
104
|
-
const linked = this.graph.get(id);
|
|
105
|
-
if (!linked || !(linked instanceof CargoPackage)) continue;
|
|
106
|
-
wait.push(id);
|
|
107
|
-
}
|
|
159
|
+
for (const { resolved } of pkg.file.listDependencies(this.cargo.graph)) if (resolved) wait.push(resolved.id);
|
|
108
160
|
return {
|
|
109
|
-
shouldPublish
|
|
161
|
+
shouldPublish,
|
|
110
162
|
wait
|
|
111
163
|
};
|
|
112
164
|
},
|
|
113
165
|
resolvePlanStatus({ plan }) {
|
|
114
|
-
if (!
|
|
166
|
+
if (!this.cargo) return;
|
|
115
167
|
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
116
168
|
if (!preflight.shouldPublish) return;
|
|
117
169
|
const pkg = this.graph.get(id);
|
|
118
|
-
if (!(pkg instanceof CargoPackage)
|
|
170
|
+
if (!(pkg instanceof CargoPackage)) return;
|
|
119
171
|
if (!await isPackagePublished(pkg.name, pkg.version)) return "pending";
|
|
120
172
|
});
|
|
121
173
|
},
|
|
@@ -132,70 +184,57 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
132
184
|
return { type: "published" };
|
|
133
185
|
},
|
|
134
186
|
async applyDraft(draft) {
|
|
135
|
-
if (!
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
for (const pkg of graph.getPackages()) {
|
|
139
|
-
if (!(pkg instanceof CargoPackage)) continue;
|
|
187
|
+
if (!this.cargo) return;
|
|
188
|
+
const graph = this.cargo.graph;
|
|
189
|
+
for (const pkg of graph.packages.values()) {
|
|
140
190
|
const bumped = draft.getPackageDraft(pkg.id)?.bumpVersion(pkg);
|
|
141
191
|
if (bumped) pkg.setVersion(bumped);
|
|
142
192
|
}
|
|
143
|
-
for (const
|
|
144
|
-
if (!(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (!linked || !(linked instanceof CargoPackage)) continue;
|
|
151
|
-
if (!linked.version || semver$1.satisfies(linked.version, spec.version)) continue;
|
|
152
|
-
let updatedRange;
|
|
153
|
-
if (spec.version.startsWith("^")) updatedRange = `^${linked.version}`;
|
|
154
|
-
else if (spec.version.startsWith("~")) updatedRange = `~${linked.version}`;
|
|
155
|
-
else updatedRange = linked.version;
|
|
156
|
-
table[rawName] = spec.setVersion(updatedRange);
|
|
157
|
-
pkg.patch(typeof rawSpec === "string" ? `${tablePath}.${rawName}` : `${tablePath}.${rawName}.version`, updatedRange);
|
|
158
|
-
}
|
|
159
|
-
writes.push(pkg.write());
|
|
193
|
+
for (const file of graph.files.values()) for (const { range, resolved, setRange } of file.listDependencies(graph)) {
|
|
194
|
+
if (!resolved || !range || !setRange || semver$1.satisfies(resolved.version, range)) continue;
|
|
195
|
+
let updatedRange;
|
|
196
|
+
if (range.startsWith("^")) updatedRange = `^${resolved.version}`;
|
|
197
|
+
else if (range.startsWith("~")) updatedRange = `~${resolved.version}`;
|
|
198
|
+
else updatedRange = resolved.version;
|
|
199
|
+
setRange(updatedRange);
|
|
160
200
|
}
|
|
161
|
-
await Promise.all(
|
|
201
|
+
await Promise.all(Array.from(graph.files.values(), (file) => writeFile(file.path, file.content + "\n")));
|
|
162
202
|
},
|
|
163
203
|
async applyCliDraft() {
|
|
164
|
-
if (!
|
|
204
|
+
if (!this.cargo || !updateLockFile) return;
|
|
165
205
|
const result = await x("cargo", ["update", "--workspace"], { nodeOptions: { cwd: this.cwd } });
|
|
166
206
|
if (result.exitCode !== 0) throw execFailure("Failed to update Cargo lock file", result);
|
|
167
207
|
}
|
|
168
208
|
};
|
|
169
209
|
}
|
|
170
|
-
function depsPolicy({
|
|
210
|
+
function depsPolicy({ cargo }, getBumpDepType = ({ kind }) => {
|
|
171
211
|
switch (kind) {
|
|
172
212
|
case "dependencies": return "patch";
|
|
173
213
|
case "build-dependencies":
|
|
174
214
|
case "dev-dependencies": return false;
|
|
175
215
|
}
|
|
176
216
|
}) {
|
|
217
|
+
const cargoGraph = cargo.graph;
|
|
177
218
|
const dependentMap = /* @__PURE__ */ new Map();
|
|
178
|
-
for (const pkg of
|
|
179
|
-
if (!
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}]);
|
|
198
|
-
}
|
|
219
|
+
for (const pkg of cargoGraph.packages.values()) for (const { resolved, path, spec, range } of pkg.file.listDependencies(cargoGraph)) {
|
|
220
|
+
if (!resolved) continue;
|
|
221
|
+
const refs = dependentMap.get(resolved.id);
|
|
222
|
+
const kind = path[path.length - 2];
|
|
223
|
+
const name = path[path.length - 1];
|
|
224
|
+
if (refs) refs.push({
|
|
225
|
+
dependent: pkg,
|
|
226
|
+
kind,
|
|
227
|
+
name,
|
|
228
|
+
spec,
|
|
229
|
+
version: range
|
|
230
|
+
});
|
|
231
|
+
else dependentMap.set(resolved.id, [{
|
|
232
|
+
dependent: pkg,
|
|
233
|
+
kind,
|
|
234
|
+
name,
|
|
235
|
+
spec,
|
|
236
|
+
version: range
|
|
237
|
+
}]);
|
|
199
238
|
}
|
|
200
239
|
return {
|
|
201
240
|
id: "cargo:deps",
|
|
@@ -203,17 +242,16 @@ function depsPolicy({ graph }, getBumpDepType = ({ kind }) => {
|
|
|
203
242
|
if (!(pkg instanceof CargoPackage)) return;
|
|
204
243
|
const deps = dependentMap.get(pkg.id);
|
|
205
244
|
if (!deps) return;
|
|
206
|
-
const group = graph.getPackageGroup(pkg.id);
|
|
207
245
|
const bumped = plan.bumpVersion(pkg);
|
|
208
246
|
if (!bumped) return;
|
|
209
247
|
for (const dep of deps) {
|
|
210
|
-
if (group?.options.syncBump &&
|
|
211
|
-
if (semver$1.satisfies(bumped, dep.version)) continue;
|
|
248
|
+
if (pkg.group?.options.syncBump && dep.dependent.group === pkg.group) continue;
|
|
249
|
+
if (dep.version && semver$1.satisfies(bumped, dep.version)) continue;
|
|
212
250
|
const bumpType = getBumpDepType(dep);
|
|
213
251
|
if (bumpType === false) continue;
|
|
214
252
|
this.bumpPackage(dep.dependent, {
|
|
215
253
|
type: bumpType,
|
|
216
|
-
reason: `update dependency "${
|
|
254
|
+
reason: `update dependency "${pkg.name}"`
|
|
217
255
|
});
|
|
218
256
|
}
|
|
219
257
|
}
|
|
@@ -225,81 +263,139 @@ async function isPackagePublished(name, version) {
|
|
|
225
263
|
if (response.status === 404) return false;
|
|
226
264
|
throw new Error(`Unable to validate ${name}@${version} against crates.io: ${await response.text()}`);
|
|
227
265
|
}
|
|
228
|
-
async function buildEntry(
|
|
266
|
+
async function buildEntry(dir) {
|
|
229
267
|
try {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
content,
|
|
234
|
-
path
|
|
235
|
-
};
|
|
268
|
+
const filePath = path.join(dir, "Cargo.toml");
|
|
269
|
+
const content = await readFile(filePath, "utf8");
|
|
270
|
+
return new CargoToml(filePath, content, cargoManifestSchema.parse(parse$1(content)));
|
|
236
271
|
} catch {
|
|
237
272
|
return;
|
|
238
273
|
}
|
|
239
274
|
}
|
|
240
|
-
async function
|
|
275
|
+
async function resolveCargoGraph(cwd) {
|
|
276
|
+
const out = {
|
|
277
|
+
packages: /* @__PURE__ */ new Map(),
|
|
278
|
+
files: /* @__PURE__ */ new Map()
|
|
279
|
+
};
|
|
241
280
|
const root = await buildEntry(cwd);
|
|
242
|
-
if (!root) return;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
281
|
+
if (!root) return out;
|
|
282
|
+
out.files.set(root.path, root);
|
|
283
|
+
if (root.data.package) {
|
|
284
|
+
const pkg = new CargoPackage(cwd, root);
|
|
285
|
+
out.packages.set(pkg.name, pkg);
|
|
286
|
+
}
|
|
287
|
+
if (root.data.workspace?.members) {
|
|
288
|
+
root.workspace = root;
|
|
289
|
+
const dirs = await expandWorkspaceMembers(cwd, root.data.workspace.members, root.data.workspace.exclude);
|
|
290
|
+
await Promise.all(dirs.map(async (dir) => {
|
|
291
|
+
const entry = await buildEntry(dir);
|
|
292
|
+
if (!entry || !entry.data.package) return;
|
|
293
|
+
entry.workspace = root;
|
|
294
|
+
const pkg = new CargoPackage(dir, entry);
|
|
295
|
+
out.files.set(entry.path, entry);
|
|
296
|
+
out.packages.set(pkg.name, pkg);
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
return out;
|
|
249
300
|
}
|
|
250
301
|
async function expandWorkspaceMembers(cwd, members, exclude = []) {
|
|
251
|
-
const paths = members.includes(".") ? [cwd] : [];
|
|
252
302
|
const patterns = members.filter((member) => member !== ".");
|
|
253
|
-
if (patterns.length
|
|
303
|
+
if (patterns.length === 0) return [];
|
|
304
|
+
return (await glob(patterns, {
|
|
254
305
|
absolute: true,
|
|
255
306
|
cwd,
|
|
256
307
|
ignore: ["**/target/**", ...exclude],
|
|
257
308
|
onlyDirectories: true,
|
|
258
309
|
onlyFiles: false
|
|
259
|
-
}))
|
|
260
|
-
|
|
310
|
+
})).map((item) => {
|
|
311
|
+
return item.endsWith(path.sep) ? item.slice(0, -1) : item;
|
|
312
|
+
});
|
|
261
313
|
}
|
|
262
|
-
function
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
const table = manifest[field];
|
|
266
|
-
if (table) {
|
|
267
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
268
|
-
tables.push({
|
|
269
|
-
kind: field,
|
|
270
|
-
table,
|
|
271
|
-
path
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
const target = manifest.target;
|
|
276
|
-
if (target) for (const [targetKey, targetConfig] of Object.entries(target)) {
|
|
277
|
-
const targetPath = prefix ? `${prefix}.target.${targetKey}` : `target.${targetKey}`;
|
|
314
|
+
function listDependencies(graph, file) {
|
|
315
|
+
const out = [];
|
|
316
|
+
function scan(obj, prefix = []) {
|
|
278
317
|
for (const field of DEP_FIELDS) {
|
|
279
|
-
const table =
|
|
280
|
-
if (table)
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
318
|
+
const table = obj[field];
|
|
319
|
+
if (!table) continue;
|
|
320
|
+
const tablePath = [...prefix, field];
|
|
321
|
+
for (const [key, spec] of Object.entries(table)) {
|
|
322
|
+
const { linked, range, setRange } = resolveLinkedDep(file, graph, tablePath, key, spec) ?? {};
|
|
323
|
+
out.push({
|
|
324
|
+
path: [...tablePath, key],
|
|
325
|
+
spec,
|
|
326
|
+
resolved: linked,
|
|
327
|
+
range,
|
|
328
|
+
setRange: setRange && ((v) => {
|
|
329
|
+
table[key] = setRange(v);
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
}
|
|
285
333
|
}
|
|
286
334
|
}
|
|
287
|
-
|
|
335
|
+
scan(file.data);
|
|
336
|
+
if (file.data.target) for (const [key, config] of Object.entries(file.data.target)) scan(config, ["target", key]);
|
|
337
|
+
if (file.data.workspace) scan(file.data.workspace);
|
|
338
|
+
return out;
|
|
288
339
|
}
|
|
289
|
-
function
|
|
290
|
-
if (typeof
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
340
|
+
function resolveLinkedDep(file, graph, tablePath, key, spec) {
|
|
341
|
+
if (typeof spec === "string") {
|
|
342
|
+
const linked = graph.packages.get(key);
|
|
343
|
+
if (!linked) return;
|
|
344
|
+
return {
|
|
345
|
+
linked,
|
|
346
|
+
range: spec,
|
|
347
|
+
setRange(v) {
|
|
348
|
+
file.patch([...tablePath, key].join("."), v);
|
|
349
|
+
return v;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
if ("git" in spec) return;
|
|
354
|
+
if ("workspace" in spec) {
|
|
355
|
+
const kind = tablePath[tablePath.length - 1];
|
|
356
|
+
const entry = file.workspace?.data.workspace?.[kind]?.[key];
|
|
357
|
+
if (!entry) return;
|
|
358
|
+
const resolved = resolveLinkedDep(file.workspace, graph, ["workspace", kind], key, entry);
|
|
359
|
+
if (!resolved) return;
|
|
360
|
+
delete resolved.setRange;
|
|
361
|
+
return resolved;
|
|
362
|
+
}
|
|
363
|
+
if ("path" in spec) {
|
|
364
|
+
const pkgPath = path.resolve(path.dirname(file.path), spec.path);
|
|
365
|
+
for (const pkg of graph.packages.values()) {
|
|
366
|
+
if (pkg.path !== pkgPath) continue;
|
|
367
|
+
return {
|
|
368
|
+
linked: pkg,
|
|
369
|
+
range: spec.version,
|
|
370
|
+
setRange(v) {
|
|
371
|
+
file.patch([
|
|
372
|
+
...tablePath,
|
|
373
|
+
key,
|
|
374
|
+
"version"
|
|
375
|
+
].join("."), v);
|
|
376
|
+
return {
|
|
377
|
+
...spec,
|
|
378
|
+
version: v
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
};
|
|
294
382
|
}
|
|
295
|
-
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const linked = graph.packages.get(spec.package ?? key);
|
|
386
|
+
if (!linked) return;
|
|
296
387
|
return {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
388
|
+
linked,
|
|
389
|
+
range: spec.version,
|
|
390
|
+
setRange(v) {
|
|
391
|
+
file.patch([
|
|
392
|
+
...tablePath,
|
|
393
|
+
key,
|
|
394
|
+
"version"
|
|
395
|
+
].join("."), v);
|
|
300
396
|
return {
|
|
301
|
-
...
|
|
302
|
-
version
|
|
397
|
+
...spec,
|
|
398
|
+
version: v
|
|
303
399
|
};
|
|
304
400
|
}
|
|
305
401
|
};
|
package/dist/plugins/git.d.ts
CHANGED
package/dist/plugins/git.js
CHANGED
|
@@ -43,9 +43,8 @@ function git(options = {}) {
|
|
|
43
43
|
const { graph } = this;
|
|
44
44
|
for (const [id, packagePlan] of plan.packages) {
|
|
45
45
|
const pkg = graph.get(id);
|
|
46
|
-
const group = graph.getPackageGroup(pkg.id);
|
|
47
46
|
packagePlan.git ??= {};
|
|
48
|
-
if (group?.options.syncGitTag && pkg.version) packagePlan.git.tag = `${group.name}@${pkg.version}`;
|
|
47
|
+
if (pkg.group?.options.syncGitTag && pkg.version) packagePlan.git.tag = `${pkg.group.name}@${pkg.version}`;
|
|
49
48
|
else if (pkg.version) packagePlan.git.tag = `${pkg.name}@${pkg.version}`;
|
|
50
49
|
}
|
|
51
50
|
},
|
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as WorkspacePackage, k as Draft, s as TegamiPlugin, t as Awaitable, x as TegamiContext, y as PublishPlan } from "../types-BoQR7Hlg.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/github.d.ts
|
package/dist/plugins/github.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
2
|
import { t as changelogFilename } from "../generate-Rvz4Lu98.js";
|
|
3
3
|
import { a as cached, n as execFailure, o as isCI } from "../error-BhMYq9iW.js";
|
|
4
|
-
import { n as createDraft, o as readChangelogEntries } from "../draft-
|
|
4
|
+
import { n as createDraft, o as readChangelogEntries } from "../draft-BLbt4bSG.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
6
|
import { n as createVersionRequestBody, r as hasGitChanges, t as commitVersionBranchChanges } from "../version-request-oxy16TJ1.js";
|
|
7
7
|
import { readFile, writeFile } from "node:fs/promises";
|
package/dist/plugins/gitlab.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as WorkspacePackage, k as Draft, s as TegamiPlugin, t as Awaitable, x as TegamiContext, y as PublishPlan } from "../types-BoQR7Hlg.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/gitlab.d.ts
|
package/dist/plugins/gitlab.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
2
|
import { t as changelogFilename } from "../generate-Rvz4Lu98.js";
|
|
3
3
|
import { a as cached, n as execFailure, o as isCI, s as joinPath } from "../error-BhMYq9iW.js";
|
|
4
|
-
import { n as createDraft, o as readChangelogEntries } from "../draft-
|
|
4
|
+
import { n as createDraft, o as readChangelogEntries } from "../draft-BLbt4bSG.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
6
|
import { n as createVersionRequestBody, r as hasGitChanges, t as commitVersionBranchChanges } from "../version-request-oxy16TJ1.js";
|
|
7
7
|
import { readFile, writeFile } from "node:fs/promises";
|
package/dist/plugins/go.d.ts
CHANGED
package/dist/plugins/go.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as isNodeError, n as execFailure } from "../error-BhMYq9iW.js";
|
|
2
|
-
import { n as WorkspacePackage } from "../graph-
|
|
2
|
+
import { n as WorkspacePackage } from "../graph-BmXTJZxx.js";
|
|
3
3
|
import { relative, resolve } from "node:path";
|
|
4
4
|
import { x } from "tinyexec";
|
|
5
5
|
import * as semver$1 from "semver";
|
|
@@ -135,7 +135,7 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
135
135
|
},
|
|
136
136
|
async publishPreflight({ pkg }) {
|
|
137
137
|
if (!(pkg instanceof GoPackage)) return;
|
|
138
|
-
const shouldPublish = pkg.
|
|
138
|
+
const shouldPublish = pkg.options.go?.publish ?? pkg.group?.options?.go?.publish ?? true;
|
|
139
139
|
const wait = [];
|
|
140
140
|
for (const [moduleName] of pkg.mod.requires) {
|
|
141
141
|
const linked = this.graph.get(`go:${moduleName}`);
|
|
@@ -205,11 +205,10 @@ function depsPolicy({ graph }, getBumpDepType = () => "patch") {
|
|
|
205
205
|
if (!(pkg instanceof GoPackage)) return;
|
|
206
206
|
const deps = dependentMap.get(pkg.id);
|
|
207
207
|
if (!deps) return;
|
|
208
|
-
const group = graph.getPackageGroup(pkg.id);
|
|
209
208
|
const bumped = plan.bumpVersion(pkg);
|
|
210
209
|
if (!bumped) return;
|
|
211
210
|
for (const dep of deps) {
|
|
212
|
-
if (group?.options.syncBump &&
|
|
211
|
+
if (pkg.group?.options.syncBump && dep.dependent.group === pkg.group) continue;
|
|
213
212
|
if (semver$1.satisfies(bumped, stripGoVersion(dep.version))) continue;
|
|
214
213
|
const bumpType = getBumpDepType?.(dep);
|
|
215
214
|
if (bumpType === false) continue;
|
package/dist/providers/npm.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as npm, l as NpmPackage, u as NpmPluginOptions } from "../types-
|
|
1
|
+
import { d as npm, l as NpmPackage, u as NpmPluginOptions } from "../types-BoQR7Hlg.js";
|
|
2
2
|
export { NpmPackage, NpmPluginOptions, npm };
|
package/dist/providers/npm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as npm, t as NpmPackage } from "../npm-
|
|
1
|
+
import { n as npm, t as NpmPackage } from "../npm-Cj685Ddn.js";
|
|
2
2
|
export { NpmPackage, npm };
|