@pnpm/releasing.commands 1100.6.0 → 1100.6.1
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/CHANGELOG.md +23 -0
- package/package.json +22 -22
- package/lib/change/index.d.ts +0 -41
- package/lib/change/index.js +0 -245
- package/lib/deploy/createDeployFiles.d.ts +0 -26
- package/lib/deploy/createDeployFiles.js +0 -255
- package/lib/deploy/deploy.d.ts +0 -12
- package/lib/deploy/deploy.js +0 -398
- package/lib/deploy/deployHook.d.ts +0 -2
- package/lib/deploy/deployHook.js +0 -15
- package/lib/deploy/index.d.ts +0 -2
- package/lib/deploy/index.js +0 -3
- package/lib/index.d.ts +0 -7
- package/lib/lane/index.d.ts +0 -24
- package/lib/lane/index.js +0 -157
- package/lib/pack-app/index.d.ts +0 -2
- package/lib/pack-app/index.js +0 -3
- package/lib/pack-app/packApp.d.ts +0 -22
- package/lib/pack-app/packApp.js +0 -558
- package/lib/publish/FailedToPublishError.d.ts +0 -22
- package/lib/publish/FailedToPublishError.js +0 -40
- package/lib/publish/batchPublish.d.ts +0 -20
- package/lib/publish/batchPublish.js +0 -201
- package/lib/publish/displayError.d.ts +0 -1
- package/lib/publish/displayError.js +0 -23
- package/lib/publish/executeTokenHelper.d.ts +0 -4
- package/lib/publish/executeTokenHelper.js +0 -17
- package/lib/publish/extractManifestFromPacked.d.ts +0 -19
- package/lib/publish/extractManifestFromPacked.js +0 -110
- package/lib/publish/index.d.ts +0 -3
- package/lib/publish/index.js +0 -4
- package/lib/publish/oidc/authToken.d.ts +0 -73
- package/lib/publish/oidc/authToken.js +0 -97
- package/lib/publish/oidc/idToken.d.ts +0 -76
- package/lib/publish/oidc/idToken.js +0 -90
- package/lib/publish/oidc/provenance.d.ts +0 -73
- package/lib/publish/oidc/provenance.js +0 -91
- package/lib/publish/otp.d.ts +0 -38
- package/lib/publish/otp.js +0 -41
- package/lib/publish/otpEnv.d.ts +0 -7
- package/lib/publish/otpEnv.js +0 -5
- package/lib/publish/pack.d.ts +0 -34
- package/lib/publish/pack.js +0 -408
- package/lib/publish/previousChangelog.d.ts +0 -19
- package/lib/publish/previousChangelog.js +0 -182
- package/lib/publish/publish.d.ts +0 -40
- package/lib/publish/publish.js +0 -256
- package/lib/publish/publishPackedPkg.d.ts +0 -79
- package/lib/publish/publishPackedPkg.js +0 -298
- package/lib/publish/recursivePublish.d.ts +0 -18
- package/lib/publish/recursivePublish.js +0 -132
- package/lib/publish/registryConfigKeys.d.ts +0 -30
- package/lib/publish/registryConfigKeys.js +0 -50
- package/lib/publish/utils/shared-context.d.ts +0 -7
- package/lib/publish/utils/shared-context.js +0 -20
- package/lib/stage/approve.d.ts +0 -2
- package/lib/stage/approve.js +0 -14
- package/lib/stage/context.d.ts +0 -14
- package/lib/stage/context.js +0 -25
- package/lib/stage/download.d.ts +0 -2
- package/lib/stage/download.js +0 -32
- package/lib/stage/errors.d.ts +0 -15
- package/lib/stage/errors.js +0 -17
- package/lib/stage/help.d.ts +0 -1
- package/lib/stage/help.js +0 -84
- package/lib/stage/index.d.ts +0 -13
- package/lib/stage/index.js +0 -57
- package/lib/stage/list.d.ts +0 -2
- package/lib/stage/list.js +0 -49
- package/lib/stage/parsing.d.ts +0 -6
- package/lib/stage/parsing.js +0 -27
- package/lib/stage/publish.d.ts +0 -7
- package/lib/stage/publish.js +0 -38
- package/lib/stage/reject.d.ts +0 -2
- package/lib/stage/reject.js +0 -16
- package/lib/stage/rendering.d.ts +0 -11
- package/lib/stage/rendering.js +0 -50
- package/lib/stage/request.d.ts +0 -29
- package/lib/stage/request.js +0 -110
- package/lib/stage/types.d.ts +0 -38
- package/lib/stage/types.js +0 -3
- package/lib/stage/view.d.ts +0 -2
- package/lib/stage/view.js +0 -14
- package/lib/tarball/index.d.ts +0 -2
- package/lib/tarball/index.js +0 -3
- package/lib/tarball/publishSummary.d.ts +0 -47
- package/lib/tarball/publishSummary.js +0 -36
- package/lib/tarball/safeTarballFilename.d.ts +0 -8
- package/lib/tarball/safeTarballFilename.js +0 -21
- package/lib/tarball/summarizeTarball.d.ts +0 -12
- package/lib/tarball/summarizeTarball.js +0 -84
- package/lib/version/index.d.ts +0 -33
- package/lib/version/index.js +0 -337
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @pnpm/releasing.commands
|
|
2
2
|
|
|
3
|
+
## 1100.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed `pnpm pack` applying workspace-root ignore rules when a workspace package has its own `.npmignore` file.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies:
|
|
10
|
+
- @pnpm/cli.utils@1101.0.15
|
|
11
|
+
- @pnpm/config.reader@1101.12.1
|
|
12
|
+
- @pnpm/engine.runtime.commands@1100.1.12
|
|
13
|
+
- @pnpm/engine.runtime.node-resolver@1101.1.14
|
|
14
|
+
- @pnpm/exec.lifecycle@1100.1.4
|
|
15
|
+
- @pnpm/fetching.directory-fetcher@1100.0.21
|
|
16
|
+
- @pnpm/fs.indexed-pkg-importer@1100.0.19
|
|
17
|
+
- @pnpm/fs.packlist@1100.0.3
|
|
18
|
+
- @pnpm/installing.client@1100.2.15
|
|
19
|
+
- @pnpm/installing.commands@1100.10.6
|
|
20
|
+
- @pnpm/network.fetch@1100.1.6
|
|
21
|
+
- @pnpm/releasing.exportable-manifest@1100.1.11
|
|
22
|
+
- @pnpm/releasing.versioning@1100.1.1
|
|
23
|
+
- @pnpm/resolving.npm-resolver@1102.1.4
|
|
24
|
+
- @pnpm/workspace.projects-filter@1100.0.28
|
|
25
|
+
|
|
3
26
|
## 1100.6.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/releasing.commands",
|
|
3
|
-
"version": "1100.6.
|
|
3
|
+
"version": "1100.6.1",
|
|
4
4
|
"description": "Commands for deploy, pack, and publish",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -31,37 +31,37 @@
|
|
|
31
31
|
"@pnpm/bins.resolver": "1100.0.9",
|
|
32
32
|
"@pnpm/catalogs.types": "1100.0.0",
|
|
33
33
|
"@pnpm/cli.common-cli-options-help": "1100.0.2",
|
|
34
|
-
"@pnpm/cli.utils": "1101.0.
|
|
34
|
+
"@pnpm/cli.utils": "1101.0.15",
|
|
35
35
|
"@pnpm/config.pick-registry-for-package": "1100.0.10",
|
|
36
|
-
"@pnpm/config.reader": "1101.12.
|
|
36
|
+
"@pnpm/config.reader": "1101.12.1",
|
|
37
37
|
"@pnpm/constants": "1100.0.0",
|
|
38
38
|
"@pnpm/deps.path": "1100.0.9",
|
|
39
|
-
"@pnpm/engine.runtime.commands": "1100.1.
|
|
40
|
-
"@pnpm/engine.runtime.node-resolver": "1101.1.
|
|
39
|
+
"@pnpm/engine.runtime.commands": "1100.1.12",
|
|
40
|
+
"@pnpm/engine.runtime.node-resolver": "1101.1.14",
|
|
41
41
|
"@pnpm/error": "1100.0.1",
|
|
42
|
-
"@pnpm/exec.lifecycle": "1100.1.
|
|
42
|
+
"@pnpm/exec.lifecycle": "1100.1.4",
|
|
43
43
|
"@pnpm/exec.pnpm-cli-runner": "1100.0.1",
|
|
44
|
-
"@pnpm/fetching.directory-fetcher": "1100.0.
|
|
44
|
+
"@pnpm/fetching.directory-fetcher": "1100.0.21",
|
|
45
45
|
"@pnpm/fetching.types": "1100.0.2",
|
|
46
|
-
"@pnpm/fs.indexed-pkg-importer": "1100.0.
|
|
46
|
+
"@pnpm/fs.indexed-pkg-importer": "1100.0.19",
|
|
47
47
|
"@pnpm/fs.is-empty-dir-or-nothing": "1100.0.0",
|
|
48
|
-
"@pnpm/fs.packlist": "1100.0.
|
|
49
|
-
"@pnpm/installing.client": "1100.2.
|
|
50
|
-
"@pnpm/installing.commands": "1100.10.
|
|
48
|
+
"@pnpm/fs.packlist": "1100.0.3",
|
|
49
|
+
"@pnpm/installing.client": "1100.2.15",
|
|
50
|
+
"@pnpm/installing.commands": "1100.10.6",
|
|
51
51
|
"@pnpm/lockfile.fs": "1100.1.11",
|
|
52
52
|
"@pnpm/lockfile.types": "1100.0.14",
|
|
53
53
|
"@pnpm/network.auth-header": "1101.1.4",
|
|
54
|
-
"@pnpm/network.fetch": "1100.1.
|
|
54
|
+
"@pnpm/network.fetch": "1100.1.6",
|
|
55
55
|
"@pnpm/network.git-utils": "1100.0.2",
|
|
56
56
|
"@pnpm/network.web-auth": "1101.2.0",
|
|
57
57
|
"@pnpm/npm-package-arg": "^2.0.0",
|
|
58
|
-
"@pnpm/releasing.exportable-manifest": "1100.1.
|
|
59
|
-
"@pnpm/releasing.versioning": "1100.1.
|
|
60
|
-
"@pnpm/resolving.npm-resolver": "1102.1.
|
|
58
|
+
"@pnpm/releasing.exportable-manifest": "1100.1.11",
|
|
59
|
+
"@pnpm/releasing.versioning": "1100.1.1",
|
|
60
|
+
"@pnpm/resolving.npm-resolver": "1102.1.4",
|
|
61
61
|
"@pnpm/resolving.registry.types": "1100.1.4",
|
|
62
62
|
"@pnpm/resolving.resolver-base": "1100.5.2",
|
|
63
63
|
"@pnpm/types": "1101.4.0",
|
|
64
|
-
"@pnpm/workspace.projects-filter": "1100.0.
|
|
64
|
+
"@pnpm/workspace.projects-filter": "1100.0.28",
|
|
65
65
|
"@pnpm/workspace.projects-sorter": "1100.0.9",
|
|
66
66
|
"@pnpm/workspace.workspace-manifest-writer": "1100.0.16",
|
|
67
67
|
"@types/normalize-path": "^3.0.2",
|
|
@@ -93,16 +93,16 @@
|
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@jest/globals": "30.4.1",
|
|
96
|
-
"@pnpm/assert-project": "1100.0.
|
|
96
|
+
"@pnpm/assert-project": "1100.0.20",
|
|
97
97
|
"@pnpm/catalogs.config": "1100.0.2",
|
|
98
|
-
"@pnpm/hooks.pnpmfile": "1100.0.
|
|
98
|
+
"@pnpm/hooks.pnpmfile": "1100.0.20",
|
|
99
99
|
"@pnpm/logger": "1100.0.0",
|
|
100
|
-
"@pnpm/prepare": "1100.0.
|
|
101
|
-
"@pnpm/releasing.commands": "1100.6.
|
|
100
|
+
"@pnpm/prepare": "1100.0.20",
|
|
101
|
+
"@pnpm/releasing.commands": "1100.6.1",
|
|
102
102
|
"@pnpm/test-fixtures": "1100.0.0",
|
|
103
103
|
"@pnpm/test-ipc-server": "1100.0.0",
|
|
104
|
-
"@pnpm/testing.command-defaults": "1100.0.
|
|
105
|
-
"@pnpm/testing.registry-mock": "1100.0.
|
|
104
|
+
"@pnpm/testing.command-defaults": "1100.0.10",
|
|
105
|
+
"@pnpm/testing.registry-mock": "1100.0.10",
|
|
106
106
|
"@types/cross-spawn": "^6.0.6",
|
|
107
107
|
"@types/is-windows": "^1.0.2",
|
|
108
108
|
"@types/libnpmpublish": "^11.2.0",
|
package/lib/change/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@pnpm/config.reader';
|
|
2
|
-
import { type ChangeIntent, type ReleasePlan, type WorkspaceProject } from '@pnpm/releasing.versioning';
|
|
3
|
-
import type { Project, VersioningSettings } from '@pnpm/types';
|
|
4
|
-
export declare function rcOptionsTypes(): Record<string, unknown>;
|
|
5
|
-
export declare function cliOptionsTypes(): Record<string, unknown>;
|
|
6
|
-
export declare const commandNames: string[];
|
|
7
|
-
export declare function help(): string;
|
|
8
|
-
export type ChangeCommandOptions = Pick<Config, 'changedFilesIgnorePattern' | 'dir' | 'testPattern' | 'versioning' | 'workspaceDir'> & {
|
|
9
|
-
allProjects?: Project[];
|
|
10
|
-
bump?: string;
|
|
11
|
-
summary?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function handler(opts: ChangeCommandOptions, params: string[]): Promise<string>;
|
|
14
|
-
export declare function renderReleasePlan(plan: ReleasePlan): string;
|
|
15
|
-
export interface ReleasableProject {
|
|
16
|
-
name: string;
|
|
17
|
-
/** Workspace-relative project directory. */
|
|
18
|
-
dir: string;
|
|
19
|
-
/**
|
|
20
|
-
* How an intent file or versioning config should reference this project:
|
|
21
|
-
* the bare name, or the `./`-prefixed directory when the name is shared by
|
|
22
|
-
* several workspace projects.
|
|
23
|
-
*/
|
|
24
|
-
ref: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The projects a change intent may demand a release from: named, carrying a
|
|
28
|
-
* valid semver version, and not frozen by `versioning.ignore`. Matches the
|
|
29
|
-
* participant set of the release-plan assembler.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getReleasableProjects(allProjects: Array<Pick<Project, 'manifest' | 'rootDir'>>, workspaceDir: string, versioning?: VersioningSettings): ReleasableProject[];
|
|
32
|
-
export declare function toWorkspaceProjects(allProjects: Array<Pick<Project, 'manifest' | 'rootDir'>>): WorkspaceProject[];
|
|
33
|
-
export type { ChangeIntent };
|
|
34
|
-
export declare const change: {
|
|
35
|
-
handler: typeof handler;
|
|
36
|
-
help: typeof help;
|
|
37
|
-
commandNames: string[];
|
|
38
|
-
cliOptionsTypes: typeof cliOptionsTypes;
|
|
39
|
-
rcOptionsTypes: typeof rcOptionsTypes;
|
|
40
|
-
recursiveByDefault: boolean;
|
|
41
|
-
};
|
package/lib/change/index.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { checkbox, input, Separator } from '@inquirer/prompts';
|
|
2
|
-
import { PnpmError } from '@pnpm/error';
|
|
3
|
-
import { assembleReleasePlan, BUMP_TYPES, indexProjectRefs, readChangeIntents, readLedger, toProjectDir, writeChangeIntent, } from '@pnpm/releasing.versioning';
|
|
4
|
-
import { getChangedProjects } from '@pnpm/workspace.projects-filter';
|
|
5
|
-
import { safeExeca as execa } from 'execa';
|
|
6
|
-
import { renderHelp } from 'render-help';
|
|
7
|
-
import { valid } from 'semver';
|
|
8
|
-
export function rcOptionsTypes() {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
export function cliOptionsTypes() {
|
|
12
|
-
return {
|
|
13
|
-
bump: String,
|
|
14
|
-
summary: String,
|
|
15
|
-
recursive: Boolean,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export const commandNames = ['change'];
|
|
19
|
-
export function help() {
|
|
20
|
-
return renderHelp({
|
|
21
|
-
description: 'Records a change intent: which packages a change affects, the bump type for each, and a summary that becomes the changelog entry. The intent file is written to .changeset/ in the changesets format.',
|
|
22
|
-
usages: [
|
|
23
|
-
'pnpm change [--bump <type>] [--summary <text>] [<pkg>...]',
|
|
24
|
-
'pnpm change status',
|
|
25
|
-
],
|
|
26
|
-
descriptionLists: [
|
|
27
|
-
{
|
|
28
|
-
title: 'Options',
|
|
29
|
-
list: [
|
|
30
|
-
{
|
|
31
|
-
description: `Bump type for the named packages: ${BUMP_TYPES.join(', ')}. "none" records an explicit decline — the change needs no release`,
|
|
32
|
-
name: '--bump <type>',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
description: 'The summary for the changelog entry. Runs non-interactively when given together with package names',
|
|
36
|
-
name: '--summary <text>',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
export async function handler(opts, params) {
|
|
44
|
-
const workspaceDir = opts.workspaceDir;
|
|
45
|
-
if (!workspaceDir) {
|
|
46
|
-
throw new PnpmError('WORKSPACE_ONLY', 'pnpm change is only supported in a workspace');
|
|
47
|
-
}
|
|
48
|
-
// Only the exact no-option invocation is the status form, so a package
|
|
49
|
-
// that happens to be named "status" stays recordable.
|
|
50
|
-
if (params.length === 1 && params[0] === 'status' && opts.bump == null && opts.summary == null) {
|
|
51
|
-
return renderStatus(workspaceDir, opts);
|
|
52
|
-
}
|
|
53
|
-
return recordChange(workspaceDir, opts, params);
|
|
54
|
-
}
|
|
55
|
-
async function recordChange(workspaceDir, opts, params) {
|
|
56
|
-
const releasable = getReleasableProjects(opts.allProjects ?? [], workspaceDir, opts.versioning);
|
|
57
|
-
if (releasable.length === 0) {
|
|
58
|
-
throw new PnpmError('VERSIONING_NO_PACKAGES', 'No releasable packages found in this workspace');
|
|
59
|
-
}
|
|
60
|
-
const releasableDirs = new Set(releasable.map((project) => project.dir));
|
|
61
|
-
const refs = indexProjectRefs(opts.allProjects ?? [], workspaceDir);
|
|
62
|
-
for (const ref of params) {
|
|
63
|
-
const dirs = refs.refToDirs(ref);
|
|
64
|
-
if (dirs.length > 1) {
|
|
65
|
-
throw new PnpmError('VERSIONING_AMBIGUOUS_PACKAGE', `${ref} matches multiple workspace projects: ${dirs.map((dir) => `./${dir}`).join(', ')}. Reference the project by directory instead.`);
|
|
66
|
-
}
|
|
67
|
-
if (dirs.length === 0 || !releasableDirs.has(dirs[0])) {
|
|
68
|
-
throw new PnpmError('VERSIONING_UNKNOWN_PACKAGE', `${ref} is not a releasable package of this workspace`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (opts.bump != null && !BUMP_TYPES.includes(opts.bump)) {
|
|
72
|
-
throw new PnpmError('VERSIONING_INVALID_BUMP', `Invalid bump type: ${opts.bump}. Expected one of ${BUMP_TYPES.join(', ')}`);
|
|
73
|
-
}
|
|
74
|
-
const pkgRefs = params.length > 0
|
|
75
|
-
? params
|
|
76
|
-
: await promptForPackages(releasable, workspaceDir, opts);
|
|
77
|
-
const releases = opts.bump != null
|
|
78
|
-
? Object.fromEntries(pkgRefs.map((ref) => [ref, opts.bump]))
|
|
79
|
-
: await promptBumpTypes(pkgRefs);
|
|
80
|
-
const summary = opts.summary ??
|
|
81
|
-
await input({ message: 'Summary of the change (becomes the changelog entry):', required: true });
|
|
82
|
-
const id = await writeChangeIntent(workspaceDir, { releases, summary });
|
|
83
|
-
return `Recorded change intent .changeset/${id}.md`;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* The affected-packages picker, changesets-style: the packages whose
|
|
87
|
-
* directories the branch touched are grouped first (under a "changed
|
|
88
|
-
* packages" heading) and preselected, the rest listed below under "unchanged
|
|
89
|
-
* packages". A name shared by several projects is offered under its directory
|
|
90
|
-
* reference so the written intent stays unambiguous. Change detection is
|
|
91
|
-
* best-effort — outside a git repo, or when no base branch can be found, the
|
|
92
|
-
* list falls back to a flat, unselected picker.
|
|
93
|
-
*/
|
|
94
|
-
async function promptForPackages(releasable, workspaceDir, opts) {
|
|
95
|
-
const changedDirs = await detectChangedDirs(releasable, workspaceDir, opts);
|
|
96
|
-
const label = (project) => project.ref === project.name ? project.name : `${project.name} (./${project.dir})`;
|
|
97
|
-
let choices;
|
|
98
|
-
if (changedDirs.size > 0) {
|
|
99
|
-
const changed = releasable.filter((project) => changedDirs.has(project.dir));
|
|
100
|
-
const unchanged = releasable.filter((project) => !changedDirs.has(project.dir));
|
|
101
|
-
choices = [
|
|
102
|
-
new Separator('changed packages'),
|
|
103
|
-
...changed.map((project) => ({ value: project.ref, name: label(project), checked: true })),
|
|
104
|
-
...(unchanged.length > 0 ? [new Separator('unchanged packages')] : []),
|
|
105
|
-
...unchanged.map((project) => ({ value: project.ref, name: label(project) })),
|
|
106
|
-
];
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
choices = releasable.map((project) => ({ value: project.ref, name: label(project) }));
|
|
110
|
-
}
|
|
111
|
-
return checkbox({
|
|
112
|
-
message: 'Which packages does this change affect?',
|
|
113
|
-
choices,
|
|
114
|
-
required: true,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* The workspace-relative directories the current branch changed, relative to
|
|
119
|
-
* the base branch, using the same detection behind `--filter="[<ref>]"`.
|
|
120
|
-
* Returns an empty set on any failure so the picker degrades to a flat list.
|
|
121
|
-
*/
|
|
122
|
-
async function detectChangedDirs(releasable, workspaceDir, opts) {
|
|
123
|
-
const baseCommit = await detectBaseCommit(workspaceDir);
|
|
124
|
-
if (baseCommit == null)
|
|
125
|
-
return new Set();
|
|
126
|
-
try {
|
|
127
|
-
const projectDirs = (opts.allProjects ?? []).map((project) => project.rootDir);
|
|
128
|
-
const [changedRootDirs] = await getChangedProjects(projectDirs, baseCommit, {
|
|
129
|
-
workspaceDir,
|
|
130
|
-
testPattern: opts.testPattern,
|
|
131
|
-
changedFilesIgnorePattern: opts.changedFilesIgnorePattern,
|
|
132
|
-
});
|
|
133
|
-
const releasableDirs = new Set(releasable.map((project) => project.dir));
|
|
134
|
-
return new Set(changedRootDirs
|
|
135
|
-
.map((rootDir) => toProjectDir(workspaceDir, rootDir))
|
|
136
|
-
.filter((dir) => releasableDirs.has(dir)));
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
return new Set();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
/** The merge-base of HEAD with the default branch, or `undefined`. */
|
|
143
|
-
async function detectBaseCommit(cwd) {
|
|
144
|
-
for (const branch of ['main', 'master']) {
|
|
145
|
-
try {
|
|
146
|
-
// eslint-disable-next-line no-await-in-loop
|
|
147
|
-
const { stdout } = await execa('git', ['merge-base', 'HEAD', branch], { cwd });
|
|
148
|
-
const commit = String(stdout).trim();
|
|
149
|
-
if (commit !== '')
|
|
150
|
-
return commit;
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
// Try the next candidate branch.
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* The changesets-style bump picker: ask which packages get a major bump, then
|
|
160
|
-
* which of the rest get a minor, and default whatever remains to patch. One
|
|
161
|
-
* multiselect per level reads far better than a per-package prompt when many
|
|
162
|
-
* packages are affected.
|
|
163
|
-
*/
|
|
164
|
-
async function promptBumpTypes(pkgRefs) {
|
|
165
|
-
const bumpByRef = new Map();
|
|
166
|
-
let remaining = [...pkgRefs];
|
|
167
|
-
for (const bumpType of ['major', 'minor']) {
|
|
168
|
-
if (remaining.length === 0)
|
|
169
|
-
break;
|
|
170
|
-
// eslint-disable-next-line no-await-in-loop
|
|
171
|
-
const chosen = new Set(await checkbox({
|
|
172
|
-
message: `Which packages should have a ${bumpType} bump?`,
|
|
173
|
-
choices: remaining.map((ref) => ({ value: ref })),
|
|
174
|
-
}));
|
|
175
|
-
for (const ref of chosen)
|
|
176
|
-
bumpByRef.set(ref, bumpType);
|
|
177
|
-
remaining = remaining.filter((ref) => !chosen.has(ref));
|
|
178
|
-
}
|
|
179
|
-
for (const ref of remaining)
|
|
180
|
-
bumpByRef.set(ref, 'patch');
|
|
181
|
-
// Emit in the original selection order rather than grouped by bump level.
|
|
182
|
-
return Object.fromEntries(pkgRefs.map((ref) => [ref, bumpByRef.get(ref)]));
|
|
183
|
-
}
|
|
184
|
-
async function renderStatus(workspaceDir, opts) {
|
|
185
|
-
const intents = await readChangeIntents(workspaceDir);
|
|
186
|
-
const ledger = await readLedger(workspaceDir);
|
|
187
|
-
const plan = assembleReleasePlan({
|
|
188
|
-
workspaceDir,
|
|
189
|
-
projects: toWorkspaceProjects(opts.allProjects ?? []),
|
|
190
|
-
intents,
|
|
191
|
-
ledger,
|
|
192
|
-
versioning: opts.versioning,
|
|
193
|
-
});
|
|
194
|
-
if (plan.releases.length === 0) {
|
|
195
|
-
return 'No pending changes.';
|
|
196
|
-
}
|
|
197
|
-
const consumedIds = new Set(plan.releases.flatMap((release) => release.intents.map((intent) => intent.id)));
|
|
198
|
-
let output = 'Pending change intents:\n';
|
|
199
|
-
for (const intent of intents.filter(({ id }) => consumedIds.has(id))) {
|
|
200
|
-
output += ` .changeset/${intent.id}.md\n`;
|
|
201
|
-
}
|
|
202
|
-
output += '\n';
|
|
203
|
-
output += renderReleasePlan(plan);
|
|
204
|
-
return output;
|
|
205
|
-
}
|
|
206
|
-
export function renderReleasePlan(plan) {
|
|
207
|
-
let output = 'Release plan:\n';
|
|
208
|
-
for (const release of plan.releases) {
|
|
209
|
-
output += ` ${release.name}: ${release.currentVersion} → ${release.newVersion} (${release.bumpType}, via ${release.causes.join('+')})\n`;
|
|
210
|
-
}
|
|
211
|
-
return output;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* The projects a change intent may demand a release from: named, carrying a
|
|
215
|
-
* valid semver version, and not frozen by `versioning.ignore`. Matches the
|
|
216
|
-
* participant set of the release-plan assembler.
|
|
217
|
-
*/
|
|
218
|
-
export function getReleasableProjects(allProjects, workspaceDir, versioning) {
|
|
219
|
-
const refs = indexProjectRefs(allProjects, workspaceDir);
|
|
220
|
-
const ignoredDirs = new Set((versioning?.ignore ?? []).flatMap((ref) => refs.refToDirs(ref)));
|
|
221
|
-
return allProjects
|
|
222
|
-
.filter(({ manifest }) => manifest.name != null &&
|
|
223
|
-
manifest.version != null &&
|
|
224
|
-
valid(manifest.version) != null)
|
|
225
|
-
.map((project) => ({ name: project.manifest.name, dir: toProjectDir(workspaceDir, project.rootDir) }))
|
|
226
|
-
.filter(({ dir }) => !ignoredDirs.has(dir))
|
|
227
|
-
.map(({ name, dir }) => ({
|
|
228
|
-
name,
|
|
229
|
-
dir,
|
|
230
|
-
ref: refs.nameToDirs(name).length > 1 ? `./${dir}` : name,
|
|
231
|
-
}))
|
|
232
|
-
.sort((left, right) => left.ref.localeCompare(right.ref));
|
|
233
|
-
}
|
|
234
|
-
export function toWorkspaceProjects(allProjects) {
|
|
235
|
-
return allProjects.map((project) => ({ rootDir: project.rootDir, manifest: project.manifest }));
|
|
236
|
-
}
|
|
237
|
-
export const change = {
|
|
238
|
-
handler,
|
|
239
|
-
help,
|
|
240
|
-
commandNames,
|
|
241
|
-
cliOptionsTypes,
|
|
242
|
-
rcOptionsTypes,
|
|
243
|
-
recursiveByDefault: true,
|
|
244
|
-
};
|
|
245
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { LockfileObject } from '@pnpm/lockfile.types';
|
|
2
|
-
import type { DependenciesField, PnpmSettings, Project, ProjectId, ProjectManifest } from '@pnpm/types';
|
|
3
|
-
export interface CreateDeployFilesOptions {
|
|
4
|
-
allProjects: Array<Pick<Project, 'manifest' | 'rootDirRealPath'>>;
|
|
5
|
-
deployDir: string;
|
|
6
|
-
include: {
|
|
7
|
-
[dependenciesField in DependenciesField]: boolean;
|
|
8
|
-
};
|
|
9
|
-
lockfile: LockfileObject;
|
|
10
|
-
lockfileDir: string;
|
|
11
|
-
patchedDependencies?: PnpmSettings['patchedDependencies'];
|
|
12
|
-
selectedProjectManifest: ProjectManifest;
|
|
13
|
-
projectId: ProjectId;
|
|
14
|
-
rootProjectManifestDir: string;
|
|
15
|
-
allowBuilds?: Record<string, boolean | string>;
|
|
16
|
-
}
|
|
17
|
-
export interface DeployWorkspaceManifest {
|
|
18
|
-
allowBuilds?: Record<string, boolean | string>;
|
|
19
|
-
patchedDependencies?: Record<string, string>;
|
|
20
|
-
}
|
|
21
|
-
export interface DeployFiles {
|
|
22
|
-
lockfile: LockfileObject;
|
|
23
|
-
manifest: ProjectManifest;
|
|
24
|
-
workspaceManifest?: DeployWorkspaceManifest;
|
|
25
|
-
}
|
|
26
|
-
export declare function createDeployFiles({ allProjects, deployDir, include, lockfile, lockfileDir, patchedDependencies, selectedProjectManifest, projectId, rootProjectManifestDir, allowBuilds, }: CreateDeployFilesOptions): DeployFiles;
|