Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
feat: nouveau releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
gtoubiana committed May 24, 2016
1 parent d8a9cef commit 0f408e9
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 96 deletions.
103 changes: 10 additions & 93 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,24 @@
<a name="0.0.10"></a>
## [0.0.10](https://github.com/gtoubiana/acte/compare/0.0.9...v0.0.10) (2016-05-22)
## Version [0.0.10](https://github.com/gtoubiana/acte/compare/0.0.9...0.0.10) (2016-05-22)


### Administration

* release v0.0.10-0 ([c11620a](https://github.com/gtoubiana/acte/commit/c11620a))
* **npm :** mise à jour des dépendances ([a81a04f](https://github.com/gtoubiana/acte/commit/a81a04f))
* **travis :** corrige travis ([0dbdba9](https://github.com/gtoubiana/acte/commit/0dbdba9))

<a name="0.0.9"></a>
## [0.0.9](https://github.com/gtoubiana/acte/compare/0.0.8...0.0.9) (2016-05-22)

## Version [0.0.9](https://github.com/gtoubiana/acte/compare/0.0.8...0.0.9) (2016-05-22)

### Administration

* release v0.0.9 ([401969e](https://github.com/gtoubiana/acte/commit/401969e))
* release v0.0.9-0 ([b620949](https://github.com/gtoubiana/acte/commit/b620949))
* release v0.0.9-1 ([941a288](https://github.com/gtoubiana/acte/commit/941a288))
* release v0.0.9-2 ([3ec4051](https://github.com/gtoubiana/acte/commit/3ec4051))
* release v0.0.9-3 ([6ff6f02](https://github.com/gtoubiana/acte/commit/6ff6f02))
* **gulp :** new release ([54b1aa9](https://github.com/gtoubiana/acte/commit/54b1aa9))
* release v0.0.9-4 ([e81a40e](https://github.com/gtoubiana/acte/commit/e81a40e))
* release v0.0.9-5 ([f85f497](https://github.com/gtoubiana/acte/commit/f85f497))
* release v0.0.9-6 ([2613744](https://github.com/gtoubiana/acte/commit/2613744))
* **gulp :** ajoute un asset aux releases ([405c5f7](https://github.com/gtoubiana/acte/commit/405c5f7))
* **gulp :** debug release ([7fad5b5](https://github.com/gtoubiana/acte/commit/7fad5b5))
* **gulp :** test des assets de releases ([59b80a8](https://github.com/gtoubiana/acte/commit/59b80a8))
* release v0.0.9-7 ([7f0bb43](https://github.com/gtoubiana/acte/commit/7f0bb43))
* release v0.0.9-8 ([272108d](https://github.com/gtoubiana/acte/commit/272108d))

### Correctifs
### <span><span>Correctifs</span></span>

* **gulp :** corrige l'asset des releases ([0dccab6](https://github.com/gtoubiana/acte/commit/0dccab6))

### Documentation

* **README :** Génére le README de master ([844e28f](https://github.com/gtoubiana/acte/commit/844e28f)), ferme [#120](https://github.com/gtoubiana/acte/issues/120)

### Réécriture du code

* **gulp :** réécriture des templates de config ([059a533](https://github.com/gtoubiana/acte/commit/059a533))

<a name="0.0.8"></a>
## [0.0.8](https://github.com/gtoubiana/acte/compare/0.0.7...0.0.8) (2016-05-10)

## Version [0.0.8](https://github.com/gtoubiana/acte/compare/0.0.7...0.0.8) (2016-05-10)

### Administration

* release v0.0.8 ([6131464](https://github.com/gtoubiana/acte/commit/6131464))

<a name="0.0.7"></a>
## [0.0.7](https://github.com/gtoubiana/acte/compare/0.0.6...0.0.7) (2016-05-09)

## Version [0.0.7](https://github.com/gtoubiana/acte/compare/0.0.6...0.0.7) (2016-05-09)

### Administration

* release v0.0.7 ([24a0fca](https://github.com/gtoubiana/acte/commit/24a0fca))
* release v0.0.7-0 ([edebdec](https://github.com/gtoubiana/acte/commit/edebdec))
* release v0.0.7-2 ([8184e3b](https://github.com/gtoubiana/acte/commit/8184e3b))
* release v0.0.7-3 ([a244a68](https://github.com/gtoubiana/acte/commit/a244a68))

### Correctifs
### <span><span>Correctifs</span></span>

* **constants :** retrait des parenthèses dans les tableaux ([fb66b8e](https://github.com/gtoubiana/acte/commit/fb66b8e))
* **functions :** retrait des parenthèses inutiles ([dcd6ced](https://github.com/gtoubiana/acte/commit/dcd6ced))
Expand All @@ -70,56 +28,15 @@
* **travis :** mise à jour de eslint en 2.9.0 ([c9c6ce4](https://github.com/gtoubiana/acte/commit/c9c6ce4))
* **travis :** retire toute référence à eslint-airbnb-base ([4262872](https://github.com/gtoubiana/acte/commit/4262872))

### Réécriture du code

* **gulp :** utilise babel ([90250ff](https://github.com/gtoubiana/acte/commit/90250ff)), ferme [#103](https://github.com/gtoubiana/acte/issues/103) [#102](https://github.com/gtoubiana/acte/issues/102) [#100](https://github.com/gtoubiana/acte/issues/100) [#98](https://github.com/gtoubiana/acte/issues/98) [#97](https://github.com/gtoubiana/acte/issues/97) [#71](https://github.com/gtoubiana/acte/issues/71) [#66](https://github.com/gtoubiana/acte/issues/66)
* **jour :** supprime les classes ([24eaf81](https://github.com/gtoubiana/acte/commit/24eaf81))
* **remplacements :** utilise Array.reduce plutôt que Map ([95b13ce](https://github.com/gtoubiana/acte/commit/95b13ce)), ferme [#107](https://github.com/gtoubiana/acte/issues/107)
* **src/js :** réécriture en ES2015 ([493ddbb](https://github.com/gtoubiana/acte/commit/493ddbb))
* converti le code en es6 ([8d4fd44](https://github.com/gtoubiana/acte/commit/8d4fd44))

### Styles

* **constants :** corrige un nom de fichier ([321edfd](https://github.com/gtoubiana/acte/commit/321edfd)), ferme [#111](https://github.com/gtoubiana/acte/issues/111)

<a name="0.0.6"></a>
## [0.0.6](https://github.com/gtoubiana/acte/compare/0.0.5...0.0.6) (2016-04-16)


### Administration

* **gulp :** tâche des releases ([ec8e36e](https://github.com/gtoubiana/acte/commit/ec8e36e)), ferme [#83](https://github.com/gtoubiana/acte/issues/83) [#94](https://github.com/gtoubiana/acte/issues/94)
* release v0.0.6-11 ([f58e9a2](https://github.com/gtoubiana/acte/commit/f58e9a2))
* **karma.conf.js :** utilise des process.env en local ([ca02f4c](https://github.com/gtoubiana/acte/commit/ca02f4c))
* release v0.0.6 ([5585503](https://github.com/gtoubiana/acte/commit/5585503))
* release v0.0.6-0 ([e6f2dff](https://github.com/gtoubiana/acte/commit/e6f2dff))
* release v0.0.6-11 ([7ffd30b](https://github.com/gtoubiana/acte/commit/7ffd30b))
* release v0.0.6-11 ([02eddc8](https://github.com/gtoubiana/acte/commit/02eddc8))
* release v0.0.6-11 ([ad43bb0](https://github.com/gtoubiana/acte/commit/ad43bb0))
* release v0.0.6-12 ([72e1908](https://github.com/gtoubiana/acte/commit/72e1908))
* release v0.0.6-12 ([d1a4126](https://github.com/gtoubiana/acte/commit/d1a4126))
* release v0.0.6-13 ([07a3776](https://github.com/gtoubiana/acte/commit/07a3776))
* release v0.0.6-13 ([ea4daf8](https://github.com/gtoubiana/acte/commit/ea4daf8))
* release v0.0.6-14 ([1a45cc0](https://github.com/gtoubiana/acte/commit/1a45cc0))
* release v0.0.6-15 ([fe55db8](https://github.com/gtoubiana/acte/commit/fe55db8))
* release v0.0.6-2 ([9fb36ae](https://github.com/gtoubiana/acte/commit/9fb36ae))
* release v0.0.6-3 ([0ca85db](https://github.com/gtoubiana/acte/commit/0ca85db))
* release v0.0.6-4 ([3694b27](https://github.com/gtoubiana/acte/commit/3694b27))

<a name="0.0.5"></a>
## [0.0.5](https://github.com/gtoubiana/acte/compare/a86e52f...0.0.5) (2016-04-07)
## Version [0.0.6](https://github.com/gtoubiana/acte/compare/0.0.5...0.0.6) (2016-04-16)


### Administration
<a name="0.0.5"></a>
## Version [0.0.5](https://github.com/gtoubiana/acte/compare/954c15a...0.0.5) (2016-04-07)

* **package.json :** Ajoute npm run tag ([4f67d6d](https://github.com/gtoubiana/acte/commit/4f67d6d))

### Nouvelles fonctionnalités
### <span><span><span>Nouveautés</span></span></span>

* **gulp :** Script pour les releases ([954c15a](https://github.com/gtoubiana/acte/commit/954c15a))

### Réécriture du code

* **gulp :** simplifie releases ([af6b30d](https://github.com/gtoubiana/acte/commit/af6b30d))
* **todo :** supprime le .todo ([a86e52f](https://github.com/gtoubiana/acte/commit/a86e52f))

1 change: 1 addition & 0 deletions gulp/tasks/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* gulp docs.dist
* gulp docs.constants
* gulp docs.functions
* gulp docs.readme
*/
const concat = require('gulp-concat');
const config = require('../config');
Expand Down
186 changes: 183 additions & 3 deletions gulp/tasks/releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
* gulp major
*/
const bump = require('gulp-bump');
const compareFunc = require('compare-func');
const config = require('../config');
const conventionalChangelog = require('gulp-conventional-changelog');
const conventionalGHReleaser = require('conventional-github-releaser');
const fse = require('fs-extra');
const git = require('gulp-git');
const Github = require('github');
const gufg = require('github-url-from-git');
const gulp = require('gulp');
const gutil = require('gulp-util');
const pkg = require('../../package.json');
const sequence = require('gulp-sequence');
const Github = require('github');

gulp.task('releases.version.patch', () => {
const stream = gulp.src(['./package.json'])
Expand Down Expand Up @@ -46,13 +50,112 @@ gulp.task('releases.version.prerelease', () => {
return stream;
});

/* eslint-disable no-bitwise, strict */
const issueUrl = () => {
'use strict';
const url = null;
let gitUrl;
let newUrl;

if (pkg.repository && pkg.repository.url &&
~pkg.repository.url.indexOf('github.com')) {
gitUrl = gufg(pkg.repository.url);

if (gitUrl) {
newUrl = `${gitUrl}/issues/`;
} else {
newUrl = url;
}
}
return newUrl;
};

/* eslint-enable no-bitwise, strict */

gulp.task('releases.conventional.changelog', () => {
const stream = gulp.src('CHANGELOG.md', {
buffer: false,
})
.pipe(conventionalChangelog({
preset: 'acte',
preset: 'angular',
releaseCount: 0,
}, {
commit: 'commit',
}, {}, {}, {
mainTemplate: fse.readFileSync(
`${config.paths.src}/tmpl/changelogMain.hbs`, 'utf8'),
headerPartial: fse.readFileSync(
`${config.paths.src}/tmpl/changelogHeader.hbs`, 'utf8'),
commitPartial: fse.readFileSync(
`${config.paths.src}/tmpl/changelogCommit.hbs`, 'utf8'),
footerPartial: fse.readFileSync(
`${config.paths.src}/tmpl/changelogFooter.hbs`, 'utf8'),
transform: function transform(commit) {
/* eslint-disable no-param-reassign,strict */
'use strict';
let discard = true;

commit.notes.forEach(note => {
note.title = 'RÉTROCOMPATIBILITÉ';
discard = false;
});

if (commit.type === 'feat') {
commit.type = '<span><span><span>Nouveautés</span></span></span>';
} else if (commit.type === 'fix' || commit.type === 'debug') {
commit.type = '<span><span>Correctifs</span></span>';
} else if (commit.type === 'perf' || commit.type === 'perfs') {
commit.type = '<span>Performances</span>';
} else if (discard) {
return false;
} else if (commit.type === 'revert') {
commit.type = 'Annulations';
} else if (commit.type === 'doc' || commit.type === 'docs') {
commit.type = 'Documentation';
} else if (commit.type === 'style' || commit.type === 'styles') {
commit.type = 'Mise en forme';
} else if (commit.type === 'refactor' || commit.type === 'revision' ||
commit.type === 'revisions') {
commit.type = 'Réécriture du code';
} else if (commit.type === 'test' || commit.type === 'tests') {
commit.type = 'Ajout de tests unitaires';
} else if (commit.type === 'chore' || commit.type === 'chores' ||
commit.type === 'admin') {
commit.type = 'Administration du projet';
}

if (commit.scope === '*') {
commit.scope = '';
}

if (typeof commit.hash === 'string') {
commit.hash = commit.hash.substring(0, 7);
}

if (typeof commit.subject === 'string') {
const url = issueUrl();

if (url) {
// GitHub issue URLs.
commit.subject = commit.subject.replace(/( ?)#([0-9]+)(\b|^)/g,
`$1[#$2](${url}$2)$3`);
}

// GitHub user URLs.
commit.subject = commit.subject.replace(
/( ?)@([a-zA-Z0-9_]+)(\b|^)/g,
'$1[@$2](https://github.com/$2)$3');
commit.subject = commit.subject;
}

/* eslint-enable no-param-reassign,strict */
return commit;
},
groupBy: 'type',
commitGroupsSort: 'title',
commitsSort: ['scope', 'subject'],
noteGroupsSort: 'subject',
notesSort: compareFunc,
}))
.pipe(gulp.dest('./'));

Expand Down Expand Up @@ -100,7 +203,84 @@ gulp.task('releases.github.releaser', (done) => {
fse.readFileSync('./package.json', 'utf8')).version;

conventionalGHReleaser(auth, {
preset: 'acte',
preset: 'angular',
}, {
commit: 'commit',
}, {}, {}, {
mainTemplate: fse.readFileSync(
`${config.paths.src}/tmpl/changelogMain.hbs`, 'utf8'),
headerPartial: fse.readFileSync(
`${config.paths.src}/tmpl/changelogHeader.hbs`, 'utf8'),
commitPartial: fse.readFileSync(
`${config.paths.src}/tmpl/changelogCommit.hbs`, 'utf8'),
footerPartial: fse.readFileSync(
`${config.paths.src}/tmpl/changelogFooter.hbs`, 'utf8'),
transform: function transform(commit) {
/* eslint-disable no-param-reassign,strict */
'use strict';
let discard = true;

commit.notes.forEach(note => {
note.title = 'RÉTROCOMPATIBILITÉ';
discard = false;
});

if (commit.type === 'feat') {
commit.type = '<span><span><span>Nouveautés</span></span></span>';
} else if (commit.type === 'fix' || commit.type === 'debug') {
commit.type = '<span><span>Correctifs</span></span>';
} else if (commit.type === 'perf' || commit.type === 'perfs') {
commit.type = '<span>Performances</span>';
} else if (discard) {
return false;
} else if (commit.type === 'revert') {
commit.type = 'Annulations';
} else if (commit.type === 'doc' || commit.type === 'docs') {
commit.type = 'Documentation';
} else if (commit.type === 'style' || commit.type === 'styles') {
commit.type = 'Mise en forme';
} else if (commit.type === 'refactor' || commit.type === 'revision' ||
commit.type === 'revisions') {
commit.type = 'Réécriture du code';
} else if (commit.type === 'test' || commit.type === 'tests') {
commit.type = 'Ajout de tests unitaires';
} else if (commit.type === 'chore' || commit.type === 'chores' ||
commit.type === 'admin') {
commit.type = 'Administration du projet';
}

if (commit.scope === '*') {
commit.scope = '';
}

if (typeof commit.hash === 'string') {
commit.hash = commit.hash.substring(0, 7);
}

if (typeof commit.subject === 'string') {
const url = issueUrl();

if (url) {
// GitHub issue URLs.
commit.subject = commit.subject.replace(/( ?)#([0-9]+)(\b|^)/g,
`$1[#$2](${url}$2)$3`);
}

// GitHub user URLs.
commit.subject = commit.subject.replace(
/( ?)@([a-zA-Z0-9_]+)(\b|^)/g,
'$1[@$2](https://github.com/$2)$3');
commit.subject = commit.subject;
}

/* eslint-enable no-param-reassign,strict */
return commit;
},
groupBy: 'type',
commitGroupsSort: 'title',
commitsSort: ['scope', 'subject'],
noteGroupsSort: 'subject',
notesSort: compareFunc,
}, (error, response) => {
/* eslint-disable no-console */
// console.log(error, response);
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.9.0",
"babel-plugin-transform-undefined-to-void": "^6.8.0",
"compare-func": "^1.3.1",
"conventional-changelog-acte": "0.0.7",
"conventional-github-releaser": "^1.1.2",
"del": "^2.2.0",
Expand All @@ -78,6 +79,7 @@
"eslint-plugin-react": "^5.0.1",
"fs-extra": "^0.30.0",
"github": "^0.2.4",
"github-url-from-git": "^1.4.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-bump": "^2.1.0",
Expand Down
5 changes: 5 additions & 0 deletions src/tmpl/changelogCommit.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*{{#if scope}} **{{scope}} :**{{/if}} {{#if subject}}{{subject}}{{else}}{{header}}{{/if}}

{{~!-- commit hash --}} {{#if @root.linkReferences}}([{{hash}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/{{@root.commit}}/{{hash}})){{else}}{{hash~}}{{/if}}

{{~!-- commit references --}}{{#if references}}, ferme{{~#each references}} {{#if @root.linkReferences}}[{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if this.repository}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}{{else}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}{{/if}}/{{@root.issue}}/{{this.issue}}){{else}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}{{/if}}{{/each}}{{/if}}
11 changes: 11 additions & 0 deletions src/tmpl/changelogFooter.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{#if noteGroups}}
{{#each noteGroups}}

### {{title}}

{{#each notes}}
* {{#if commit.scope}}{{commit.scope}} : {{/if}}{{text}}
{{/each}}
{{/each}}

{{/if}}
2 changes: 2 additions & 0 deletions src/tmpl/changelogHeader.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<a name="{{version}}"></a>
{{#if isPatch}}##{{else}}#{{/if}} {{#if @root.linkCompare}}Version [{{version}}]({{@root.host}}/{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/compare/{{previousTag}}...{{currentTag}}){{else}}{{version}}{{/if}}{{#if title}} "{{title}}"{{/if}}{{#if date}} ({{date}}){{/if}}
Loading

0 comments on commit 0f408e9

Please sign in to comment.