@pnpm/releasing.commands 1100.3.0 → 1100.4.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.
@@ -1,6 +1,9 @@
1
1
  import { type OtpContext as BaseOtpContext } from '@pnpm/network.web-auth';
2
2
  import type { ExportedManifest } from '@pnpm/releasing.exportable-manifest';
3
3
  import type { PublishOptions } from 'libnpmpublish';
4
+ export type PublishOptionsWithDefaultAccess = Omit<PublishOptions, 'access'> & {
5
+ access?: PublishOptions['access'] | null;
6
+ };
4
7
  export interface OtpPublishResponse {
5
8
  readonly ok: boolean;
6
9
  readonly status: number;
@@ -9,14 +12,14 @@ export interface OtpPublishResponse {
9
12
  /** Set by the registry only when the publish was staged (i.e. `stage: true` was sent). */
10
13
  readonly stageId?: string;
11
14
  }
12
- export type OtpPublishFn = (manifest: ExportedManifest, tarballData: Buffer, options: PublishOptions) => Promise<OtpPublishResponse>;
15
+ export type OtpPublishFn = (manifest: ExportedManifest, tarballData: Buffer, options: PublishOptionsWithDefaultAccess) => Promise<OtpPublishResponse>;
13
16
  export interface OtpContext extends BaseOtpContext {
14
17
  publish: OtpPublishFn;
15
18
  }
16
19
  export interface OtpParams {
17
20
  context?: OtpContext;
18
21
  manifest: ExportedManifest;
19
- publishOptions: PublishOptions;
22
+ publishOptions: PublishOptionsWithDefaultAccess;
20
23
  tarballData: Buffer;
21
24
  }
22
25
  /**
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import { confirm } from '@inquirer/prompts';
2
3
  import { FILTERING } from '@pnpm/cli.common-cli-options-help';
3
4
  import { docsUrl, readProjectManifest } from '@pnpm/cli.utils';
4
5
  import { types as allTypes } from '@pnpm/config.reader';
@@ -6,7 +7,6 @@ import { PnpmError } from '@pnpm/error';
6
7
  import { runLifecycleHook } from '@pnpm/exec.lifecycle';
7
8
  import { getCurrentBranch, isGitRepo, isRemoteHistoryClean, isWorkingTreeClean } from '@pnpm/network.git-utils';
8
9
  import { rimraf } from '@zkochan/rimraf';
9
- import enquirer from 'enquirer';
10
10
  import { pick } from 'ramda';
11
11
  import { realpathMissing } from 'realpath-missing';
12
12
  import { renderHelp } from 'render-help';
@@ -140,13 +140,21 @@ export async function publish(opts, params) {
140
140
  });
141
141
  }
142
142
  if (!branches.includes(currentBranch)) {
143
- const { confirm } = await enquirer.prompt({
144
- message: `You're on branch "${currentBranch}" but your "publish-branch" is set to "${branches.join('|')}". \
145
- Do you want to continue?`,
146
- name: 'confirm',
147
- type: 'confirm',
148
- }); // eslint-disable-line @typescript-eslint/no-explicit-any
149
- if (!confirm) {
143
+ let isConfirmed;
144
+ try {
145
+ isConfirmed = await confirm({
146
+ message: `You're on branch "${currentBranch}" but your "publish-branch" is set to "${branches.join('|')}". Do you want to continue?`,
147
+ });
148
+ }
149
+ catch (err) {
150
+ if (err instanceof Error && err.name === 'ExitPromptError') {
151
+ isConfirmed = false;
152
+ }
153
+ else {
154
+ throw err;
155
+ }
156
+ }
157
+ if (!isConfirmed) {
150
158
  throw new PnpmError('GIT_NOT_CORRECT_BRANCH', `Branch is not on '${branches.join('|')}'.`, {
151
159
  hint: GIT_CHECKS_HINT,
152
160
  });
@@ -1,9 +1,8 @@
1
1
  import type { Config } from '@pnpm/config.reader';
2
2
  import { PnpmError } from '@pnpm/error';
3
3
  import type { ExportedManifest } from '@pnpm/releasing.exportable-manifest';
4
- import type { PublishOptions } from 'libnpmpublish';
5
4
  import { type PublishSummary } from '../tarball/publishSummary.js';
6
- import { type OtpContext } from './otp.js';
5
+ import { type OtpContext, type PublishOptionsWithDefaultAccess } from './otp.js';
7
6
  import type { PackResult } from './pack.js';
8
7
  export type { PublishSummary };
9
8
  export type PublishPackedPkgOptions = Pick<Config, 'configByUri' | 'dryRun' | 'fetchRetries' | 'fetchRetryFactor' | 'fetchRetryMaxtimeout' | 'fetchRetryMintimeout' | 'fetchTimeout' | 'registries' | 'tag' | 'userAgent'> & Partial<Pick<Config, 'ca' | 'cert' | 'httpProxy' | 'httpsProxy' | 'key' | 'localAddress' | 'noProxy' | 'strictSsl'>> & {
@@ -23,11 +22,15 @@ export declare function publishPackedPkg(packResult: Pick<PackResult, 'published
23
22
  * https://github.com/pnpm/pnpm/issues/11561).
24
23
  */
25
24
  export declare function createPublishContext(opts: PublishPackedPkgOptions): OtpContext;
25
+ type StagePublishOptions = PublishOptionsWithDefaultAccess & {
26
+ command?: string;
27
+ stage?: boolean;
28
+ };
26
29
  /**
27
30
  * @internal Exported for unit testing of the access / registry / auth fallback rules. Not part of the package's
28
31
  * public API.
29
32
  */
30
- export declare function createPublishOptions(manifest: ExportedManifest, options: PublishPackedPkgOptions): Promise<PublishOptions>;
33
+ export declare function createPublishOptions(manifest: ExportedManifest, options: PublishPackedPkgOptions): Promise<StagePublishOptions>;
31
34
  export declare class PublishUnsupportedRegistryProtocolError extends PnpmError {
32
35
  readonly registryUrl: string;
33
36
  constructor(registryUrl: string);
@@ -81,7 +81,7 @@ export async function createPublishOptions(manifest, options) {
81
81
  const { registry, config } = findRegistryInfo(manifest, options, publishConfigRegistry);
82
82
  const { creds, tls } = config ?? {};
83
83
  const publishConfigAccess = manifest.publishConfig?.access;
84
- const access = options.access ?? (isPublishAccess(publishConfigAccess) ? publishConfigAccess : undefined);
84
+ const access = options.access ?? (isPublishAccess(publishConfigAccess) ? publishConfigAccess : null);
85
85
  const { ci: isFromCI, fetchRetries, fetchRetryFactor, fetchRetryMaxtimeout, fetchRetryMintimeout, fetchTimeout: timeout, otp, provenance, provenanceFile, tag: defaultTag, userAgent, } = options;
86
86
  const npmCommand = options.stage === true ? 'stage' : 'publish';
87
87
  const headers = {
@@ -165,12 +165,6 @@ function findRegistryInfo({ name }, { configByUri, registries }, publishConfigRe
165
165
  // TLS from longer path individually overrides shorter path
166
166
  tls = { ...entry.tls, ...tls };
167
167
  }
168
- const isDefaultRegistry = nonNormalizedRegistry === registries.default ||
169
- registry === registries.default ||
170
- registry === parseSupportedRegistryUrl(registries.default)?.normalizedUrl;
171
- if (isDefaultRegistry) {
172
- creds ??= configByUri['']?.creds;
173
- }
174
168
  return {
175
169
  registry,
176
170
  config: { creds, tls },
@@ -1,15 +1,15 @@
1
1
  import readline from 'node:readline';
2
+ import { input } from '@inquirer/prompts';
2
3
  import { globalInfo, globalWarn } from '@pnpm/logger';
3
4
  import { fetch } from '@pnpm/network.fetch';
4
5
  import ciInfo from 'ci-info';
5
- import enquirer from 'enquirer';
6
6
  import { publish as _publish } from 'libnpmpublish';
7
7
  const publish = _publish;
8
8
  export const SHARED_CONTEXT = {
9
9
  Date,
10
10
  createReadlineInterface: readline.createInterface.bind(null, { input: process.stdin }),
11
11
  ciInfo,
12
- enquirer,
12
+ enquirer: { input },
13
13
  fetch,
14
14
  globalInfo,
15
15
  globalWarn,
@@ -4,7 +4,7 @@ import { createFetchFromRegistry } from '@pnpm/network.fetch';
4
4
  const DEFAULT_REGISTRY = 'https://registry.npmjs.org/';
5
5
  export function createStageContext(opts, packageName) {
6
6
  const registry = getStageRegistry(opts, packageName);
7
- const getAuthHeaderByUri = createGetAuthHeaderByURI(opts.configByUri ?? {}, registry);
7
+ const getAuthHeaderByUri = createGetAuthHeaderByURI(opts.configByUri ?? {});
8
8
  return {
9
9
  opts,
10
10
  registry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/releasing.commands",
3
- "version": "1100.3.0",
3
+ "version": "1100.4.0",
4
4
  "description": "Commands for deploy, pack, and publish",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -24,66 +24,65 @@
24
24
  "!*.map"
25
25
  ],
26
26
  "dependencies": {
27
+ "@inquirer/prompts": "^8.4.3",
27
28
  "@pnpm/npm-package-arg": "^2.0.0",
28
29
  "@types/normalize-path": "^3.0.2",
29
30
  "@zkochan/rimraf": "^4.0.0",
30
- "chalk": "^5.6.0",
31
- "ci-info": "^4.3.0",
32
- "detect-libc": "^2.0.3",
33
- "enquirer": "^2.4.1",
31
+ "chalk": "^5.6.2",
32
+ "ci-info": "^4.4.0",
33
+ "detect-libc": "^2.1.2",
34
34
  "execa": "npm:safe-execa@0.3.0",
35
35
  "libnpmpublish": "^11.2.0",
36
36
  "normalize-path": "^3.0.0",
37
37
  "normalize-registry-url": "2.0.1",
38
38
  "p-filter": "^4.1.0",
39
- "p-limit": "^7.1.0",
39
+ "p-limit": "^7.3.0",
40
40
  "ramda": "npm:@pnpm/ramda@0.28.1",
41
41
  "realpath-missing": "^2.0.0",
42
42
  "render-help": "^2.0.0",
43
- "semver": "^7.7.2",
44
- "tar-stream": "^3.1.7",
43
+ "semver": "^7.8.1",
44
+ "tar-stream": "^3.2.0",
45
45
  "tempy": "3.0.0",
46
- "tinyglobby": "^0.2.14",
46
+ "tinyglobby": "^0.2.16",
47
47
  "validate-npm-package-name": "7.0.2",
48
48
  "write-json-file": "^7.0.0",
49
49
  "write-yaml-file": "^6.0.0",
50
- "@pnpm/bins.resolver": "1100.0.4",
50
+ "@pnpm/bins.resolver": "1100.0.5",
51
51
  "@pnpm/catalogs.types": "1100.0.0",
52
52
  "@pnpm/cli.common-cli-options-help": "1100.0.1",
53
- "@pnpm/cli.utils": "1101.0.7",
54
- "@pnpm/config.reader": "1101.4.0",
55
- "@pnpm/config.pick-registry-for-package": "1100.0.5",
56
- "@pnpm/deps.path": "1100.0.4",
53
+ "@pnpm/cli.utils": "1101.0.8",
54
+ "@pnpm/config.pick-registry-for-package": "1100.0.6",
55
+ "@pnpm/config.reader": "1101.5.0",
57
56
  "@pnpm/constants": "1100.0.0",
58
- "@pnpm/engine.runtime.commands": "1100.0.17",
59
- "@pnpm/engine.runtime.node-resolver": "1101.1.1",
57
+ "@pnpm/deps.path": "1100.0.5",
58
+ "@pnpm/engine.runtime.commands": "1100.1.1",
59
+ "@pnpm/engine.runtime.node-resolver": "1101.1.3",
60
60
  "@pnpm/error": "1100.0.0",
61
- "@pnpm/exec.lifecycle": "1100.0.13",
62
61
  "@pnpm/exec.pnpm-cli-runner": "1100.0.1",
63
- "@pnpm/fetching.directory-fetcher": "1100.0.12",
64
- "@pnpm/fs.indexed-pkg-importer": "1100.0.9",
62
+ "@pnpm/fetching.directory-fetcher": "1100.0.13",
65
63
  "@pnpm/fs.is-empty-dir-or-nothing": "1100.0.0",
66
64
  "@pnpm/fs.packlist": "1100.0.1",
67
- "@pnpm/installing.client": "1100.2.2",
68
- "@pnpm/installing.commands": "1100.5.0",
69
- "@pnpm/lockfile.fs": "1100.1.1",
70
- "@pnpm/lockfile.types": "1100.0.7",
71
- "@pnpm/network.fetch": "1100.0.6",
72
- "@pnpm/network.auth-header": "1100.0.3",
65
+ "@pnpm/fs.indexed-pkg-importer": "1100.0.10",
66
+ "@pnpm/installing.client": "1100.2.4",
67
+ "@pnpm/installing.commands": "1100.7.0",
68
+ "@pnpm/lockfile.types": "1100.0.8",
69
+ "@pnpm/lockfile.fs": "1100.1.2",
70
+ "@pnpm/exec.lifecycle": "1100.0.14",
71
+ "@pnpm/network.auth-header": "1101.0.0",
72
+ "@pnpm/network.fetch": "1100.0.8",
73
73
  "@pnpm/network.git-utils": "1100.0.1",
74
- "@pnpm/releasing.exportable-manifest": "1100.1.0",
75
- "@pnpm/resolving.resolver-base": "1100.3.0",
76
- "@pnpm/network.web-auth": "1101.0.0",
77
- "@pnpm/workspace.projects-sorter": "1100.0.3",
78
- "@pnpm/types": "1101.1.1",
79
- "@pnpm/workspace.projects-filter": "1100.0.15"
74
+ "@pnpm/network.web-auth": "1101.1.0",
75
+ "@pnpm/releasing.exportable-manifest": "1100.1.1",
76
+ "@pnpm/resolving.resolver-base": "1100.3.1",
77
+ "@pnpm/types": "1101.2.0",
78
+ "@pnpm/workspace.projects-filter": "1100.0.17",
79
+ "@pnpm/workspace.projects-sorter": "1100.0.4"
80
80
  },
81
81
  "peerDependencies": {
82
- "@pnpm/logger": ">=1001.0.0 <1002.0.0"
82
+ "@pnpm/logger": "^1001.0.1"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@jest/globals": "30.3.0",
86
- "@pnpm/registry-mock": "6.0.0",
87
86
  "@types/cross-spawn": "^6.0.6",
88
87
  "@types/is-windows": "^1.0.2",
89
88
  "@types/libnpmpublish": "^9.0.1",
@@ -93,22 +92,23 @@
93
92
  "@types/tar": "^7.0.87",
94
93
  "@types/tar-stream": "^3.1.4",
95
94
  "@types/validate-npm-package-name": "^4.0.2",
96
- "ci-info": "^4.3.0",
95
+ "ci-info": "^4.4.0",
97
96
  "cross-spawn": "^7.0.6",
98
97
  "is-windows": "^1.0.2",
99
98
  "load-json-file": "^7.0.1",
100
- "tar": "^7.5.10",
101
- "undici": "^7.2.0",
99
+ "tar": "^7.5.15",
100
+ "undici": "^7.26.0",
102
101
  "write-yaml-file": "^6.0.0",
103
- "@pnpm/assert-project": "1100.0.10",
102
+ "@pnpm/assert-project": "1100.0.12",
103
+ "@pnpm/catalogs.config": "1100.0.0",
104
+ "@pnpm/hooks.pnpmfile": "1100.0.11",
104
105
  "@pnpm/logger": "1100.0.0",
105
- "@pnpm/hooks.pnpmfile": "1100.0.10",
106
- "@pnpm/releasing.commands": "1100.3.0",
107
- "@pnpm/testing.command-defaults": "1100.0.1",
108
- "@pnpm/test-ipc-server": "1100.0.0",
106
+ "@pnpm/prepare": "1100.0.12",
107
+ "@pnpm/releasing.commands": "1100.4.0",
109
108
  "@pnpm/test-fixtures": "1100.0.0",
110
- "@pnpm/catalogs.config": "1100.0.0",
111
- "@pnpm/prepare": "1100.0.10"
109
+ "@pnpm/testing.command-defaults": "1100.0.2",
110
+ "@pnpm/test-ipc-server": "1100.0.0",
111
+ "@pnpm/testing.registry-mock": "1100.0.2"
112
112
  },
113
113
  "engines": {
114
114
  "node": ">=22.13"