pubm 0.0.0-alpha.16 → 0.0.0-alpha.19

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/README.md CHANGED
@@ -44,21 +44,19 @@ Options:
44
44
  -p, --preview Show tasks without actually executing publish
45
45
  -b, --branch <name> Name of the release branch (default: main)
46
46
  -a, --any-branch Show tasks without actually executing publish
47
- --no-pre-check Skip prerequisites check task (default: true)
48
- --no-condition-check Skip required conditions check task (default: true)
49
- --no-cleanup Skip cleaning the `node_modules` directory (default: true)
50
- --no-tests Skip running tests before publishing (default: true)
51
- --no-build Skip build before publishing (default: true)
52
- --no-publish Skip publishing task (default: true)
53
- --no-release-draft Skip creating a GitHub release draft (default: true)
54
- -y, --yolo Skip both cleanup and tests
47
+ --no-pre-check Skip prerequisites check task
48
+ --no-condition-check Skip required conditions check task
49
+ --no-tests Skip running tests before publishing
50
+ --no-build Skip build before publishing
51
+ --no-publish Skip publishing task
52
+ --no-release-draft Skip creating a GitHub release draft
55
53
  -t, --tag <name> Publish under a specific dist-tag (default: latest)
56
- --package-manager <name> Use a specific package manager 'packageManager' field in package.json or package manager configuration file
57
54
  -c, --contents <path> Subdirectory to publish
58
- -h, --help Display this message
59
- -v, --version Display version number
55
+ --no-save-token Do not save jsr tokens (request the token each time)
60
56
  --registry <...registries> Target registries for publish
61
57
  registry can be npm | jsr | https://url.for.private-registries (default: npm,jsr)
