Skip to content

Commit

Permalink
feat: remove getLastRelease hook
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `getLastRelease` hook is removed

The plugin is compatible only with `semantic-release@13.0.0` and above.
  • Loading branch information
pvdlg committed Jan 27, 2018
1 parent 3949db9 commit adfa773
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 72 deletions.
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ Execute a shell command to verify if the release should happen.
| `stdout` | Write only the reason for the verification to fail. |
| `stderr` | Can be used for logging. |

## getLastRelease

Execute a shell command to determine the last release.

| Command property | Description |
|------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `exit code` | Any non `0` code is considered as an unexpected error and will stop the `semantic-release` execution with an error. |
| `stdout` | Only the `lastRelease` must be written to `stdout` as parseable JSON (for example `{"version": "x.x.x", "gitHead": "xxxx"}`). |
| `stderr` | Can be used for logging. |

## analyzeCommits

Execute a shell command to determine the type release.
Expand Down
10 changes: 2 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const {castArray, isPlainObject} = require('lodash');
const parseJson = require('parse-json');
const SemanticReleaseError = require('@semantic-release/error');
const execScript = require('./lib/exec-script');
const verifyConfig = require('./lib/verify-config');

const PLUGIN_TYPES = ['getLastRelease', 'analyzeCommits', 'verifyRelease', 'generateNotes', 'publish'];
const PLUGIN_TYPES = ['analyzeCommits', 'verifyRelease', 'generateNotes', 'publish'];

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

async function getLastRelease(pluginConfig, params) {
const stdout = await execScript(pluginConfig, params);
return stdout ? parseJson(stdout) : undefined;
}

async function analyzeCommits(pluginConfig, params) {
const stdout = await execScript(pluginConfig, params);
return stdout.trim() ? stdout : undefined;
Expand All @@ -55,4 +49,4 @@ async function publish(pluginConfig, params) {
await execScript(pluginConfig, params);
}

module.exports = {verifyConditions, getLastRelease, analyzeCommits, verifyRelease, generateNotes, publish};
module.exports = {verifyConditions, analyzeCommits, verifyRelease, generateNotes, publish};
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"@semantic-release/error": "^2.1.0",
"debug": "^3.1.0",
"execa": "^0.9.0",
"lodash": "^4.17.4",
"parse-json": "^4.0.0"
"lodash": "^4.17.4"
},
"devDependencies": {
"ava": "^0.25.0",
Expand Down
51 changes: 0 additions & 51 deletions test/get-last-release.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/verify-confitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ test.serial('Throw "SemanticReleaseError" if another script plugin "cmd" options
logger: t.context.logger,
options: {
branch: 'master',
getLastRelease: ['@semantic-release/npm', {path: '@semantic-release/script', cmd: ' '}],
publish: ['@semantic-release/npm', {path: '@semantic-release/script', cmd: ' '}],
},
};

Expand Down

0 comments on commit adfa773

Please sign in to comment.