pubm 0.1.5 → 0.1.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.
Files changed (4) hide show
  1. package/bin/cli.js +237 -174
  2. package/dist/index.cjs +257 -194
  3. package/dist/index.js +254 -191
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4821,9 +4821,71 @@ function createListr(...args) {
4821
4821
  }
4822
4822
 
4823
4823
  // src/utils/package.ts
4824
+ import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
4825
+ import path3 from "node:path";
4826
+ import process7 from "node:process";
4827
+
4828
+ // src/ecosystem/rust.ts
4824
4829
  import { readFile, stat as stat2, writeFile } from "node:fs/promises";
4825
4830
  import path2 from "node:path";
4826
- import process7 from "node:process";
4831
+ import { parse, stringify } from "smol-toml";
4832
+
4833
+ // src/ecosystem/ecosystem.ts
4834
+ var Ecosystem = class {
4835
+ constructor(packagePath) {
4836
+ this.packagePath = packagePath;
4837
+ }
4838
+ };
4839
+
4840
+ // src/ecosystem/rust.ts
4841
+ var RustEcosystem = class extends Ecosystem {
4842
+ static async detect(packagePath) {
4843
+ try {
4844
+ return (await stat2(path2.join(packagePath, "Cargo.toml"))).isFile();
4845
+ } catch {
4846
+ return false;
4847
+ }
4848
+ }
4849
+ async readCargoToml() {
4850
+ const raw = await readFile(
4851
+ path2.join(this.packagePath, "Cargo.toml"),
4852
+ "utf-8"
4853
+ );
4854
+ return parse(raw);
4855
+ }
4856
+ async packageName() {
4857
+ const cargo = await this.readCargoToml();
4858
+ const pkg = cargo.package;
4859
+ return pkg.name;
4860
+ }
4861
+ async readVersion() {
4862
+ const cargo = await this.readCargoToml();
4863
+ const pkg = cargo.package;
4864
+ return pkg.version;
4865
+ }
4866
+ async writeVersion(newVersion) {
4867
+ const filePath = path2.join(this.packagePath, "Cargo.toml");
4868
+ const raw = await readFile(filePath, "utf-8");
4869
+ const cargo = parse(raw);
4870
+ const pkg = cargo.package;
4871
+ pkg.version = newVersion;
4872
+ await writeFile(filePath, stringify(cargo));
4873
+ }
4874
+ manifestFiles() {
4875
+ return ["Cargo.toml"];
4876
+ }
4877
+ defaultTestCommand() {
4878
+ return "cargo test";
4879
+ }
4880
+ defaultBuildCommand() {
4881
+ return "cargo build --release";
4882
+ }
4883
+ supportedRegistries() {
4884
+ return ["crates"];
4885
+ }
4886
+ };
4887
+
4888
+ // src/utils/package.ts
4827
4889
  var cachedPackageJson = {};
4828
4890
  var cachedJsrJson = {};
4829
4891
  function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
