pubm 0.0.4-0 → 0.0.5

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
@@ -4442,7 +4442,7 @@ var Git = class {
4442
4442
  async previousTag(tag) {
4443
4443
  try {
4444
4444
  const tags = await this.tags();
4445
- return tags.at(tags.findIndex((t) => t === tag) - 1);
4445
+ return tags.at(tags.findIndex((t) => t === tag) - 1) ?? null;
4446
4446
  } catch {
4447
4447
  return null;
4448
4448
  }
@@ -4478,7 +4478,7 @@ var Git = class {
4478
4478
  }
4479
4479
  async revisionDiffsCount() {
4480
4480
  try {
4481
- return await Number.parseInt(
4481
+ return Number.parseInt(
4482
4482
  await this.git(["rev-list", "@{u}...HEAD", "--count", "--left-only"])
4483
4483
  );
4484
4484
  } catch (error) {
@@ -4518,7 +4518,7 @@ var Git = class {
4518
4518
  }
4519
4519
  async version() {
4520
4520
  try {
4521
- return (await this.git(["--version"])).trim().match(/\d+\.\d+\.\d+/)?.[0];
4521
+ return `${(await this.git(["--version"])).trim().match(/\d+\.\d+\.\d+/)?.[0]}`;
4522
4522
  } catch (error) {
4523
4523
  throw new GitError("Failed to run `git --version`", {
4524
4524
  cause: error
@@ -4739,7 +4739,7 @@ import path from "node:path";
4739
4739
  import process7 from "node:process";
4740
4740
  var cachedPackageJson = {};
4741
4741
  var cachedJsrJson = {};
4742
- async function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
4742
+ function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
4743
4743
  cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
4744
4744
  }
4745
4745
  async function findOutFile(file, { cwd = process7.cwd() } = {}) {
@@ -4850,7 +4850,7 @@ async function packageJsonToJsrJson(packageJson) {
4850
4850
  return convertedExports;
4851
4851
  }
4852
4852
  }
4853
- async function jsrJsonToPackageJson(jsrJson) {
4853
+ function jsrJsonToPackageJson(jsrJson) {
4854
4854
  return {
4855
4855
  name: jsrJson.name,
4856
4856
  version: jsrJson.version,
@@ -4990,13 +4990,13 @@ function isScopedPackage(packageName) {
4990
4990
  return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
4991
4991
  }
4992
4992
  function getScope(packageName) {
4993
- return packageName.match(/^@([^/]+)/)?.[1];
4993
+ return packageName.match(/^@([^/]+)/)?.[1] ?? null;
4994
4994
  }
4995
4995
  function getScopeAndName(packageName) {
4996
4996
  const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
4997
4997
  const scope = matches?.[1];
4998
4998
  const name = matches?.[2];
4999
- return [scope, name];
4999
+ return [`${scope}`, `${name}`];
5000
5000
  }
5001
5001
  var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
5002
5002
  var blacklist = ["node_modules", "favicon.ico"];
@@ -5886,7 +5886,7 @@ var requiredConditionsCheckTask = (options2) => createListr({
5886
5886
  [
5887
5887
  {
5888
5888
  title: "Ping registries",
5889
- task: async (ctx, parentTask2) => parentTask2.newListr(
5889
+ task: (ctx, parentTask2) => parentTask2.newListr(
5890
5890
  ctx.registries.map((registryKey) => ({
5891
5891
  title: `Ping to ${registryKey}`,
5892
5892
  task: async () => {
@@ -5975,7 +5975,7 @@ var requiredConditionsCheckTask = (options2) => createListr({
5975
5975
  },
5976
5976
  {
5977
5977
  title: "Checking available registries for publishing",
5978
- task: async (ctx, parentTask2) => parentTask2.newListr(
5978
+ task: (ctx, parentTask2) => parentTask2.newListr(
5979
5979
  ctx.registries.map((registryKey) => {
5980
5980
  switch (registryKey) {
5981
5981
  case "npm":
@@ -6413,50 +6413,52 @@ function resolveCliOptions(options2) {
6413
6413
  skipConditionsCheck: !options2.conditionCheck
6414
6414
  };
6415
6415
  }
6416
- cli.command("[version]").action(async (nextVersion, options2) => {
6417
- console.clear();
6418
- if (!isCI3) {
6419
- await notifyNewVersion();
6420
- }
6421
- const context = {
6422
- version: nextVersion,
6423
- tag: options2.tag
6424
- };
6425
- try {
6426
- if (isCI3) {
6427
- if (options2.publishOnly) {
6428
- const git = new Git();
6429
- const latestVersion = (await git.latestTag())?.slice(1);
6430
- if (!latestVersion) {
6431
- throw new Error(
6432
- "Cannot find the latest tag. Please ensure tags exist in the repository."
6433
- );
6434
- }
6435
- if (!valid(latestVersion)) {
6416
+ cli.command("[version]").action(
6417
+ async (nextVersion, options2) => {
6418
+ console.clear();
6419
+ if (!isCI3) {
6420
+ await notifyNewVersion();
6421
+ }
6422
+ const context = {
6423
+ version: nextVersion,
6424
+ tag: options2.tag
6425
+ };
6426
+ try {
6427
+ if (isCI3) {
6428
+ if (options2.publishOnly) {
6429
+ const git = new Git();
6430
+ const latestVersion = (await git.latestTag())?.slice(1);
6431
+ if (!latestVersion) {
6432
+ throw new Error(
6433
+ "Cannot find the latest tag. Please ensure tags exist in the repository."
6434
+ );
6435
+ }
6436
+ if (!valid(latestVersion)) {
6437
+ throw new Error(
6438
+ "Cannot parse the latest tag to a valid SemVer version. Please check the tag format."
6439
+ );
6440
+ }
6441
+ context.version = latestVersion;
6442
+ } else {
6436
6443
  throw new Error(
6437
- "Cannot parse the latest tag to a valid SemVer version. Please check the tag format."
6444
+ "Version must be set in the CI environment. Please define the version before proceeding."
6438
6445
  );
6439
6446
  }
6440
- context.version = latestVersion;
6441
6447
  } else {
6442
- throw new Error(
6443
- "Version must be set in the CI environment. Please define the version before proceeding."
6444
- );
6448
+ await requiredMissingInformationTasks().run(context);
6445
6449
  }
6446
- } else {
6447
- await requiredMissingInformationTasks().run(context);
6448
- }
6449
- await pubm(
6450
- resolveCliOptions({
6451
- ...options2,
6452
- version: context.version,
6453
- tag: context.tag
6454
- })
6455
- );
6456
- } catch (e2) {
6457
- consoleError(e2);
6450
+ await pubm(
6451
+ resolveCliOptions({
6452
+ ...options2,
6453
+ version: context.version,
6454
+ tag: context.tag
6455
+ })
6456
+ );
6457
+ } catch (e2) {
6458
+ consoleError(e2);
6459
+ }
6458
6460
  }
6459
- });
6461
+ );
6460
6462
  cli.help((sections) => {
6461
6463
  sections[1].body += `
6462
6464
 
package/dist/index.cjs CHANGED
@@ -4466,7 +4466,7 @@ var Git = class {
4466
4466
  async previousTag(tag) {
4467
4467
  try {
4468
4468
  const tags = await this.tags();
4469
- return tags.at(tags.findIndex((t) => t === tag) - 1);
4469
+ return tags.at(tags.findIndex((t) => t === tag) - 1) ?? null;
4470
4470
  } catch {
4471
4471
  return null;
4472
4472
  }
@@ -4502,7 +4502,7 @@ var Git = class {
4502
4502
  }
4503
4503
  async revisionDiffsCount() {
4504
4504
  try {
4505
- return await Number.parseInt(
4505
+ return Number.parseInt(
4506
4506
  await this.git(["rev-list", "@{u}...HEAD", "--count", "--left-only"])
4507
4507
  );
4508
4508
  } catch (error) {
@@ -4542,7 +4542,7 @@ var Git = class {
4542
4542
  }
4543
4543
  async version() {
4544
4544
  try {
4545
- return (await this.git(["--version"])).trim().match(/\d+\.\d+\.\d+/)?.[0];
4545
+ return `${(await this.git(["--version"])).trim().match(/\d+\.\d+\.\d+/)?.[0]}`;
4546
4546
  } catch (error) {
4547
4547
  throw new GitError("Failed to run `git --version`", {
4548
4548
  cause: error
@@ -4743,7 +4743,7 @@ var import_node_path = __toESM(require("path"), 1);
4743
4743
  var import_node_process5 = __toESM(require("process"), 1);
4744
4744
  var cachedPackageJson = {};
4745
4745
  var cachedJsrJson = {};
4746
- async function patchCachedJsrJson(contents, { cwd = import_node_process5.default.cwd() } = {}) {
4746
+ function patchCachedJsrJson(contents, { cwd = import_node_process5.default.cwd() } = {}) {
4747
4747
  cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
4748
4748
  }
4749
4749
  async function findOutFile(file, { cwd = import_node_process5.default.cwd() } = {}) {
@@ -4854,7 +4854,7 @@ async function packageJsonToJsrJson(packageJson) {
4854
4854
  return convertedExports;
4855
4855
  }
4856
4856
  }
4857
- async function jsrJsonToPackageJson(jsrJson) {
4857
+ function jsrJsonToPackageJson(jsrJson) {
4858
4858
  return {
4859
4859
  name: jsrJson.name,
4860
4860
  version: jsrJson.version,
@@ -4995,13 +4995,13 @@ function isScopedPackage(packageName) {
4995
4995
  return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
4996
4996
  }
4997
4997
  function getScope(packageName) {
4998
- return packageName.match(/^@([^/]+)/)?.[1];
4998
+ return packageName.match(/^@([^/]+)/)?.[1] ?? null;
4999
4999
  }
5000
5000
  function getScopeAndName(packageName) {
5001
5001
  const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
5002
5002
  const scope = matches?.[1];
5003
5003
  const name = matches?.[2];
5004
- return [scope, name];
5004
+ return [`${scope}`, `${name}`];
5005
5005
  }
5006
5006
  var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
5007
5007
  var blacklist = ["node_modules", "favicon.ico"];
@@ -5893,7 +5893,7 @@ var requiredConditionsCheckTask = (options) => createListr({
5893
5893
  [
5894
5894
  {
5895
5895
  title: "Ping registries",
5896
- task: async (ctx, parentTask2) => parentTask2.newListr(
5896
+ task: (ctx, parentTask2) => parentTask2.newListr(
5897
5897
  ctx.registries.map((registryKey) => ({
5898
5898
  title: `Ping to ${registryKey}`,
5899
5899
  task: async () => {
@@ -5982,7 +5982,7 @@ var requiredConditionsCheckTask = (options) => createListr({
5982
5982
  },
5983
5983
  {
5984
5984
  title: "Checking available registries for publishing",
5985
- task: async (ctx, parentTask2) => parentTask2.newListr(
5985
+ task: (ctx, parentTask2) => parentTask2.newListr(
5986
5986
  ctx.registries.map((registryKey) => {
5987
5987
  switch (registryKey) {
5988
5988
  case "npm":
package/dist/index.d.cts CHANGED
@@ -1,4 +1,7 @@
1
1
  type RegistryType = 'npm' | 'jsr' | string;
2
+ /**
3
+ * Options for configuring the {@linkcode pubm} function.
4
+ */
2
5
  interface Options {
3
6
  /**
4
7
  * @description Version to publish
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  type RegistryType = 'npm' | 'jsr' | string;
2
+ /**
3
+ * Options for configuring the {@linkcode pubm} function.
4
+ */
2
5
  interface Options {
3
6
  /**
4
7
  * @description Version to publish
package/dist/index.js CHANGED
@@ -4457,7 +4457,7 @@ var Git = class {
4457
4457
  async previousTag(tag) {
4458
4458
  try {
4459
4459
  const tags = await this.tags();
4460
- return tags.at(tags.findIndex((t) => t === tag) - 1);
4460
+ return tags.at(tags.findIndex((t) => t === tag) - 1) ?? null;
4461
4461
  } catch {
4462
4462
  return null;
4463
4463
  }
@@ -4493,7 +4493,7 @@ var Git = class {
4493
4493
  }
4494
4494
  async revisionDiffsCount() {
4495
4495
  try {
4496
- return await Number.parseInt(
4496
+ return Number.parseInt(
4497
4497
  await this.git(["rev-list", "@{u}...HEAD", "--count", "--left-only"])
4498
4498
  );
4499
4499
  } catch (error) {
@@ -4533,7 +4533,7 @@ var Git = class {
4533
4533
  }
4534
4534
  async version() {
4535
4535
  try {
4536
- return (await this.git(["--version"])).trim().match(/\d+\.\d+\.\d+/)?.[0];
4536
+ return `${(await this.git(["--version"])).trim().match(/\d+\.\d+\.\d+/)?.[0]}`;
4537
4537
  } catch (error) {
4538
4538
  throw new GitError("Failed to run `git --version`", {
4539
4539
  cause: error
@@ -4734,7 +4734,7 @@ import path from "node:path";
4734
4734
  import process7 from "node:process";
4735
4735
  var cachedPackageJson = {};
4736
4736
  var cachedJsrJson = {};
4737
- async function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
4737
+ function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
4738
4738
  cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
4739
4739
  }
4740
4740
  async function findOutFile(file, { cwd = process7.cwd() } = {}) {
@@ -4845,7 +4845,7 @@ async function packageJsonToJsrJson(packageJson) {
4845
4845
  return convertedExports;
4846
4846
  }
4847
4847
  }
4848
- async function jsrJsonToPackageJson(jsrJson) {
4848
+ function jsrJsonToPackageJson(jsrJson) {
4849
4849
  return {
4850
4850
  name: jsrJson.name,
4851
4851
  version: jsrJson.version,
@@ -4985,13 +4985,13 @@ function isScopedPackage(packageName) {
4985
4985
  return /^@[^/]+\/[^@][\w.-]*$/.test(packageName);
4986
4986
  }
4987
4987
  function getScope(packageName) {
4988
- return packageName.match(/^@([^/]+)/)?.[1];
4988
+ return packageName.match(/^@([^/]+)/)?.[1] ?? null;
4989
4989
  }
4990
4990
  function getScopeAndName(packageName) {
4991
4991
  const matches = packageName.match(/^@([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)$/);
4992
4992
  const scope = matches?.[1];
4993
4993
  const name = matches?.[2];
4994
- return [scope, name];
4994
+ return [`${scope}`, `${name}`];
4995
4995
  }
4996
4996
  var scopedPackagePattern = /^(?:@([^/]+?)[/])?([^/]+?)$/;
4997
4997
  var blacklist = ["node_modules", "favicon.ico"];
@@ -5881,7 +5881,7 @@ var requiredConditionsCheckTask = (options) => createListr({
5881
5881
  [
5882
5882
  {
5883
5883
  title: "Ping registries",
5884
- task: async (ctx, parentTask2) => parentTask2.newListr(
5884
+ task: (ctx, parentTask2) => parentTask2.newListr(
5885
5885
  ctx.registries.map((registryKey) => ({
5886
5886
  title: `Ping to ${registryKey}`,
5887
5887
  task: async () => {
@@ -5970,7 +5970,7 @@ var requiredConditionsCheckTask = (options) => createListr({
5970
5970
  },
5971
5971
  {
5972
5972
  title: "Checking available registries for publishing",
5973
- task: async (ctx, parentTask2) => parentTask2.newListr(
5973
+ task: (ctx, parentTask2) => parentTask2.newListr(
5974
5974
  ctx.registries.map((registryKey) => {
5975
5975
  switch (registryKey) {
5976
5976
  case "npm":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.0.4-0",
3
+ "version": "0.0.5",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"