Skip to content

Commit

Permalink
v0.3.0 - Setting up Danger.js for repo (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleynolan authored and DamianMullins committed Feb 1, 2018
1 parent f76e3fc commit e7025e7
Show file tree
Hide file tree
Showing 5 changed files with 400 additions and 119 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ before_script:
- yarn run lint

script:
- yarn danger ci
- yarn test:cover

after_success:
- yarn run test:cover:CI
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


v0.3.0
------------------------------
*February 1, 2018*

### Added
- Dangerfile setup on travis builds

### Changed
- Updated gulp-build-fozzie version


v0.2.1
------------------------------
*January 30, 2018*
Expand Down
34 changes: 34 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* eslint-disable no-console */
/* global danger, fail, message */

const bodyAndTitle = (danger.github.pr.body + danger.github.pr.title).toLowerCase();
const isTrivial = bodyAndTitle.includes('#trivial');

if (!isTrivial) {
// Fail if there isn’t a CHANGELOG entry – should update for every PR
if (!danger.git.modified_files.includes('CHANGELOG.md')) {
const changelogLink = 'https://github.com/justeat/f-dom/blob/master/CHANGELOG.md';
fail(`:memo: Please include a CHANGELOG entry. You can find the current version at <a href="${changelogLink}">CHANGELOG.md</a>`);
}


// Check for version update
const hasPackageJsonChanged = danger.git.modified_files.includes('package.json');
const packageDiff = danger.git.JSONDiffForFile('package.json');

packageDiff.then(result => {
if (!hasPackageJsonChanged || (hasPackageJsonChanged && !result.version)) {
const semverLink = 'https://docs.npmjs.com/getting-started/semantic-versioning';
console.log('Versioning Missing');
console.log(hasPackageJsonChanged, result);
fail(`:exclamation: This PR should include a <a href="${semverLink}">SEMVER</a> version bump, so that it can be published once merged.`);
}
}, err => {
console.log(err);
});

// Message on deletions
if (danger.github.pr.deletions > danger.github.pr.additions) {
message(':fire: :clap: You’re a deletion machine!');
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@justeat/f-dom",
"description": "Fozzie JS DOM queries library.",
"version": "0.2.1",
"version": "0.3.0",
"main": "dist/index.js",
"files": [
"dist"
Expand All @@ -25,12 +25,13 @@
"qwery": "^4.0.0"
},
"devDependencies": {
"@justeat/gulp-build-fozzie": "^7.2.0",
"@justeat/gulp-build-fozzie": "^7.8.0",
"babel-cli": "^6.26.0",
"babel-preset-babili": "^0.1.4",
"babel-preset-env": "^1.6.1",
"concurrently": "^3.5.1",
"coveralls": "^3.0.0",
"danger": "^3.1.3",
"gulp": "^3.9.1"
},
"keywords": [
Expand Down
Loading

0 comments on commit e7025e7

Please sign in to comment.