pubm 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -5652,6 +5652,8 @@ var Registry = class {
5652
5652
  this.packageName = packageName;
5653
5653
  this.registry = registry;
5654
5654
  }
5655
+ async dryRunPublish(_manifestDir) {
5656
+ }
5655
5657
  };
5656
5658
 
5657
5659
  // src/registry/crates.ts
@@ -5732,6 +5734,20 @@ ${stderr}` : "Failed to run `cargo publish`";
5732
5734
  throw new CratesError(message, { cause: error });
5733
5735
  }
5734
5736
  }
5737
+ async dryRunPublish(manifestDir) {
5738
+ try {
5739
+ const args = ["publish", "--dry-run"];
5740
+ if (manifestDir) {
5741
+ args.push("--manifest-path", path9.join(manifestDir, "Cargo.toml"));
5742
+ }
5743
+ await exec3("cargo", args, { throwOnError: true });
5744
+ } catch (error) {
5745
+ const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
5746
+ const message = stderr ? `Dry-run failed for \`cargo publish\`:
5747
+ ${stderr}` : "Dry-run failed for `cargo publish`";
5748
+ throw new CratesError(message, { cause: error });
5749
+ }
5750
+ }
5735
5751
  async isPublished() {
5736
5752
  try {
5737
5753
  const response = await fetch(
@@ -5818,11 +5834,6 @@ function createCratesPublishTask(packagePath) {
5818
5834
  var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
5819
5835
  var cratesPublishTasks = createCratesPublishTask();
5820
5836
 
5821
- // src/tasks/jsr.ts
5822
- import process12 from "node:process";
5823
- import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
5824
- import npmCli from "@npmcli/promise-spawn";
5825
-
5826
5837
  // src/registry/jsr.ts
5827
5838
  import { exec as exec4, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
5828
5839
 
@@ -6022,6 +6033,28 @@ ${stderr}` : ""}`,
6022
6033
  );
6023
6034
  }
6024
6035
  }
6036
+ async dryRunPublish() {
6037
+ try {
6038
+ await exec4(
6039
+ "jsr",
6040
+ [
6041
+ "publish",
6042
+ "--dry-run",
6043
+ "--allow-dirty",
6044
+ "--token",
6045
+ `${JsrClient.token}`
6046
+ ],
6047
+ { throwOnError: true }
6048
+ );
6049
+ } catch (error) {
6050
+ const stderr = error instanceof NonZeroExitError2 ? error.output?.stderr : void 0;
6051
+ throw new JsrError(
6052
+ `Dry-run failed for \`jsr publish\`${stderr ? `
6053
+ ${stderr}` : ""}`,
6054
+ { cause: error }
6055
+ );
6056
+ }
6057
+ }
6025
6058
  async version() {
6026
6059
  return await this.jsr(["--version"]);
6027
6060
  }
@@ -6416,6 +6449,22 @@ var NpmRegistry = class extends Registry {
6416
6449
  throw this.classifyPublishError(error);
6417
6450
  }
6418
6451
  }
6452
+ async dryRunPublish() {
6453
+ try {
6454
+ await this.npm(["publish", "--dry-run"]);
6455
+ } catch (error) {
6456
+ throw this.classifyPublishError(error);
6457
+ }
6458
+ }
6459
+ async twoFactorAuthMode() {
6460
+ try {
6461
+ const output = await this.npm(["profile", "get", "--json"]);
6462
+ const profile = JSON.parse(output);
6463
+ return profile?.tfa?.mode ?? null;
6464
+ } catch {
6465
+ return null;
6466
+ }
6467
+ }
6419
6468
  async isPackageNameAvaliable() {
6420
6469
  return isValidPackageName(this.packageName);
6421
6470
  }
@@ -6452,7 +6501,71 @@ async function npmRegistry() {
6452
6501
  return new NpmRegistry(packageJson.name);
6453
6502
  }
6454
6503
 
6504
+ // src/tasks/dry-run-publish.ts
6505
+ var npmDryRunPublishTask = {
6506
+ title: "Dry-run npm publish",
6507
+ task: async (_, task) => {
6508
+ const npm = await npmRegistry();
6509
+ task.output = "Running npm publish --dry-run...";
6510
+ await npm.dryRunPublish();
6511
+ }
6512
+ };
6513
+ var jsrDryRunPublishTask = {
6514
+ title: "Dry-run jsr publish",
6515
+ skip: () => !JsrClient.token,
6516
+ task: async (_, task) => {
6517
+ const jsr = await jsrRegistry();
6518
+ task.output = "Running jsr publish --dry-run...";
6519
+ await jsr.dryRunPublish();
6520
+ }
6521
+ };
6522
+ function createCratesDryRunPublishTask(packagePath) {
6523
+ const label = packagePath ? ` (${packagePath})` : "";
6524
+ return {
6525
+ title: `Dry-run cargo publish${label}`,
6526
+ task: async (_, task) => {
6527
+ const eco = new RustEcosystem(packagePath ?? process.cwd());
6528
+ const packageName = await eco.packageName();
6529
+ const registry = new CratesRegistry(packageName);
6530
+ task.output = "Running cargo publish --dry-run...";
6531
+ await registry.dryRunPublish(packagePath);
6532
+ }
6533
+ };
6534
+ }
6535
+ var cratesDryRunPublishTask = createCratesDryRunPublishTask();
6536
+ function registryDryRunTask(registryKey) {
6537
+ switch (registryKey) {
6538
+ case "npm":
6539
+ return npmDryRunPublishTask;
6540
+ case "jsr":
6541
+ return jsrDryRunPublishTask;
6542
+ case "crates":
6543
+ return cratesDryRunPublishTask;
6544
+ default:
6545
+ return npmDryRunPublishTask;
6546
+ }
6547
+ }
6548
+ var dryRunPublishTask = {
6549
+ title: "Validating publish (dry-run)",
6550
+ task: (ctx, parentTask) => {
6551
+ if (ctx.packages?.length) {
6552
+ const tasks = ctx.packages.flatMap(
6553
+ (pkg) => pkg.registries.map(
6554
+ (registryKey) => registryKey === "crates" ? createCratesDryRunPublishTask(pkg.path) : registryDryRunTask(registryKey)
6555
+ )
6556
+ );
6557
+ return parentTask.newListr(tasks, { concurrent: true });
6558
+ }
6559
+ return parentTask.newListr(collectRegistries(ctx).map(registryDryRunTask), {
6560
+ concurrent: true
6561
+ });
6562
+ }
6563
+ };
6564
+
6455
6565
  // src/tasks/jsr.ts
6566
+ import process12 from "node:process";
6567
+ import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
6568
+ import npmCli from "@npmcli/promise-spawn";
6456
6569
  var { open } = npmCli;
6457
6570
  var JsrAvailableError = class extends AbstractError {
6458
6571
  constructor(message, { cause } = {}) {
@@ -6685,7 +6798,6 @@ var NpmAvailableError = class extends AbstractError {
6685
6798
  };
6686
6799
  var npmAvailableCheckTasks = {
6687
6800
  title: "Checking npm avaliable for publising",
6688
- skip: (ctx) => !!ctx.preview,
6689
6801
  task: async (ctx, task) => {
6690
6802
  const npm = await npmRegistry();
6691
6803
  if (!await npm.isLoggedIn()) {
@@ -6748,6 +6860,14 @@ var npmAvailableCheckTasks = {
6748
6860
  More information: ${link2("npm naming rules", "https://github.com/npm/validate-npm-package-name?tab=readme-ov-file#naming-rules")}`
6749
6861
  );
6750
6862
  }
6863
+ if (!ctx.promptEnabled) {
6864
+ const tfaMode = await npm.twoFactorAuthMode();
6865
+ if (tfaMode === "auth-and-writes") {
6866
+ throw new NpmAvailableError(
6867
+ `npm account has 2FA enabled for writes (auth-and-writes). CI publish will fail with EOTP. Use an automation token or configure granular access token at https://www.npmjs.com/package/${npm.packageName}/access`
6868
+ );
6869
+ }
6870
+ }
6751
6871
  }
6752
6872
  };
6753
6873
  var npmPublishTasks = {
@@ -7242,6 +7362,10 @@ async function run(options) {
7242
7362
  }
7243
7363
  }
7244
7364
  },
7365
+ {
7366
+ ...dryRunPublishTask,
7367
+ skip: (ctx2) => options.skipPublish || !!ctx2.preview
7368
+ },
7245
7369
  {
7246
7370
  title: "Bumping version",
7247
7371
  skip: (ctx2) => !!ctx2.preview,
package/dist/index.cjs CHANGED
@@ -5217,6 +5217,8 @@ var Registry = class {
5217
5217
  this.packageName = packageName;
5218
5218
  this.registry = registry;
5219
5219
  }
5220
+ async dryRunPublish(_manifestDir) {
5221
+ }
5220
5222
  };
5221
5223
 
5222
5224
  // src/registry/crates.ts
@@ -5297,6 +5299,20 @@ ${stderr}` : "Failed to run `cargo publish`";
5297
5299
  throw new CratesError(message, { cause: error });
5298
5300
  }
5299
5301
  }
5302
+ async dryRunPublish(manifestDir) {
5303
+ try {
5304
+ const args = ["publish", "--dry-run"];
5305
+ if (manifestDir) {
5306
+ args.push("--manifest-path", import_node_path4.default.join(manifestDir, "Cargo.toml"));
5307
+ }
5308
+ await (0, import_tinyexec2.exec)("cargo", args, { throwOnError: true });
5309
+ } catch (error) {
5310
+ const stderr = error instanceof import_tinyexec2.NonZeroExitError ? error.output?.stderr : void 0;
5311
+ const message = stderr ? `Dry-run failed for \`cargo publish\`:
5312
+ ${stderr}` : "Dry-run failed for `cargo publish`";
5313
+ throw new CratesError(message, { cause: error });
5314
+ }
5315
+ }
5300
5316
  async isPublished() {
5301
5317
  try {
5302
5318
  const response = await fetch(
@@ -5383,11 +5399,6 @@ function createCratesPublishTask(packagePath) {
5383
5399
  var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
5384
5400
  var cratesPublishTasks = createCratesPublishTask();
5385
5401
 
5386
- // src/tasks/jsr.ts
5387
- var import_node_process6 = __toESM(require("process"), 1);
5388
- var import_prompt_adapter_enquirer = require("@listr2/prompt-adapter-enquirer");
5389
- var import_promise_spawn = __toESM(require("@npmcli/promise-spawn"), 1);
5390
-
5391
5402
  // src/registry/jsr.ts
5392
5403
  var import_tinyexec3 = require("tinyexec");
5393
5404
 
@@ -5589,6 +5600,28 @@ ${stderr}` : ""}`,
5589
5600
  );
5590
5601
  }
5591
5602
  }
5603
+ async dryRunPublish() {
5604
+ try {
5605
+ await (0, import_tinyexec3.exec)(
5606
+ "jsr",
5607
+ [
5608
+ "publish",
5609
+ "--dry-run",
5610
+ "--allow-dirty",
5611
+ "--token",
5612
+ `${JsrClient.token}`
5613
+ ],
5614
+ { throwOnError: true }
5615
+ );
5616
+ } catch (error) {
5617
+ const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
5618
+ throw new JsrError(
5619
+ `Dry-run failed for \`jsr publish\`${stderr ? `
5620
+ ${stderr}` : ""}`,
5621
+ { cause: error }
5622
+ );
5623
+ }
5624
+ }
5592
5625
  async version() {
5593
5626
  return await this.jsr(["--version"]);
5594
5627
  }
@@ -5983,6 +6016,22 @@ var NpmRegistry = class extends Registry {
5983
6016
  throw this.classifyPublishError(error);
5984
6017
  }
5985
6018
  }
6019
+ async dryRunPublish() {
6020
+ try {
6021
+ await this.npm(["publish", "--dry-run"]);
6022
+ } catch (error) {
6023
+ throw this.classifyPublishError(error);
6024
+ }
6025
+ }
6026
+ async twoFactorAuthMode() {
6027
+ try {
6028
+ const output = await this.npm(["profile", "get", "--json"]);
6029
+ const profile = JSON.parse(output);
6030
+ return profile?.tfa?.mode ?? null;
6031
+ } catch {
6032
+ return null;
6033
+ }
6034
+ }
5986
6035
  async isPackageNameAvaliable() {
5987
6036
  return isValidPackageName(this.packageName);
5988
6037
  }
@@ -6019,7 +6068,71 @@ async function npmRegistry() {
6019
6068
  return new NpmRegistry(packageJson.name);
6020
6069
  }
6021
6070
 
6071
+ // src/tasks/dry-run-publish.ts
6072
+ var npmDryRunPublishTask = {
6073
+ title: "Dry-run npm publish",
6074
+ task: async (_, task) => {
6075
+ const npm = await npmRegistry();
6076
+ task.output = "Running npm publish --dry-run...";
6077
+ await npm.dryRunPublish();
6078
+ }
6079
+ };
6080
+ var jsrDryRunPublishTask = {
6081
+ title: "Dry-run jsr publish",
6082
+ skip: () => !JsrClient.token,
6083
+ task: async (_, task) => {
6084
+ const jsr = await jsrRegistry();
6085
+ task.output = "Running jsr publish --dry-run...";
6086
+ await jsr.dryRunPublish();
6087
+ }
6088
+ };
6089
+ function createCratesDryRunPublishTask(packagePath) {
6090
+ const label = packagePath ? ` (${packagePath})` : "";
6091
+ return {
6092
+ title: `Dry-run cargo publish${label}`,
6093
+ task: async (_, task) => {
6094
+ const eco = new RustEcosystem(packagePath ?? process.cwd());
6095
+ const packageName = await eco.packageName();
6096
+ const registry = new CratesRegistry(packageName);
6097
+ task.output = "Running cargo publish --dry-run...";
6098
+ await registry.dryRunPublish(packagePath);
6099
+ }
6100
+ };
6101
+ }
6102
+ var cratesDryRunPublishTask = createCratesDryRunPublishTask();
6103
+ function registryDryRunTask(registryKey) {
6104
+ switch (registryKey) {
6105
+ case "npm":
6106
+ return npmDryRunPublishTask;
6107
+ case "jsr":
6108
+ return jsrDryRunPublishTask;
6109
+ case "crates":
6110
+ return cratesDryRunPublishTask;
6111
+ default:
6112
+ return npmDryRunPublishTask;
6113
+ }
6114
+ }
6115
+ var dryRunPublishTask = {
6116
+ title: "Validating publish (dry-run)",
6117
+ task: (ctx, parentTask) => {
6118
+ if (ctx.packages?.length) {
6119
+ const tasks = ctx.packages.flatMap(
6120
+ (pkg) => pkg.registries.map(
6121
+ (registryKey) => registryKey === "crates" ? createCratesDryRunPublishTask(pkg.path) : registryDryRunTask(registryKey)
6122
+ )
6123
+ );
6124
+ return parentTask.newListr(tasks, { concurrent: true });
6125
+ }
6126
+ return parentTask.newListr(collectRegistries(ctx).map(registryDryRunTask), {
6127
+ concurrent: true
6128
+ });
6129
+ }
6130
+ };
6131
+
6022
6132
  // src/tasks/jsr.ts
