Skip to content

Commit 8cab3bd

Browse files
author
cfernandes
committed
Add standard set of tooling to project
1 parent b372112 commit 8cab3bd

File tree

5 files changed

+2387
-95
lines changed

5 files changed

+2387
-95
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.md]
14+
indent_size = 4

.eslintrc

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"rules": {
3+
"indent": [
4+
2,
5+
2,
6+
{"SwitchCase": 1}
7+
],
8+
"quotes": [
9+
2,
10+
"single"
11+
],
12+
"linebreak-style": [
13+
2,
14+
"unix"
15+
],
16+
"semi": [
17+
2,
18+
"always"
19+
],
20+
"no-console": [
21+
0
22+
],
23+
"no-multiple-empty-lines": [
24+
2,
25+
{
26+
"max": 2
27+
}
28+
],
29+
"spaced-comment": [
30+
2,
31+
"always",
32+
{
33+
"exceptions": [
34+
"-",
35+
"+"
36+
]
37+
}
38+
],
39+
"space-infix-ops": [
40+
2,
41+
{
42+
"int32Hint": false
43+
}
44+
],
45+
"keyword-spacing": [
46+
"error", {
47+
"overrides": {
48+
"if": {"after": true},
49+
"for": {"after": true},
50+
"while": {"after": true}
51+
}
52+
}
53+
],
54+
"no-inline-comments": 2,
55+
"space-before-blocks": 2
56+
},
57+
"env": {
58+
"es6": true,
59+
"node": true
60+
},
61+
"parserOptions": {
62+
"ecmaVersion": 8
63+
},
64+
"extends": "eslint:recommended"
65+
}

gulpfile.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
3+
const gulp = require('gulp');
4+
const mocha = require('gulp-mocha');
5+
const istanbul = require('gulp-istanbul');
6+
const gutil = require('gulp-util');
7+
const eslint = require('gulp-eslint');
8+
9+
const sourceFiles = ['index.js', 'lib/**/*.js', 'bin/index.js'];
10+
const testSourceFiles = ['test/**/**.spec.js'];
11+
const allSourceFiles = sourceFiles.concat(testSourceFiles);
12+
13+
gulp.task('test', done => {
14+
gulp.src(sourceFiles)
15+
.pipe(istanbul()) // Covering files
16+
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
17+
.on('finish', function () {
18+
return gulp.src(testSourceFiles)
19+
.pipe(mocha())
20+
.on('error', gutil.log)
21+
.pipe(istanbul.writeReports()) // Creating the reports after tests ran
22+
.pipe(istanbul.enforceThresholds({thresholds: {global: 100}})) // Enforce a coverage of at least 100%
23+
.on('end', done);
24+
25+
})
26+
.on('error', gutil.log);
27+
});
28+
29+
gulp.task('lint', _ => {
30+
return gulp.src(allSourceFiles)
31+
.pipe(eslint())
32+
.pipe(eslint.format())
33+
.pipe(eslint.failAfterError());
34+
});
35+
36+
gulp.task('default', ['lint']);

package.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "skull-island",
33
"version": "1.0.0",
44
"description": "A tool for diffable Kong configuration",
5-
"main": "skull-island.js",
5+
"main": "./kong/index.js",
66
"bin": {
77
"skull-island": "./bin/skull-island.js"
88
},
@@ -22,5 +22,15 @@
2222
"ramda": "^0.24.1",
2323
"request": "^2.81.0",
2424
"request-promise-native": "^1.0.4"
25+
},
26+
"devDependencies": {
27+
"gulp": "^3.9.1",
28+
"gulp-eslint": "^2.1.0",
29+
"gulp-istanbul": "^0.10.4",
30+
"gulp-mocha": "^2.1.3",
31+
"gulp-util": "^3.0.6",
32+
"jscs-stylish": "^0.3.1",
33+
"jshint-stylish": "^2.0.1",
34+
"mocha": "^3.4.2"
2535
}
2636
}

0 commit comments

Comments
 (0)