58
+ -h, --help Display this message
59
+ -v, --version Display version number
62
60
  ```
63
61
 
64
62
  ## Config for publish
@@ -147,12 +145,12 @@ np tasks
147
145
 
148
146
  ## FAQ
149
147
 
150
- ### Why is jsr only asking for tokens?
148
+ ### Why does jsr only ask for tokens?
151
149
 
152
- The only way to access the certified environment for jsr is to request api directly with token.
150
+ The only way to access jsr’s certified environment is through a direct API request with a token.
153
151
 
154
- ### How is jsr token saved? Is it safe?
152
+ ### How is the jsr token stored? Is it secure?
155
153
 
156
- jsr token is encrypted and stored through various pieces of information, and unless you have complete control of the local computer that ran pubm, I think it is difficult for token to be taken over.
154
+ The jsr token is encrypted and stored using various layers of information. As long as you have control over the local machine where pubm was run, it is highly unlikely the token can be compromised.
157
155
 
158
- If desired, the --no-save-token option allows you to run tokens without saving them.
156
+ If you prefer not to save tokens, you can use the `--no-save-token` option, which will request the token each time.
@@ -0,0 +1 @@
1
+ bb1b5e0897a25b17444b95266e3494d0e653bae57836260243bf54194f71cd729bf8abe6cdc4a6a86b5f03b4200033fc
package/bin/cli.js CHANGED
@@ -58,6 +58,7 @@ function resolveOptions(options2) {
58
58
  }
59
59
 
60
60
  // src/tasks/runner.ts
61
+ import process2 from "node:process";
61
62
  import npmCli from "@npmcli/promise-spawn";
62
63
  import { color as color5 } from "listr2";
63
64
  import SemVer from "semver";
@@ -366,13 +367,13 @@ function createListr(...args) {
366
367
  // src/utils/package.ts
367
368
  import { readFile, stat, writeFile } from "node:fs/promises";
368
369
  import path from "node:path";
369
- import process2 from "node:process";
370
+ import process from "node:process";
370
371
  var cachedPackageJson = {};
371
372
  var cachedJsrJson = {};
372
- async function patchCachedJsrJson(contents, { cwd = process2.cwd() } = {}) {
373
+ async function patchCachedJsrJson(contents, { cwd = process.cwd() } = {}) {
373
374
  cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
374
375
  }
375
- async function findOutFile(file, { cwd = process2.cwd() } = {}) {
376
+ async function findOutFile(file, { cwd = process.cwd() } = {}) {
376
377
  let directory = cwd;
377
378
  let filePath = "";
378
379
  const { root } = path.parse(cwd);
@@ -390,7 +391,7 @@ async function findOutFile(file, { cwd = process2.cwd() } = {}) {
390
391
  return filePath;
391
392
  }
392
393
  async function getPackageJson({
393
- cwd = process2.cwd(),
394
+ cwd = process.cwd(),
394
395
  fallbackJsr = true
395
396
  } = {}) {
396
397
  if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
@@ -423,7 +424,7 @@ async function getPackageJson({
423
424
  }
424
425
  }
425
426
  async function getJsrJson({
426
- cwd = process2.cwd(),
427
+ cwd = process.cwd(),
427
428
  fallbackPackage = true
428
429
  } = {}) {
429
430
  if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
@@ -501,7 +502,7 @@ async function jsrJsonToPackageJson(jsrJson) {
501
502
  return convertedExports;
502
503
  }
503
504
  }
504
- async function version({ cwd = process2.cwd() } = {}) {
505
+ async function version({ cwd = process.cwd() } = {}) {
505
506
  let version2 = (await getPackageJson({ cwd }))?.version;
506
507
  if (!version2) {
507
508
  version2 = (await getJsrJson({ cwd }))?.version;
@@ -1200,6 +1201,7 @@ var NpmAvailableError = class extends AbstractError {
1200
1201
  };
1201
1202
  var npmAvailableCheckTasks = {
1202
1203
  title: "Checking npm avaliable for publising",
1204
+ skip: (ctx) => !!ctx.preview,
1203
1205
  task: async () => {
1204
1206
  const npm = await npmRegistry();
1205
1207
  if (await npm.isPublished()) {
@@ -1220,6 +1222,7 @@ More information: ${link("npm naming rules", "https://github.com/npm/validate-np
1220
1222
  };
1221
1223
  var npmPublishTasks = {
1222
1224
  title: "Running npm publish",
1225
+ skip: (ctx) => !!ctx.preview,
1223
1226
  task: async (_, task) => {
1224
1227
  const npm = await npmRegistry();
1225
1228
  task.output = "Publishing on npm...";
@@ -1570,6 +1573,7 @@ async function run(options2) {
1570
1573
  lastRev: await git.latestTag() || await git.firstCommit()
1571
1574
  };
1572
1575
  try {
1576
+ if (options2.contents) process2.chdir(options2.contents);
1573
1577
  await prerequisitesCheckTask({ skip: options2.skipPrerequisitesCheck }).run(
1574
1578
  ctx
1575
1579
  );
@@ -1613,6 +1617,7 @@ async function run(options2) {
1613
1617
  },
1614
1618
  {
1615
1619
  title: "Bumping version",
1620
+ skip: (ctx2) => !!ctx2.preview,
1616
1621
  task: async (ctx2, task) => {
1617
1622
  const git2 = new Git();
1618
1623
  let tagCreated = false;
@@ -1644,7 +1649,7 @@ async function run(options2) {
1644
1649
  }
1645
1650
  },
1646
1651
  {
1647
- skip: options2.skipPublish,
1652
+ skip: (ctx2) => options2.skipPublish || !!ctx2.preview,
1648
1653
  title: "Publishing",
1649
1654
  task: (ctx2, parentTask) => parentTask.newListr(
1650
1655
  ctx2.registries.map((registry) => {
@@ -1662,6 +1667,7 @@ async function run(options2) {
1662
1667
  },
1663
1668
  {
1664
1669
  title: "Pushing tags to GitHub",
1670
+ skip: (ctx2) => !!ctx2.preview,
1665
1671
  task: async (_, task) => {
1666
1672
  const git2 = new Git();
1667
1673
  const result = await git2.push("--follow-tags");
@@ -1672,7 +1678,7 @@ async function run(options2) {
1672
1678
  }
1673
1679
  },
1674
1680
  {
1675
- skip: options2.skipReleaseDraft,
1681
+ skip: (ctx2) => options2.skipReleaseDraft || !!ctx2.preview,
1676
1682
  title: "Creating release draft on GitHub",
1677
1683
  task: async (ctx2, task) => {
1678
1684
  const git2 = new Git();
@@ -1709,7 +1715,7 @@ ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
1709
1715
  } catch (e2) {
1710
1716
  consoleError(e2);
1711
1717
  await rollback();
1712
- process.exit(1);
1718
+ process2.exit(1);
1713
1719
  }
1714
1720
  }
1715
1721
 
@@ -1889,11 +1895,6 @@ var options = [
1889
1895
  description: "Skip required conditions check task",
1890
1896
  options: { type: Boolean }
1891
1897
  },
1892
- {
1893
- rawName: "--no-cleanup",
1894
- description: "Skip cleaning the `node_modules` directory",
1895
- options: { type: Boolean }
1896
- },
1897
1898
  {
1898
1899
  rawName: "--no-tests",
1899
1900
  description: "Skip running tests before publishing",
@@ -1914,21 +1915,11 @@ var options = [
1914
1915
  description: "Skip creating a GitHub release draft",
1915
1916
  options: { type: Boolean }
1916
1917
  },
1917
- {
1918
- rawName: "-y, --yolo",
1919
- description: "Skip both cleanup and tests",
1920
- options: { type: Boolean }
1921
- },
1922
1918
  {
1923
1919
  rawName: "-t, --tag <name>",
1924
1920
  description: "Publish under a specific dist-tag",
1925
1921
  options: { default: "latest", type: String }
1926
1922
  },
1927
- {
1928
- rawName: "--package-manager <name>",
1929
- description: `Use a specific package manager 'packageManager' field in package.json or package manager configuration file`,
1930
- options: { type: String }
1931
- },
1932
1923
  {
1933
1924
  rawName: "-c, --contents <path>",
1934
1925
  description: "Subdirectory to publish",
@@ -1936,12 +1927,12 @@ var options = [
1936
1927
  },
1937
1928
  {
1938
1929
  rawName: "--no-save-token",
1939
- description: "Do not save jsr tokens (requested for every run)",
1930
+ description: "Do not save jsr tokens (request the token each time)",
1940
1931
  options: { type: Boolean }
1941
1932
  },
1942
1933
  {
1943
1934
  rawName: "--registry <...registries>",
1944
- description: "Target registries for publish\n registry can be npm | jsr | https://url.for.private-registries\n",
1935
+ description: "Target registries for publish\n registry can be npm | jsr | https://url.for.private-registries",
1945
1936
  options: { type: String, default: "npm,jsr" }
1946
1937
  }
1947
1938
  ];
@@ -1952,7 +1943,6 @@ for (const option of options) {
1952
1943
  function resolveCliOptions(options2) {
1953
1944
  return {
1954
1945
  ...options2,
1955
- skipCleanup: !options2.cleanup,
1956
1946
  skipPublish: !options2.publish,
1957
1947
  skipReleaseDraft: !options2.releaseDraft,
1958
1948
  skipTests: !options2.tests,
@@ -1988,6 +1978,9 @@ cli.help((sections) => {
1988
1978
  Version can be:
1989
1979
  ${RELEASE_TYPES2.join(" | ")} | 1.2.3`;