6133
+ var import_node_process6 = __toESM(require("process"), 1);
6134
+ var import_prompt_adapter_enquirer = require("@listr2/prompt-adapter-enquirer");
6135
+ var import_promise_spawn = __toESM(require("@npmcli/promise-spawn"), 1);
6023
6136
  var { open } = import_promise_spawn.default;
6024
6137
  var JsrAvailableError = class extends AbstractError {
6025
6138
  constructor(message, { cause } = {}) {
@@ -6252,7 +6365,6 @@ var NpmAvailableError = class extends AbstractError {
6252
6365
  };
6253
6366
  var npmAvailableCheckTasks = {
6254
6367
  title: "Checking npm avaliable for publising",
6255
- skip: (ctx) => !!ctx.preview,
6256
6368
  task: async (ctx, task) => {
6257
6369
  const npm = await npmRegistry();
6258
6370
  if (!await npm.isLoggedIn()) {
@@ -6315,6 +6427,14 @@ var npmAvailableCheckTasks = {
6315
6427
  More information: ${link2("npm naming rules", "https://github.com/npm/validate-npm-package-name?tab=readme-ov-file#naming-rules")}`
6316
6428
  );
6317
6429
  }
6430
+ if (!ctx.promptEnabled) {
6431
+ const tfaMode = await npm.twoFactorAuthMode();
6432
+ if (tfaMode === "auth-and-writes") {
6433
+ throw new NpmAvailableError(
6434
+ `npm account has 2FA enabled for writes (auth-and-writes). CI publish will fail with EOTP. Use an automation token or configure granular access token at https://www.npmjs.com/package/${npm.packageName}/access`
6435
+ );
6436
+ }
6437
+ }
6318
6438
  }
6319
6439
  };
6320
6440
  var npmPublishTasks = {
@@ -6810,6 +6930,10 @@ async function run(options) {
6810
6930
  }
6811
6931
  }
6812
6932
  },
