Last active
March 16, 2017 21:14
-
-
Save lbenie/d731a6da3a5f96328f2047bc20ecb177 to your computer and use it in GitHub Desktop.
git-guppy and gulp tasks setup
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
{ | |
"indent_size": 2, | |
"indent_char": " ", | |
"indent_with_tabs": false, | |
"eol": "\n", | |
"end_with_newline": false, | |
"indent_level": 0, | |
"preserve_newlines": true, | |
"max_preserve_newlines": 10, | |
"space_in_paren": false, | |
"space_in_empty_paren": false, | |
"jslint_happy": true, | |
"space_after_anon_function": false, | |
"break_chained_methods": false, | |
"keep_array_indentation": false, | |
"unescape_strings": false, | |
"wrap_line_length": 0, | |
"e4x": false, | |
"comma_first": false, | |
"operator_position": "before-newline" | |
} |
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
const server = "server"; | |
module.exports = { | |
linters: { | |
eslint: { | |
src: `${server}/**/*.js` | |
} | |
} | |
}; |
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
const config = require("../config"); | |
const formatter = require("eslint-formatter-pretty"); | |
module.exports = (gulp, plugins) => { | |
return () => { | |
gulp | |
.src(config.linters.eslint.src) | |
.pipe(plugins.eslint()) | |
.pipe(plugins.eslint.format(formatter)) | |
.pipe(plugins.eslint.failAfterError()); | |
}; | |
}; |
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
const gulp = require("gulp"); | |
const $ = require("gulp-load-plugins"); | |
const requireDir = require("require-dir"); | |
const taskDirectory = `${__dirname}/gulpTasks`; | |
/** | |
* Directory structure | |
* / | |
* gulpTasks/ | |
* first/ | |
* second/ | |
* third/ | |
*/ | |
const taskDirectoryNames = [ | |
"first", | |
"second", | |
"third" | |
].map(name => `${taskDirectory}/${name}`); | |
taskDirectoryNames.forEach((dir) => { | |
const tasks = requireDir(dir); | |
Object.keys(tasks).forEach((task) => { | |
gulp.task(task, require(`${dir}/${task}`)(gulp, $)); | |
}); | |
}); | |
gulp.task("pre-commit", ["prettify", "eslint"]); | |
gulp.task("default", []); |
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
{ | |
"scripts": { | |
"postinstall": "guppy install pre-commit" | |
}, | |
"devDependencies": { | |
"eslint": "^3.17.1", | |
"eslint-formatter-pretty": "^1.1.0", | |
"git-guppy": "^2.0.0", | |
"gulp": "^3.9.1", | |
"gulp-eslint": "^3.0.1", | |
"gulp-filter": "^5.0.0", | |
"gulp-jsbeautifier": "^2.1.0", | |
"gulp-load-plugins": "^1.5.0", | |
"guppy-cli": "^1.2.2", | |
"require-dir": "^0.3.1" | |
} | |
} |
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
const config = require("../config"); | |
module.exports = (gulp, plugins) => { | |
return () => { | |
gulp | |
.src(config.linters.eslint.src, { base: "./" }) | |
.pipe(plugins.jsbeautifier({ | |
config: "./.jsbeautifyrc" | |
})) | |
.pipe(gulp.dest("./")); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment