Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
v1.1.0 — Adding DangerJS & updating travis config. (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianMullins authored and kevinrodrigues committed Jun 15, 2018
1 parent ba8e0fc commit e30114e
Show file tree
Hide file tree
Showing 7 changed files with 1,265 additions and 577 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ node_js:

cache: yarn

sudo: false

notifications:
email: false

script:
- yarn danger ci

after_success:
- yarn run test:coveralls
- yarn run test:ci
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ 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).


v1.1.0
------------------------------
*June 15, 2018*

### Added
- DangerJS dependency.
- DangerJS travis config.
- snyk badge.

### Changed
- Updated travis config.
- Renamed unit test CI task.
- Replaced object spread with `Object.assign` to fix node 6 CI build.
- Updated npm package versions to latest.

### Removed
- Gemnasium badge.



v1.0.0
------------------------------
*May 25, 2018*
Expand Down
40 changes: 40 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* 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 the title of the PR isn't in the format of a version i.e. vX.X.X (such as v1.4.0)
const versionRegex = /^(v[0-9]+\.[0-9]+\.[0-9]+)/;
const isPRTitleVersioned = danger.github.pr.title.match(versionRegex);
if (!isPRTitleVersioned) {
fail(':exclamation: PR title should start with the package version in the format v(x.x.x) (such as v1.4.0)');
}

// 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-validate/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!');
}
}
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@justeat/f-validate",
"description": "Fozzie vanilla JS Validation Component",
"version": "1.0.0",
"version": "1.1.0",
"main": "dist/index.js",
"files": [
"dist"
Expand All @@ -22,16 +22,17 @@
"node": ">=4.0.0"
},
"dependencies": {
"@justeat/f-dom": "^0.2.0"
"@justeat/f-dom": "^0.4.0"
},
"devDependencies": {
"@justeat/gulp-build-fozzie": "^7.6.0",
"@justeat/gulp-build-fozzie": "^7.19.0",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-env": "^1.7.0",
"concurrently": "^3.5.1",
"coveralls": "^3.0.0",
"coveralls": "^3.0.1",
"danger": "^3.7.18",
"gulp": "^3.9.1",
"js-test-buddy": "^0.0.7"
"js-test-buddy": "^0.1.0"
},
"keywords": [
"fozzie"
Expand All @@ -42,7 +43,7 @@
"compile": "babel -d dist src",
"test": "gulp scripts:test:coverage",
"test:watch": "jest --coverage --watch",
"test:coveralls": "cat coverage/lcov.info | coveralls"
"test:ci": "cat coverage/lcov.info | coveralls"
},
"browserslist": [
"> 5%",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm version](https://badge.fury.io/js/%40justeat%2Ff-validate.svg)](https://badge.fury.io/js/%40justeat%2Ff-validate)
[![Build Status](https://travis-ci.org/justeat/f-validate.svg)](https://travis-ci.org/justeat/f-validate)
[![Coverage Status](https://coveralls.io/repos/github/justeat/f-validate/badge.svg)](https://coveralls.io/github/justeat/f-validate)
[![Dependency Status](https://gemnasium.com/badges/github.com/justeat/f-validate.svg)](https://gemnasium.com/github.com/justeat/f-validate)
[![Known Vulnerabilities](https://snyk.io/test/github/justeat/f-validate/badge.svg?targetFile=package.json)](https://snyk.io/test/github/justeat/f-validate?targetFile=package.json)

Fozzie vanilla JS Validation Component.

Expand Down
9 changes: 5 additions & 4 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ describe('options', () => {
const validateForm = new FormValidation(form, options);

// Assert
expect(validateForm.options).toEqual({
...defaultOptions,
focus
});
expect(validateForm.options).toEqual(
Object.assign({}, defaultOptions, {
focus
})
);

});

Expand Down
Loading

0 comments on commit e30114e

Please sign in to comment.