-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
130a7f7
commit f7a24ea
Showing
5 changed files
with
6,559 additions
and
263 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Browser-sync config file | ||
|-------------------------------------------------------------------------- | ||
| | ||
| For up-to-date information about the options: | ||
| http://www.browsersync.io/docs/options/ | ||
| | ||
| There are more options than you see here, these are just the ones that are | ||
| set internally. See the website for more info. | ||
| | ||
| | ||
*/ | ||
module.exports = { | ||
ui: { | ||
port: 3001, | ||
}, | ||
files: false, | ||
watchEvents: [ | ||
"change", | ||
], | ||
watch: false, | ||
ignore: [], | ||
single: false, | ||
watchOptions: { | ||
ignoreInitial: true, | ||
}, | ||
server: false, | ||
proxy: false, | ||
port: 3000, | ||
middleware: false, | ||
serveStatic: [], | ||
ghostMode: { | ||
clicks: true, | ||
scroll: true, | ||
location: true, | ||
forms: { | ||
submit: true, | ||
inputs: true, | ||
toggles: true, | ||
}, | ||
}, | ||
logLevel: "info", | ||
logPrefix: "Browsersync", | ||
logConnections: false, | ||
logFileChanges: true, | ||
logSnippet: true, | ||
rewriteRules: [], | ||
open: "local", | ||
browser: "default", | ||
cors: false, | ||
xip: false, | ||
hostnameSuffix: false, | ||
reloadOnRestart: false, | ||
notify: true, | ||
scrollProportionally: true, | ||
scrollThrottle: 0, | ||
scrollRestoreTechnique: "window.name", | ||
scrollElements: [], | ||
scrollElementMapping: [], | ||
reloadDelay: 0, | ||
reloadDebounce: 500, | ||
reloadThrottle: 0, | ||
plugins: [], | ||
injectChanges: true, | ||
startPath: null, | ||
minify: true, | ||
host: null, | ||
localOnly: false, | ||
codeSync: true, | ||
timestamps: true, | ||
clientEvents: [ | ||
"scroll", | ||
"scroll:element", | ||
"input:text", | ||
"input:toggles", | ||
"form:submit", | ||
"form:reset", | ||
"click", | ||
], | ||
socket: { | ||
socketIoOptions: { | ||
log: false, | ||
}, | ||
socketIoClientConfig: { | ||
reconnectionAttempts: 50, | ||
}, | ||
path: "/browser-sync/socket.io", | ||
clientPath: "/browser-sync", | ||
namespace: "/browser-sync", | ||
clients: { | ||
heartbeatTimeout: 5000, | ||
}, | ||
}, | ||
tagNames: { | ||
less: "link", | ||
scss: "link", | ||
css: "link", | ||
jpg: "img", | ||
jpeg: "img", | ||
png: "img", | ||
svg: "img", | ||
gif: "img", | ||
js: "script", | ||
}, | ||
injectNotification: false, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* eslint-disable jsdoc/require-jsdoc */ | ||
|
||
const {watch, src, dest, series, parallel} = require("gulp"); | ||
const mocha = require("gulp-mocha"); | ||
const eslint = require("gulp-eslint"); | ||
const jsdoc = require("gulp-jsdoc3"); | ||
// const istanbul = require("gulp-istanbul"); // gulp-istanbul is broken; hasn't been updated in 3 years | ||
// const exec = require("gulp-exec"); | ||
let {exec, spawn} = require("child_process"); | ||
const browserSync = require("browser-sync").create(); | ||
|
||
const sources = ["src/*.js", "lib/*.js"]; | ||
const tests = ["test/*.js"]; | ||
const support = ["gulpfile.js", "package.json", ".eslintrc.js", "docs.json"]; | ||
const js = [... sources, ... tests]; | ||
const css = ["./jsdoc.css"]; | ||
const markdown = ["**/*.md"]; | ||
const documentation = [... sources, ... markdown, ... css]; | ||
const all = [... sources, ... tests, ... support]; | ||
const jsDocConfig = require("./.jsdoc-conf.json"); | ||
|
||
/* ************ | ||
* TESTING | ||
**************/ | ||
function test(testReporter = "spec") { | ||
return src(tests) | ||
.pipe(mocha({reporter: testReporter})) | ||
.on("error", function(err) { | ||
console.log(err.stack); | ||
}); | ||
} | ||
|
||
function watchTest() { | ||
return watch(all, test.bind(null, "min")); | ||
} | ||
|
||
/* ************ | ||
* LINT | ||
**************/ | ||
function lint() { | ||
return src(js) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failAfterError()); | ||
} | ||
|
||
function watchLint() { | ||
return watch(all, function() { | ||
return src(js) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()); | ||
}); | ||
} | ||
|
||
/* ************ | ||
* COVERAGE | ||
**************/ | ||
function runIstanbul(done) { | ||
let cmd = "nyc"; | ||
let args = [ | ||
"--reporter=text", | ||
"--reporter=html", | ||
"mocha", | ||
]; | ||
let opts = { | ||
stdio: "inherit", | ||
}; | ||
spawn(cmd, args, opts); | ||
done(); | ||
} | ||
|
||
const coverage = runIstanbul; | ||
|
||
function coverageRefresh() { | ||
return watch(js, runIstanbul); | ||
} | ||
|
||
function coverageBrowserSync() { | ||
browserSync.init({ | ||
server: { | ||
baseDir: "./coverage", | ||
}, | ||
}); | ||
|
||
watch("coverage/*").on("change", browserSync.reload); | ||
watch("coverage/*").on("add", browserSync.reload); | ||
} | ||
|
||
const watchCoverage = parallel(coverageBrowserSync, coverageRefresh); | ||
|
||
/* ************ | ||
* DOCS | ||
**************/ | ||
function docsBuild() { | ||
return src(documentation, {read: false}) | ||
.pipe(jsdoc(jsDocConfig)); | ||
} | ||
|
||
const docs = series(docsBuild, copyCss); | ||
|
||
function copyCss() { | ||
return src("jsdoc.css") | ||
.pipe(dest("./docs")); | ||
} | ||
|
||
function docsBrowserSync() { | ||
browserSync.init({ | ||
server: { | ||
baseDir: "./docs", | ||
}, | ||
}); | ||
|
||
watch("docs/*").on("change", browserSync.reload); | ||
watch("docs/*").on("add", browserSync.reload); | ||
} | ||
|
||
function docsRefresh() { | ||
watch(css, copyCss); | ||
watch(documentation, docsBuild); | ||
} | ||
|
||
const watchDocs = parallel(docsBrowserSync, docsRefresh); | ||
|
||
module.exports = { | ||
test, | ||
lint, | ||
coverage, | ||
docs, | ||
"default": watchTest, | ||
"dev:test": watchTest, | ||
"dev:lint": watchLint, | ||
"dev:coverage": watchCoverage, | ||
"dev:docs": watchDocs, | ||
}; |
Oops, something went wrong.