pubm 0.1.4 → 0.1.6

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/index.cjs CHANGED
@@ -1960,6 +1960,80 @@ __export(src_exports, {
1960
1960
  });
1961
1961
  module.exports = __toCommonJS(src_exports);
1962
1962
 
1963
+ // src/config/defaults.ts
1964
+ var defaultValidate = {
1965
+ cleanInstall: true,
1966
+ entryPoints: true,
1967
+ extraneousFiles: true
1968
+ };
1969
+ var defaultSnapshot = {
1970
+ useCalculatedVersion: false,
1971
+ prereleaseTemplate: "{tag}-{timestamp}"
1972
+ };
1973
+ var defaultConfig = {
1974
+ versioning: "independent",
1975
+ branch: "main",
1976
+ changelog: true,
1977
+ changelogFormat: "default",
1978
+ commit: false,
1979
+ access: "public",
1980
+ fixed: [],
1981
+ linked: [],
1982
+ updateInternalDependencies: "patch",
1983
+ ignore: [],
1984
+ tag: "latest",
1985
+ contents: ".",
1986
+ saveToken: true,
1987
+ releaseDraft: true,
1988
+ releaseNotes: true,
1989
+ registries: ["npm", "jsr"],
1990
+ rollbackStrategy: "individual"
1991
+ };
1992
+ function resolveConfig(config) {
1993
+ const packages = config.packages ?? [
1994
+ { path: ".", registries: ["npm", "jsr"] }
1995
+ ];
1996
+ return {
1997
+ ...defaultConfig,
1998
+ ...config,
1999
+ packages,
2000
+ validate: { ...defaultValidate, ...config.validate },
2001
+ snapshot: { ...defaultSnapshot, ...config.snapshot }
2002
+ };
2003
+ }
2004
+
2005
+ // src/config/loader.ts
2006
+ var import_promises = require("fs/promises");
2007
+ var import_node_path = __toESM(require("path"), 1);
2008
+ var CONFIG_FILES = [
2009
+ "pubm.config.ts",
2010
+ "pubm.config.mts",
2011
+ "pubm.config.cts",
2012
+ "pubm.config.js",
2013
+ "pubm.config.mjs",
2014
+ "pubm.config.cjs"
2015
+ ];
2016
+ async function findConfigFile(cwd) {
2017
+ for (const file of CONFIG_FILES) {
2018
+ const filePath = import_node_path.default.join(cwd, file);
2019
+ try {
2020
+ if ((await (0, import_promises.stat)(filePath)).isFile()) {
2021
+ return filePath;
2022
+ }
2023
+ } catch {
2024
+ }
2025
+ }
2026
+ return null;
2027
+ }
2028
+ async function loadConfig(cwd = process.cwd()) {
2029
+ const configPath = await findConfigFile(cwd);
2030
+ if (!configPath) return null;
2031
+ const { createJiti } = await import("jiti");
2032
+ const jiti = createJiti(cwd, { interopDefault: true });
2033
+ const mod = await jiti.import(configPath);
2034
+ return mod.default ?? mod;
2035
+ }
2036
+
1963
2037
  // src/options.ts
