diff --git a/.gitignore b/.gitignore index b19e4ae..45f9810 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ !/yarn* !/.*ignore +## Travis CI +!/.travis.yml + # Unwanted crap .DS_Store .DS_Store? diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1f4b11b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +# Configuration +sudo: false +language: node_js + +node_js: + - "stable" + +# The install script +install: + - yarn install + +# The pre-build script +before_script: + - yarn run lint + +# The build script +script: + - yarn run build + +# Disable email notifications +notifications: + email: false + +# WHO IN THE F# (the programming language) DOESN’T SUPPORT TABS IN 2017? ' ' <- tab +# P.S.: F# (the programming language) also doesn’t support tabs, and that's terrible diff --git a/README.md b/README.md index 06fc376..0403f4e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Build](https://travis-ci.com/ExE-Boss/app-menu.svg?branch=master)](https://travis-ci.com/ExE-Boss/app-menu) [![Mozilla Add-on](https://img.shields.io/amo/v/application-menu.svg)](https://addons.mozilla.org/firefox/addon/application-menu/) [![devDependencies](https://img.shields.io/david/dev/ExE-Boss/app-menu.svg)](https://david-dm.org/ExE-Boss/app-menu?type=dev) [![License](https://img.shields.io/github/license/ExE-Boss/app-menu.svg)](https://github.com/ExE-Boss/app-menu/blob/master/LICENSE) diff --git a/gulpfile.js b/gulpfile.js index 98972f9..0338404 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,6 +6,7 @@ const gulp = require("gulp"); const webExt = require("web-ext").default; const mergeStream = require("merge-stream"); +const eslint = require("gulp-eslint"); const jsonEdit = require("gulp-json-editor"); const pkgJson = require("./package.json"); @@ -15,6 +16,14 @@ const BUILD_DIR = "./build/"; const SOURCE_DIR = "./src/"; const ARCHIVES_DIR = "./dist/"; +gulp.task("clean", () => { + try { + fse.emptyDirSync(BUILD_DIR); + } catch (e) { + console.error(e); + } +}); + { const build = () => { return mergeStream( @@ -31,12 +40,14 @@ const ARCHIVES_DIR = "./dist/"; gulp.task("build-clean", ["clean"], build); } -gulp.task("clean", () => { - try { - fse.emptyDirSync(BUILD_DIR); - } catch (e) { - console.error(e); - } +gulp.task("lint", ["build-clean"], () => { + webExt.cmd.lint({ + sourceDir: BUILD_DIR + }, {shouldExitProgram: false}); + return gulp.src(`${BUILD_DIR}**/*.js`) + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failAfterError()); }); gulp.task("dist", ["build-clean"], () => { diff --git a/package.json b/package.json index 0fb7842..5f190bc 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "version": "0.1.8a1", "author": "ExE Boss", "scripts": { - "build": "gulp build", + "build": "gulp build", "dist": "gulp dist", + "lint": "gulp lint", "run": "gulp run" }, "repository": { @@ -22,6 +23,7 @@ "fs-extra": "^6.0.1", "gulp": "^3.9.1", "gulp-cli": "^2.0.1", + "gulp-eslint": "^4.0.2", "gulp-json-editor": "^2.4.1", "merge-stream": "^1.0.1", "stylelint": "^9.2.1", diff --git a/yarn.lock b/yarn.lock index 1418fff..c17b8dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1626,7 +1626,7 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@4.19.1, eslint@^4.19.1: +eslint@4.19.1, eslint@^4.0.0, eslint@^4.19.1: version "4.19.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" dependencies: @@ -2451,6 +2451,14 @@ gulp-cli@^2.0.1: v8flags "^3.0.1" yargs "^7.1.0" +gulp-eslint@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/gulp-eslint/-/gulp-eslint-4.0.2.tgz#18a2a6768e4404cbf3e203239cb57474168fa606" + dependencies: + eslint "^4.0.0" + fancy-log "^1.3.2" + plugin-error "^1.0.0" + gulp-json-editor@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/gulp-json-editor/-/gulp-json-editor-2.4.1.tgz#ef9dfcc7a29c664bdd0e992a331d2f1b0e64650d" @@ -4386,7 +4394,7 @@ pino@4.16.1, pino@~4.16.1: quick-format-unescaped "^1.1.2" split2 "^2.2.0" -plugin-error@^1.0.1: +plugin-error@^1.0.0, plugin-error@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c" dependencies: