pubm 0.2.5 → 0.2.7

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/bin/cli.js CHANGED
@@ -5521,6 +5521,31 @@ var RustEcosystem = class extends Ecosystem {
5521
5521
  pkg.version = newVersion;
5522
5522
  await writeFile(filePath, stringify(cargo));
5523
5523
  }
5524
+ /**
5525
+ * Update the `version` field of dependencies that match sibling crate names.
5526
+ * This ensures `cargo publish` works when crates depend on each other via path.
5527
+ */
5528
+ async updateSiblingDependencyVersions(siblingVersions) {
5529
+ const filePath = path8.join(this.packagePath, "Cargo.toml");
5530
+ const raw = await readFile(filePath, "utf-8");
5531
+ const cargo = parse(raw);
5532
+ let modified = false;
5533
+ for (const section of ["dependencies", "build-dependencies"]) {
5534
+ const sectionData = cargo[section];
5535
+ if (!sectionData) continue;
5536
+ for (const [depName, depValue] of Object.entries(sectionData)) {
5537
+ if (typeof depValue === "object" && depValue !== null && "path" in depValue && siblingVersions.has(depName)) {
5538
+ const dep = depValue;
5539
+ dep.version = siblingVersions.get(depName);
5540
+ modified = true;
5541
+ }
5542
+ }
5543
+ }
5544
+ if (modified) {
5545
+ await writeFile(filePath, stringify(cargo));
5546
+ }
5547
+ return modified;
5548
+ }
5524
5549
  async syncLockfile() {
5525
5550
  const lockfilePath = await this.findLockfile();
5526
5551
  if (!lockfilePath) return void 0;
@@ -5839,8 +5864,15 @@ async function replaceVersion(version2, packages) {
5839
5864
  );
5840
5865
  }
5841
5866
  return "jsr.json";