1964
2038
  var defaultOptions = {
1965
2039
  testScript: "test",
@@ -1969,13 +2043,16 @@ var defaultOptions = {
1969
2043
  registries: ["npm", "jsr"]
1970
2044
  };
1971
2045
  function resolveOptions(options) {
1972
- const nextOptions = { ...options, ...defaultOptions };
2046
+ const defined = Object.fromEntries(
2047
+ Object.entries(options).filter(([, v]) => v !== void 0)
2048
+ );
2049
+ const nextOptions = { ...defaultOptions, ...defined };
1973
2050
  return nextOptions;
1974
2051
  }
1975
2052
 
1976
2053
  // src/tasks/runner.ts
1977
2054
  var import_node_process8 = __toESM(require("process"), 1);
1978
- var import_promise_spawn2 = __toESM(require("@npmcli/promise-spawn"), 1);
2055
+ var import_promise_spawn3 = __toESM(require("@npmcli/promise-spawn"), 1);
1979
2056
 
1980
2057
  // node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
1981
2058
  var import_index = __toESM(require_eventemitter3(), 1);
@@ -1996,15 +2073,15 @@ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !is
1996
2073
  var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
1997
2074
  var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
1998
2075
  var replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
1999
- var clearBleed = (index, string, open3, close, replace) => index < 0 ? open3 + string + close : open3 + replaceClose(index, string, close, replace) + close;
2000
- var filterEmpty = (open3, close, replace = open3, at = open3.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(
2076
+ var clearBleed = (index, string, open4, close, replace) => index < 0 ? open4 + string + close : open4 + replaceClose(index, string, close, replace) + close;
2077
+ var filterEmpty = (open4, close, replace = open4, at = open4.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(
2001
2078
  ("" + string).indexOf(close, at),
2002
2079
  string,
2003
- open3,
2080
+ open4,
2004
2081
  close,
2005
2082
  replace
2006
2083
  ) : "";
2007
- var init = (open3, close, replace) => filterEmpty(`\x1B[${open3}m`, `\x1B[${close}m`, replace);
2084
+ var init = (open4, close, replace) => filterEmpty(`\x1B[${open4}m`, `\x1B[${close}m`, replace);
2008
2085
  var colors = {
2009
2086
  reset: init(0, 0),
2010
2087
  bold: init(1, 22, "\x1B[22m\x1B[1m"),
@@ -4530,7 +4607,8 @@ var Git = class {
4530
4607
  async revisionDiffsCount() {
4531
4608
  try {
4532
4609
  return Number.parseInt(
4533
- await this.git(["rev-list", "@{u}...HEAD", "--count", "--left-only"])
4610
+ await this.git(["rev-list", "@{u}...HEAD", "--count", "--left-only"]),
4611
+ 10
4534
4612
  );
4535
4613
  } catch (error) {
4536
4614
  throw new GitError(
@@ -4776,9 +4854,71 @@ function createListr(...args) {
4776
4854
  }
4777
4855
 
4778
4856
  // src/utils/package.ts
4779
- var import_promises = require("fs/promises");
4780
- var import_node_path = __toESM(require("path"), 1);
4857
+ var import_promises3 = require("fs/promises");
4858
+ var import_node_path3 = __toESM(require("path"), 1);
4781
4859
  var import_node_process5 = __toESM(require("process"), 1);
4860
+
4861
+ // src/ecosystem/rust.ts
4862
+ var import_promises2 = require("fs/promises");
4863
+ var import_node_path2 = __toESM(require("path"), 1);
4864
+ var import_smol_toml = require("smol-toml");
4865
+
4866
+ // src/ecosystem/ecosystem.ts
4867
+ var Ecosystem = class {
4868
+ constructor(packagePath) {
4869
+ this.packagePath = packagePath;
4870
+ }
4871
+ };
4872
+
4873
+ // src/ecosystem/rust.ts
4874
+ var RustEcosystem = class extends Ecosystem {
4875
+ static async detect(packagePath) {
4876
+ try {
4877
+ return (await (0, import_promises2.stat)(import_node_path2.default.join(packagePath, "Cargo.toml"))).isFile();
4878
+ } catch {
4879
+ return false;
4880
+ }
4881
+ }
4882
+ async readCargoToml() {
4883
+ const raw = await (0, import_promises2.readFile)(
4884
+ import_node_path2.default.join(this.packagePath, "Cargo.toml"),
4885
+ "utf-8"
4886
+ );
4887
+ return (0, import_smol_toml.parse)(raw);
4888
+ }
4889
+ async packageName() {
4890
+ const cargo = await this.readCargoToml();
4891
+ const pkg = cargo.package;
4892
+ return pkg.name;
4893
+ }
4894
+ async readVersion() {
4895
+ const cargo = await this.readCargoToml();
4896
+ const pkg = cargo.package;
4897
+ return pkg.version;
4898
+ }
4899
+ async writeVersion(newVersion) {
4900
+ const filePath = import_node_path2.default.join(this.packagePath, "Cargo.toml");
4901
+ const raw = await (0, import_promises2.readFile)(filePath, "utf-8");
4902
+ const cargo = (0, import_smol_toml.parse)(raw);
4903
+ const pkg = cargo.package;
4904
+ pkg.version = newVersion;
4905
+ await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
4906
+ }
4907
+ manifestFiles() {
4908
+ return ["Cargo.toml"];
4909
+ }
4910
+ defaultTestCommand() {
4911
+ return "cargo test";
4912
+ }
4913
+ defaultBuildCommand() {
4914
+ return "cargo build --release";
4915
+ }
4916
+ supportedRegistries() {
4917
+ return ["crates"];
4918
+ }
4919
+ };
4920
+
4921
+ // src/utils/package.ts
4782
4922
  var cachedPackageJson = {};
4783
4923
  var cachedJsrJson = {};
4784
4924
  function patchCachedJsrJson(contents, { cwd = import_node_process5.default.cwd() } = {}) {
@@ -4787,16 +4927,16 @@ function patchCachedJsrJson(contents, { cwd = import_node_process5.default.cwd()
4787
4927
  async function findOutFile(file, { cwd = import_node_process5.default.cwd() } = {}) {
4788
4928
  let directory = cwd;
4789
4929
  let filePath = "";
4790
- const { root } = import_node_path.default.parse(cwd);
4930
+ const { root } = import_node_path3.default.parse(cwd);
4791
4931
  while (directory) {
4792
- filePath = import_node_path.default.join(directory, file);
4932
+ filePath = import_node_path3.default.join(directory, file);
4793
4933
  try {
4794
- if ((await (0, import_promises.stat)(filePath)).isFile()) {
4934
+ if ((await (0, import_promises3.stat)(filePath)).isFile()) {
4795
4935
  break;
4796
4936
  }
4797
4937
  } catch {
4798
4938
  }
4799
- directory = import_node_path.default.dirname(directory);
4939
+ directory = import_node_path3.default.dirname(directory);
4800
4940
  if (directory === root) return null;
4801
4941
  }
4802
4942
  return filePath;
@@ -4808,7 +4948,7 @@ async function getPackageJson({
4808
4948
  if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
4809
4949
  try {
4810
4950
  const packageJsonPath = await findOutFile("package.json");
4811
- const raw = packageJsonPath && (await (0, import_promises.readFile)(packageJsonPath)).toString();
4951
+ const raw = packageJsonPath && (await (0, import_promises3.readFile)(packageJsonPath)).toString();
4812
4952
  if (!raw) {
4813
4953
  if (!fallbackJsr) {
4814
4954
  throw new Error(
@@ -4841,7 +4981,7 @@ async function getJsrJson({
4841
4981
  if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
4842
4982
  try {
4843
4983
  const jsrJsonPath = await findOutFile("jsr.json");
4844
- const raw = jsrJsonPath && (await (0, import_promises.readFile)(jsrJsonPath)).toString();
4984
+ const raw = jsrJsonPath && (await (0, import_promises3.readFile)(jsrJsonPath)).toString();
4845
4985
  if (!raw) {
4846
4986
  if (!fallbackPackage) {
4847
4987
  throw new Error(
@@ -4925,14 +5065,14 @@ async function version({ cwd = import_node_process5.default.cwd() } = {}) {
4925
5065
  return version2;
4926
5066
  }
4927
5067
  var versionRegex = /("version"\s*:\s*")[^"]*(")/;
4928
- async function replaceVersion(version2) {
5068
+ async function replaceVersion(version2, packages) {
4929
5069
  const results = await Promise.all([
4930
5070
  (async () => {
4931
5071
  const packageJsonPath = await findOutFile("package.json");
4932
5072
  if (!packageJsonPath) return void 0;
4933
- const packageJson = (await (0, import_promises.readFile)(packageJsonPath)).toString();
5073
+ const packageJson = (await (0, import_promises3.readFile)(packageJsonPath)).toString();
4934
5074
  try {
4935
- await (0, import_promises.writeFile)(
5075
+ await (0, import_promises3.writeFile)(
4936
5076
  packageJsonPath,
4937
5077
  packageJson.replace(versionRegex, `$1${version2}$2`)
4938
5078
  );
@@ -4947,9 +5087,9 @@ async function replaceVersion(version2) {
4947
5087
  (async () => {
4948
5088
  const jsrJsonPath = await findOutFile("jsr.json");
4949
5089
  if (!jsrJsonPath) return void 0;
4950
- const jsrJson = (await (0, import_promises.readFile)(jsrJsonPath)).toString();
5090
+ const jsrJson = (await (0, import_promises3.readFile)(jsrJsonPath)).toString();
4951
5091
  try {
4952
- await (0, import_promises.writeFile)(
5092
+ await (0, import_promises3.writeFile)(
4953
5093
  jsrJsonPath,
4954
5094
  jsrJson.replace(versionRegex, `$1${version2}$2`)
4955
5095
  );
@@ -4960,7 +5100,19 @@ async function replaceVersion(version2) {
4960
5100
  );
4961
5101
  }
4962
5102
  return "jsr.json";
4963
- })()
5103
+ })(),
5104
+ ...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
5105
+ const eco = new RustEcosystem(import_node_path3.default.resolve(pkg.path));
5106
+ try {
5107
+ await eco.writeVersion(version2);
5108
+ } catch (error) {
5109
+ throw new AbstractError(
5110
+ `Failed to write version to Cargo.toml at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5111
+ { cause: error }
5112
+ );
5113
+ }
5114
+ return import_node_path3.default.join(pkg.path, "Cargo.toml");
5115
+ })
4964
5116
  ]);
4965
5117
  return results.filter((v) => v);
4966
5118
  }
@@ -4981,67 +5133,26 @@ async function getPackageManager() {
4981
5133
  return "npm";
4982
5134
  }
4983
5135
 
4984
- // src/ecosystem/rust.ts
4985
- var import_promises2 = require("fs/promises");
4986
- var import_node_path2 = __toESM(require("path"), 1);
4987
- var import_smol_toml = require("smol-toml");
4988
-
4989
- // src/ecosystem/ecosystem.ts
4990
- var Ecosystem = class {
4991
- constructor(packagePath) {
4992
- this.packagePath = packagePath;
4993
- }
4994
- };
4995
-
4996
- // src/ecosystem/rust.ts
4997
- var RustEcosystem = class extends Ecosystem {
4998
- static async detect(packagePath) {
4999
- try {
5000
- return (await (0, import_promises2.stat)(import_node_path2.default.join(packagePath, "Cargo.toml"))).isFile();
5001
- } catch {
5002
- return false;
5136
+ // src/utils/registries.ts
5137
+ function collectRegistries(ctx) {
5138
+ if (ctx.packages?.length) {
5139
+ const seen = /* @__PURE__ */ new Set();
5140
+ const result = [];
5141
+ for (const pkg of ctx.packages) {
5142
+ for (const reg of pkg.registries) {
5143
+ if (!seen.has(reg)) {
5144
+ seen.add(reg);
5145
+ result.push(reg);
5146
+ }
5147
+ }
5003
5148
  }
5149
+ return result;
5004
5150
  }
5005
- async readCargoToml() {
5006
- const raw = await (0, import_promises2.readFile)(
5007
- import_node_path2.default.join(this.packagePath, "Cargo.toml"),
5008
- "utf-8"
5009
- );
5010
- return (0, import_smol_toml.parse)(raw);
5011
- }
5012
- async packageName() {
5013
- const cargo = await this.readCargoToml();
5014
- const pkg = cargo.package;
5015
- return pkg.name;
5016
- }
5017
- async readVersion() {
5018
- const cargo = await this.readCargoToml();
5019
- const pkg = cargo.package;
5020
- return pkg.version;
5021
- }
5022
- async writeVersion(newVersion) {
5023
- const filePath = import_node_path2.default.join(this.packagePath, "Cargo.toml");
5024
- const raw = await (0, import_promises2.readFile)(filePath, "utf-8");
5025
- const cargo = (0, import_smol_toml.parse)(raw);
5026
- const pkg = cargo.package;
5027
- pkg.version = newVersion;
5028
- await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
5029
- }
5030
- manifestFiles() {
5031
- return ["Cargo.toml"];
5032
- }
5033
- defaultTestCommand() {
5034
- return "cargo test";
5035
- }
5036
- defaultBuildCommand() {
5037
- return "cargo build --release";
5038
- }
5039
- supportedRegistries() {
5040
- return ["crates"];
5041
- }
5042
- };
5151
+ return ctx.registries;
5152
+ }
5043
5153
 
5044
5154
  // src/registry/crates.ts
5155
+ var import_node_path4 = __toESM(require("path"), 1);
5045
5156
  var import_tinyexec2 = require("tinyexec");
5046
5157
 
5047
5158
  // src/registry/registry.ts
@@ -5115,9 +5226,13 @@ var CratesRegistry = class extends Registry {
5115
5226
  );
5116
5227
  }
5117
5228
  }
5118
- async publish() {
5229
+ async publish(manifestDir) {
5119
5230
  try {
5120
- await (0, import_tinyexec2.exec)("cargo", ["publish"], { throwOnError: true });
5231
+ const args = ["publish"];
5232
+ if (manifestDir) {
5233
+ args.push("--manifest-path", import_node_path4.default.join(manifestDir, "Cargo.toml"));
5234
+ }
5235
+ await (0, import_tinyexec2.exec)("cargo", args, { throwOnError: true });
5121
5236
  return true;
5122
5237
  } catch (error) {
5123
5238
  throw new CratesError("Failed to run `cargo publish`", {
@@ -5173,39 +5288,48 @@ var CratesError2 = class extends AbstractError {
5173
5288
  this.stack = "";
5174
5289
  }
5175
5290
  };
5176
- async function getCrateName() {
5177
- const eco = new RustEcosystem(process.cwd());
5291
+ async function getCrateName(packagePath) {
5292
+ const eco = new RustEcosystem(packagePath ?? process.cwd());
5178
5293
  return await eco.packageName();
5179
5294
  }
5180
- var cratesAvailableCheckTasks = {
5181
- title: "Checking crates.io availability",
5182
- task: async () => {
5183
- const packageName = await getCrateName();
5184
- const registry = new CratesRegistry(packageName);
5185
- if (!await registry.isInstalled()) {
5186
- throw new CratesError2(
5187
- "cargo is not installed. Please install Rust toolchain to proceed."
5188
- );
5295
+ function createCratesAvailableCheckTask(packagePath) {
5296
+ const label = packagePath ? ` (${packagePath})` : "";
5297
+ return {
5298
+ title: `Checking crates.io availability${label}`,
5299
+ task: async () => {
5300
+ const packageName = await getCrateName(packagePath);
5301
+ const registry = new CratesRegistry(packageName);
5302
+ if (!await registry.isInstalled()) {
5303
+ throw new CratesError2(
5304
+ "cargo is not installed. Please install Rust toolchain to proceed."
5305
+ );
5306
+ }
5307
+ if (!await registry.hasPermission()) {
5308
+ throw new CratesError2(
5309
+ "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5310
+ );
5311
+ }
5189
5312
  }
5190
- if (!await registry.hasPermission()) {
5191
- throw new CratesError2(
5192
- "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5193
- );
5313
+ };
5314
+ }
5315
+ function createCratesPublishTask(packagePath) {
5316
+ const label = packagePath ? ` (${packagePath})` : "";
5317
+ return {
5318
+ title: `Publishing to crates.io${label}`,
5319
+ task: async () => {
5320
+ const packageName = await getCrateName(packagePath);
5321
+ const registry = new CratesRegistry(packageName);
5322
+ await registry.publish(packagePath);
5194
5323
  }
5195
- }
5196
- };
5197
- var cratesPublishTasks = {
5198
- title: "Publishing to crates.io",
5199
- task: async () => {
5200
- const packageName = await getCrateName();
5201
- const registry = new CratesRegistry(packageName);
5202
- await registry.publish();
5203
- }
5204
- };
5324
+ };
5325
+ }
5326
+ var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
5327
+ var cratesPublishTasks = createCratesPublishTask();
5205
5328
 
5206
5329
  // src/tasks/jsr.ts
5207
5330
  var import_node_process6 = __toESM(require("process"), 1);
5208
5331
  var import_prompt_adapter_enquirer = require("@listr2/prompt-adapter-enquirer");
5332
+ var import_promise_spawn = __toESM(require("@npmcli/promise-spawn"), 1);
5209
5333
 
5210
5334
  // src/registry/jsr.ts
5211
5335
  var import_tinyexec3 = require("tinyexec");
@@ -5213,7 +5337,7 @@ var import_tinyexec3 = require("tinyexec");
5213
5337
  // src/utils/db.ts
5214
5338
  var import_node_crypto = require("crypto");
5215
5339
  var import_node_fs = require("fs");
5216
- var import_node_path3 = __toESM(require("path"), 1);
5340
+ var import_node_path5 = __toESM(require("path"), 1);
5217
5341
  var import_meta = {};
5218
5342
  var a = "aes-256-cbc";
5219
5343
  var n = (0, import_node_fs.statSync)(import_meta.dirname);
@@ -5229,7 +5353,7 @@ function d(g, h) {
5229
5353
  }
5230
5354
  var Db = class {
5231
5355
  constructor() {
5232
- __publicField(this, "path", import_node_path3.default.resolve(import_meta.dirname, ".pubm"));
5356
+ __publicField(this, "path", import_node_path5.default.resolve(import_meta.dirname, ".pubm"));
5233
5357
  try {
5234
5358
  if (!(0, import_node_fs.statSync)(this.path).isDirectory()) {
5235
5359
  (0, import_node_fs.mkdirSync)(this.path);
@@ -5247,7 +5371,7 @@ var Db = class {
5247
5371
  set(field, value) {
5248
5372
  try {
5249
5373
  (0, import_node_fs.writeFileSync)(
5250
- import_node_path3.default.resolve(
5374
+ import_node_path5.default.resolve(
5251
5375
  this.path,
5252
5376
  Buffer.from(e(field, field)).toString("base64")
5253
5377
  ),
@@ -5261,7 +5385,7 @@ var Db = class {
5261
5385
  }
5262
5386
  }
5263
5387
  get(field) {
5264
- const filePath = import_node_path3.default.resolve(
5388
+ const filePath = import_node_path5.default.resolve(
5265
5389
  this.path,
5266
5390
  Buffer.from(e(field, field)).toString("base64")
5267
5391
  );
@@ -5344,6 +5468,7 @@ var JsrRegisry = class extends Registry {
5344
5468
  super(packageName, registry);
5345
5469
  __publicField(this, "registry", "https://jsr.io");
5346
5470
  __publicField(this, "client");
5471
+ __publicField(this, "packageCreationUrls");
5347
5472
  this.client = new JsrClient(getApiEndpoint(this.registry));
5348
5473
  }
5349
5474
  async jsr(args) {
@@ -5385,9 +5510,19 @@ var JsrRegisry = class extends Registry {
5385
5510
  throwOnError: true
5386
5511
  }
5387
5512
  );
5513
+ this.packageCreationUrls = void 0;
5388
5514
  return true;
5389
5515
  } catch (error) {
5390
5516
  const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
5517
+ if (stderr?.includes("don't exist")) {
5518
+ const urls = [...stderr.matchAll(/https:\/\/jsr\.io\/new\S+/g)].map(
5519
+ (m) => m[0]
5520
+ );
5521
+ if (urls.length > 0) {
5522
+ this.packageCreationUrls = urls;
5523
+ return false;
5524
+ }
5525
+ }
5391
5526
  throw new JsrError(
5392
5527
  `Failed to run \`jsr publish --allow-dirty --token ***\`${stderr ? `
5393
5528
  ${stderr}` : ""}`,
@@ -5828,6 +5963,7 @@ async function npmRegistry() {
5828
5963
  }
5829
5964
 
5830
5965
  // src/tasks/jsr.ts
5966
+ var { open } = import_promise_spawn.default;
5831
5967
  var JsrAvailableError = class extends AbstractError {
5832
5968
  constructor(message, { cause } = {}) {
5833
5969
  super(message, { cause });
@@ -6008,7 +6144,39 @@ var jsrPublishTasks = {
6008
6144
  }
6009
6145
  JsrClient.token = jsrTokenEnv;
6010
6146
  }
6011
- await jsr.publish();
6147
+ let result = await jsr.publish();
6148
+ if (!result && jsr.packageCreationUrls) {
6149
+ if (ctx.promptEnabled) {
6150
+ task.title = "Running jsr publish (package creation needed)";
6151
+ const urls = jsr.packageCreationUrls;
6152
+ const maxAttempts = 3;
6153
+ task.output = `Package doesn't exist on jsr. Create it at:
6154
+ ${urls.map((url) => ` ${color.cyan(url)}`).join("\n")}`;
6155
+ open(urls[0]);
6156
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
6157
+ await task.prompt(import_prompt_adapter_enquirer.ListrEnquirerPromptAdapter).run({
6158
+ type: "input",
6159
+ message: `Press ${color.bold("enter")} after creating the package on jsr.io${attempt > 1 ? ` (attempt ${attempt}/${maxAttempts})` : ""}`
6160
+ });
6161
+ result = await jsr.publish();
6162
+ if (result) break;
6163
+ if (attempt < maxAttempts) {
6164
+ task.output = "Package still doesn't exist. Please create it and try again.";
6165
+ }
6166
+ }
6167
+ if (!result) {
6168
+ throw new JsrAvailableError(
6169
+ "Package creation not completed after 3 attempts."
6170
+ );
6171
+ }
6172
+ task.title = "Running jsr publish (package created)";
6173
+ } else {
6174
+ throw new JsrAvailableError(
6175
+ `Package doesn't exist on jsr. Create it at:
6176
+ ${jsr.packageCreationUrls.join("\n")}`
6177
+ );
6178
+ }
6179
+ }
6012
6180
  }
6013
6181
  };
6014
6182
 
@@ -6016,8 +6184,8 @@ var jsrPublishTasks = {
6016
6184
  var import_node_child_process = require("child_process");
6017
6185
  var import_node_process7 = __toESM(require("process"), 1);
6018
6186
  var import_prompt_adapter_enquirer2 = require("@listr2/prompt-adapter-enquirer");
6019
- var import_promise_spawn = __toESM(require("@npmcli/promise-spawn"), 1);
6020
- var { open } = import_promise_spawn.default;
6187
+ var import_promise_spawn2 = __toESM(require("@npmcli/promise-spawn"), 1);
6188
+ var { open: open2 } = import_promise_spawn2.default;
6021
6189
  var NpmAvailableError = class extends AbstractError {
6022
6190
  constructor(message, { cause } = {}) {
6023
6191
  super(message, { cause });
@@ -6047,7 +6215,7 @@ var npmAvailableCheckTasks = {
6047
6215
  if (urlMatch && !opened) {
6048
6216
  opened = true;
6049
6217
  task.output = `Login at: ${color.cyan(urlMatch[0])}`;
6050
- open(urlMatch[0]);
6218
+ open2(urlMatch[0]);
6051
6219
  child.stdin?.write("\n");
6052
6220
  }
6053
6221
  };
@@ -6055,9 +6223,7 @@ var npmAvailableCheckTasks = {
6055
6223
  child.stderr?.on("data", onData);
6056
6224
  child.on(
6057
6225
  "close",
6058
- (code) => code === 0 ? resolve() : reject(
6059
- new Error(`npm login exited with code ${code}`)
6060
- )
6226
+ (code) => code === 0 ? resolve() : reject(new Error(`npm login exited with code ${code}`))
6061
6227
  );
6062
6228
  child.on("error", reject);
6063
6229
  });
@@ -6361,7 +6527,7 @@ var requiredConditionsCheckTask = (options) => createListr({
6361
6527
  {
6362
6528
  title: "Ping registries",
6363
6529
  task: (ctx, parentTask2) => parentTask2.newListr(
6364
- ctx.registries.map((registryKey) => ({
6530
+ collectRegistries(ctx).map((registryKey) => ({
6365
6531
  title: `Ping to ${registryKey}`,
6366
6532
  task: async () => {
6367
6533
  const registry = await getRegistry(registryKey);
@@ -6378,7 +6544,9 @@ var requiredConditionsCheckTask = (options) => createListr({
6378
6544
  task: async (_2, parentTask2) => parentTask2.newListr(
6379
6545
  [
6380
6546
  {
6381
- enabled: (ctx) => ctx.registries.some((registry) => registry !== "jsr"),
6547
+ enabled: (ctx) => collectRegistries(ctx).some(
6548
+ (registry) => registry !== "jsr"
6549
+ ),
6382
6550
  title: "Verifying if npm are installed",
6383
6551
  task: async () => {
6384
6552
  const npm = await npmRegistry();
@@ -6390,7 +6558,9 @@ var requiredConditionsCheckTask = (options) => createListr({
6390
6558
  }
6391
6559
  },
6392
6560
  {
6393
- enabled: (ctx) => ctx.registries.some((registry) => registry === "jsr"),
6561
+ enabled: (ctx) => collectRegistries(ctx).some(
6562
+ (registry) => registry === "jsr"
6563
+ ),
6394
6564
  title: "Verifying if jsr are installed",
6395
6565
  task: async (_3, task) => {
6396
6566
  const jsr = await jsrRegistry();
@@ -6421,7 +6591,7 @@ var requiredConditionsCheckTask = (options) => createListr({
6421
6591
  },
6422
6592
  {
6423
6593
  title: "Checking if test and build scripts exist",
6424
- skip: (ctx) => !needsPackageScripts(ctx.registries),
6594
+ skip: (ctx) => !needsPackageScripts(collectRegistries(ctx)),
6425
6595
  task: async (ctx) => {
6426
6596
  const { scripts } = await getPackageJson();
6427
6597
  const errors = [];
@@ -6449,23 +6619,42 @@ var requiredConditionsCheckTask = (options) => createListr({
6449
6619
  },
6450
6620
  {
6451
6621
  title: "Checking available registries for publishing",
6452
- task: (ctx, parentTask2) => parentTask2.newListr(
6453
- ctx.registries.map((registryKey) => {
6454
- switch (registryKey) {
6455
- case "npm":
6456
- return npmAvailableCheckTasks;
6457
- case "jsr":
6458
- return jsrAvailableCheckTasks;
6459
- case "crates":
6460
- return cratesAvailableCheckTasks;
6461
- default:
6462
- return npmAvailableCheckTasks;
6463
- }
6464
- }),
6465
- {
6466
- concurrent: true
6622
+ task: (ctx, parentTask2) => {
6623
+ if (ctx.packages?.length) {
6624
+ const tasks = ctx.packages.flatMap(
6625
+ (pkg) => pkg.registries.map((registryKey) => {
6626
+ switch (registryKey) {
6627
+ case "npm":
6628
+ return npmAvailableCheckTasks;
6629
+ case "jsr":
6630
+ return jsrAvailableCheckTasks;
6631
+ case "crates":
6632
+ return createCratesAvailableCheckTask(pkg.path);
6633
+ default:
6634
+ return npmAvailableCheckTasks;
6635
+ }
6636
+ })
6637
+ );
6638
+ return parentTask2.newListr(tasks, { concurrent: true });
6467
6639
  }
6468
- )
6640
+ return parentTask2.newListr(
6641
+ collectRegistries(ctx).map((registryKey) => {
6642
+ switch (registryKey) {
6643
+ case "npm":
6644
+ return npmAvailableCheckTasks;
6645
+ case "jsr":
6646
+ return jsrAvailableCheckTasks;
6647
+ case "crates":
6648
+ return cratesAvailableCheckTasks;
6649
+ default:
6650
+ return npmAvailableCheckTasks;
6651
+ }
6652
+ }),
6653
+ {
6654
+ concurrent: true
6655
+ }
6656
+ );
6657
+ }
6469
6658
  }
6470
6659
  ],
6471
6660
  {
@@ -6475,8 +6664,30 @@ var requiredConditionsCheckTask = (options) => createListr({
6475
6664
  });
6476
6665
 
6477
6666
  // src/tasks/runner.ts
6478
- var { open: open2 } = import_promise_spawn2.default;
6667
+ var { open: open3 } = import_promise_spawn3.default;
6479
6668
  var { prerelease } = import_semver3.default;
6669
+ function registryTask(registry) {
6670
+ switch (registry) {
6671
+ case "npm":
6672
+ return npmPublishTasks;
6673
+ case "jsr":
6674
+ return jsrPublishTasks;
6675
+ case "crates":
6676
+ return cratesPublishTasks;
6677
+ default:
6678
+ return npmPublishTasks;
6679
+ }
6680
+ }
6681
+ function collectPublishTasks(ctx) {
6682
+ if (ctx.packages?.length) {
6683
+ return ctx.packages.flatMap(
6684
+ (pkg) => pkg.registries.map(
6685
+ (reg) => reg === "crates" ? createCratesPublishTask(pkg.path) : registryTask(reg)
6686
+ )
6687
+ );
6688
+ }
6689
+ return collectRegistries(ctx).map(registryTask);
6690
+ }
6480
6691
  async function run(options) {
6481
6692
  const ctx = {
6482
6693
  ...options,
@@ -6495,21 +6706,9 @@ async function run(options) {
6495
6706
  await createListr(
6496
6707
  options.publishOnly ? {
6497
6708
  title: "Publishing",
6498
- task: (ctx2, parentTask) => parentTask.newListr(
6499
- ctx2.registries.map((registry) => {
6500
- switch (registry) {
6501
- case "npm":
6502
- return npmPublishTasks;
6503
- case "jsr":
6504
- return jsrPublishTasks;
6505
- case "crates":
6506
- return cratesPublishTasks;
6507
- default:
6508
- return npmPublishTasks;
6509
- }
6510
- }),
6511
- { concurrent: true }
6512
- )
6709
+ task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
6710
+ concurrent: true
6711
+ })
6513
6712
  } : [
6514
6713
  {
6515
6714
  skip: options.skipTests,
@@ -6578,7 +6777,10 @@ async function run(options) {
6578
6777
  }
6579
6778
  }, ctx2);
6580
6779
  await git.reset();
6581
- const replaced = await replaceVersion(ctx2.version);
6780
+ const replaced = await replaceVersion(
6781
+ ctx2.version,
6782
+ ctx2.packages
6783
+ );
6582
6784
  for (const replacedFile of replaced) {
6583
6785
  await git.stage(replacedFile);
6584
6786
  }
@@ -6593,21 +6795,9 @@ async function run(options) {
6593
6795
  {
6594
6796
  skip: (ctx2) => options.skipPublish || !!ctx2.preview,
6595
6797
  title: "Publishing",
6596
- task: (ctx2, parentTask) => parentTask.newListr(
6597
- ctx2.registries.map((registry) => {
6598
- switch (registry) {
6599
- case "npm":
6600
- return npmPublishTasks;
6601
- case "jsr":
6602
- return jsrPublishTasks;
6603
- case "crates":
6604
- return cratesPublishTasks;
6605
- default:
6606
- return npmPublishTasks;
6607
- }
6608
- }),
6609
- { concurrent: true }
6610
- )
6798
+ task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
6799
+ concurrent: true
6800
+ })
6611
6801
  },
6612
6802
  {
6613
6803
  title: "Pushing tags to GitHub",
@@ -6647,7 +6837,7 @@ ${repositoryUrl}/compare/${lastRev}...${latestTag}`;
6647
6837
  );
6648
6838
  const linkUrl = link2("Link", releaseDraftUrl.toString());
6649
6839
  task.title += ` ${linkUrl}`;
6650
- await open2(releaseDraftUrl.toString());
6840
+ await open3(releaseDraftUrl.toString());
6651
6841
  }
6652
6842
  }
6653
6843
  ]
@@ -6709,11 +6899,11 @@ function generateChangelog(version2, entries, depUpdates) {
6709
6899
 
6710
6900
  // src/changeset/migrate.ts
6711
6901
  var import_node_fs2 = require("fs");
6712
- var import_node_path4 = __toESM(require("path"), 1);
6902
+ var import_node_path6 = __toESM(require("path"), 1);
6713
6903
  var import_node_process9 = __toESM(require("process"), 1);
6714
6904
  var SKIPPED_FILES = /* @__PURE__ */ new Set(["config.json", "README.md"]);
6715
6905
  function migrateFromChangesets(cwd = import_node_process9.default.cwd()) {
6716
- const changesetDir = import_node_path4.default.join(cwd, ".changeset");
6906
+ const changesetDir = import_node_path6.default.join(cwd, ".changeset");
6717
6907
  if (!(0, import_node_fs2.existsSync)(changesetDir)) {
6718
6908
  return {
6719
6909
  success: false,
@@ -6722,7 +6912,7 @@ function migrateFromChangesets(cwd = import_node_process9.default.cwd()) {
6722
6912
  configMigrated: false
6723
6913
  };
6724
6914
  }
6725
- const pubmDir = import_node_path4.default.join(cwd, ".pubm", "changesets");
6915
+ const pubmDir = import_node_path6.default.join(cwd, ".pubm", "changesets");
6726
6916
  (0, import_node_fs2.mkdirSync)(pubmDir, { recursive: true });
6727
6917
  const files = (0, import_node_fs2.readdirSync)(changesetDir);
6728
6918
  const migratedFiles = [];
@@ -6737,15 +6927,15 @@ function migrateFromChangesets(cwd = import_node_process9.default.cwd()) {
6737
6927
  }
6738
6928
  if (file === "pre.json") {
6739
6929
  (0, import_node_fs2.copyFileSync)(
6740
- import_node_path4.default.join(changesetDir, file),
6741
- import_node_path4.default.resolve(cwd, ".pubm", "pre.json")
6930
+ import_node_path6.default.join(changesetDir, file),
6931
+ import_node_path6.default.resolve(cwd, ".pubm", "pre.json")
6742
6932
  );
6743
6933
  migratedFiles.push(file);
6744
6934
  continue;
6745
6935
  }
6746
6936
  if (file.endsWith(".md")) {
6747
- const src = import_node_path4.default.join(changesetDir, file);
6748
- const dest = import_node_path4.default.join(pubmDir, file);
6937
+ const src = import_node_path6.default.join(changesetDir, file);
6938
+ const dest = import_node_path6.default.join(pubmDir, file);
6749
6939
  (0, import_node_fs2.copyFileSync)(src, dest);
6750
6940
  migratedFiles.push(file);
6751
6941
  }
@@ -6792,10 +6982,10 @@ function parseChangeset(content, fileName) {
6792
6982
 
6793
6983
  // src/changeset/reader.ts
6794
6984
  var import_node_fs3 = require("fs");
6795
- var import_node_path5 = __toESM(require("path"), 1);
6985
+ var import_node_path7 = __toESM(require("path"), 1);
6796
6986
  var import_node_process10 = __toESM(require("process"), 1);
6797
6987
  function readChangesets(cwd = import_node_process10.default.cwd()) {
6798
- const changesetsDir = import_node_path5.default.join(cwd, ".pubm", "changesets");
6988
+ const changesetsDir = import_node_path7.default.join(cwd, ".pubm", "changesets");
6799
6989
  if (!(0, import_node_fs3.existsSync)(changesetsDir)) {
6800
6990
  return [];
6801
6991
  }
@@ -6805,7 +6995,7 @@ function readChangesets(cwd = import_node_process10.default.cwd()) {
6805
6995
  if (!file.endsWith(".md") || file === "README.md") {
6806
6996
  continue;
6807
6997
  }
6808
- const filePath = import_node_path5.default.join(changesetsDir, file);
6998
+ const filePath = import_node_path7.default.join(changesetsDir, file);
6809
6999
  const content = (0, import_node_fs3.readFileSync)(filePath, "utf-8");
6810
7000
  changesets.push(parseChangeset(content, file));
6811
7001
  }
@@ -6875,7 +7065,7 @@ function calculateVersionBumps(currentVersions, cwd = import_node_process12.defa
6875
7065
 
6876
7066
  // src/changeset/writer.ts
6877
7067
  var import_node_fs4 = require("fs");
6878
- var import_node_path6 = __toESM(require("path"), 1);
7068
+ var import_node_path8 = __toESM(require("path"), 1);
6879
7069
  var import_node_process13 = __toESM(require("process"), 1);
6880
7070
  var import_yaml2 = require("yaml");
6881
7071
  var adjectives = [
@@ -6970,90 +7160,16 @@ ${summary}
6970
7160
  return content;
6971
7161
  }
6972
7162
  function writeChangeset(releases, summary, cwd = import_node_process13.default.cwd()) {
6973
- const changesetsDir = import_node_path6.default.join(cwd, ".pubm", "changesets");
7163
+ const changesetsDir = import_node_path8.default.join(cwd, ".pubm", "changesets");
6974
7164
  (0, import_node_fs4.mkdirSync)(changesetsDir, { recursive: true });
6975
7165
  const id = generateChangesetId();
6976
7166
  const fileName = `${id}.md`;
6977
- const filePath = import_node_path6.default.join(changesetsDir, fileName);
7167
+ const filePath = import_node_path8.default.join(changesetsDir, fileName);
6978
7168
  const content = generateChangesetContent(releases, summary);
6979
7169
  (0, import_node_fs4.writeFileSync)(filePath, content, "utf-8");
6980
7170
  return filePath;
6981
7171
  }
6982
7172
 
6983
- // src/config/defaults.ts
6984
- var defaultValidate = {
6985
- cleanInstall: true,
6986
- entryPoints: true,
6987
- extraneousFiles: true
6988
- };
6989
- var defaultSnapshot = {
6990
- useCalculatedVersion: false,
6991
- prereleaseTemplate: "{tag}-{timestamp}"
6992
- };
6993
- var defaultConfig = {
6994
- versioning: "independent",
6995
- branch: "main",
6996
- changelog: true,
6997
- changelogFormat: "default",
6998
- commit: false,
6999
- access: "public",
7000
- fixed: [],
7001
- linked: [],
7002
- updateInternalDependencies: "patch",
7003
- ignore: [],
7004
- tag: "latest",
7005
- contents: ".",
7006
- saveToken: true,
7007
- releaseDraft: true,
7008
- releaseNotes: true,
7009
- registries: ["npm", "jsr"],
7010
- rollbackStrategy: "individual"
7011
- };
7012
- function resolveConfig(config) {
7013
- const packages = config.packages ?? [
7014
- { path: ".", registries: ["npm", "jsr"] }
7015
- ];
7016
- return {
7017
- ...defaultConfig,
7018
- ...config,
7019
- packages,
7020
- validate: { ...defaultValidate, ...config.validate },
7021
- snapshot: { ...defaultSnapshot, ...config.snapshot }
7022
- };
7023
- }
7024
-
7025
- // src/config/loader.ts
7026
- var import_promises3 = require("fs/promises");
7027
- var import_node_path7 = __toESM(require("path"), 1);
7028
- var CONFIG_FILES = [
7029
- "pubm.config.ts",
7030
- "pubm.config.mts",
7031
- "pubm.config.cts",
7032
- "pubm.config.js",
7033
- "pubm.config.mjs",
7034
- "pubm.config.cjs"
7035
- ];
7036
- async function findConfigFile(cwd) {
7037
- for (const file of CONFIG_FILES) {
7038
- const filePath = import_node_path7.default.join(cwd, file);
7039
- try {
7040
- if ((await (0, import_promises3.stat)(filePath)).isFile()) {
7041
- return filePath;
7042
- }
7043
- } catch {
7044
- }
7045
- }
7046
- return null;
7047
- }
7048
- async function loadConfig(cwd = process.cwd()) {
7049
- const configPath = await findConfigFile(cwd);
7050
- if (!configPath) return null;
7051
- const { createJiti } = await import("jiti");
7052
- const jiti = createJiti(cwd, { interopDefault: true });
7053
- const mod = await jiti.import(configPath);
7054
- return mod.default ?? mod;
7055
- }
7056
-
7057
7173
  // src/config/types.ts
7058
7174
  function defineConfig(config) {
7059
7175
  return config;
@@ -7107,23 +7223,23 @@ function topologicalSort(graph) {
7107
7223
 
7108
7224
  // src/monorepo/discover.ts
7109
7225
  var import_node_fs6 = require("fs");
7110
- var import_node_path9 = __toESM(require("path"), 1);
7226
+ var import_node_path10 = __toESM(require("path"), 1);
7111
7227
  var import_micromatch = __toESM(require("micromatch"), 1);
7112
7228
 
7113
7229
  // src/monorepo/workspace.ts
7114
7230
  var import_node_fs5 = require("fs");
7115
- var import_node_path8 = require("path");
7231
+ var import_node_path9 = require("path");
7116
7232
  var import_yaml3 = require("yaml");
7117
7233
  function detectWorkspace(cwd) {
7118
7234
  const root = cwd ?? process.cwd();
7119
- const pnpmWorkspacePath = (0, import_node_path8.join)(root, "pnpm-workspace.yaml");
7235
+ const pnpmWorkspacePath = (0, import_node_path9.join)(root, "pnpm-workspace.yaml");
7120
7236
  if ((0, import_node_fs5.existsSync)(pnpmWorkspacePath)) {
7121
7237
  const content = (0, import_node_fs5.readFileSync)(pnpmWorkspacePath, "utf-8");
7122
7238
  const parsed = (0, import_yaml3.parse)(content);
7123
7239
  const packages = parsed?.packages ?? [];
7124
7240
  return { type: "pnpm", patterns: packages };
7125
7241
  }
7126
- const packageJsonPath = (0, import_node_path8.join)(root, "package.json");
7242
+ const packageJsonPath = (0, import_node_path9.join)(root, "package.json");
7127
7243
  if ((0, import_node_fs5.existsSync)(packageJsonPath)) {
7128
7244
  const content = (0, import_node_fs5.readFileSync)(packageJsonPath, "utf-8");
7129
7245
  const pkg = JSON.parse(content);
@@ -7184,9 +7300,9 @@ function applyLinkedGroup(bumps, group) {
7184
7300
 
7185
7301
  // src/prerelease/pre.ts
7186
7302
  var import_node_fs7 = require("fs");
7187
- var import_node_path10 = __toESM(require("path"), 1);
7303
+ var import_node_path11 = __toESM(require("path"), 1);
7188
7304
  function getPreStatePath(cwd) {
7189
- return import_node_path10.default.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
7305
+ return import_node_path11.default.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
7190
7306
  }
7191
7307
  function readPreState(cwd) {
7192
7308
  const filePath = getPreStatePath(cwd);
@@ -7203,7 +7319,7 @@ function enterPreMode(tag, cwd) {
7203
7319
  "Already in pre mode. Exit pre mode first before entering a new one."
7204
7320
  );
7205
7321
  }
7206
- const dir = import_node_path10.default.dirname(filePath);
7322
+ const dir = import_node_path11.default.dirname(filePath);
7207
7323
  if (!(0, import_node_fs7.existsSync)(dir)) {
7208
7324
  (0, import_node_fs7.mkdirSync)(dir, { recursive: true });
7209
7325
  }
@@ -7245,10 +7361,10 @@ function generateSnapshotVersion(options) {
7245
7361
 
7246
7362
  // src/validate/entry-points.ts
7247
7363
  var import_node_fs8 = require("fs");
7248
- var import_node_path11 = __toESM(require("path"), 1);
7364
+ var import_node_path12 = __toESM(require("path"), 1);
7249
7365
  var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
7250
7366
  function checkPath(filePath, cwd) {
7251
- return (0, import_node_fs8.existsSync)(import_node_path11.default.resolve(cwd, filePath));
7367
+ return (0, import_node_fs8.existsSync)(import_node_path12.default.resolve(cwd, filePath));
7252
7368
  }
7253
7369
  function validateExports(exports2, cwd, prefix = "exports") {
7254
7370
  const errors = [];
@@ -7352,7 +7468,18 @@ function detectExtraneousFiles(files) {
7352
7468
 
7353
7469
  // src/index.ts
7354
7470
  async function pubm(options) {
7355
- const resolvedOptions = resolveOptions({ ...options });
7471
+ const config = await loadConfig();
7472
+ const configOptions = {};
7473
+ if (config) {
7474
+ const resolved = resolveConfig(config);
7475
+ if (resolved.packages) {
7476
+ configOptions.packages = resolved.packages;
7477
+ }
7478
+ if (!options.registries && resolved.registries) {
7479
+ configOptions.registries = resolved.registries;
7480
+ }
7481
+ }
7482
+ const resolvedOptions = resolveOptions({ ...configOptions, ...options });
7356
7483
  await run(resolvedOptions);
7357
7484
  }
7358
7485
  // Annotate the CommonJS export names for ESM import in node: