You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

conventional-changelog-core

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conventional-changelog-core - npm Package Compare versions

Comparing version

to
1.9.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

<a name="1.9.0"></a>
# [1.9.0](https://github.com/conventional-changelog/conventional-changelog-core/compare/conventional-changelog-core@1.8.0...conventional-changelog-core@1.9.0) (2017-03-23)
### Features
* **context:** default currentTag may not prefix with v ([#179](https://github.com/conventional-changelog/conventional-changelog/issues/179)) ([431598a](https://github.com/conventional-changelog/conventional-changelog-core/commit/431598a))
<a name="1.8.0"></a>

@@ -8,0 +16,0 @@ # [1.8.0](https://github.com/conventional-changelog/conventional-changelog-core/compare/conventional-changelog-core@1.7.0...conventional-changelog-core@1.8.0) (2017-03-11)

30

lib/merge-config.js

@@ -35,2 +35,22 @@ 'use strict';

function guessNextTag(previousTag, version) {
if (previousTag) {
if (previousTag[0] === 'v' && version[0] !== 'v') {
return 'v' + version;
}
if (previousTag[0] !== 'v' && version[0] === 'v') {
return version.replace(/^v/, '');
}
return version;
}
if (version[0] !== 'v') {
return 'v' + version;
}
return version;
}
function mergeConfig(options, context, gitRawCommitsOpts, parserOpts, writerOpts) {

@@ -159,2 +179,4 @@ var configPromise;

context.version = context.version || '';
if (tagsObj.state === 'fulfilled') {

@@ -269,5 +291,7 @@ gitSemverTags = context.gitSemverTags = tagsObj.value;

}
} else {
if (!context.currentTag) {
context.currentTag = options.lernaPackage ? options.lernaPackage + '@' + context.version : 'v' + context.version;
} else if (!context.currentTag) {
if (options.lernaPackage) {
context.currentTag = options.lernaPackage + '@' + context.version;
} else {
context.currentTag = guessNextTag(gitSemverTags[0], context.version);
}

@@ -274,0 +298,0 @@ }

4

package.json
{
"name": "conventional-changelog-core",
"version": "1.8.0",
"version": "1.9.0",
"description": "conventional-changelog core",

@@ -33,3 +33,3 @@ "repository": {

"better-than-before": "^1.0.0",
"conventional-changelog-angular": "^1.3.3",
"conventional-changelog-angular": "^1.3.4",
"chai": "^3.4.1",

@@ -36,0 +36,0 @@ "git-dummy-commit": "^1.1.0",

@@ -100,3 +100,7 @@ 'use strict';

shell.exec('git add --all && git commit -m"feat: second lerna style commit woo"');
}
},
function() { // 18
gitDummyCommit();
shell.exec('git tag 3.0.0');
},
]);

@@ -987,2 +991,82 @@

it('should not prefix with a "v"', function(done) {
preparing(18);
var i = 0;
conventionalChangelogCore({
releaseCount: 0
}, {
version: '4.0.0'
}, {}, {}, {
mainTemplate: '{{previousTag}}...{{currentTag}}'
})
.pipe(through(function(chunk, enc, cb) {
chunk = chunk.toString();
if (i === 0) {
expect(chunk).to.equal('3.0.0...4.0.0');
}
i++;
cb();
}, function() {
done();
}));
});
it('should remove the first "v"', function(done) {
preparing(18);
var i = 0;
conventionalChangelogCore({
releaseCount: 0
}, {
version: 'v4.0.0'
}, {}, {}, {
mainTemplate: '{{previousTag}}...{{currentTag}}'
})
.pipe(through(function(chunk, enc, cb) {
chunk = chunk.toString();
if (i === 0) {
expect(chunk).to.equal('3.0.0...4.0.0');
}
i++;
cb();
}, function() {
done();
}));
});
it('should prefix a leading v to version if no previous tags found', function(done) {
preparing(1);
conventionalChangelogCore({}, {
version: '1.0.0'
}, {}, {}, {
mainTemplate: '{{previousTag}}...{{currentTag}}'
})
.pipe(through(function(chunk) {
expect(chunk.toString()).to.include('...v1.0.0');
done();
}));
});
it('should not prefix a leading v to version if there is already a leading v', function(done) {
preparing(1);
conventionalChangelogCore({}, {
version: 'v1.0.0'
}, {}, {}, {
mainTemplate: '{{previousTag}}...{{currentTag}}'
})
.pipe(through(function(chunk) {
expect(chunk.toString()).to.include('...v1.0.0');
done();
}));
});
it('should not link compare if previousTag is not truthy', function(done) {

@@ -989,0 +1073,0 @@ preparing(13);