6933
+ {
6934
+ ...dryRunPublishTask,
6935
+ skip: (ctx2) => options.skipPublish || !!ctx2.preview
6936
+ },
6813
6937
  {
6814
6938
  title: "Bumping version",
6815
6939
  skip: (ctx2) => !!ctx2.preview,
package/dist/index.js CHANGED
@@ -5184,6 +5184,8 @@ var Registry = class {
5184
5184
  this.packageName = packageName;
5185
5185
  this.registry = registry;
5186
5186
  }
5187
+ async dryRunPublish(_manifestDir) {
5188
+ }
5187
5189
  };
5188
5190
 
5189
5191
  // src/registry/crates.ts
@@ -5264,6 +5266,20 @@ ${stderr}` : "Failed to run `cargo publish`";
5264
5266
  throw new CratesError(message, { cause: error });
5265
5267
  }
5266
5268
  }
5269
+ async dryRunPublish(manifestDir) {
5270
+ try {
5271
+ const args = ["publish", "--dry-run"];
5272
+ if (manifestDir) {
5273
+ args.push("--manifest-path", path4.join(manifestDir, "Cargo.toml"));
5274
+ }
5275
+ await exec3("cargo", args, { throwOnError: true });
5276
+ } catch (error) {
5277
+ const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
5278
+ const message = stderr ? `Dry-run failed for \`cargo publish\`:
5279
+ ${stderr}` : "Dry-run failed for `cargo publish`";
5280
+ throw new CratesError(message, { cause: error });
5281
+ }
5282
+ }
5267
5283
  async isPublished() {
5268
5284
  try {
5269
5285
  const response = await fetch(
@@ -5350,11 +5366,6 @@ function createCratesPublishTask(packagePath) {
5350
5366
  var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
5351
5367
  var cratesPublishTasks = createCratesPublishTask();
5352
5368
 
5353
- // src/tasks/jsr.ts
5354
- import process8 from "node:process";
5355
- import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
5356
- import npmCli from "@npmcli/promise-spawn";
5357
-
5358
5369
  // src/registry/jsr.ts
5359
5370
  import { exec as exec4, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
5360
5371
 
@@ -5554,6 +5565,28 @@ ${stderr}` : ""}`,
5554
5565
  );
5555
5566
  }
5556
5567
  }
5568
+ async dryRunPublish() {
5569
+ try {
5570
+ await exec4(
5571
+ "jsr",
5572
+ [
5573
+ "publish",
5574
+ "--dry-run",
5575
+ "--allow-dirty",
5576
+ "--token",
5577
+ `${JsrClient.token}`
5578
+ ],
5579
+ { throwOnError: true }
5580
+ );
5581
+ } catch (error) {
5582
+ const stderr = error instanceof NonZeroExitError2 ? error.output?.stderr : void 0;
5583
+ throw new JsrError(
5584
+ `Dry-run failed for \`jsr publish\`${stderr ? `
5585
+ ${stderr}` : ""}`,
5586
+ { cause: error }
5587
+ );
5588
+ }
5589
+ }
5557
5590
  async version() {
5558
5591
  return await this.jsr(["--version"]);
5559
5592
  }
@@ -5948,6 +5981,22 @@ var NpmRegistry = class extends Registry {
5948
5981
  throw this.classifyPublishError(error);
5949
5982
  }
5950
5983
  }
5984
+ async dryRunPublish() {
5985
+ try {
5986
+ await this.npm(["publish", "--dry-run"]);
5987
+ } catch (error) {
5988
+ throw this.classifyPublishError(error);
5989
+ }
5990
+ }
5991
+ async twoFactorAuthMode() {
5992
+ try {
5993
+ const output = await this.npm(["profile", "get", "--json"]);
5994
+ const profile = JSON.parse(output);
5995
+ return profile?.tfa?.mode ?? null;
5996
+ } catch {
5997
+ return null;
5998
+ }
5999
+ }
5951
6000
  async isPackageNameAvaliable() {
5952
6001
  return isValidPackageName(this.packageName);
5953
6002
  }
@@ -5984,7 +6033,71 @@ async function npmRegistry() {
5984
6033
  return new NpmRegistry(packageJson.name);
5985
6034
  }
5986
6035
 
6036
+ // src/tasks/dry-run-publish.ts
6037
+ var npmDryRunPublishTask = {
6038
+ title: "Dry-run npm publish",
6039
+ task: async (_, task) => {
6040
+ const npm = await npmRegistry();
6041
+ task.output = "Running npm publish --dry-run...";
6042
+ await npm.dryRunPublish();
6043
+ }
6044
+ };
6045
+ var jsrDryRunPublishTask = {
6046
+ title: "Dry-run jsr publish",
6047
+ skip: () => !JsrClient.token,
6048
+ task: async (_, task) => {
6049
+ const jsr = await jsrRegistry();
6050
+ task.output = "Running jsr publish --dry-run...";
6051
+ await jsr.dryRunPublish();
6052
+ }
6053
+ };
6054
+ function createCratesDryRunPublishTask(packagePath) {
6055
+ const label = packagePath ? ` (${packagePath})` : "";
6056
+ return {
6057
+ title: `Dry-run cargo publish${label}`,
6058
+ task: async (_, task) => {
6059
+ const eco = new RustEcosystem(packagePath ?? process.cwd());
6060
+ const packageName = await eco.packageName();
6061
+ const registry = new CratesRegistry(packageName);
6062
+ task.output = "Running cargo publish --dry-run...";
6063
+ await registry.dryRunPublish(packagePath);
6064
+ }
6065
+ };
6066
+ }
6067
+ var cratesDryRunPublishTask = createCratesDryRunPublishTask();
6068
+ function registryDryRunTask(registryKey) {
6069
+ switch (registryKey) {
6070
+ case "npm":
6071
+ return npmDryRunPublishTask;
6072
+ case "jsr":
6073
+ return jsrDryRunPublishTask;
6074
+ case "crates":
6075
+ return cratesDryRunPublishTask;
6076
+ default:
6077
+ return npmDryRunPublishTask;
6078
+ }
6079
+ }
6080
+ var dryRunPublishTask = {
6081
+ title: "Validating publish (dry-run)",
6082
+ task: (ctx, parentTask) => {
6083
+ if (ctx.packages?.length) {
6084
+ const tasks = ctx.packages.flatMap(
6085
+ (pkg) => pkg.registries.map(
6086
+ (registryKey) => registryKey === "crates" ? createCratesDryRunPublishTask(pkg.path) : registryDryRunTask(registryKey)
6087
+ )
6088
+ );
6089
+ return parentTask.newListr(tasks, { concurrent: true });
6090
+ }
6091
+ return parentTask.newListr(collectRegistries(ctx).map(registryDryRunTask), {
6092
+ concurrent: true
6093
+ });
6094
+ }
6095
+ };
6096
+
5987
6097
  // src/tasks/jsr.ts
6098
+ import process8 from "node:process";
6099
+ import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
6100
+ import npmCli from "@npmcli/promise-spawn";
5988
6101
  var { open } = npmCli;
5989
6102
  var JsrAvailableError = class extends AbstractError {
5990
6103
  constructor(message, { cause } = {}) {
@@ -6217,7 +6330,6 @@ var NpmAvailableError = class extends AbstractError {
6217
6330
  };
6218
6331
  var npmAvailableCheckTasks = {
6219
6332
  title: "Checking npm avaliable for publising",
6220
- skip: (ctx) => !!ctx.preview,
6221
6333
  task: async (ctx, task) => {
6222
6334
  const npm = await npmRegistry();
6223
6335
  if (!await npm.isLoggedIn()) {
@@ -6280,6 +6392,14 @@ var npmAvailableCheckTasks = {
6280
6392
  More information: ${link2("npm naming rules", "https://github.com/npm/validate-npm-package-name?tab=readme-ov-file#naming-rules")}`
6281
6393
  );
6282
6394
  }
6395
+ if (!ctx.promptEnabled) {
6396
+ const tfaMode = await npm.twoFactorAuthMode();
6397
+ if (tfaMode === "auth-and-writes") {
6398
+ throw new NpmAvailableError(
6399
+ `npm account has 2FA enabled for writes (auth-and-writes). CI publish will fail with EOTP. Use an automation token or configure granular access token at https://www.npmjs.com/package/${npm.packageName}/access`
6400
+ );
6401
+ }
6402
+ }
6283
6403
  }
6284
6404
  };
6285
6405
  var npmPublishTasks = {
@@ -6774,6 +6894,10 @@ async function run(options) {
6774
6894
  }
6775
6895
  }
6776
6896
  },
6897
+ {
6898
+ ...dryRunPublishTask,
6899
+ skip: (ctx2) => options.skipPublish || !!ctx2.preview
6900
+ },
6777
6901
  {
6778
6902
  title: "Bumping version",
6779
6903
  skip: (ctx2) => !!ctx2.preview,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"