pubm 0.0.0-alpha.9 → 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -58,9 +58,7 @@ function resolveOptions(options2) {
58
58
  }
59
59
 
60
60
  // src/tasks/runner.ts
61
- import npmCli from "@npmcli/promise-spawn";
62
61
  import { color as color5 } from "listr2";
63
- import SemVer from "semver";
64
62
  import { exec as exec5 } from "tinyexec";
65
63
 
66
64
  // src/git.ts
@@ -148,7 +146,7 @@ var Git = class {
148
146
  const logs = await this.git([
149
147
  "log",
150
148
  `${leftRev}...${rightRev}`,
151
- "--format=%H %s"
149
+ `--format='%H %s'`
152
150
  ]);
153
151
  return logs.split("\n").flatMap(
154
152
  (log) => log ? [{ id: log.slice(0, 40), message: log.slice(41) }] : []
@@ -291,15 +289,6 @@ var Git = class {
291
289
  });
292
290
  }
293
291
  }
294
- async repository() {
295
- try {
296
- return (await this.git(["remote", "get-url", "origin"])).trim();
297
- } catch (error) {
298
- throw new GitError("Failed to run `git remote get-url origin`", {
299
- cause: error
300
- });
301
- }
302
- }
303
292
  async createTag(tag, commitRev) {
304
293
  const args = ["tag", tag, commitRev].filter((v) => v);
305
294
  try {
@@ -314,10 +303,7 @@ var Git = class {
314
303
  async push(options2) {
315
304
  const args = ["push", options2].filter((v) => v);
316
305
  try {
317
- const { stderr } = await exec("git", args, { throwOnError: true });
318
- if (`${stderr}`.includes("GH006")) {
319
- return false;
320
- }
306
+ await this.git(args);
321
307
  return true;
322
308
  } catch (error) {
323
309
  if (`${error}`.includes("GH006")) {
@@ -330,13 +316,6 @@ var Git = class {
330
316
  }
331
317
  };
332
318
 
333
- // src/utils/cli.ts
334
- import { color as color2 } from "listr2";
335
- var warningBadge = color2.bgYellow(" Warning ");
336
- function link(text, url) {
337
- return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
338
- }
339
-
340
319
  // src/utils/listr.ts
341
320
  import { Listr } from "listr2";
342
321
 
@@ -367,6 +346,15 @@ function createListr(...args) {
367
346
  import { readFile, stat, writeFile } from "node:fs/promises";
368
347
  import path from "node:path";
369
348
  import process2 from "node:process";
349
+
350
+ // src/utils/cli.ts
351
+ import { color as color2 } from "listr2";
352
+ var warningBadge = color2.bgYellow(" Warning ");
353
+ function link(text, url) {
354
+ return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
355
+ }
356
+
357
+ // src/utils/package.ts
370
358
  var cachedPackageJson = {};
371
359
  var cachedJsrJson = {};
372
360
  async function patchCachedJsrJson(contents, { cwd = process2.cwd() } = {}) {
@@ -561,6 +549,55 @@ import { color as color3 } from "listr2";
561
549
  // src/registry/jsr.ts
562
550
  import { exec as exec2 } from "tinyexec";
563
551
 
552
+ // src/utils/package-name.ts
553
+ import { builtinModules } from "node:module";
554
+ function isScopedPackage(packageName) {
555
+ return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
556
+ }
557
+ function getScope(packageName) {
558
+ return packageName.match(/^@([^/]+)/)?.[1];
559
+ }
560
+ function getScopeAndName(packageName) {
561
+ const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
562
+ const scope = matches?.[1];
563
+ const name = matches?.[2];
564
+ return [scope, name];
565
+ }
566
+ var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
567
+ var blacklist = ["node_modules", "favicon.ico"];
568
+ function isValidPackageName(packageName) {
569
+ if (packageName.length <= 0) return false;
570
+ if (packageName.match(/^\./)) return false;
571
+ if (packageName.match(/^_/)) return false;
572
+ if (packageName.trim() !== packageName) return false;
573
+ for (const blacklistedName of blacklist) {
574
+ if (packageName.toLowerCase() === blacklistedName) return false;
575
+ }
576
+ if (builtinModules.includes(packageName.toLowerCase())) return false;
577
+ if (packageName.length > 214) return false;
578
+ if (packageName.toLowerCase() !== packageName) return false;
579
+ if (/[~'!()*]/.test(packageName.split("/").slice(-1)[0])) return false;
580
+ if (encodeURIComponent(packageName) !== packageName) {
581
+ const matches = packageName.match(scopedPackagePattern);
582
+ if (matches) {
583
+ const scope = matches[1];
584
+ const name = matches[2];
585
+ if (encodeURIComponent(scope) === scope && encodeURIComponent(name) === name) {
586
+ return true;
587
+ }
588
+ }
589
+ }
590
+ return true;
591
+ }
592
+
593
+ // src/registry/registry.ts
594
+ var Registry = class {
595
+ constructor(packageName, registry) {
596
+ this.packageName = packageName;
597
+ this.registry = registry;
598
+ }
599
+ };
600
+
564
601
  // src/utils/db.ts
565
602
  import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
566
603
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
@@ -614,55 +651,6 @@ var Db = class {
614
651
  }
615
652
  };
616
653
 
617
- // src/utils/package-name.ts
618
- import { builtinModules } from "node:module";
619
- function isScopedPackage(packageName) {
620
- return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
621
- }
622
- function getScope(packageName) {
623
- return packageName.match(/^@([^/]+)/)?.[1];
624
- }
625
- function getScopeAndName(packageName) {
626
- const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
627
- const scope = matches?.[1];
628
- const name = matches?.[2];
629
- return [scope, name];
630
- }
631
- var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
632
- var blacklist = ["node_modules", "favicon.ico"];
633
- function isValidPackageName(packageName) {
634
- if (packageName.length <= 0) return false;
635
- if (packageName.match(/^\./)) return false;
636
- if (packageName.match(/^_/)) return false;
637
- if (packageName.trim() !== packageName) return false;
638
- for (const blacklistedName of blacklist) {
639
- if (packageName.toLowerCase() === blacklistedName) return false;
640
- }
641
- if (builtinModules.includes(packageName.toLowerCase())) return false;
642
- if (packageName.length > 214) return false;
643
- if (packageName.toLowerCase() !== packageName) return false;
644
- if (/[~'!()*]/.test(packageName.split("/").slice(-1)[0])) return false;
645
- if (encodeURIComponent(packageName) !== packageName) {
646
- const matches = packageName.match(scopedPackagePattern);
647
- if (matches) {
648
- const scope = matches[1];
649
- const name = matches[2];
650
- if (encodeURIComponent(scope) === scope && encodeURIComponent(name) === name) {
651
- return true;
652
- }
653
- }
654
- }
655
- return true;
656
- }
657
-
658
- // src/registry/registry.ts
659
- var Registry = class {
660
- constructor(packageName, registry) {
661
- this.packageName = packageName;
662
- this.registry = registry;
663
- }
664
- };
665
-
666
654
  // src/registry/jsr.ts
667
655
  var JsrError = class extends AbstractError {
668
656
  constructor() {
@@ -1238,15 +1226,13 @@ var npmPublishTasks = {
1238
1226
  if (!result) {
1239
1227
  task.title = "Running npm publish (OTP code needed)";
1240
1228
  while (!result) {
1229
+ task.output = "2FA failed";
1241
1230
  result = await npm.publish(
1242
1231
  await task.prompt(ListrEnquirerPromptAdapter2).run({
1243
1232
  type: "password",
1244
1233
  message: "npm OTP code"
1245
1234
  })
1246
1235
  );
1247
- if (!result) {
1248
- task.output = "2FA failed";
1249
- }
1250
1236
  }
1251
1237
  task.title = "Running npm publish (2FA passed)";
1252
1238
  }
@@ -1400,9 +1386,6 @@ var prerequisitesCheckTask = (options2) => {
1400
1386
  });
1401
1387
  };
1402
1388
 
1403
- // src/tasks/required-conditions-check.ts
1404
- import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
1405
-
1406
1389
  // src/registry/custom-registry.ts
1407
1390
  import { exec as exec4 } from "tinyexec";
1408
1391
  var CustomRegistry = class extends NpmRegistry {
@@ -1445,6 +1428,7 @@ async function validateEngineVersion(engine, version2) {
1445
1428
  }
1446
1429
 
1447
1430
  // src/tasks/required-conditions-check.ts
1431
+ import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
1448
1432
  var RequiredConditionCheckError = class extends AbstractError {
1449
1433
  constructor(message, { cause } = {}) {
1450
1434
  super(message, { cause });
@@ -1572,8 +1556,6 @@ var requiredConditionsCheckTask = (options2) => createListr({
1572
1556
  });
1573
1557
 
1574
1558
  // src/tasks/runner.ts
1575
- var { open } = npmCli;
1576
- var { prerelease } = SemVer;
1577
1559
  async function run(options2) {
1578
1560
  const git = new Git();
1579
1561
  const ctx = {
@@ -1687,27 +1669,13 @@ async function run(options2) {
1687
1669
  {
1688
1670
  skip: options2.skipReleaseDraft,
1689
1671
  title: "Creating release draft on GitHub",
1690
- task: async (ctx2, task) => {
1672
+ task: async (ctx2) => {
1691
1673
  const git2 = new Git();
1692
- const repositoryUrl = await git2.repository();
1693
- const commits = (await git2.commits(ctx2.lastRev, `${await git2.latestTag()}`)).slice(0, -1);
1694
- const latestTag = await git2.latestTag();
1695
- let body = commits.map(
1696
- ({ id, message }) => `- ${message.replace("#", `${repositoryUrl}/issues/`)} ${repositoryUrl}/commit/${id}`
1697
- ).join("\n");
1698
- body += `
1699
-
1700
- ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
1701
- const releaseDraftUrl = new URL(`${repositoryUrl}/releases/new`);
1702
- releaseDraftUrl.searchParams.set("tag", `${latestTag}`);
1703
- releaseDraftUrl.searchParams.set("body", body);
1704
- releaseDraftUrl.searchParams.set(
1705
- "prerelease",
1706
- `${!!prerelease(ctx2.version)}`
1674
+ const logs = await git2.commits(
1675
+ ctx2.lastRev,
1676
+ `${await git2.latestTag()}`
1707
1677
  );
1708
- const linkUrl = link("Link", releaseDraftUrl.toString());
1709
- task.title += ` ${linkUrl}`;
1710
- await open(releaseDraftUrl.toString());
1678
+ console.log(logs);
1711
1679
  }
1712
1680
  }
1713
1681
  ]).run(ctx);
@@ -1736,7 +1704,7 @@ async function pubm(options2) {
1736
1704
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter5 } from "@listr2/prompt-adapter-enquirer";
1737
1705
  import { color as color6 } from "listr2";
1738
1706
  import semver from "semver";
1739
- var { RELEASE_TYPES, SemVer: SemVer2, prerelease: prerelease2 } = semver;
1707
+ var { RELEASE_TYPES, SemVer, prerelease } = semver;
1740
1708
  var requiredMissingInformationTasks = (options2) => createListr({
1741
1709
  ...options2,
1742
1710
  title: "Checking required information",
@@ -1750,7 +1718,7 @@ var requiredMissingInformationTasks = (options2) => createListr({
1750
1718
  type: "select",
1751
1719
  message: "Select SemVer increment or specify new version",
1752
1720
  choices: RELEASE_TYPES.map((releaseType) => {
1753
- const increasedVersion = new SemVer2(currentVersion).inc(releaseType).toString();
1721
+ const increasedVersion = new SemVer(currentVersion).inc(releaseType).toString();
1754
1722
  return {
1755
1723
  message: `${releaseType} ${color6.dim(increasedVersion)}`,
1756
1724
  name: increasedVersion
@@ -1773,7 +1741,7 @@ var requiredMissingInformationTasks = (options2) => createListr({
1773
1741
  },
1774
1742
  {
1775
1743
  title: "Checking tag information",
1776
- skip: (ctx) => !prerelease2(`${ctx.version}`) && ctx.tag === defaultOptions.tag,
1744
+ skip: (ctx) => !prerelease(`${ctx.version}`) && ctx.tag === defaultOptions.tag,
1777
1745
  task: async (ctx, task) => {
1778
1746
  const npm = await npmRegistry();
1779
1747
  const jsr = await jsrRegistry();
@@ -1972,7 +1940,6 @@ function resolveCliOptions(options2) {
1972
1940
  }
1973
1941
  cli.command("[version]").action(async (nextVersion, options2) => {
1974
1942
  console.clear();
1975
- await notifyNewVersion();
1976
1943
  const context = {
1977
1944
  version: nextVersion,
1978
1945
  tag: options2.tag
@@ -1999,6 +1966,7 @@ cli.help((sections) => {
1999
1966
  sections.push({ body: "\n" });
2000
1967
  });
2001
1968
  (async () => {
1969
+ await notifyNewVersion();
2002
1970
  cli.version(await version({ cwd: import.meta.dirname }));
2003
1971
  cli.parse();
2004
1972
  })();
package/dist/index.cjs CHANGED
@@ -49,9 +49,7 @@ function resolveOptions(options) {
49
49
  }
50
50
 
51
51
  // src/tasks/runner.ts
52
- var import_promise_spawn = __toESM(require("@npmcli/promise-spawn"), 1);
53
52
  var import_listr26 = require("listr2");
54
- var import_semver2 = __toESM(require("semver"), 1);
55
53
  var import_tinyexec5 = require("tinyexec");
56
54
 
57
55
  // src/error.ts
@@ -176,7 +174,7 @@ var Git = class {
176
174
  const logs = await this.git([
177
175
  "log",
178
176
  `${leftRev}...${rightRev}`,
179
- "--format=%H %s"
177
+ `--format='%H %s'`
180
178
  ]);
181
179
  return logs.split("\n").flatMap(
182
180
  (log) => log ? [{ id: log.slice(0, 40), message: log.slice(41) }] : []
@@ -319,15 +317,6 @@ var Git = class {
319
317
  });
320
318
  }
321
319
  }
322
- async repository() {
323
- try {
324
- return (await this.git(["remote", "get-url", "origin"])).trim();
325
- } catch (error) {
326
- throw new GitError("Failed to run `git remote get-url origin`", {
327
- cause: error
328
- });
329
- }
330
- }
331
320
  async createTag(tag, commitRev) {
332
321
  const args = ["tag", tag, commitRev].filter((v) => v);
333
322
  try {
@@ -342,10 +331,7 @@ var Git = class {
342
331
  async push(options) {
343
332
  const args = ["push", options].filter((v) => v);
344
333
  try {
345
- const { stderr } = await (0, import_tinyexec.exec)("git", args, { throwOnError: true });
346
- if (`${stderr}`.includes("GH006")) {
347
- return false;
348
- }
334
+ await this.git(args);
349
335
  return true;
350
336
  } catch (error) {
351
337
  if (`${error}`.includes("GH006")) {
@@ -358,15 +344,8 @@ var Git = class {
358
344
  }
359
345
  };
360
346
 
361
- // src/utils/cli.ts
362
- var import_listr22 = require("listr2");
363
- var warningBadge = import_listr22.color.bgYellow(" Warning ");
364
- function link(text, url) {
365
- return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
366
- }
367
-
368
347
  // src/utils/listr.ts
369
- var import_listr23 = require("listr2");
348
+ var import_listr22 = require("listr2");
370
349
 
371
350
  // src/utils/rollback.ts
372
351
  var rollbacks = [];
@@ -385,7 +364,7 @@ async function rollback() {
385
364
 
386
365
  // src/utils/listr.ts
387
366
  function createListr(...args) {
388
- const listr = new import_listr23.Listr(...args);
367
+ const listr = new import_listr22.Listr(...args);
389
368
  listr.isRoot = () => false;
390
369
  listr.externalSignalHandler = rollback;
391
370
  return listr;
@@ -395,6 +374,15 @@ function createListr(...args) {
395
374
  var import_promises = require("fs/promises");
396
375
  var import_node_path = __toESM(require("path"), 1);
397
376
  var import_node_process = __toESM(require("process"), 1);
377
+
378
+ // src/utils/cli.ts
379
+ var import_listr23 = require("listr2");
380
+ var warningBadge = import_listr23.color.bgYellow(" Warning ");
381
+ function link(text, url) {
382
+ return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
383
+ }
384
+
385
+ // src/utils/package.ts
398
386
  var cachedPackageJson = {};
399
387
  var cachedJsrJson = {};
400
388
  async function patchCachedJsrJson(contents, { cwd = import_node_process.default.cwd() } = {}) {
@@ -589,6 +577,55 @@ var import_listr24 = require("listr2");
589
577
  // src/registry/jsr.ts
590
578
  var import_tinyexec2 = require("tinyexec");
591
579
 
580
+ // src/utils/package-name.ts
581
+ var import_node_module = require("module");
582
+ function isScopedPackage(packageName) {
583
+ return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
584
+ }
585
+ function getScope(packageName) {
586
+ return packageName.match(/^@([^/]+)/)?.[1];
587
+ }
588
+ function getScopeAndName(packageName) {
589
+ const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
590
+ const scope = matches?.[1];
591
+ const name = matches?.[2];
592
+ return [scope, name];
593
+ }
594
+ var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
595
+ var blacklist = ["node_modules", "favicon.ico"];
596
+ function isValidPackageName(packageName) {
597
+ if (packageName.length <= 0) return false;
598
+ if (packageName.match(/^\./)) return false;
599
+ if (packageName.match(/^_/)) return false;
600
+ if (packageName.trim() !== packageName) return false;
601
+ for (const blacklistedName of blacklist) {
602
+ if (packageName.toLowerCase() === blacklistedName) return false;
603
+ }
604
+ if (import_node_module.builtinModules.includes(packageName.toLowerCase())) return false;
605
+ if (packageName.length > 214) return false;
606
+ if (packageName.toLowerCase() !== packageName) return false;
607
+ if (/[~'!()*]/.test(packageName.split("/").slice(-1)[0])) return false;
608
+ if (encodeURIComponent(packageName) !== packageName) {
609
+ const matches = packageName.match(scopedPackagePattern);
610
+ if (matches) {
611
+ const scope = matches[1];
612
+ const name = matches[2];
613
+ if (encodeURIComponent(scope) === scope && encodeURIComponent(name) === name) {
614
+ return true;
615
+ }
616
+ }
617
+ }
618
+ return true;
619
+ }
620
+
621
+ // src/registry/registry.ts
622
+ var Registry = class {
623
+ constructor(packageName, registry) {
624
+ this.packageName = packageName;
625
+ this.registry = registry;
626
+ }
627
+ };
628
+
592
629
  // src/utils/db.ts
593
630
  var import_node_crypto = require("crypto");
594
631
  var import_node_fs = require("fs");
@@ -643,55 +680,6 @@ var Db = class {
643
680
  }
644
681
  };
645
682
 
646
- // src/utils/package-name.ts
647
- var import_node_module = require("module");
648
- function isScopedPackage(packageName) {
649
- return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
650
- }
651
- function getScope(packageName) {
652
- return packageName.match(/^@([^/]+)/)?.[1];
653
- }
654
- function getScopeAndName(packageName) {
655
- const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
656
- const scope = matches?.[1];
657
- const name = matches?.[2];
658
- return [scope, name];
659
- }
660
- var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
661
- var blacklist = ["node_modules", "favicon.ico"];
662
- function isValidPackageName(packageName) {
663
- if (packageName.length <= 0) return false;
664
- if (packageName.match(/^\./)) return false;
665
- if (packageName.match(/^_/)) return false;
666
- if (packageName.trim() !== packageName) return false;
667
- for (const blacklistedName of blacklist) {
668
- if (packageName.toLowerCase() === blacklistedName) return false;
669
- }
670
- if (import_node_module.builtinModules.includes(packageName.toLowerCase())) return false;
671
- if (packageName.length > 214) return false;
672
- if (packageName.toLowerCase() !== packageName) return false;
673
- if (/[~'!()*]/.test(packageName.split("/").slice(-1)[0])) return false;
674
- if (encodeURIComponent(packageName) !== packageName) {
675
- const matches = packageName.match(scopedPackagePattern);
676
- if (matches) {
677
- const scope = matches[1];
678
- const name = matches[2];
679
- if (encodeURIComponent(scope) === scope && encodeURIComponent(name) === name) {
680
- return true;
681
- }
682
- }
683
- }
684
- return true;
685
- }
686
-
687
- // src/registry/registry.ts
688
- var Registry = class {
689
- constructor(packageName, registry) {
690
- this.packageName = packageName;
691
- this.registry = registry;
692
- }
693
- };
694
-
695
683
  // src/registry/jsr.ts
696
684
  var import_meta2 = {};
697
685
  var JsrError = class extends AbstractError {
@@ -1268,15 +1256,13 @@ var npmPublishTasks = {
1268
1256
  if (!result) {
1269
1257
  task.title = "Running npm publish (OTP code needed)";
1270
1258
  while (!result) {
1259
+ task.output = "2FA failed";
1271
1260
  result = await npm.publish(
1272
1261
  await task.prompt(import_prompt_adapter_enquirer2.ListrEnquirerPromptAdapter).run({
1273
1262
  type: "password",
1274
1263
  message: "npm OTP code"
1275
1264
  })
1276
1265
  );
1277
- if (!result) {
1278
- task.output = "2FA failed";
1279
- }
1280
1266
  }
1281
1267
  task.title = "Running npm publish (2FA passed)";
1282
1268
  }
@@ -1430,9 +1416,6 @@ var prerequisitesCheckTask = (options) => {
1430
1416
  });
1431
1417
  };
1432
1418
 
1433
- // src/tasks/required-conditions-check.ts
1434
- var import_prompt_adapter_enquirer4 = require("@listr2/prompt-adapter-enquirer");
1435
-
1436
1419
  // src/registry/custom-registry.ts
1437
1420
  var import_tinyexec4 = require("tinyexec");
1438
1421
  var CustomRegistry = class extends NpmRegistry {
@@ -1476,6 +1459,7 @@ async function validateEngineVersion(engine, version2) {
1476
1459
  }
1477
1460
 
1478
1461
  // src/tasks/required-conditions-check.ts
1462
+ var import_prompt_adapter_enquirer4 = require("@listr2/prompt-adapter-enquirer");
1479
1463
  var RequiredConditionCheckError = class extends AbstractError {
1480
1464
  constructor(message, { cause } = {}) {
1481
1465
  super(message, { cause });
@@ -1603,8 +1587,6 @@ var requiredConditionsCheckTask = (options) => createListr({
1603
1587
  });
1604
1588
 
1605
1589
  // src/tasks/runner.ts
1606
- var { open } = import_promise_spawn.default;
1607
- var { prerelease } = import_semver2.default;
1608
1590
  async function run(options) {
1609
1591
  const git = new Git();
1610
1592
  const ctx = {
@@ -1718,27 +1700,13 @@ async function run(options) {
1718
1700
  {
1719
1701
  skip: options.skipReleaseDraft,
1720
1702
  title: "Creating release draft on GitHub",
1721
- task: async (ctx2, task) => {
1703
+ task: async (ctx2) => {
1722
1704
  const git2 = new Git();
1723
- const repositoryUrl = await git2.repository();
1724
- const commits = (await git2.commits(ctx2.lastRev, `${await git2.latestTag()}`)).slice(0, -1);
1725
- const latestTag = await git2.latestTag();
1726
- let body = commits.map(
1727
- ({ id, message }) => `- ${message.replace("#", `${repositoryUrl}/issues/`)} ${repositoryUrl}/commit/${id}`
1728
- ).join("\n");
1729
- body += `
1730
-
1731
- ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
1732
- const releaseDraftUrl = new URL(`${repositoryUrl}/releases/new`);
1733
- releaseDraftUrl.searchParams.set("tag", `${latestTag}`);
1734
- releaseDraftUrl.searchParams.set("body", body);
1735
- releaseDraftUrl.searchParams.set(
1736
- "prerelease",
1737
- `${!!prerelease(ctx2.version)}`
1705
+ const logs = await git2.commits(
1706
+ ctx2.lastRev,
1707
+ `${await git2.latestTag()}`
1738
1708
  );
1739
- const linkUrl = link("Link", releaseDraftUrl.toString());
1740
- task.title += ` ${linkUrl}`;
1741
- await open(releaseDraftUrl.toString());
1709
+ console.log(logs);
1742
1710
  }
1743
1711
  }
1744
1712
  ]).run(ctx);
package/dist/index.js CHANGED
@@ -15,9 +15,7 @@ function resolveOptions(options) {
15
15
  }
16
16
 
17
17
  // src/tasks/runner.ts
18
- import npmCli from "@npmcli/promise-spawn";
19
18
  import { color as color5 } from "listr2";
20
- import SemVer from "semver";
21
19
  import { exec as exec5 } from "tinyexec";
22
20
 
23
21
  // src/error.ts
@@ -142,7 +140,7 @@ var Git = class {
142
140
  const logs = await this.git([
143
141
  "log",
144
142
  `${leftRev}...${rightRev}`,
145
- "--format=%H %s"
143
+ `--format='%H %s'`
146
144
  ]);
147
145
  return logs.split("\n").flatMap(
148
146
  (log) => log ? [{ id: log.slice(0, 40), message: log.slice(41) }] : []
@@ -285,15 +283,6 @@ var Git = class {
285
283
  });
286
284
  }
287
285
  }
288
- async repository() {
289
- try {
290
- return (await this.git(["remote", "get-url", "origin"])).trim();
291
- } catch (error) {
292
- throw new GitError("Failed to run `git remote get-url origin`", {
293
- cause: error
294
- });
295
- }
296
- }
297
286
  async createTag(tag, commitRev) {
298
287
  const args = ["tag", tag, commitRev].filter((v) => v);
299
288
  try {
@@ -308,10 +297,7 @@ var Git = class {
308
297
  async push(options) {
309
298
  const args = ["push", options].filter((v) => v);
310
299
  try {
311
- const { stderr } = await exec("git", args, { throwOnError: true });
312
- if (`${stderr}`.includes("GH006")) {
313
- return false;
314
- }
300
+ await this.git(args);
315
301
  return true;
316
302
  } catch (error) {
317
303
  if (`${error}`.includes("GH006")) {
@@ -324,13 +310,6 @@ var Git = class {
324
310
  }
325
311
  };
326
312
 
327
- // src/utils/cli.ts
328
- import { color as color2 } from "listr2";
329
- var warningBadge = color2.bgYellow(" Warning ");
330
- function link(text, url) {
331
- return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
332
- }
333
-
334
313
  // src/utils/listr.ts
335
314
  import { Listr } from "listr2";
336
315
 
@@ -361,6 +340,15 @@ function createListr(...args) {
361
340
  import { readFile, stat, writeFile } from "node:fs/promises";
362
341
  import path from "node:path";
363
342
  import process2 from "node:process";
343
+
344
+ // src/utils/cli.ts
345
+ import { color as color2 } from "listr2";
346
+ var warningBadge = color2.bgYellow(" Warning ");
347
+ function link(text, url) {
348
+ return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
349
+ }
350
+
351
+ // src/utils/package.ts
364
352
  var cachedPackageJson = {};
365
353
  var cachedJsrJson = {};
366
354
  async function patchCachedJsrJson(contents, { cwd = process2.cwd() } = {}) {
@@ -555,6 +543,55 @@ import { color as color3 } from "listr2";
555
543
  // src/registry/jsr.ts
556
544
  import { exec as exec2 } from "tinyexec";
557
545
 
546
+ // src/utils/package-name.ts
547
+ import { builtinModules } from "node:module";
548
+ function isScopedPackage(packageName) {
549
+ return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
550
+ }
551
+ function getScope(packageName) {
552
+ return packageName.match(/^@([^/]+)/)?.[1];
553
+ }
554
+ function getScopeAndName(packageName) {
555
+ const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
556
+ const scope = matches?.[1];
557
+ const name = matches?.[2];
558
+ return [scope, name];
559
+ }
560
+ var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
561
+ var blacklist = ["node_modules", "favicon.ico"];
562
+ function isValidPackageName(packageName) {
563
+ if (packageName.length <= 0) return false;
564
+ if (packageName.match(/^\./)) return false;
565
+ if (packageName.match(/^_/)) return false;
566
+ if (packageName.trim() !== packageName) return false;
567
+ for (const blacklistedName of blacklist) {
568
+ if (packageName.toLowerCase() === blacklistedName) return false;
569
+ }
570
+ if (builtinModules.includes(packageName.toLowerCase())) return false;
571
+ if (packageName.length > 214) return false;
572
+ if (packageName.toLowerCase() !== packageName) return false;
573
+ if (/[~'!()*]/.test(packageName.split("/").slice(-1)[0])) return false;
574
+ if (encodeURIComponent(packageName) !== packageName) {
575
+ const matches = packageName.match(scopedPackagePattern);
576
+ if (matches) {
577
+ const scope = matches[1];
578
+ const name = matches[2];
579
+ if (encodeURIComponent(scope) === scope && encodeURIComponent(name) === name) {
580
+ return true;
581
+ }
582
+ }
583
+ }
584
+ return true;
585
+ }
586
+
587
+ // src/registry/registry.ts
588
+ var Registry = class {
589
+ constructor(packageName, registry) {
590
+ this.packageName = packageName;
591
+ this.registry = registry;
592
+ }
593
+ };
594
+
558
595
  // src/utils/db.ts
559
596
  import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
560
597
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
@@ -608,55 +645,6 @@ var Db = class {
608
645
  }
609
646
  };
610
647
 
611
- // src/utils/package-name.ts
612
- import { builtinModules } from "node:module";
613
- function isScopedPackage(packageName) {
614
- return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
615
- }
616
- function getScope(packageName) {
617
- return packageName.match(/^@([^/]+)/)?.[1];
618
- }
619
- function getScopeAndName(packageName) {
620
- const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
621
- const scope = matches?.[1];
622
- const name = matches?.[2];
623
- return [scope, name];
624
- }
625
- var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
626
- var blacklist = ["node_modules", "favicon.ico"];
627
- function isValidPackageName(packageName) {
628
- if (packageName.length <= 0) return false;
629
- if (packageName.match(/^\./)) return false;
630
- if (packageName.match(/^_/)) return false;
631
- if (packageName.trim() !== packageName) return false;
632
- for (const blacklistedName of blacklist) {
633
- if (packageName.toLowerCase() === blacklistedName) return false;
634
- }
635
- if (builtinModules.includes(packageName.toLowerCase())) return false;
636
- if (packageName.length > 214) return false;
637
- if (packageName.toLowerCase() !== packageName) return false;
638
- if (/[~'!()*]/.test(packageName.split("/").slice(-1)[0])) return false;
639
- if (encodeURIComponent(packageName) !== packageName) {
640
- const matches = packageName.match(scopedPackagePattern);
641
- if (matches) {
642
- const scope = matches[1];
643
- const name = matches[2];
644
- if (encodeURIComponent(scope) === scope && encodeURIComponent(name) === name) {
645
- return true;
646
- }
647
- }
648
- }
649
- return true;
650
- }
651
-
652
- // src/registry/registry.ts
653
- var Registry = class {
654
- constructor(packageName, registry) {
655
- this.packageName = packageName;
656
- this.registry = registry;
657
- }
658
- };
659
-
660
648
  // src/registry/jsr.ts
661
649
  var JsrError = class extends AbstractError {
662
650
  constructor() {
@@ -1232,15 +1220,13 @@ var npmPublishTasks = {
1232
1220
  if (!result) {
1233
1221
  task.title = "Running npm publish (OTP code needed)";
1234
1222
  while (!result) {
1223
+ task.output = "2FA failed";
1235
1224
  result = await npm.publish(
1236
1225
  await task.prompt(ListrEnquirerPromptAdapter2).run({
1237
1226
  type: "password",
1238
1227
  message: "npm OTP code"
1239
1228
  })
1240
1229
  );
1241
- if (!result) {
1242
- task.output = "2FA failed";
1243
- }
1244
1230
  }
1245
1231
  task.title = "Running npm publish (2FA passed)";
1246
1232
  }
@@ -1394,9 +1380,6 @@ var prerequisitesCheckTask = (options) => {
1394
1380
  });
1395
1381
  };
1396
1382
 
1397
- // src/tasks/required-conditions-check.ts
1398
- import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
1399
-
1400
1383
  // src/registry/custom-registry.ts
1401
1384
  import { exec as exec4 } from "tinyexec";
1402
1385
  var CustomRegistry = class extends NpmRegistry {
@@ -1439,6 +1422,7 @@ async function validateEngineVersion(engine, version2) {
1439
1422
  }
1440
1423
 
1441
1424
  // src/tasks/required-conditions-check.ts
1425
+ import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
1442
1426
  var RequiredConditionCheckError = class extends AbstractError {
1443
1427
  constructor(message, { cause } = {}) {
1444
1428
  super(message, { cause });
@@ -1566,8 +1550,6 @@ var requiredConditionsCheckTask = (options) => createListr({
1566
1550
  });
1567
1551
 
1568
1552
  // src/tasks/runner.ts
1569
- var { open } = npmCli;
1570
- var { prerelease } = SemVer;
1571
1553
  async function run(options) {
1572
1554
  const git = new Git();
1573
1555
  const ctx = {
@@ -1681,27 +1663,13 @@ async function run(options) {
1681
1663
  {
1682
1664
  skip: options.skipReleaseDraft,
1683
1665
  title: "Creating release draft on GitHub",
1684
- task: async (ctx2, task) => {
1666
+ task: async (ctx2) => {
1685
1667
  const git2 = new Git();
1686
- const repositoryUrl = await git2.repository();
1687
- const commits = (await git2.commits(ctx2.lastRev, `${await git2.latestTag()}`)).slice(0, -1);
1688
- const latestTag = await git2.latestTag();
1689
- let body = commits.map(
1690
- ({ id, message }) => `- ${message.replace("#", `${repositoryUrl}/issues/`)} ${repositoryUrl}/commit/${id}`
1691
- ).join("\n");
1692
- body += `
1693
-
1694
- ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
1695
- const releaseDraftUrl = new URL(`${repositoryUrl}/releases/new`);
1696
- releaseDraftUrl.searchParams.set("tag", `${latestTag}`);
1697
- releaseDraftUrl.searchParams.set("body", body);
1698
- releaseDraftUrl.searchParams.set(
1699
- "prerelease",
1700
- `${!!prerelease(ctx2.version)}`
1668
+ const logs = await git2.commits(
1669
+ ctx2.lastRev,
1670
+ `${await git2.latestTag()}`
1701
1671
  );
1702
- const linkUrl = link("Link", releaseDraftUrl.toString());
1703
- task.title += ` ${linkUrl}`;
1704
- await open(releaseDraftUrl.toString());
1672
+ console.log(logs);
1705
1673
  }
1706
1674
  }
1707
1675
  ]).run(ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.0.0-alpha.9",
3
+ "version": "0.0.1-alpha.0",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"
@@ -33,7 +33,6 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@listr2/prompt-adapter-enquirer": "^2.0.12",
36
- "@npmcli/promise-spawn": "^8.0.1",
37
36
  "cac": "^6.7.14",
38
37
  "enquirer": "^2.4.1",
39
38
  "listr2": "^8.2.5",
@@ -45,7 +44,6 @@
45
44
  "@biomejs/biome": "^1.9.2",
46
45
  "@types/node": "^22.7.4",
47
46
  "@types/npm": "^7.19.3",
48
- "@types/npmcli__promise-spawn": "^6.0.3",
49
47
  "@types/picomatch": "^3.0.1",
50
48
  "@types/semver": "^7.5.8",
51
49
  "@vitest/coverage-v8": "^2.1.1",