Skip to content

Commit 9383a98

Browse files
committed
feat: remove getLastRelease hook
BREAKING CHANGE: The `getLastRelease` hook is removed The plugin is compatible only with `semantic-release@13.0.0` and above.
1 parent 0f774fc commit 9383a98

12 files changed

+10
-724
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ Set of [semantic-release](https://github.com/semantic-release/semantic-release)
1010

1111
Verify the presence of the `NPM_TOKEN` environment variable, create or update the `.npmrc` file with the token and verify the token is valid.
1212

13-
## getLastRelease
14-
15-
Determine the last release of the package on the `npm` registry.
16-
1713
## publish
1814

1915
Update the `package.json` version, [create](https://docs.npmjs.com/cli/pack) the `npm` package tarball and [publish](https://docs.npmjs.com/cli/publish) to the `npm` registry.
@@ -73,7 +69,6 @@ Each individual plugin can be disabled, replaced or used with other plugins in t
7369
{
7470
"release": {
7571
"verifyConditions": ["@semantic-release/npm", "verify-other-condition"],
76-
"getLastRelease": "custom-get-last-release",
7772
"publish": ["@semantic-release/npm", "custom-publish"]
7873
}
7974
}
@@ -85,7 +80,6 @@ The `npmPublish` and `tarballDir` option can be used to skip the publishing to t
8580
{
8681
"release": {
8782
"verifyConditions": ["@semantic-release/npm", "@semantic-release/git", "@semantic-release/github"],
88-
"getLastRelease": "@semantic-release/git",
8983
"publish": [
9084
{
9185
"path": "@semantic-release/npm",
@@ -107,7 +101,6 @@ When publishing from a sub-directory with the `pkgRoot` option, the `package.jso
107101
{
108102
"release": {
109103
"verifyConditions": ["@semantic-release/npm", "@semantic-release/git"],
110-
"getLastRelease": "@semantic-release/npm",
111104
"publish": [
112105
{
113106
"path": "@semantic-release/npm",

index.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ const getPkg = require('./lib/get-pkg');
44
const verifyNpmConfig = require('./lib/verify-config');
55
const verifyNpmAuth = require('./lib/verify-auth');
66
const publishNpm = require('./lib/publish');
7-
const getLastReleaseNpm = require('./lib/get-last-release');
87

98
let verified;
109

11-
async function verifyConditions(pluginConfig, {options: {publish, getLastRelease}, logger}) {
10+
async function verifyConditions(pluginConfig, {options: {publish}, logger}) {
1211
// If the npm publish plugin is used and has `npmPublish`, `tarballDir` or `pkgRoot` configured, validate them now in order to prevent any release if the configuration is wrong
1312
if (publish) {
1413
const publishPlugin = castArray(publish).find(config => config.path && config.path === '@semantic-release/npm');
@@ -26,35 +25,14 @@ async function verifyConditions(pluginConfig, {options: {publish, getLastRelease
2625
const pkg = await getPkg(pluginConfig.pkgRoot);
2726
await verifyNpmConfig(pluginConfig, pkg, logger);
2827

29-
// Verify the npm authentication only if `npmPublish` is not false and if the npm plugin is used as `getLastRelease`
30-
if (
31-
pluginConfig.npmPublish !== false ||
32-
(getLastRelease && (getLastRelease === '@semantic-release/npm' || getLastRelease.path === '@semantic-release/npm'))
33-
) {
28+
// Verify the npm authentication only if `npmPublish` is not false
29+
if (pluginConfig.npmPublish !== false) {
3430
setLegacyToken();
3531
await verifyNpmAuth(pluginConfig, pkg, logger);
3632
}
3733
verified = true;
3834
}
3935

40-
async function getLastRelease(pluginConfig, {options: {publish, branch}, logger}) {
41-
setLegacyToken();
42-
// Reload package.json in case a previous external step updated it
43-
const pkg = await getPkg(pluginConfig.pkgRoot);
44-
if (!verified) {
45-
if (publish) {
46-
const publishPlugin = castArray(publish).find(config => config.path && config.path === '@semantic-release/npm');
47-
if (publishPlugin && publishPlugin.pkgRoot) {
48-
pluginConfig.pkgRoot = publishPlugin.pkgRoot;
49-
}
50-
}
51-
await verifyNpmConfig(pluginConfig, pkg, logger);
52-
await verifyNpmAuth(pluginConfig, pkg, logger);
53-
verified = true;
54-
}
55-
return getLastReleaseNpm(pkg, branch, logger);
56-
}
57-
5836
async function publish(pluginConfig, {nextRelease: {version}, logger}) {
5937
setLegacyToken();
6038
// Reload package.json in case a previous external step updated it
@@ -69,4 +47,4 @@ async function publish(pluginConfig, {nextRelease: {version}, logger}) {
6947
await publishNpm(pluginConfig, pkg, version, logger);
7048
}
7149

72-
module.exports = {verifyConditions, getLastRelease, publish};
50+
module.exports = {verifyConditions, publish};

lib/get-client-config.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/get-last-release.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

lib/get-version-head.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

lib/git.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
],
1818
"dependencies": {
1919
"@semantic-release/error": "^2.1.0",
20-
"debug": "^3.1.0",
2120
"execa": "^0.9.0",
2221
"fs-extra": "^5.0.0",
2322
"lodash": "^4.17.4",
2423
"nerf-dart": "^1.0.0",
2524
"normalize-url": "^2.0.1",
26-
"npm-conf": "^1.1.3",
27-
"npm-registry-client": "^8.5.0",
2825
"read-pkg": "^3.0.0",
2926
"registry-auth-token": "^3.3.1"
3027
},

0 commit comments

Comments
 (0)