Skip to content
This repository has been archived by the owner on Sep 18, 2017. It is now read-only.

feat: Change to new version of plugin API #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ariporad
Copy link

Change to the new version of the commit analyzer API. Now the parser is called
multiple times with only a single commit each time, and semantic-release takes
care of keeping track of the version. This drastically simplifies the code.

BREAKING CHANGE:
Instead of accepting an array of commits with the commits option, we now
accept a single commit with the commit option. Use that instead, and call
the plugin multiple times.

ariporad referenced this pull request in ariporad/semantic-release Aug 19, 2015
Support the new commit-analyzer API. With the new API, we call the plugin once
for each commit, and keep track of the changes ourselfs.
This also adds support for the 'rskip' release type, which skips the release.
This revealed a major problem with the pre.js unit tests (test/specs/pre.js),
child process was not actually being mocked, and was simply returning an empty
array. With the old system, the mocked commit-analyzer was still called and
could still trigger a release (this is actually a flaw with the whole system.
With the new system, this is no longer true, so the unit tests fail. I did not
fix this both because it's not related to this branch/pull request, and because
it would mean a major revamp, which I would need to think about more.

Fixes semantic-release#41
Refs semantic-release/commit-analyzer#1, semantic-release/commit-analyzer#2
BREAKING CHANGE:
	The commit-analyzer is now called multiple times, and with a single commit
	(passed in as `commit`, vs `commits` as an array). The plugin also no longer
	has to deal with keeping track of the release type between commits.
@@ -1,26 +1,12 @@
const { parseRawCommit } = require('conventional-changelog/lib/git')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While doing the rewrite I think it would make sense to switch over to https://github.com/stevemao/conventional-commits-parser

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I started working on it, but may I ask why?

Also, that doesn't tell us if it broke anything, we have to parse it our selfs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, didn't know it doesn't contain the BREAKING CHANGE: parsing 👀.
It makes sense because going forward this will allow us to support more commit message styles.
Given that it's not fully compatible, let's just skip it for this PR.

@boennemann
Copy link
Member

Looks good so far 👍

Change to the new version of the commit analyzer API. Now the parser is called
multiple times with only a single commit each time, and semantic-release takes
care of keeping track of the version. This drastically simplifies the code.

BREAKING CHANGE:
Instead of accepting an array of commits with the `commits` option, we now
accept a single commit with the `commit` option. Use that instead, and call
the plugin multiple times.
@ariporad
Copy link
Author

Fixed commit message.

@Guria
Copy link

Guria commented Jan 11, 2016

what happened with this?

@ghost
Copy link

ghost commented Jan 26, 2016

@Guria looks like it just needs a few lint corrections.

@ghost
Copy link

ghost commented Jan 26, 2016

Also, could the pull request comment be updated to reference #6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants