mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(changelog): properly name tags for github compare links (#971)
* chore(changelog): properly name tags for github compare links * The convention changelog currently auto-prefixes the previous semver tag with a `v`, which causes the github compare links to not work. * Manually resolve the previous and current tag from the git metadata. (As in https://github.com/angular/material/pull/9264) * Remove prefixed compare links in previous generated chaneglog * Change `getTags` to `getAvailableTags` * Add comment explaining how we resolve the tags
This commit is contained in:
committed by
Jeremy Elbourn
parent
7f594ce206
commit
ab5f9533d0
+7
-7
@@ -1,5 +1,5 @@
|
||||
<a name="2.0.0-alpha.7"></a>
|
||||
# [2.0.0-alpha.7 wax-umpire](https://github.com/angular/material2/compare/2.0.0-alpha.6...v2.0.0-alpha.7) (2016-08-09)
|
||||
# [2.0.0-alpha.7 wax-umpire](https://github.com/angular/material2/compare/2.0.0-alpha.6...2.0.0-alpha.7) (2016-08-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -50,7 +50,7 @@ The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.
|
||||
|
||||
|
||||
<a name="2.0.0-alpha.6"></a>
|
||||
# [2.0.0-alpha.6 carbonfiber-discotheque](https://github.com/angular/material2/compare/2.0.0-alpha.5...v2.0.0-alpha.6) (2016-06-30)
|
||||
# [2.0.0-alpha.6 carbonfiber-discotheque](https://github.com/angular/material2/compare/2.0.0-alpha.5...2.0.0-alpha.6) (2016-06-30)
|
||||
|
||||
### Breaking changes
|
||||
* `MdRadioDispatcher` is now `MdUniqueSelectionDispatcher` and is imported from `core`
|
||||
@@ -110,7 +110,7 @@ The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.
|
||||
|
||||
|
||||
<a name="2.0.0-alpha.5"></a>
|
||||
# [2.0.0-alpha.5 granite-gouda](https://github.com/angular/material2/compare/2.0.0-alpha.4...v2.0.0-alpha.5) (2016-05-25)
|
||||
# [2.0.0-alpha.5 granite-gouda](https://github.com/angular/material2/compare/2.0.0-alpha.4...2.0.0-alpha.5) (2016-05-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -152,7 +152,7 @@ The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.
|
||||
|
||||
|
||||
<a name="2.0.0-alpha.4"></a>
|
||||
# [2.0.0-alpha.4 mahogany-tambourine](https://github.com/angular/material2/compare/2.0.0-alpha.3...v2.0.0-alpha.4) (2016-05-04)
|
||||
# [2.0.0-alpha.4 mahogany-tambourine](https://github.com/angular/material2/compare/2.0.0-alpha.3...2.0.0-alpha.4) (2016-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -176,7 +176,7 @@ The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.
|
||||
|
||||
|
||||
<a name="2.0.0-alpha.3"></a>
|
||||
# [2.0.0-alpha.3 cotton-candelabrum](https://github.com/angular/material2/compare/2.0.0-alpha.2...v2.0.0-alpha.3) (2016-04-21)
|
||||
# [2.0.0-alpha.3 cotton-candelabrum](https://github.com/angular/material2/compare/2.0.0-alpha.2...2.0.0-alpha.3) (2016-04-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -198,7 +198,7 @@ The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.
|
||||
|
||||
|
||||
<a name="2.0.0-alpha.2"></a>
|
||||
# [2.0.0-alpha.2 diamond-haircut](https://github.com/angular/material2/compare/2.0.0-alpha.1...v2.0.0-alpha.2) (2016-04-06)
|
||||
# [2.0.0-alpha.2 diamond-haircut](https://github.com/angular/material2/compare/2.0.0-alpha.1...2.0.0-alpha.2) (2016-04-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -231,7 +231,7 @@ The MD_XXX_DIRECTIVES constants are now deprecated and will be removed in alpha.
|
||||
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
# [2.0.0-alpha.1 nylon-hyperdrive](https://github.com/angular/material2/compare/2.0.0-alpha.0...v2.0.0-alpha.1) (2016-03-16)
|
||||
# [2.0.0-alpha.1 nylon-hyperdrive](https://github.com/angular/material2/compare/2.0.0-alpha.0...2.0.0-alpha.1) (2016-03-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
|
||||
/*
|
||||
* Creates a conventional changelog from the current git repository / metadata.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var addStream = require('add-stream');
|
||||
var cl = require('conventional-changelog');
|
||||
var inStream = fs.createReadStream('CHANGELOG.md');
|
||||
const fs = require('fs');
|
||||
const addStream = require('add-stream');
|
||||
const changelog = require('conventional-changelog');
|
||||
const spawnSync = require('child_process').spawnSync;
|
||||
const npmVersion = require('../../package.json').version;
|
||||
|
||||
/**
|
||||
* When the command line argument `--force` is provided, then the full changelog will created and overwritten.
|
||||
* By default, it will only create the changelog from the latest tag to head and prepends it to the changelog.
|
||||
*/
|
||||
var isForce = process.argv.indexOf('--force') !== -1;
|
||||
const isForce = process.argv.indexOf('--force') !== -1;
|
||||
const inStream = fs.createReadStream('CHANGELOG.md');
|
||||
const gitTags = getAvailableTags();
|
||||
|
||||
// Whether the npm version is later than the most recent tag.
|
||||
const isNpmLatest = npmVersion !== gitTags[0];
|
||||
// When the npm version is the latest, use the npm version, otherwise use the latest tag.
|
||||
const currentTag = isNpmLatest ? npmVersion : gitTags[0];
|
||||
// When the npm version is the latest use the most recent tag. Otherwise use the previous tag.
|
||||
const previousTag = isNpmLatest ? gitTags[0] : gitTags[1];
|
||||
|
||||
inStream.on('error', function(err) {
|
||||
console.error('An error occurred, while reading the previous changelog file.\n' +
|
||||
@@ -28,7 +39,12 @@ var config = {
|
||||
releaseCount: isForce ? 0 : 1
|
||||
};
|
||||
|
||||
var stream = cl(config)
|
||||
var context = {
|
||||
currentTag: currentTag,
|
||||
previousTag: previousTag
|
||||
};
|
||||
|
||||
var stream = changelog(config, context)
|
||||
.on('error', function(err) {
|
||||
console.error('An error occurred while generating the changelog: ' + err);
|
||||
})
|
||||
@@ -45,3 +61,11 @@ if (!isForce) {
|
||||
function getOutputStream() {
|
||||
return fs.createWriteStream('CHANGELOG.md');
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves available tags over all branches from the repository metadata.
|
||||
* @returns {Array.<String>} Array of available tags.
|
||||
*/
|
||||
function getAvailableTags() {
|
||||
return spawnSync('git', ['tag']).stdout.toString().trim().split('\n').reverse();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user