Skip to content

Commit adfa773

Browse files
committed
feat: remove getLastRelease hook
BREAKING CHANGE: The `getLastRelease` hook is removed The plugin is compatible only with `[email protected]` and above.
1 parent 3949db9 commit adfa773

File tree

5 files changed

+4
-72
lines changed

5 files changed

+4
-72
lines changed

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ Execute a shell command to verify if the release should happen.
1616
| `stdout` | Write only the reason for the verification to fail. |
1717
| `stderr` | Can be used for logging. |
1818

19-
## getLastRelease
20-
21-
Execute a shell command to determine the last release.
22-
23-
| Command property | Description |
24-
|------------------|-------------------------------------------------------------------------------------------------------------------------------|
25-
| `exit code` | Any non `0` code is considered as an unexpected error and will stop the `semantic-release` execution with an error. |
26-
| `stdout` | Only the `lastRelease` must be written to `stdout` as parseable JSON (for example `{"version": "x.x.x", "gitHead": "xxxx"}`). |
27-
| `stderr` | Can be used for logging. |
28-
2919
## analyzeCommits
3020

3121
Execute a shell command to determine the type release.

index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const {castArray, isPlainObject} = require('lodash');
2-
const parseJson = require('parse-json');
32
const SemanticReleaseError = require('@semantic-release/error');
43
const execScript = require('./lib/exec-script');
54
const verifyConfig = require('./lib/verify-config');
65

7-
const PLUGIN_TYPES = ['getLastRelease', 'analyzeCommits', 'verifyRelease', 'generateNotes', 'publish'];
6+
const PLUGIN_TYPES = ['analyzeCommits', 'verifyRelease', 'generateNotes', 'publish'];
87

98
async function verifyConditions(pluginConfig, params) {
109
for (const [option, value] of Object.entries(params.options || {})) {
@@ -29,11 +28,6 @@ async function verifyConditions(pluginConfig, params) {
2928
}
3029
}
3130

32-
async function getLastRelease(pluginConfig, params) {
33-
const stdout = await execScript(pluginConfig, params);
34-
return stdout ? parseJson(stdout) : undefined;
35-
}
36-
3731
async function analyzeCommits(pluginConfig, params) {
3832
const stdout = await execScript(pluginConfig, params);
3933
return stdout.trim() ? stdout : undefined;
@@ -55,4 +49,4 @@ async function publish(pluginConfig, params) {
5549
await execScript(pluginConfig, params);
5650
}
5751

58-
module.exports = {verifyConditions, getLastRelease, analyzeCommits, verifyRelease, generateNotes, publish};
52+
module.exports = {verifyConditions, analyzeCommits, verifyRelease, generateNotes, publish};

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"@semantic-release/error": "^2.1.0",
2020
"debug": "^3.1.0",
2121
"execa": "^0.9.0",
22-
"lodash": "^4.17.4",
23-
"parse-json": "^4.0.0"
22+
"lodash": "^4.17.4"
2423
},
2524
"devDependencies": {
2625
"ava": "^0.25.0",

test/get-last-release.test.js

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

test/verify-confitions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test.serial('Throw "SemanticReleaseError" if another script plugin "cmd" options
5959
logger: t.context.logger,
6060
options: {
6161
branch: 'master',
62-
getLastRelease: ['@semantic-release/npm', {path: '@semantic-release/script', cmd: ' '}],
62+
publish: ['@semantic-release/npm', {path: '@semantic-release/script', cmd: ' '}],
6363
},
6464
};
6565

0 commit comments

Comments
 (0)