-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Swap Grunt to Gulp * Add binary files generated via gulp * Convert the project to ES2015, add Commander and change the structure
- Loading branch information
1 parent
68036bf
commit accbbbf
Showing
23 changed files
with
10,650 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,56 @@ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 5, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"impliedStrict": true | ||
}, | ||
"allowImportExportEverywhere": false | ||
}, | ||
|
||
"extends": [ | ||
"standard" | ||
], | ||
|
||
"rules": { | ||
"semi": [2, "always"], | ||
"no-empty": 2, | ||
"array-callback-return": 2, | ||
"indent": [2, 4, { "SwitchCase": 1 }], | ||
"space-before-function-paren": [2, "never"], | ||
"no-debugger": 0 | ||
} | ||
} | ||
parser: babel-eslint | ||
env: | ||
es6: true | ||
parserOptions: | ||
ecmaVersion: 6 | ||
sourceType: module | ||
ecmaFeatures: | ||
impliedStrict: true | ||
allowImportExportEverywhere: false | ||
plugins: | ||
- babel | ||
extends: | ||
- semistandard | ||
rules: | ||
no-undef: 1 | ||
no-unreachable: 1 | ||
no-empty: error | ||
array-callback-return: error | ||
no-var: error | ||
indent: | ||
- error | ||
- 4 | ||
- | ||
SwitchCase: 1 | ||
space-before-function-paren: | ||
- error | ||
- never | ||
no-debugger: 0 | ||
prefer-const: error | ||
strict: error | ||
no-template-curly-in-string: error | ||
consistent-return: error | ||
no-multiple-empty-lines: | ||
- error | ||
- | ||
max: 1 | ||
maxBOF: 0 | ||
no-lonely-if: error | ||
new-parens: error | ||
eol-last: error | ||
no-array-constructor: error | ||
arrow-body-style: | ||
- error | ||
- as-needed | ||
prefer-arrow-callback: | ||
- error | ||
- | ||
allowNamedFunctions: true | ||
prefer-destructuring: | ||
- error | ||
- | ||
object: true | ||
array: false | ||
prefer-spread: error | ||
prefer-rest-params: error | ||
valid-typeof: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ node_modules/ | |
npm-debug.log | ||
docs/_site | ||
docs/.sass-cache | ||
dist | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
lib/ | ||
docs/ | ||
node_modules/ | ||
Gruntfile.js | ||
gulpfile.js | ||
.grenrc | ||
.grenrc.* | ||
.jsdoc.conf.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
require('../github-release-notes'); | ||
var _commander = require('commander'); | ||
|
||
var _commander2 = _interopRequireDefault(_commander); | ||
|
||
var _package = require('../package.json'); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var argvWithVersion = function argvWithVersion(argvs) { | ||
var vPos = argvs.indexOf('-v'); | ||
|
||
if (vPos > -1) { | ||
argvs[vPos] = '-V'; | ||
} | ||
|
||
return argvs; | ||
}; | ||
|
||
_commander2.default.version(_package.version).description(_package.description).usage('[command] [options]').command('release', 'Release into chunk').alias('r').command('changelog', 'Write a motherfucking changelog').alias('c').on('--help', function () { | ||
// Get help from markdown or json instead. | ||
console.log(''); | ||
console.log(' Examples:'); | ||
console.log(''); | ||
console.log(' $ gren release'); | ||
console.log(''); | ||
console.log(' $ gren help release'); | ||
console.log(''); | ||
}).parse(argvWithVersion(process.argv)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const gulp = require('gulp'); | ||
const mocha = require('gulp-mocha'); | ||
const eslint = require('gulp-eslint'); | ||
const watch = require('gulp-watch'); | ||
const sass = require('gulp-sass'); | ||
const gulpIf = require('gulp-if'); | ||
const ghPages = require('gulp-gh-pages'); | ||
const babel = require('gulp-babel'); | ||
const chmod = require('gulp-chmod'); | ||
const nodeunit = require('gulp-nodeunit'); | ||
|
||
gulp.task('deploy', ['build'], function() { | ||
return gulp.src('./docs/**/*') | ||
.pipe(ghPages()); | ||
}); | ||
|
||
gulp.task('scripts', () => { | ||
gulp.src('./lib/src/**/*.js') | ||
.pipe(babel({ | ||
presets: ['es2015'] | ||
})) | ||
.pipe(gulp.dest('dist')); | ||
|
||
gulp.src('./lib/src/**/*.json') | ||
.pipe(gulp.dest('dist')); | ||
|
||
gulp.src('./lib/*.js') | ||
.pipe(babel({ | ||
presets: ['es2015'] | ||
})) | ||
.pipe(chmod(0o755)) | ||
.pipe(gulp.dest('bin')); | ||
|
||
}); | ||
|
||
gulp.task('lint', () => { | ||
const isFixed = file => file.eslint != null && file.eslint.fixed; | ||
|
||
return gulp.src('./lib/**/*.js') | ||
.pipe( | ||
eslint({ | ||
fix: true, | ||
envs: [ | ||
'node' | ||
] | ||
}) | ||
) | ||
.pipe(eslint.format()) | ||
.pipe(gulpIf(isFixed, gulp.dest('./lib/'))); | ||
}); | ||
|
||
gulp.task('watch', () => { | ||
return gulp.watch('./lib/**/*.js', ['lint', 'scripts']); | ||
}); | ||
|
||
gulp.task('test', () => { | ||
gulp.src('test/**/*.js') | ||
.pipe(nodeunit({ | ||
reporter: 'junit', | ||
reporterOptions: { | ||
output: 'test' | ||
} | ||
})); | ||
}); | ||
|
||
gulp.task('build', ['lint', 'scripts', 'test']); | ||
gulp.task('default', ['build', 'watch']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// TODO: write test to check whether there are any duplicates (short or name) | ||
export const options = [ | ||
{ | ||
short: '-u', | ||
name: 'username', | ||
valueType: '<repo owner>', | ||
description: 'The username of the repo e.g. github-tools' | ||
}, | ||
{ | ||
short: '-r', | ||
name: 'repo', | ||
valueType: '<repository name>', | ||
description: 'The repository name e.g. github-release-notes' | ||
}, | ||
{ | ||
short: '-T', | ||
name: 'token', | ||
valueType: '<github token>', | ||
description: 'The token generated with repo access' | ||
}, | ||
{ | ||
short: '-au', | ||
name: 'api-url', | ||
valueType: '<url>', | ||
description: 'Override the GitHub API URL, allows gren to connect to a private GHE installation' | ||
}, | ||
{ | ||
short: '-o', | ||
name: 'override', | ||
description: 'Override the release notes if exist.' | ||
}, | ||
{ | ||
short: '-t', | ||
name: 'tags', | ||
valueType: '<old-tag>..<new-tag>', | ||
description: 'Write release notes for a range of tags, a specific tag or all. e.g. 0.2.0..0.1.0 or 0.2.0.. or ..0.1.0 or 0.2.0 or *', // needs to be documented better, | ||
action: value => value.split('..') | ||
}, | ||
{ | ||
short: '-D', | ||
name: 'data-source', | ||
valueType: '<source>', | ||
description: 'The informations you want to use to build release notes.', | ||
action: /^(issues|commits|milestones)$/i, | ||
defaultValue: 'issues' | ||
}, | ||
{ | ||
short: '-im', | ||
name: 'include-messages', | ||
valueType: '<merge|commits|all>', | ||
description: 'Filter the messages added to the release notes. Only used when --data-source used is commits', | ||
action: /^(merge|commits|all)$/i, | ||
defaultValue: 'commits' | ||
}, | ||
{ | ||
short: '-p', | ||
name: 'prefix', | ||
valueType: '<name prefix>', | ||
description: 'Add a prefix to the tag version. e.g. \'v\'' | ||
}, | ||
{ | ||
short: '-d', | ||
name: 'draft', | ||
description: 'Set the release as a draft.' | ||
}, | ||
{ | ||
short: '-pr', | ||
name: 'prerelease', | ||
description: 'Set the release as a prerelease.' | ||
}, | ||
{ | ||
short: '-g', | ||
name: 'group-by', | ||
valueType: '<"label"|Object>', | ||
description: 'Group the issues using the labels as group headings. You can set custom headings for groups of labels from a configuration file.' | ||
}, | ||
{ | ||
short: '-L', | ||
name: 'ignore-labels', | ||
valueType: '<label1>,<label2>,<label3>', | ||
description: 'Ignore the specified labels.', | ||
action: value => value.split(',') | ||
}, | ||
{ | ||
short: '-I', | ||
name: 'ignore-issues-with', | ||
valueType: '<label1>,<label2>,<label3>', | ||
description: 'Ignore issues that contains one of the specified labels.', | ||
action: value => value.split(',') | ||
}, | ||
{ | ||
short: '-mm', | ||
name: 'milestone-match', | ||
valueType: '<prefix>', | ||
description: 'The title that the script needs to match to link the release to the milestone. e.g. v will match v0.1.0' | ||
}, | ||
{ | ||
short: '-M', | ||
name: 'only-milestones', | ||
description: 'Add to the release bodies only the issues that have a milestone' | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
console.log('changelog'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env node | ||
|
||
import Program from '../dist/Program'; | ||
import GitHubInfo from '../dist/GitHubInfo'; | ||
import Release from '../dist/Release'; | ||
import { options } from './_release-options'; | ||
|
||
const githubInfo = new GitHubInfo(); | ||
|
||
githubInfo.options.then(githubOptions => Promise.resolve(new Program({ | ||
name: 'gren release', | ||
description: 'Generate release notes and attach them to a tag', | ||
argv: process.argv, | ||
cwd: process.cwd(), | ||
bashOptions: Object.assign({}, ...githubOptions), | ||
options, | ||
events: { | ||
'--help': () => { | ||
console.log(''); | ||
console.log(' Basic Examples:'); | ||
console.log(''); | ||
console.log(' $ gren release'); | ||
console.log(''); | ||
console.log(' $ gren release --tags 2.1.3..4.0.0'); | ||
console.log(''); | ||
} | ||
} | ||
}))) | ||
.then(({ options }) => { | ||
const releaseAction = new Release(options); | ||
return releaseAction.release(); | ||
}) | ||
.catch(error => { | ||
console.error(error); | ||
}); |
Oops, something went wrong.