@pnpm/releasing.commands 1100.2.9 → 1100.2.10
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/version/index.js +33 -1
- package/package.json +9 -9
package/lib/version/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { readProjectManifest } from '@pnpm/cli.utils';
|
|
3
3
|
import { types as allTypes } from '@pnpm/config.reader';
|
|
4
4
|
import { PnpmError } from '@pnpm/error';
|
|
5
|
+
import { runLifecycleHook } from '@pnpm/exec.lifecycle';
|
|
5
6
|
import { isGitRepo, isWorkingTreeClean } from '@pnpm/network.git-utils';
|
|
6
7
|
import { filterProjectsFromDir } from '@pnpm/workspace.projects-filter';
|
|
7
8
|
import { safeExeca as execa } from 'execa';
|
|
@@ -146,6 +147,7 @@ export async function handler(opts, params) {
|
|
|
146
147
|
if (!opts.recursive && opts.gitTagVersion !== false && await isGitRepo({ cwd: gitCwd })) {
|
|
147
148
|
await commitAndTag(changes, { ...opts, cwd: gitCwd });
|
|
148
149
|
}
|
|
150
|
+
await Promise.all(changes.map(change => runVersionLifecycleHook('postversion', change, opts)));
|
|
149
151
|
if (opts.json) {
|
|
150
152
|
return JSON.stringify(changes.map(({ manifestPath: _manifestPath, ...change }) => change), null, 2);
|
|
151
153
|
}
|
|
@@ -164,6 +166,14 @@ async function bumpPackageVersion(pkgDir, rawBump, explicitVersion, opts) {
|
|
|
164
166
|
if (!valid(currentVersion)) {
|
|
165
167
|
throw new PnpmError('INVALID_VERSION', `Invalid version in ${pkgDir}: ${currentVersion}`);
|
|
166
168
|
}
|
|
169
|
+
const preVersionChange = {
|
|
170
|
+
name: manifest.name,
|
|
171
|
+
currentVersion,
|
|
172
|
+
newVersion: currentVersion,
|
|
173
|
+
path: pkgDir,
|
|
174
|
+
manifestPath: path.join(pkgDir, fileName),
|
|
175
|
+
};
|
|
176
|
+
await runVersionLifecycleHook('preversion', preVersionChange, opts);
|
|
167
177
|
const newVersion = explicitVersion ?? inc(currentVersion, rawBump, false, opts.preid);
|
|
168
178
|
if (!newVersion) {
|
|
169
179
|
throw new PnpmError('VERSION_BUMP_FAILED', `Failed to bump version from ${currentVersion} using ${rawBump}`);
|
|
@@ -173,13 +183,35 @@ async function bumpPackageVersion(pkgDir, rawBump, explicitVersion, opts) {
|
|
|
173
183
|
}
|
|
174
184
|
manifest.version = newVersion;
|
|
175
185
|
await writeProjectManifest(manifest);
|
|
176
|
-
|
|
186
|
+
const change = {
|
|
177
187
|
name: manifest.name,
|
|
178
188
|
currentVersion,
|
|
179
189
|
newVersion,
|
|
180
190
|
path: pkgDir,
|
|
181
191
|
manifestPath: path.join(pkgDir, fileName),
|
|
182
192
|
};
|
|
193
|
+
await runVersionLifecycleHook('version', change, opts);
|
|
194
|
+
return change;
|
|
195
|
+
}
|
|
196
|
+
async function runVersionLifecycleHook(stage, change, opts) {
|
|
197
|
+
if (opts.ignoreScripts === true)
|
|
198
|
+
return;
|
|
199
|
+
const { manifest } = await readProjectManifest(change.path);
|
|
200
|
+
const lifecycleOpts = {
|
|
201
|
+
depPath: change.name,
|
|
202
|
+
extraBinPaths: opts.extraBinPaths,
|
|
203
|
+
extraEnv: opts.extraEnv,
|
|
204
|
+
initCwd: opts.dir,
|
|
205
|
+
pkgRoot: change.path,
|
|
206
|
+
rootModulesDir: path.join(change.path, opts.modulesDir ?? 'node_modules'),
|
|
207
|
+
scriptShell: opts.scriptShell,
|
|
208
|
+
scriptsPrependNodePath: opts.scriptsPrependNodePath,
|
|
209
|
+
shellEmulator: opts.shellEmulator,
|
|
210
|
+
stdio: 'inherit',
|
|
211
|
+
unsafePerm: opts.unsafePerm ?? false,
|
|
212
|
+
userAgent: opts.userAgent,
|
|
213
|
+
};
|
|
214
|
+
await runLifecycleHook(stage, manifest, lifecycleOpts);
|
|
183
215
|
}
|
|
184
216
|
async function commitAndTag(changes, opts) {
|
|
185
217
|
const resolvedCwd = path.resolve(opts.cwd);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/releasing.commands",
|
|
3
|
-
"version": "1100.2.
|
|
3
|
+
"version": "1100.2.10",
|
|
4
4
|
"description": "Commands for deploy, pack, and publish",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -47,12 +47,12 @@
|
|
|
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/catalogs.types": "1100.0.0",
|
|
51
50
|
"@pnpm/bins.resolver": "1100.0.2",
|
|
51
|
+
"@pnpm/catalogs.types": "1100.0.0",
|
|
52
52
|
"@pnpm/cli.common-cli-options-help": "1100.0.1",
|
|
53
53
|
"@pnpm/cli.utils": "1101.0.2",
|
|
54
|
-
"@pnpm/config.pick-registry-for-package": "1100.0.2",
|
|
55
54
|
"@pnpm/config.reader": "1101.2.1",
|
|
55
|
+
"@pnpm/config.pick-registry-for-package": "1100.0.2",
|
|
56
56
|
"@pnpm/constants": "1100.0.0",
|
|
57
57
|
"@pnpm/deps.path": "1100.0.2",
|
|
58
58
|
"@pnpm/engine.runtime.commands": "1100.0.11",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"@pnpm/fetching.directory-fetcher": "1100.0.6",
|
|
64
64
|
"@pnpm/fs.indexed-pkg-importer": "1100.0.5",
|
|
65
65
|
"@pnpm/fs.is-empty-dir-or-nothing": "1100.0.0",
|
|
66
|
-
"@pnpm/
|
|
67
|
-
"@pnpm/installing.
|
|
68
|
-
"@pnpm/
|
|
66
|
+
"@pnpm/fs.packlist": "1100.0.0",
|
|
67
|
+
"@pnpm/installing.client": "1100.0.11",
|
|
68
|
+
"@pnpm/installing.commands": "1100.1.11",
|
|
69
|
+
"@pnpm/lockfile.fs": "1100.0.6",
|
|
69
70
|
"@pnpm/lockfile.types": "1100.0.4",
|
|
70
71
|
"@pnpm/network.fetch": "1100.0.2",
|
|
71
72
|
"@pnpm/network.git-utils": "1100.0.1",
|
|
72
73
|
"@pnpm/network.web-auth": "1101.0.0",
|
|
73
74
|
"@pnpm/releasing.exportable-manifest": "1100.0.3",
|
|
74
|
-
"@pnpm/fs.packlist": "1100.0.0",
|
|
75
75
|
"@pnpm/resolving.resolver-base": "1100.1.2",
|
|
76
76
|
"@pnpm/types": "1101.0.0",
|
|
77
77
|
"@pnpm/workspace.projects-filter": "1100.0.8",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"tar": "^7.5.13",
|
|
100
100
|
"undici": "^7.25.0",
|
|
101
101
|
"write-yaml-file": "^6.0.0",
|
|
102
|
-
"@pnpm/catalogs.config": "1100.0.0",
|
|
103
102
|
"@pnpm/assert-project": "1100.0.5",
|
|
103
|
+
"@pnpm/catalogs.config": "1100.0.0",
|
|
104
104
|
"@pnpm/hooks.pnpmfile": "1100.0.6",
|
|
105
105
|
"@pnpm/logger": "1100.0.0",
|
|
106
106
|
"@pnpm/prepare": "1100.0.5",
|
|
107
|
-
"@pnpm/releasing.commands": "1100.2.
|
|
107
|
+
"@pnpm/releasing.commands": "1100.2.10",
|
|
108
108
|
"@pnpm/test-fixtures": "1100.0.0",
|
|
109
109
|
"@pnpm/test-ipc-server": "1100.0.0",
|
|
110
110
|
"@pnpm/testing.command-defaults": "1100.0.1"
|