github-pr-release
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -11,3 +11,4 @@ var fs = require('fs') | ||
return client.collectReleasePRs(releasePR).then(function (prs) { | ||
var template = fs.readFileSync(__dirname + '/release.mustache', 'utf8') | ||
var templatePath = config.template || __dirname + '/release.mustache' | ||
var template = fs.readFileSync(templatePath, 'utf8') | ||
var message = releaseMessage(template, prs) | ||
@@ -14,0 +15,0 @@ |
{ | ||
"name": "github-pr-release", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Create a release pull request by Github API", | ||
@@ -28,4 +28,5 @@ "main": "index.js", | ||
"power-assert": "^0.11.0", | ||
"proxyquire": "^1.7.2", | ||
"standard": "^4.5.4" | ||
} | ||
} |
@@ -26,4 +26,5 @@ # github-pr-release | ||
repo: 'awesome-web-app', | ||
head: 'master', | ||
base: 'production' | ||
head: 'master', // optional | ||
base: 'production', // optional | ||
template: '/path/to/template.mustache' // optional | ||
} | ||
@@ -40,2 +41,8 @@ | ||
## Install | ||
``` | ||
npm install github-pr-release | ||
``` | ||
## Tips | ||
### Pull request titles | ||
@@ -45,5 +52,21 @@ | ||
## Install | ||
### Specify a message format | ||
You can specify a template to change the message format. Pass a template path to `config.template`. | ||
```javascript | ||
release({ | ||
token: 'token' | ||
owner: 'uiureo', | ||
repo: 'awesome-web-app', | ||
template: './template.mustache' | ||
}) | ||
``` | ||
npm install github-pr-release | ||
The default template is below. The first line is treated as the title. | ||
```mustache | ||
Release {{version}} | ||
{{#prs}} | ||
- [ ] #{{number}} {{title}} {{#assignee}}@{{login}}{{/assignee}}{{^assignee}}{{#user}}@{{login}}{{/user}}{{/assignee}} | ||
{{/prs}} | ||
``` | ||
@@ -50,0 +73,0 @@ |
/* global describe it */ | ||
var assert = require('power-assert') | ||
var proxyquire = require('proxyquire') | ||
var Promise = require('es6-promise').Promise | ||
function MockGithubClient () { | ||
return { | ||
prepareReleasePR: function () { | ||
return Promise.resolve({ number: 42 }) | ||
}, | ||
collectReleasePRs: function () { | ||
return Promise.resolve([ | ||
{ number: 42, title: 'foo', user: { login: 'uiureo' } }, | ||
{ number: 43, title: 'bar', user: { login: 'hiroshi' } } | ||
]) | ||
}, | ||
updatePR: function (releasePR, message) { | ||
return Promise.resolve({ pr: releasePR, message: message }) | ||
} | ||
} | ||
} | ||
proxyquire('../', { | ||
'./lib/github-client.js': MockGithubClient | ||
}) | ||
var release = require('../') | ||
describe('release()', function () { | ||
it('is a func', function () { | ||
assert(typeof release === 'function') | ||
it('generates a default PR message', function (done) { | ||
release({}).then(function (result) { | ||
assert((/^Release/).test(result.message.title)) | ||
assert((/#42 foo @uiureo/).test(result.message.body)) | ||
assert((/#43 bar @hiroshi/).test(result.message.body)) | ||
}).then(done, done) | ||
}) | ||
it('uses the specified template in config', function (done) { | ||
release({ | ||
template: './test/fixtures/test.mustache' | ||
}).then(function (result) { | ||
assert(result.message.title === 'party party') | ||
}).then(done, done) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16132
12
360
90
7