Update gulpfile from my boilerplate & relocate pjax.js into src folder

This commit is contained in:
Maxime Thirouin
2014-04-03 07:07:34 +02:00
parent 4a3ba25547
commit e09c164491
4 changed files with 37 additions and 11 deletions

View File

@@ -1,12 +1,12 @@
{ {
"name": "pjax", "name": "pjax",
"main": "pjax.js",
"version": "0.1.1", "version": "0.1.1",
"description": "Boost browsing experience using Ajax navigation (+ Push state)",
"main": "src/pjax.js",
"homepage": "https://github.com/MoOx/pjax", "homepage": "https://github.com/MoOx/pjax",
"authors": [ "authors": [
"Maxime Thirouin <m@moox.io>" "Maxime Thirouin <m@moox.io>"
], ],
"description": "Boost browsing experience using Ajax navigation (+ Push state)",
"moduleType": [ "moduleType": [
"amd", "amd",
"globals", "globals",

View File

@@ -1,31 +1,56 @@
///
var pkg = require("./package.json") var pkg = require("./package.json")
, gulp = require("gulp") , gulp = require("gulp")
, plumber = require("gulp-plumber") , plumber = require("gulp-plumber")
/// ///
// Lint JS // JS Lint
/// ///
var jshint = require("gulp-jshint") var jshint = require("gulp-jshint")
, jsFiles = [".jshintrc", "*.json", "*.js"] , jsonFiles = [".jshintrc", "*.json"]
, jsFiles = ["*.js", "src/**/*.js"]
gulp.task("scripts.lint", function() { gulp.task("scripts.lint", function() {
gulp.src(jsFiles) gulp.src([].concat(jsonFiles).concat(jsFiles))
.pipe(plumber()) .pipe(plumber())
.pipe(jshint(".jshintrc")) .pipe(jshint(".jshintrc"))
.pipe(jshint.reporter("jshint-stylish")) .pipe(jshint.reporter("jshint-stylish"))
}) })
///
// JS Code Sniffing
///
var jscs = require("gulp-jscs") var jscs = require("gulp-jscs")
gulp.task("scripts.cs", function() { gulp.task("scripts.cs", function() {
gulp.src("*.js") gulp.src(jsFiles)
.pipe(plumber()) .pipe(plumber())
.pipe(jscs()) .pipe(jscs())
}) })
// JS Alias
gulp.task("scripts", ["scripts.lint", "scripts.cs"]) gulp.task("scripts", ["scripts.lint", "scripts.cs"])
///
// Watch
///
gulp.task("watch", function() { gulp.task("watch", function() {
gulp.watch([jsFiles], ["scripts"]) gulp.watch(jsFiles, ["scripts"])
}) })
gulp.task("default", ["scripts", "watch"]) ///
// Publish gh-branch
///
var buildBranch = require("buildbranch")
gulp.task("publish", ["test"], function(cb) {
buildBranch({folder: "src"}
, function(err) {
if (err) {
throw err
}
console.log(pkg.name + " published.")
cb()
})
})
// Aliases
gulp.task("build", ["scripts"])
gulp.task("test", ["build"])
gulp.task("default", ["test", "watch"])

View File

@@ -2,7 +2,7 @@
"name": "pjax", "name": "pjax",
"version": "0.1.1", "version": "0.1.1",
"description": "Boost browsing experience using Ajax navigation (+ Push state)", "description": "Boost browsing experience using Ajax navigation (+ Push state)",
"main": "pjax.js", "main": "src/pjax.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
@@ -30,6 +30,7 @@
"gulp-jscs": "^0.3.2", "gulp-jscs": "^0.3.2",
"gulp-plumber": "^0.5.6", "gulp-plumber": "^0.5.6",
"gulp": "^3.5.6", "gulp": "^3.5.6",
"gulp-jshint": "^1.5.1" "gulp-jshint": "^1.5.1",
"buildbranch": "0.0.1"
} }
} }