@pnpm/releasing.commands 1100.3.1 → 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.
package/lib/publish/otp.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
22
|
+
publishOptions: PublishOptionsWithDefaultAccess;
|
|
20
23
|
tarballData: Buffer;
|
|
21
24
|
}
|
|
22
25
|
/**
|
package/lib/publish/publish.js
CHANGED
|
@@ -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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
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<
|
|
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 :
|
|
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 = {
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/releasing.commands",
|
|
3
|
-
"version": "1100.
|
|
3
|
+
"version": "1100.4.0",
|
|
4
4
|
"description": "Commands for deploy, pack, and publish",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -24,13 +24,13 @@
|
|
|
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
31
|
"chalk": "^5.6.2",
|
|
31
32
|
"ci-info": "^4.4.0",
|
|
32
33
|
"detect-libc": "^2.1.2",
|
|
33
|
-
"enquirer": "^2.4.1",
|
|
34
34
|
"execa": "npm:safe-execa@0.3.0",
|
|
35
35
|
"libnpmpublish": "^11.2.0",
|
|
36
36
|
"normalize-path": "^3.0.0",
|
|
@@ -47,35 +47,35 @@
|
|
|
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.5",
|
|
50
51
|
"@pnpm/catalogs.types": "1100.0.0",
|
|
51
|
-
"@pnpm/cli.utils": "1101.0.8",
|
|
52
52
|
"@pnpm/cli.common-cli-options-help": "1100.0.1",
|
|
53
|
-
"@pnpm/
|
|
53
|
+
"@pnpm/cli.utils": "1101.0.8",
|
|
54
54
|
"@pnpm/config.pick-registry-for-package": "1100.0.6",
|
|
55
|
-
"@pnpm/
|
|
55
|
+
"@pnpm/config.reader": "1101.5.0",
|
|
56
56
|
"@pnpm/constants": "1100.0.0",
|
|
57
|
+
"@pnpm/deps.path": "1100.0.5",
|
|
58
|
+
"@pnpm/engine.runtime.commands": "1100.1.1",
|
|
59
|
+
"@pnpm/engine.runtime.node-resolver": "1101.1.3",
|
|
57
60
|
"@pnpm/error": "1100.0.0",
|
|
58
|
-
"@pnpm/exec.lifecycle": "1100.0.14",
|
|
59
61
|
"@pnpm/exec.pnpm-cli-runner": "1100.0.1",
|
|
60
|
-
"@pnpm/engine.runtime.commands": "1100.1.0",
|
|
61
|
-
"@pnpm/bins.resolver": "1100.0.5",
|
|
62
|
-
"@pnpm/fs.indexed-pkg-importer": "1100.0.10",
|
|
63
62
|
"@pnpm/fetching.directory-fetcher": "1100.0.13",
|
|
64
|
-
"@pnpm/installing.client": "1100.2.3",
|
|
65
|
-
"@pnpm/engine.runtime.node-resolver": "1101.1.2",
|
|
66
|
-
"@pnpm/fs.packlist": "1100.0.1",
|
|
67
63
|
"@pnpm/fs.is-empty-dir-or-nothing": "1100.0.0",
|
|
68
|
-
"@pnpm/
|
|
64
|
+
"@pnpm/fs.packlist": "1100.0.1",
|
|
65
|
+
"@pnpm/fs.indexed-pkg-importer": "1100.0.10",
|
|
66
|
+
"@pnpm/installing.client": "1100.2.4",
|
|
67
|
+
"@pnpm/installing.commands": "1100.7.0",
|
|
69
68
|
"@pnpm/lockfile.types": "1100.0.8",
|
|
70
69
|
"@pnpm/lockfile.fs": "1100.1.2",
|
|
71
|
-
"@pnpm/
|
|
70
|
+
"@pnpm/exec.lifecycle": "1100.0.14",
|
|
71
|
+
"@pnpm/network.auth-header": "1101.0.0",
|
|
72
|
+
"@pnpm/network.fetch": "1100.0.8",
|
|
72
73
|
"@pnpm/network.git-utils": "1100.0.1",
|
|
73
|
-
"@pnpm/network.web-auth": "1101.
|
|
74
|
+
"@pnpm/network.web-auth": "1101.1.0",
|
|
74
75
|
"@pnpm/releasing.exportable-manifest": "1100.1.1",
|
|
75
|
-
"@pnpm/network.auth-header": "1101.0.0",
|
|
76
76
|
"@pnpm/resolving.resolver-base": "1100.3.1",
|
|
77
77
|
"@pnpm/types": "1101.2.0",
|
|
78
|
-
"@pnpm/workspace.projects-filter": "1100.0.
|
|
78
|
+
"@pnpm/workspace.projects-filter": "1100.0.17",
|
|
79
79
|
"@pnpm/workspace.projects-sorter": "1100.0.4"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
@@ -83,7 +83,6 @@
|
|
|
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",
|
|
@@ -100,15 +99,16 @@
|
|
|
100
99
|
"tar": "^7.5.15",
|
|
101
100
|
"undici": "^7.26.0",
|
|
102
101
|
"write-yaml-file": "^6.0.0",
|
|
103
|
-
"@pnpm/assert-project": "1100.0.
|
|
102
|
+
"@pnpm/assert-project": "1100.0.12",
|
|
103
|
+
"@pnpm/catalogs.config": "1100.0.0",
|
|
104
104
|
"@pnpm/hooks.pnpmfile": "1100.0.11",
|
|
105
105
|
"@pnpm/logger": "1100.0.0",
|
|
106
|
-
"@pnpm/
|
|
106
|
+
"@pnpm/prepare": "1100.0.12",
|
|
107
|
+
"@pnpm/releasing.commands": "1100.4.0",
|
|
107
108
|
"@pnpm/test-fixtures": "1100.0.0",
|
|
108
|
-
"@pnpm/
|
|
109
|
-
"@pnpm/prepare": "1100.0.11",
|
|
109
|
+
"@pnpm/testing.command-defaults": "1100.0.2",
|
|
110
110
|
"@pnpm/test-ipc-server": "1100.0.0",
|
|
111
|
-
"@pnpm/testing.
|
|
111
|
+
"@pnpm/testing.registry-mock": "1100.0.2"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|
|
114
114
|
"node": ">=22.13"
|