@@ -4832,16 +4894,16 @@ function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
4832
4894
  async function findOutFile(file, { cwd = process7.cwd() } = {}) {
4833
4895
  let directory = cwd;
4834
4896
  let filePath = "";
4835
- const { root } = path2.parse(cwd);
4897
+ const { root } = path3.parse(cwd);
4836
4898
  while (directory) {
4837
- filePath = path2.join(directory, file);
4899
+ filePath = path3.join(directory, file);
4838
4900
  try {
4839
- if ((await stat2(filePath)).isFile()) {
4901
+ if ((await stat3(filePath)).isFile()) {
4840
4902
  break;
4841
4903
  }
4842
4904
  } catch {
4843
4905
  }
4844
- directory = path2.dirname(directory);
4906
+ directory = path3.dirname(directory);
4845
4907
  if (directory === root) return null;
4846
4908
  }
4847
4909
  return filePath;
@@ -4853,7 +4915,7 @@ async function getPackageJson({
4853
4915
  if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
4854
4916
  try {
4855
4917
  const packageJsonPath = await findOutFile("package.json");
4856
- const raw = packageJsonPath && (await readFile(packageJsonPath)).toString();
4918
+ const raw = packageJsonPath && (await readFile2(packageJsonPath)).toString();
4857
4919
  if (!raw) {
4858
4920
  if (!fallbackJsr) {
4859
4921
  throw new Error(
@@ -4886,7 +4948,7 @@ async function getJsrJson({
4886
4948
  if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
4887
4949
  try {
4888
4950
  const jsrJsonPath = await findOutFile("jsr.json");
4889
- const raw = jsrJsonPath && (await readFile(jsrJsonPath)).toString();
4951
+ const raw = jsrJsonPath && (await readFile2(jsrJsonPath)).toString();
4890
4952
  if (!raw) {
4891
4953
  if (!fallbackPackage) {
4892
4954
  throw new Error(
@@ -4970,14 +5032,14 @@ async function version({ cwd = process7.cwd() } = {}) {
4970
5032
  return version2;
4971
5033
  }
4972
5034
  var versionRegex = /("version"\s*:\s*")[^"]*(")/;
4973
- async function replaceVersion(version2) {
5035
+ async function replaceVersion(version2, packages) {
4974
5036
  const results = await Promise.all([
4975
5037
  (async () => {
4976
5038
  const packageJsonPath = await findOutFile("package.json");
4977
5039
  if (!packageJsonPath) return void 0;
4978
- const packageJson = (await readFile(packageJsonPath)).toString();
5040
+ const packageJson = (await readFile2(packageJsonPath)).toString();
4979
5041
  try {
4980
- await writeFile(
5042
+ await writeFile2(
4981
5043
  packageJsonPath,
4982
5044
  packageJson.replace(versionRegex, `$1${version2}$2`)
4983
5045
  );
@@ -4992,9 +5054,9 @@ async function replaceVersion(version2) {
4992
5054
  (async () => {
4993
5055
  const jsrJsonPath = await findOutFile("jsr.json");
4994
5056
  if (!jsrJsonPath) return void 0;
4995
- const jsrJson = (await readFile(jsrJsonPath)).toString();
5057
+ const jsrJson = (await readFile2(jsrJsonPath)).toString();
4996
5058
  try {
4997
- await writeFile(
5059
+ await writeFile2(
4998
5060
  jsrJsonPath,
4999
5061
  jsrJson.replace(versionRegex, `$1${version2}$2`)
5000
5062
  );
@@ -5005,7 +5067,19 @@ async function replaceVersion(version2) {
5005
5067
  );
5006
5068
  }
5007
5069
  return "jsr.json";
5008
- })()
5070
+ })(),
5071
+ ...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
5072
+ const eco = new RustEcosystem(path3.resolve(pkg.path));
5073
+ try {
5074
+ await eco.writeVersion(version2);
5075
+ } catch (error) {
5076
+ throw new AbstractError(
5077
+ `Failed to write version to Cargo.toml at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5078
+ { cause: error }
5079
+ );
5080
+ }
5081
+ return path3.join(pkg.path, "Cargo.toml");
5082
+ })
5009
5083
  ]);
5010
5084
  return results.filter((v) => v);
5011
5085
  }
@@ -5026,67 +5100,26 @@ async function getPackageManager() {
5026
5100
  return "npm";
5027
5101
  }
5028
5102
 
5029
- // src/ecosystem/rust.ts
5030
- import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
5031
- import path3 from "node:path";
5032
- import { parse, stringify } from "smol-toml";
5033
-
5034
- // src/ecosystem/ecosystem.ts
5035
- var Ecosystem = class {
5036
- constructor(packagePath) {
5037
- this.packagePath = packagePath;
5038
- }
5039
- };
5040
-
5041
- // src/ecosystem/rust.ts
5042
- var RustEcosystem = class extends Ecosystem {
5043
- static async detect(packagePath) {
5044
- try {
5045
- return (await stat3(path3.join(packagePath, "Cargo.toml"))).isFile();
5046
- } catch {
5047
- return false;
5103
+ // src/utils/registries.ts
5104
+ function collectRegistries(ctx) {
5105
+ if (ctx.packages?.length) {
5106
+ const seen = /* @__PURE__ */ new Set();
5107
+ const result = [];
5108
+ for (const pkg of ctx.packages) {
5109
+ for (const reg of pkg.registries) {
5110
+ if (!seen.has(reg)) {
5111
+ seen.add(reg);
5112
+ result.push(reg);
5113
+ }
5114
+ }
5048
5115
  }
5116
+ return result;
5049
5117
  }
5050
- async readCargoToml() {
5051
- const raw = await readFile2(
5052
- path3.join(this.packagePath, "Cargo.toml"),
5053
- "utf-8"
5054
- );
5055
- return parse(raw);
5056
- }
5057
- async packageName() {
5058
- const cargo = await this.readCargoToml();
5059
- const pkg = cargo.package;
5060
- return pkg.name;
5061
- }
5062
- async readVersion() {
5063
- const cargo = await this.readCargoToml();
5064
- const pkg = cargo.package;
5065
- return pkg.version;
5066
- }
5067
- async writeVersion(newVersion) {
5068
- const filePath = path3.join(this.packagePath, "Cargo.toml");
5069
- const raw = await readFile2(filePath, "utf-8");
5070
- const cargo = parse(raw);
5071
- const pkg = cargo.package;
5072
- pkg.version = newVersion;
5073
- await writeFile2(filePath, stringify(cargo));
5074
- }
5075
- manifestFiles() {
5076
- return ["Cargo.toml"];
5077
- }
5078
- defaultTestCommand() {
5079
- return "cargo test";
5080
- }
5081
- defaultBuildCommand() {
5082
- return "cargo build --release";
5083
- }
5084
- supportedRegistries() {
5085
- return ["crates"];
5086
- }
5087
- };
5118
+ return ctx.registries;
5119
+ }
5088
5120
 
5089
5121
  // src/registry/crates.ts
5122
+ import path4 from "node:path";
5090
5123
  import { exec as exec3 } from "tinyexec";
5091
5124
 
5092
5125
  // src/registry/registry.ts
@@ -5160,9 +5193,13 @@ var CratesRegistry = class extends Registry {
5160
5193
  );
5161
5194
  }
5162
5195
  }
5163
- async publish() {
5196
+ async publish(manifestDir) {
5164
5197
  try {
5165
- await exec3("cargo", ["publish"], { throwOnError: true });
5198
+ const args = ["publish"];
5199
+ if (manifestDir) {
5200
+ args.push("--manifest-path", path4.join(manifestDir, "Cargo.toml"));
5201
+ }
5202
+ await exec3("cargo", args, { throwOnError: true });
5166
5203
  return true;
5167
5204
  } catch (error) {
5168
5205
  throw new CratesError("Failed to run `cargo publish`", {
@@ -5218,35 +5255,43 @@ var CratesError2 = class extends AbstractError {
5218
5255
  this.stack = "";
5219
5256
  }
5220
5257
  };
5221
- async function getCrateName() {
5222
- const eco = new RustEcosystem(process.cwd());
5258
+ async function getCrateName(packagePath) {
5259
+ const eco = new RustEcosystem(packagePath ?? process.cwd());
5223
5260
  return await eco.packageName();
5224
5261
  }
5225
- var cratesAvailableCheckTasks = {
5226
- title: "Checking crates.io availability",
5227
- task: async () => {
5228
- const packageName = await getCrateName();
5229
- const registry = new CratesRegistry(packageName);
5230
- if (!await registry.isInstalled()) {
5231
- throw new CratesError2(
5232
- "cargo is not installed. Please install Rust toolchain to proceed."
5233
- );
5262
+ function createCratesAvailableCheckTask(packagePath) {
5263
+ const label = packagePath ? ` (${packagePath})` : "";
5264
+ return {
5265
+ title: `Checking crates.io availability${label}`,
5266
+ task: async () => {
5267
+ const packageName = await getCrateName(packagePath);
5268
+ const registry = new CratesRegistry(packageName);
5269
+ if (!await registry.isInstalled()) {
5270
+ throw new CratesError2(
5271
+ "cargo is not installed. Please install Rust toolchain to proceed."
5272
+ );
5273
+ }
5274
+ if (!await registry.hasPermission()) {
5275
+ throw new CratesError2(
5276
+ "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5277
+ );
5278
+ }
5234
5279
  }
5235
- if (!await registry.hasPermission()) {
5236
- throw new CratesError2(
5237
- "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5238
- );
5280
+ };
5281
+ }
5282
+ function createCratesPublishTask(packagePath) {
5283
+ const label = packagePath ? ` (${packagePath})` : "";
5284
+ return {
5285
+ title: `Publishing to crates.io${label}`,
5286
+ task: async () => {
5287
+ const packageName = await getCrateName(packagePath);
5288
+ const registry = new CratesRegistry(packageName);
5289
+ await registry.publish(packagePath);
5239
5290
  }
5240
- }
5241
- };
5242
- var cratesPublishTasks = {
5243
- title: "Publishing to crates.io",
5244
- task: async () => {
5245
- const packageName = await getCrateName();
5246
- const registry = new CratesRegistry(packageName);
5247
- await registry.publish();
5248
- }
5249
- };
5291
+ };
5292
+ }
5293
+ var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
5294
+ var cratesPublishTasks = createCratesPublishTask();
5250
5295
 
5251
5296
  // src/tasks/jsr.ts
5252
5297
  import process8 from "node:process";
@@ -5259,7 +5304,7 @@ import { exec as exec4, NonZeroExitError } from "tinyexec";
5259
5304
  // src/utils/db.ts
5260
5305
  import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
5261
5306
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
5262
- import path4 from "node:path";
5307
+ import path5 from "node:path";
5263
5308
  var a = "aes-256-cbc";
5264
5309
  var n = statSync(import.meta.dirname);
5265
5310
  var k = `${n.rdev}${n.birthtimeMs}${n.nlink}${n.gid}`;
@@ -5274,7 +5319,7 @@ function d(g, h) {
5274
5319
  }
5275
5320
  var Db = class {
5276
5321
  constructor() {
5277
- __publicField(this, "path", path4.resolve(import.meta.dirname, ".pubm"));
5322
+ __publicField(this, "path", path5.resolve(import.meta.dirname, ".pubm"));
5278
5323
  try {
5279
5324
  if (!statSync(this.path).isDirectory()) {
5280
5325
  mkdirSync(this.path);
@@ -5292,7 +5337,7 @@ var Db = class {
5292
5337
  set(field, value) {
5293
5338
  try {
5294
5339
  writeFileSync(
5295
- path4.resolve(
5340
+ path5.resolve(
5296
5341
  this.path,
5297
5342
  Buffer.from(e(field, field)).toString("base64")
5298
5343
  ),
@@ -5306,7 +5351,7 @@ var Db = class {
5306
5351
  }
5307
5352
  }
5308
5353
  get(field) {
5309
- const filePath = path4.resolve(
5354
+ const filePath = path5.resolve(
5310
5355
  this.path,
5311
5356
  Buffer.from(e(field, field)).toString("base64")
5312
5357
  );
@@ -6143,9 +6188,7 @@ var npmAvailableCheckTasks = {
6143
6188
  child.stderr?.on("data", onData);
6144
6189
  child.on(
6145
6190
  "close",
6146
- (code) => code === 0 ? resolve() : reject(
6147
- new Error(`npm login exited with code ${code}`)
6148
- )
6191
+ (code) => code === 0 ? resolve() : reject(new Error(`npm login exited with code ${code}`))
6149
6192
  );
6150
6193
  child.on("error", reject);
6151
6194
  });
@@ -6448,7 +6491,7 @@ var requiredConditionsCheckTask = (options) => createListr({
6448
6491
  {
6449
6492
  title: "Ping registries",
6450
6493
  task: (ctx, parentTask2) => parentTask2.newListr(
6451
- ctx.registries.map((registryKey) => ({
6494
+ collectRegistries(ctx).map((registryKey) => ({
6452
6495
  title: `Ping to ${registryKey}`,
6453
6496
  task: async () => {
6454
6497
  const registry = await getRegistry(registryKey);
@@ -6465,8 +6508,8 @@ var requiredConditionsCheckTask = (options) => createListr({
6465
6508
  task: async (_2, parentTask2) => parentTask2.newListr(
6466
6509
  [
6467
6510
  {
6468
- enabled: (ctx) => ctx.registries.some((registry) => registry !== "jsr"),
6469
- title: "Verifying if npm are installed",
6511
+ enabled: (ctx) => collectRegistries(ctx).includes("npm"),
6512
+ title: "Verifying if npm is installed",
6470
6513
  task: async () => {
6471
6514
  const npm = await npmRegistry();
6472
6515
  if (!await npm.isInstalled()) {
@@ -6477,7 +6520,9 @@ var requiredConditionsCheckTask = (options) => createListr({
6477
6520
  }
6478
6521
  },
6479
6522
  {
6480
- enabled: (ctx) => ctx.registries.some((registry) => registry === "jsr"),
6523
+ enabled: (ctx) => collectRegistries(ctx).some(
6524
+ (registry) => registry === "jsr"
6525
+ ),
6481
6526
  title: "Verifying if jsr are installed",
6482
6527
  task: async (_3, task) => {
6483
6528
  const jsr = await jsrRegistry();
@@ -6508,7 +6553,7 @@ var requiredConditionsCheckTask = (options) => createListr({
6508
6553
  },
6509
6554
  {
6510
6555
  title: "Checking if test and build scripts exist",
6511
- skip: (ctx) => !needsPackageScripts(ctx.registries),
6556
+ skip: (ctx) => !needsPackageScripts(collectRegistries(ctx)),
6512
6557
  task: async (ctx) => {
6513
6558
  const { scripts } = await getPackageJson();
6514
6559
  const errors = [];
@@ -6536,23 +6581,42 @@ var requiredConditionsCheckTask = (options) => createListr({
6536
6581
  },
6537
6582
  {
6538
6583
  title: "Checking available registries for publishing",
6539
- task: (ctx, parentTask2) => parentTask2.newListr(
6540
- ctx.registries.map((registryKey) => {
6541
- switch (registryKey) {
6542
- case "npm":
6543
- return npmAvailableCheckTasks;
6544
- case "jsr":
6545
- return jsrAvailableCheckTasks;
6546
- case "crates":
6547
- return cratesAvailableCheckTasks;
6548
- default:
6549
- return npmAvailableCheckTasks;
6550
- }
6551
- }),
6552
- {
6553
- concurrent: true
6584
+ task: (ctx, parentTask2) => {
6585
+ if (ctx.packages?.length) {
6586
+ const tasks = ctx.packages.flatMap(
6587
+ (pkg) => pkg.registries.map((registryKey) => {
6588
+ switch (registryKey) {
6589
+ case "npm":
6590
+ return npmAvailableCheckTasks;
6591
+ case "jsr":
6592
+ return jsrAvailableCheckTasks;
6593
+ case "crates":
6594
+ return createCratesAvailableCheckTask(pkg.path);
6595
+ default:
6596
+ return npmAvailableCheckTasks;
6597
+ }
6598
+ })
6599
+ );
6600
+ return parentTask2.newListr(tasks, { concurrent: true });
6554
6601
  }
6555
- )
6602
+ return parentTask2.newListr(
6603
+ collectRegistries(ctx).map((registryKey) => {
6604
+ switch (registryKey) {
6605
+ case "npm":
6606
+ return npmAvailableCheckTasks;
6607
+ case "jsr":
6608
+ return jsrAvailableCheckTasks;
6609
+ case "crates":
6610
+ return cratesAvailableCheckTasks;
6611
+ default:
6612
+ return npmAvailableCheckTasks;
6613
+ }
6614
+ }),
6615
+ {
6616
+ concurrent: true
6617
+ }
6618
+ );
6619
+ }
6556
6620
  }
6557
6621
  ],
6558
6622
  {
@@ -6564,21 +6628,27 @@ var requiredConditionsCheckTask = (options) => createListr({
6564
6628
  // src/tasks/runner.ts
6565
6629
  var { open: open3 } = npmCli3;
6566
6630
  var { prerelease } = SemVer;
6567
- function collectRegistries(ctx) {
6631
+ function registryTask(registry) {
6632
+ switch (registry) {
6633
+ case "npm":
6634
+ return npmPublishTasks;
6635
+ case "jsr":
6636
+ return jsrPublishTasks;
6637
+ case "crates":
6638
+ return cratesPublishTasks;
6639
+ default:
6640
+ return npmPublishTasks;
6641
+ }
6642
+ }
6643
+ function collectPublishTasks(ctx) {
6568
6644
  if (ctx.packages?.length) {
6569
- const seen = /* @__PURE__ */ new Set();
6570
- const result = [];
6571
- for (const pkg of ctx.packages) {
6572
- for (const reg of pkg.registries) {
6573
- if (!seen.has(reg)) {
6574
- seen.add(reg);
6575
- result.push(reg);
6576
- }
6577
- }
6578
- }
6579
- return result;
6645
+ return ctx.packages.flatMap(
6646
+ (pkg) => pkg.registries.map(
6647
+ (reg) => reg === "crates" ? createCratesPublishTask(pkg.path) : registryTask(reg)
6648
+ )
6649
+ );
6580
6650
  }
6581
- return ctx.registries;
6651
+ return collectRegistries(ctx).map(registryTask);
6582
6652
  }
6583
6653
  async function run(options) {
6584
6654
  const ctx = {
@@ -6598,21 +6668,9 @@ async function run(options) {
6598
6668
  await createListr(
6599
6669
  options.publishOnly ? {
6600
6670
  title: "Publishing",
6601
- task: (ctx2, parentTask) => parentTask.newListr(
6602
- collectRegistries(ctx2).map((registry) => {
6603
- switch (registry) {
6604
- case "npm":
6605
- return npmPublishTasks;
6606
- case "jsr":
6607
- return jsrPublishTasks;
6608
- case "crates":
6609
- return cratesPublishTasks;
6610
- default:
6611
- return npmPublishTasks;
6612
- }
6613
- }),
6614
- { concurrent: true }
6615
- )
6671
+ task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
6672
+ concurrent: true
6673
+ })
6616
6674
  } : [
6617
6675
  {
6618
6676
  skip: options.skipTests,
@@ -6681,7 +6739,10 @@ async function run(options) {
6681
6739
  }
6682
6740
  }, ctx2);
6683
6741
  await git.reset();
6684
- const replaced = await replaceVersion(ctx2.version);
6742
+ const replaced = await replaceVersion(
6743
+ ctx2.version,
6744
+ ctx2.packages
6745
+ );
6685
6746
  for (const replacedFile of replaced) {
6686
6747
  await git.stage(replacedFile);
6687
6748
  }
@@ -6696,21 +6757,9 @@ async function run(options) {
6696
6757
  {
6697
6758
  skip: (ctx2) => options.skipPublish || !!ctx2.preview,
6698
6759
  title: "Publishing",
6699
- task: (ctx2, parentTask) => parentTask.newListr(
6700
- collectRegistries(ctx2).map((registry) => {
6701
- switch (registry) {
6702
- case "npm":
6703
- return npmPublishTasks;
6704
- case "jsr":
6705
- return jsrPublishTasks;
6706
- case "crates":
6707
- return cratesPublishTasks;
6708
- default:
6709
- return npmPublishTasks;
6710
- }
6711
- }),
6712
- { concurrent: true }
6713
- )
6760
+ task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
6761
+ concurrent: true
6762
+ })
6714
6763
  },
6715
6764
  {
6716
6765
  title: "Pushing tags to GitHub",
@@ -6755,12 +6804,26 @@ ${repositoryUrl}/compare/${lastRev}...${latestTag}`;
6755
6804
  }
6756
6805
  ]
6757
6806
  ).run(ctx);
6758
- const npmPackageName = (await getPackageJson()).name;
6759
- const jsrPackageName = (await getJsrJson()).name;
6807
+ const registries = collectRegistries(ctx);
6808
+ const parts = [];
6809
+ if (registries.includes("npm")) {
6810
+ const npmPackageName = (await getPackageJson()).name;
6811
+ parts.push(`${color.bold(npmPackageName)} on ${color.green("npm")}`);
6812
+ }
6813
+ if (registries.includes("jsr")) {
6814
+ const jsrPackageName = (await getJsrJson()).name;
6815
+ parts.push(`${color.bold(jsrPackageName)} on ${color.yellow("jsr")}`);
6816
+ }
6817
+ if (registries.includes("crates")) {
6818
+ const crateNames = ctx.packages?.filter((pkg) => pkg.registries.includes("crates")).map((pkg) => pkg.path) ?? ["crate"];
6819
+ for (const name of crateNames) {
6820
+ parts.push(`${color.bold(name)} on ${color.red("crates.io")}`);
6821
+ }
6822
+ }
6760
6823
  console.log(
6761
6824
  `
6762
6825
 
6763
- \u{1F680} Successfully published ${color.bold(npmPackageName)} on ${color.green("npm")} and ${color.bold(jsrPackageName)} on ${color.yellow("jsr")} ${color.blueBright(`v${ctx.version}`)} \u{1F680}
6826
+ \u{1F680} Successfully published ${parts.join(", ")} ${color.blueBright(`v${ctx.version}`)} \u{1F680}
6764
6827
  `
6765
6828
  );
6766
6829
  } catch (e2) {
@@ -6812,11 +6875,11 @@ function generateChangelog(version2, entries, depUpdates) {
6812
6875
 
6813
6876
  // src/changeset/migrate.ts
6814
6877
  import { copyFileSync, existsSync, mkdirSync as mkdirSync2, readdirSync } from "node:fs";
6815
- import path5 from "node:path";
6878
+ import path6 from "node:path";
6816
6879
  import process11 from "node:process";
6817
6880
  var SKIPPED_FILES = /* @__PURE__ */ new Set(["config.json", "README.md"]);
6818
6881
  function migrateFromChangesets(cwd = process11.cwd()) {
6819
- const changesetDir = path5.join(cwd, ".changeset");
6882
+ const changesetDir = path6.join(cwd, ".changeset");
6820
6883
  if (!existsSync(changesetDir)) {
6821
6884
  return {
6822
6885
  success: false,
@@ -6825,7 +6888,7 @@ function migrateFromChangesets(cwd = process11.cwd()) {
6825
6888
  configMigrated: false
6826
6889
  };
6827
6890
  }
6828
- const pubmDir = path5.join(cwd, ".pubm", "changesets");
6891
+ const pubmDir = path6.join(cwd, ".pubm", "changesets");
6829
6892
  mkdirSync2(pubmDir, { recursive: true });
6830
6893
  const files = readdirSync(changesetDir);
6831
6894
  const migratedFiles = [];
@@ -6840,15 +6903,15 @@ function migrateFromChangesets(cwd = process11.cwd()) {
6840
6903
  }
6841
6904
  if (file === "pre.json") {
6842
6905
  copyFileSync(
6843
- path5.join(changesetDir, file),
6844
- path5.resolve(cwd, ".pubm", "pre.json")
6906
+ path6.join(changesetDir, file),
6907
+ path6.resolve(cwd, ".pubm", "pre.json")
6845
6908
  );
6846
6909
  migratedFiles.push(file);
6847
6910
  continue;
6848
6911
  }
6849
6912
  if (file.endsWith(".md")) {
6850
- const src = path5.join(changesetDir, file);
6851
- const dest = path5.join(pubmDir, file);
6913
+ const src = path6.join(changesetDir, file);
6914
+ const dest = path6.join(pubmDir, file);
6852
6915
  copyFileSync(src, dest);
6853
6916
  migratedFiles.push(file);
6854
6917
  }
@@ -6895,10 +6958,10 @@ function parseChangeset(content, fileName) {
6895
6958
 
6896
6959
  // src/changeset/reader.ts
6897
6960
  import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
6898
- import path6 from "node:path";
6961
+ import path7 from "node:path";
6899
6962
  import process12 from "node:process";
6900
6963
  function readChangesets(cwd = process12.cwd()) {
6901
- const changesetsDir = path6.join(cwd, ".pubm", "changesets");
6964
+ const changesetsDir = path7.join(cwd, ".pubm", "changesets");
6902
6965
  if (!existsSync2(changesetsDir)) {
6903
6966
  return [];
6904
6967
  }
@@ -6908,7 +6971,7 @@ function readChangesets(cwd = process12.cwd()) {
6908
6971
  if (!file.endsWith(".md") || file === "README.md") {
6909
6972
  continue;
6910
6973
  }
6911
- const filePath = path6.join(changesetsDir, file);
6974
+ const filePath = path7.join(changesetsDir, file);
6912
6975
  const content = readFileSync2(filePath, "utf-8");
6913
6976
  changesets.push(parseChangeset(content, file));
6914
6977
  }
@@ -6978,7 +7041,7 @@ function calculateVersionBumps(currentVersions, cwd = process14.cwd()) {
6978
7041
 
6979
7042
  // src/changeset/writer.ts
6980
7043
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "node:fs";
6981
- import path7 from "node:path";
7044
+ import path8 from "node:path";
6982
7045
  import process15 from "node:process";
6983
7046
  import { stringify as stringifyYaml } from "yaml";
6984
7047
  var adjectives = [
@@ -7073,11 +7136,11 @@ ${summary}
7073
7136
  return content;
7074
7137
  }
7075
7138
  function writeChangeset(releases, summary, cwd = process15.cwd()) {
7076
- const changesetsDir = path7.join(cwd, ".pubm", "changesets");
7139
+ const changesetsDir = path8.join(cwd, ".pubm", "changesets");
7077
7140
  mkdirSync3(changesetsDir, { recursive: true });
7078
7141
  const id = generateChangesetId();
7079
7142
  const fileName = `${id}.md`;
7080
- const filePath = path7.join(changesetsDir, fileName);
7143
+ const filePath = path8.join(changesetsDir, fileName);
7081
7144
  const content = generateChangesetContent(releases, summary);
7082
7145
  writeFileSync2(filePath, content, "utf-8");
7083
7146
  return filePath;
@@ -7136,7 +7199,7 @@ function topologicalSort(graph) {
7136
7199
 
7137
7200
  // src/monorepo/discover.ts
7138
7201
  import { existsSync as existsSync4, readdirSync as readdirSync3, statSync as statSync2 } from "node:fs";
7139
- import path8 from "node:path";
7202
+ import path9 from "node:path";
7140
7203
  import micromatch from "micromatch";
7141
7204
 
7142
7205
  // src/monorepo/workspace.ts
@@ -7219,9 +7282,9 @@ import {
7219
7282
  rmSync,
7220
7283
  writeFileSync as writeFileSync3
7221
7284
  } from "node:fs";
7222
- import path9 from "node:path";
7285
+ import path10 from "node:path";
7223
7286
  function getPreStatePath(cwd) {
7224
- return path9.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
7287
+ return path10.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
7225
7288
  }
7226
7289
  function readPreState(cwd) {
7227
7290
  const filePath = getPreStatePath(cwd);
@@ -7238,7 +7301,7 @@ function enterPreMode(tag, cwd) {
7238
7301
  "Already in pre mode. Exit pre mode first before entering a new one."
7239
7302
  );
7240
7303
  }
7241
- const dir = path9.dirname(filePath);
7304
+ const dir = path10.dirname(filePath);
7242
7305
  if (!existsSync5(dir)) {
7243
7306
  mkdirSync4(dir, { recursive: true });
7244
7307
  }
@@ -7280,10 +7343,10 @@ function generateSnapshotVersion(options) {
7280
7343
 
7281
7344
  // src/validate/entry-points.ts
7282
7345
  import { existsSync as existsSync6 } from "node:fs";
7283
- import path10 from "node:path";
7346
+ import path11 from "node:path";
7284
7347
  var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
7285
7348
  function checkPath(filePath, cwd) {
7286
- return existsSync6(path10.resolve(cwd, filePath));
7349
+ return existsSync6(path11.resolve(cwd, filePath));
7287
7350
  }
7288
7351
  function validateExports(exports, cwd, prefix = "exports") {
7289
7352
  const errors = [];