5842
- })(),
5843
- ...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
5867
+ })()
5868
+ ]);
5869
+ const cratePackages = (packages ?? []).filter(
5870
+ (pkg) => pkg.registries.includes("crates")
5871
+ );
5872
+ const crateFiles = [];
5873
+ if (cratePackages.length > 0) {
5874
+ const ecosystems = [];
5875
+ for (const pkg of cratePackages) {
5844
5876
  const eco = new RustEcosystem(path9.resolve(pkg.path));
5845
5877
  try {
5846
5878
  await eco.writeVersion(version2);
@@ -5850,19 +5882,38 @@ async function replaceVersion(version2, packages) {
5850
5882
  { cause: error }
5851
5883
  );
5852
5884
  }
5853
- let lockfilePath;
5885
+ ecosystems.push({ eco, pkg });
5886
+ }
5887
+ if (ecosystems.length > 1) {
5888
+ const siblingVersions = /* @__PURE__ */ new Map();
5889
+ for (const { eco } of ecosystems) {
5890
+ siblingVersions.set(await eco.packageName(), version2);
5891
+ }
5892
+ await Promise.all(
5893
+ ecosystems.map(
5894
+ ({ eco }) => eco.updateSiblingDependencyVersions(siblingVersions)
5895
+ )
5896
+ );
5897
+ }
5898
+ for (const { eco, pkg } of ecosystems) {
5899
+ crateFiles.push(path9.join(pkg.path, "Cargo.toml"));
5854
5900
  try {
5855
- lockfilePath = await eco.syncLockfile();
5901
+ const lockfilePath = await eco.syncLockfile();
5902
+ if (lockfilePath) crateFiles.push(lockfilePath);
5856
5903
  } catch (error) {
5857
5904
  throw new AbstractError(
5858
5905
  `Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5859
5906
  { cause: error }
5860
5907
  );
5861
5908
  }
5862
- return [path9.join(pkg.path, "Cargo.toml"), lockfilePath];
5863
- })
5864
- ]);
5865
- return [...new Set(results.flat().filter((v) => !!v))];
5909
+ }
5910
+ }
5911
+ const allFiles = [];
5912
+ for (const r of results) {
5913
+ if (r) allFiles.push(r);
5914
+ }
5915
+ allFiles.push(...crateFiles);
5916
+ return [...new Set(allFiles)];
5866
5917
  }
5867
5918
 
5868
5919
  // src/utils/package-manager.ts
@@ -5993,7 +6044,7 @@ ${stderr}` : "Failed to run `cargo publish`";
5993
6044
  }
5994
6045
  async dryRunPublish(manifestDir) {
5995
6046
  try {
5996
- const args = ["publish", "--dry-run"];
6047
+ const args = ["publish", "--dry-run", "--no-verify"];
5997
6048
  if (manifestDir) {
5998
6049
  args.push("--manifest-path", path10.join(manifestDir, "Cargo.toml"));
5999
6050
  }
@@ -7673,7 +7724,7 @@ async function run(options) {
7673
7724
  }
7674
7725
  },
7675
7726
  {
7676
- skip: (ctx2) => options.skipPublish || !!ctx2.preview || options.preflight,
7727
+ skip: (ctx2) => !!options.skipPublish || !!ctx2.preview || !!options.preflight,
7677
7728
  title: "Publishing",
7678
7729
  task: async (ctx2, parentTask) => parentTask.newListr(await collectPublishTasks(ctx2), {
7679
7730
  concurrent: true
@@ -7699,7 +7750,7 @@ async function run(options) {
7699
7750
  }
7700
7751
  },
7701
7752
  {
7702
- skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
7753
+ skip: (ctx2) => !!options.skipReleaseDraft || !!ctx2.preview,
7703
7754
  title: "Creating release draft on GitHub",
7704
7755
  task: async (ctx2, task) => {
7705
7756
  const git = new Git();
package/dist/index.cjs CHANGED
@@ -4861,6 +4861,31 @@ var RustEcosystem = class extends Ecosystem {
4861
4861
  pkg.version = newVersion;
4862
4862
  await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
4863
4863
  }
4864
+ /**
4865
+ * Update the `version` field of dependencies that match sibling crate names.
4866
+ * This ensures `cargo publish` works when crates depend on each other via path.
4867
+ */
4868
+ async updateSiblingDependencyVersions(siblingVersions) {
4869
+ const filePath = import_node_path2.default.join(this.packagePath, "Cargo.toml");
4870
+ const raw = await (0, import_promises2.readFile)(filePath, "utf-8");
4871
+ const cargo = (0, import_smol_toml.parse)(raw);
4872
+ let modified = false;
4873
+ for (const section of ["dependencies", "build-dependencies"]) {
4874
+ const sectionData = cargo[section];
4875
+ if (!sectionData) continue;
4876
+ for (const [depName, depValue] of Object.entries(sectionData)) {
4877
+ if (typeof depValue === "object" && depValue !== null && "path" in depValue && siblingVersions.has(depName)) {
4878
+ const dep = depValue;
4879
+ dep.version = siblingVersions.get(depName);
4880
+ modified = true;
4881
+ }
4882
+ }
4883
+ }
4884
+ if (modified) {
4885
+ await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
4886
+ }
4887
+ return modified;
4888
+ }
4864
4889
  async syncLockfile() {
4865
4890
  const lockfilePath = await this.findLockfile();
4866
4891
  if (!lockfilePath) return void 0;
@@ -5179,8 +5204,15 @@ async function replaceVersion(version2, packages) {
5179
5204
  );
5180
5205
  }
5181
5206
  return "jsr.json";
5182
- })(),
5183
- ...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
5207
+ })()
5208
+ ]);
5209
+ const cratePackages = (packages ?? []).filter(
5210
+ (pkg) => pkg.registries.includes("crates")
5211
+ );
5212
+ const crateFiles = [];
5213
+ if (cratePackages.length > 0) {
5214
+ const ecosystems = [];
5215
+ for (const pkg of cratePackages) {
5184
5216
  const eco = new RustEcosystem(import_node_path3.default.resolve(pkg.path));
5185
5217
  try {
5186
5218
  await eco.writeVersion(version2);
@@ -5190,19 +5222,38 @@ async function replaceVersion(version2, packages) {
5190
5222
  { cause: error }
5191
5223
  );
5192
5224
  }
5193
- let lockfilePath;
5225
+ ecosystems.push({ eco, pkg });
5226
+ }
5227
+ if (ecosystems.length > 1) {
5228
+ const siblingVersions = /* @__PURE__ */ new Map();
5229
+ for (const { eco } of ecosystems) {
5230
+ siblingVersions.set(await eco.packageName(), version2);
5231
+ }
5232
+ await Promise.all(
5233
+ ecosystems.map(
5234
+ ({ eco }) => eco.updateSiblingDependencyVersions(siblingVersions)
5235
+ )
5236
+ );
5237
+ }
5238
+ for (const { eco, pkg } of ecosystems) {
5239
+ crateFiles.push(import_node_path3.default.join(pkg.path, "Cargo.toml"));
5194
5240
  try {
5195
- lockfilePath = await eco.syncLockfile();
5241
+ const lockfilePath = await eco.syncLockfile();
5242
+ if (lockfilePath) crateFiles.push(lockfilePath);
5196
5243
  } catch (error) {
5197
5244
  throw new AbstractError(
5198
5245
  `Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5199
5246
  { cause: error }
5200
5247
  );
5201
5248
  }
5202
- return [import_node_path3.default.join(pkg.path, "Cargo.toml"), lockfilePath];
5203
- })
5204
- ]);
5205
- return [...new Set(results.flat().filter((v) => !!v))];
5249
+ }
5250
+ }
5251
+ const allFiles = [];
5252
+ for (const r of results) {
5253
+ if (r) allFiles.push(r);
5254
+ }
5255
+ allFiles.push(...crateFiles);
5256
+ return [...new Set(allFiles)];
5206
5257
  }
5207
5258
 
5208
5259
  // src/utils/package-manager.ts
@@ -5456,7 +5507,7 @@ ${stderr}` : "Failed to run `cargo publish`";
5456
5507
  }
5457
5508
  async dryRunPublish(manifestDir) {
5458
5509
  try {
5459
- const args = ["publish", "--dry-run"];
5510
+ const args = ["publish", "--dry-run", "--no-verify"];
5460
5511
  if (manifestDir) {
5461
5512
  args.push("--manifest-path", import_node_path5.default.join(manifestDir, "Cargo.toml"));
5462
5513
  }
@@ -7212,7 +7263,7 @@ async function run(options) {
7212
7263
  }
7213
7264
  },
7214
7265
  {
7215
- skip: (ctx2) => options.skipPublish || !!ctx2.preview || options.preflight,
7266
+ skip: (ctx2) => !!options.skipPublish || !!ctx2.preview || !!options.preflight,
7216
7267
  title: "Publishing",
7217
7268
  task: async (ctx2, parentTask) => parentTask.newListr(await collectPublishTasks(ctx2), {
7218
7269
  concurrent: true
@@ -7238,7 +7289,7 @@ async function run(options) {
7238
7289
  }
7239
7290
  },
7240
7291
  {
7241
- skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
7292
+ skip: (ctx2) => !!options.skipReleaseDraft || !!ctx2.preview,
7242
7293
  title: "Creating release draft on GitHub",
7243
7294
  task: async (ctx2, task) => {
7244
7295
  const git = new Git();
package/dist/index.js CHANGED
@@ -4828,6 +4828,31 @@ var RustEcosystem = class extends Ecosystem {
4828
4828
  pkg.version = newVersion;
4829
4829
  await writeFile(filePath, stringify(cargo));
4830
4830
  }
4831
+ /**
4832
+ * Update the `version` field of dependencies that match sibling crate names.
4833
+ * This ensures `cargo publish` works when crates depend on each other via path.
4834
+ */
4835
+ async updateSiblingDependencyVersions(siblingVersions) {
4836
+ const filePath = path2.join(this.packagePath, "Cargo.toml");
4837
+ const raw = await readFile(filePath, "utf-8");
4838
+ const cargo = parse(raw);
4839
+ let modified = false;
4840
+ for (const section of ["dependencies", "build-dependencies"]) {
4841
+ const sectionData = cargo[section];
4842
+ if (!sectionData) continue;
4843
+ for (const [depName, depValue] of Object.entries(sectionData)) {
4844
+ if (typeof depValue === "object" && depValue !== null && "path" in depValue && siblingVersions.has(depName)) {
4845
+ const dep = depValue;
4846
+ dep.version = siblingVersions.get(depName);
4847
+ modified = true;
4848
+ }
4849
+ }
4850
+ }
4851
+ if (modified) {
4852
+ await writeFile(filePath, stringify(cargo));
4853
+ }
4854
+ return modified;
4855
+ }
4831
4856
  async syncLockfile() {
4832
4857
  const lockfilePath = await this.findLockfile();
4833
4858
  if (!lockfilePath) return void 0;
@@ -5146,8 +5171,15 @@ async function replaceVersion(version2, packages) {
5146
5171
  );
5147
5172
  }
5148
5173
  return "jsr.json";
5149
- })(),
5150
- ...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
5174
+ })()
5175
+ ]);
5176
+ const cratePackages = (packages ?? []).filter(
5177
+ (pkg) => pkg.registries.includes("crates")
5178
+ );
5179
+ const crateFiles = [];
5180
+ if (cratePackages.length > 0) {
5181
+ const ecosystems = [];
5182
+ for (const pkg of cratePackages) {
5151
5183
  const eco = new RustEcosystem(path3.resolve(pkg.path));
5152
5184
  try {
5153
5185
  await eco.writeVersion(version2);
@@ -5157,19 +5189,38 @@ async function replaceVersion(version2, packages) {
5157
5189
  { cause: error }
5158
5190
  );
5159
5191
  }
5160
- let lockfilePath;
5192
+ ecosystems.push({ eco, pkg });
5193
+ }
5194
+ if (ecosystems.length > 1) {
5195
+ const siblingVersions = /* @__PURE__ */ new Map();
5196
+ for (const { eco } of ecosystems) {
5197
+ siblingVersions.set(await eco.packageName(), version2);
5198
+ }
5199
+ await Promise.all(
5200
+ ecosystems.map(
5201
+ ({ eco }) => eco.updateSiblingDependencyVersions(siblingVersions)
5202
+ )
5203
+ );
5204
+ }
5205
+ for (const { eco, pkg } of ecosystems) {
5206
+ crateFiles.push(path3.join(pkg.path, "Cargo.toml"));
5161
5207
  try {
5162
- lockfilePath = await eco.syncLockfile();
5208
+ const lockfilePath = await eco.syncLockfile();
5209
+ if (lockfilePath) crateFiles.push(lockfilePath);
5163
5210
  } catch (error) {
5164
5211
  throw new AbstractError(
5165
5212
  `Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5166
5213
  { cause: error }
5167
5214
  );
5168
5215
  }
5169
- return [path3.join(pkg.path, "Cargo.toml"), lockfilePath];
5170
- })
5171
- ]);
5172
- return [...new Set(results.flat().filter((v) => !!v))];
5216
+ }
5217
+ }
5218
+ const allFiles = [];
5219
+ for (const r of results) {
5220
+ if (r) allFiles.push(r);
5221
+ }
5222
+ allFiles.push(...crateFiles);
5223
+ return [...new Set(allFiles)];
5173
5224
  }
5174
5225
 
5175
5226
  // src/utils/package-manager.ts
@@ -5422,7 +5473,7 @@ ${stderr}` : "Failed to run `cargo publish`";
5422
5473
  }
5423
5474
  async dryRunPublish(manifestDir) {
5424
5475
  try {
5425
- const args = ["publish", "--dry-run"];
5476
+ const args = ["publish", "--dry-run", "--no-verify"];
5426
5477
  if (manifestDir) {
5427
5478
  args.push("--manifest-path", path5.join(manifestDir, "Cargo.toml"));
5428
5479
  }
@@ -7176,7 +7227,7 @@ async function run(options) {
7176
7227
  }
7177
7228
  },
7178
7229
  {
7179
- skip: (ctx2) => options.skipPublish || !!ctx2.preview || options.preflight,
7230
+ skip: (ctx2) => !!options.skipPublish || !!ctx2.preview || !!options.preflight,
7180
7231
  title: "Publishing",
7181
7232
  task: async (ctx2, parentTask) => parentTask.newListr(await collectPublishTasks(ctx2), {
7182
7233
  concurrent: true
@@ -7202,7 +7253,7 @@ async function run(options) {
7202
7253
  }
7203
7254
  },
7204
7255
  {
7205
- skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
7256
+ skip: (ctx2) => !!options.skipReleaseDraft || !!ctx2.preview,
7206
7257
  title: "Creating release draft on GitHub",
7207
7258
  task: async (ctx2, task) => {
7208
7259
  const git = new Git();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"