1990
1980
  sections.splice(2, 2);
1981
+ if (sections.at(2)) {
1982
+ sections[2].body = sections[2].body.replace(/ \(default: true\)/g, "");
1983
+ }
1991
1984
  sections.push({ body: "\n" });
1992
1985
  });
1993
1986
  (async () => {
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ function resolveOptions(options) {
49
49
  }
50
50
 
51
51
  // src/tasks/runner.ts
52
+ var import_node_process2 = __toESM(require("process"), 1);
52
53
  var import_promise_spawn = __toESM(require("@npmcli/promise-spawn"), 1);
53
54
  var import_listr26 = require("listr2");
54
55
  var import_semver2 = __toESM(require("semver"), 1);
@@ -1230,6 +1231,7 @@ var NpmAvailableError = class extends AbstractError {
1230
1231
  };
1231
1232
  var npmAvailableCheckTasks = {
1232
1233
  title: "Checking npm avaliable for publising",
1234
+ skip: (ctx) => !!ctx.preview,
1233
1235
  task: async () => {
1234
1236
  const npm = await npmRegistry();
1235
1237
  if (await npm.isPublished()) {
@@ -1250,6 +1252,7 @@ More information: ${link("npm naming rules", "https://github.com/npm/validate-np
1250
1252
  };
1251
1253
  var npmPublishTasks = {
1252
1254
  title: "Running npm publish",
1255
+ skip: (ctx) => !!ctx.preview,
1253
1256
  task: async (_, task) => {
1254
1257
  const npm = await npmRegistry();
1255
1258
  task.output = "Publishing on npm...";
@@ -1601,6 +1604,7 @@ async function run(options) {
1601
1604
  lastRev: await git.latestTag() || await git.firstCommit()
1602
1605
  };
1603
1606
  try {
1607
+ if (options.contents) import_node_process2.default.chdir(options.contents);
1604
1608
  await prerequisitesCheckTask({ skip: options.skipPrerequisitesCheck }).run(
1605
1609
  ctx
1606
1610
  );
@@ -1644,6 +1648,7 @@ async function run(options) {
1644
1648
  },
1645
1649
  {
1646
1650
  title: "Bumping version",
1651
+ skip: (ctx2) => !!ctx2.preview,
1647
1652
  task: async (ctx2, task) => {
1648
1653
  const git2 = new Git();
1649
1654
  let tagCreated = false;
@@ -1675,7 +1680,7 @@ async function run(options) {
1675
1680
  }
1676
1681
  },
1677
1682
  {
1678
- skip: options.skipPublish,
1683
+ skip: (ctx2) => options.skipPublish || !!ctx2.preview,
1679
1684
  title: "Publishing",
1680
1685
  task: (ctx2, parentTask) => parentTask.newListr(
1681
1686
  ctx2.registries.map((registry) => {
@@ -1693,6 +1698,7 @@ async function run(options) {
1693
1698
  },
1694
1699
  {
1695
1700
  title: "Pushing tags to GitHub",
1701
+ skip: (ctx2) => !!ctx2.preview,
1696
1702
  task: async (_, task) => {
1697
1703
  const git2 = new Git();
1698
1704
  const result = await git2.push("--follow-tags");
@@ -1703,7 +1709,7 @@ async function run(options) {
1703
1709
  }
1704
1710
  },
1705
1711
  {
1706
- skip: options.skipReleaseDraft,
1712
+ skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
1707
1713
  title: "Creating release draft on GitHub",
1708
1714
  task: async (ctx2, task) => {
1709
1715
  const git2 = new Git();
@@ -1740,7 +1746,7 @@ ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
1740
1746
  } catch (e2) {
1741
1747
  consoleError(e2);
1742
1748
  await rollback();
1743
- process.exit(1);
1749
+ import_node_process2.default.exit(1);
1744
1750
  }
1745
1751
  }
1746
1752
 
package/dist/index.d.cts CHANGED
@@ -29,11 +29,6 @@ interface Options {
29
29
  * @default false
30
30
  */
31
31
  anyBranch?: boolean;
32
- /**
33
- * @description Skip cleaning the `node_modules` directory
34
- * @default false
35
- */
36
- skipCleanup?: boolean;
37
32
  /**
38
33
  * @description Skip running tests before publishing
39
34
  * @default false
@@ -64,27 +59,17 @@ interface Options {
64
59
  * @default false
65
60
  */
66
61
  skipConditionsCheck?: boolean;
67
- /**
68
- * @description Skip both cleanup and tests
69
- * @default false
70
- */
71
- yolo?: boolean;
72
62
  /**
73
63
  * @description Publish under a specific dist-tag
74
64
  * @default "latest"
75
65
  */
76
66
  tag?: string;
77
- /**
78
- * @description Use a specific package manager
79
- * @default 'packageManager' field in package.json or package manager configuration file
80
- */
81
- packageManager?: string;
82
67
  /**
83
68
  * @description Subdirectory to publish
84
69
  */
85
70
  contents?: string;
86
71
  /**
87
- * @description Do not save jsr tokens (requested for every run)
72
+ * @description Do not save jsr tokens (request the token each time)
88
73
  * @default true
89
74
  */
90
75
  saveToken?: boolean;
package/dist/index.d.ts CHANGED
@@ -29,11 +29,6 @@ interface Options {
29
29
  * @default false
30
30
  */
31
31
  anyBranch?: boolean;
32
- /**
33
- * @description Skip cleaning the `node_modules` directory
34
- * @default false
35
- */
36
- skipCleanup?: boolean;
37
32
  /**
38
33
  * @description Skip running tests before publishing
39
34
  * @default false
@@ -64,27 +59,17 @@ interface Options {
64
59
  * @default false
65
60
  */
66
61
  skipConditionsCheck?: boolean;
67
- /**
68
- * @description Skip both cleanup and tests
69
- * @default false
70
- */
71
- yolo?: boolean;
72
62
  /**
73
63
  * @description Publish under a specific dist-tag
74
64
  * @default "latest"
75
65
  */
76
66
  tag?: string;
77
- /**
78
- * @description Use a specific package manager
79
- * @default 'packageManager' field in package.json or package manager configuration file
80
- */
81
- packageManager?: string;
82
67
  /**
83
68
  * @description Subdirectory to publish
84
69
  */
85
70
  contents?: string;
86
71
  /**
87
- * @description Do not save jsr tokens (requested for every run)
72
+ * @description Do not save jsr tokens (request the token each time)
88
73
  * @default true
89
74
  */
90
75
  saveToken?: boolean;
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ function resolveOptions(options) {
15
15
  }
16
16
 
17
17
  // src/tasks/runner.ts
18
+ import process2 from "node:process";
18
19
  import npmCli from "@npmcli/promise-spawn";
19
20
  import { color as color5 } from "listr2";
20
21
  import SemVer from "semver";
@@ -360,13 +361,13 @@ function createListr(...args) {
360
361
  // src/utils/package.ts
361
362
  import { readFile, stat, writeFile } from "node:fs/promises";
362
363
  import path from "node:path";
363
- import process2 from "node:process";
364
+ import process from "node:process";
364
365
  var cachedPackageJson = {};
365
366
  var cachedJsrJson = {};
366
- async function patchCachedJsrJson(contents, { cwd = process2.cwd() } = {}) {
367
+ async function patchCachedJsrJson(contents, { cwd = process.cwd() } = {}) {
367
368
  cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
368
369
  }
369
- async function findOutFile(file, { cwd = process2.cwd() } = {}) {
370
+ async function findOutFile(file, { cwd = process.cwd() } = {}) {
370
371
  let directory = cwd;
371
372
  let filePath = "";
372
373
  const { root } = path.parse(cwd);
@@ -384,7 +385,7 @@ async function findOutFile(file, { cwd = process2.cwd() } = {}) {
384
385
  return filePath;
385
386
  }
386
387
  async function getPackageJson({
387
- cwd = process2.cwd(),
388
+ cwd = process.cwd(),
388
389
  fallbackJsr = true
389
390
  } = {}) {
390
391
  if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
@@ -417,7 +418,7 @@ async function getPackageJson({
417
418
  }
418
419
  }
419
420
  async function getJsrJson({
420
- cwd = process2.cwd(),
421
+ cwd = process.cwd(),
421
422
  fallbackPackage = true
422
423
  } = {}) {
423
424
  if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
@@ -495,7 +496,7 @@ async function jsrJsonToPackageJson(jsrJson) {
495
496
  return convertedExports;
496
497
  }
497
498
  }
498
- async function version({ cwd = process2.cwd() } = {}) {
499
+ async function version({ cwd = process.cwd() } = {}) {
499
500
  let version2 = (await getPackageJson({ cwd }))?.version;
500
501
  if (!version2) {
501
502
  version2 = (await getJsrJson({ cwd }))?.version;
@@ -1194,6 +1195,7 @@ var NpmAvailableError = class extends AbstractError {
1194
1195
  };
1195
1196
  var npmAvailableCheckTasks = {
1196
1197
  title: "Checking npm avaliable for publising",
1198
+ skip: (ctx) => !!ctx.preview,
1197
1199
  task: async () => {
1198
1200
  const npm = await npmRegistry();
1199
1201
  if (await npm.isPublished()) {
@@ -1214,6 +1216,7 @@ More information: ${link("npm naming rules", "https://github.com/npm/validate-np
1214
1216
  };
1215
1217
  var npmPublishTasks = {
1216
1218
  title: "Running npm publish",
1219
+ skip: (ctx) => !!ctx.preview,
1217
1220
  task: async (_, task) => {
1218
1221
  const npm = await npmRegistry();
1219
1222
  task.output = "Publishing on npm...";
@@ -1564,6 +1567,7 @@ async function run(options) {
1564
1567
  lastRev: await git.latestTag() || await git.firstCommit()
1565
1568
  };
1566
1569
  try {
1570
+ if (options.contents) process2.chdir(options.contents);
1567
1571
  await prerequisitesCheckTask({ skip: options.skipPrerequisitesCheck }).run(
1568
1572
  ctx
1569
1573
  );
@@ -1607,6 +1611,7 @@ async function run(options) {
1607
1611
  },
1608
1612
  {
1609
1613
  title: "Bumping version",
1614
+ skip: (ctx2) => !!ctx2.preview,
1610
1615
  task: async (ctx2, task) => {
1611
1616
  const git2 = new Git();
1612
1617
  let tagCreated = false;
@@ -1638,7 +1643,7 @@ async function run(options) {
1638
1643
  }
1639
1644
  },
1640
1645
  {
1641
- skip: options.skipPublish,
1646
+ skip: (ctx2) => options.skipPublish || !!ctx2.preview,
1642
1647
  title: "Publishing",
1643
1648
  task: (ctx2, parentTask) => parentTask.newListr(
1644
1649
  ctx2.registries.map((registry) => {
@@ -1656,6 +1661,7 @@ async function run(options) {
1656
1661
  },
1657
1662
  {
1658
1663
  title: "Pushing tags to GitHub",
1664
+ skip: (ctx2) => !!ctx2.preview,
1659
1665
  task: async (_, task) => {
1660
1666
  const git2 = new Git();
1661
1667
  const result = await git2.push("--follow-tags");
@@ -1666,7 +1672,7 @@ async function run(options) {
1666
1672
  }
1667
1673
  },
1668
1674
  {
1669
- skip: options.skipReleaseDraft,
1675
+ skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
1670
1676
  title: "Creating release draft on GitHub",
1671
1677
  task: async (ctx2, task) => {
1672
1678
  const git2 = new Git();
@@ -1703,7 +1709,7 @@ ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
1703
1709
  } catch (e2) {
1704
1710
  consoleError(e2);
1705
1711
  await rollback();
1706
- process.exit(1);
1712
+ process2.exit(1);
1707
1713
  }
1708
1714
  }
1709
1715
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.0.0-alpha.16",
3
+ "version": "0.0.0-alpha.19",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"