Update workflow/conventions/tools

This commit is contained in:
Maxime Thirouin
2014-05-04 08:16:31 +02:00
parent d72e2a852c
commit bd72da06ff
8 changed files with 217 additions and 226 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.DS_Store
node_modules/

View File

@@ -1,147 +1,143 @@
{
"excludeFiles": [
]
, "requireCurlyBraces": [
"if"
, "else"
, "for"
, "while"
, "do"
, "try"
, "catch"
]
, "requireSpaceAfterKeywords": [
"if"
, "else"
, "for"
, "while"
, "do"
, "switch"
, "return"
, "try"
, "catch"
]
, "requireSpacesInFunctionExpression": {
"excludeFiles": [],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
}
, "disallowSpacesInFunctionExpression": {
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
}
, "disallowEmptyBlocks": true
, "disallowSpacesInsideObjectBrackets": true
, "disallowSpacesInsideArrayBrackets": true
, "disallowSpacesInsideParentheses": true
, "disallowSpaceAfterObjectKeys": true
, "disallowCommaBeforeLineBreak": true
, "requireOperatorBeforeLineBreak": [
"?"
, "+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
, ">"
, ">="
, "<"
, "<="
]
, "disallowLeftStickedOperators": [
"?"
, "+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
, ">"
, ">="
, "<"
, "<="
]
, "requireRightStickedOperators": [
},
"disallowEmptyBlocks": true,
"disallowSpacesInsideParentheses": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowQuotedKeysInObjects": "allButReserved",
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowLeftStickedOperators": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireRightStickedOperators": [
"!"
]
, "disallowRightStickedOperators": [
"?"
, "+"
, "/"
, "*"
, ":"
, "="
, "=="
, "==="
, "!="
, "!=="
, ">"
, ">="
, "<"
, "<="
]
, "disallowSpaceAfterPrefixUnaryOperators": [
"++"
, "--"
, "+"
, "-"
, "~"
, "!"
]
, "disallowSpaceBeforePostfixUnaryOperators": [
"++"
, "--"
]
, "requireSpaceBeforeBinaryOperators": [
"+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
]
, "requireSpaceAfterBinaryOperators": [
"+"
, "-"
, "/"
, "*"
, "="
, "=="
, "==="
, "!="
, "!=="
]
, "disallowImplicitTypeConversion": [
"numeric"
, "boolean"
, "binary"
, "string"
]
, "disallowKeywords": [
],
"disallowRightStickedOperators": [
"?",
"+",
"/",
"*",
":",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"disallowKeywords": [
"with"
]
, "disallowMultipleLineStrings": true
, "validateQuoteMarks": "\""
, "disallowMixedSpacesAndTabs": true
, "disallowTrailingWhitespace": true
, "requireKeywordsOnNewLine": [
]
, "requireLineFeedAtFileEnd": true
, "requireCapitalizedConstructors": true
, "safeContextKeyword": "that"
, "validateJSDoc": {
"checkParamNames": true
, "checkRedundantParams": true
, "requireParamTypes": true
],
"disallowMultipleLineStrings": true,
"validateQuoteMarks": "\"",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"requireKeywordsOnNewLine": [],
"requireLineFeedAtFileEnd": true,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "that",
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
}
}

View File

@@ -1,4 +1,4 @@
{
"asi": true
, "laxcomma": true
"asi": true,
"laxcomma": true
}

35
Gulpfile.js Normal file
View File

@@ -0,0 +1,35 @@
var gulp = require("gulp")
var server = require("./tasks/server")
gulp.task("clean", require("./tasks/clean"))
// html
// @todo
// static assets
// generated assets
gulp.task("scripts:linting", require("./tasks/scripts-linting"))
gulp.task("scripts", ["scripts:linting"], require("./tasks/scripts"))
// gulp.task("stylesheets", require("./tasks/stylesheets"))
// build
// gulp.task("dist", ["clean", "static", "scripts", "stylesheets"])
gulp.task("dist", ["clean", "scripts"])
// publish
gulp.task("publish", ["dist"], require("./tasks/publish"))
// dev tasks
// gulp.task("server", ["dist"], server.start)
// gulp.task("default", ["dist", "server", "watch" ])
gulp.task("default", ["dist", "watch" ])
gulp.task("test", ["dist"])
gulp.task("watch", ["dist"], function() {
gulp.watch("./styles/**/*.css", ["stylesheets"])
gulp.watch("./scripts/**/*.js", ["scripts"])
gulp.watch("./tasks/**/*.js", ["scripts:linting"])
// gulp.watch("./dist/**/*").on("change", server.livereload)
})

View File

@@ -134,8 +134,8 @@ Let's talk more about the most basic way to get started:
```js
new Pjax({
elements: "a" // default is "a[href], form[action]"
, selectors: ["title", ".my-Header", ".my-Content", ".my-Sidebar"]
elements: "a", // default is "a[href], form[action]"
selectors: ["title", ".my-Header", ".my-Content", ".my-Sidebar"]
})
```
@@ -202,8 +202,8 @@ Examples:
```js
new Pjax({
selectors: ["title", ".Navbar", ".js-Pjax"]
, switches: {
selectors: ["title", ".Navbar", ".js-Pjax"],
switches: {
// "title": Pjax.switches.outerHTML // default behavior
".Navbar": function(oldEl, newEl, options) {
// here it's a stupid example since it's the default behavior too
@@ -248,23 +248,23 @@ with or without [WOW.js](https://github.com/matthieua/WOW).
```js
new Pjax({
selectors: ["title", ".js-Pjax"]
, switches: {
selectors: ["title", ".js-Pjax"],
switches: {
".js-Pjax": Pjax.switches.sideBySide
}
, switchesClasses: {
},
switchesClasses: {
".js-Pjax": {
classNames: {
// class added on the element that will be removed
remove: "Animated Animated--reverse Animate--fast Animate--noDelay"
remove: "Animated Animated--reverse Animate--fast Animate--noDelay",
// class added on the element that will be added
, add: "Animated"
add: "Animated",
// class added on the element when it go backward
, backward: "Animate--slideInRight"
backward: "Animate--slideInRight",
// class added on the element when it go forward (used for new page too)
, forward: "Animate--slideInLeft"
}
, callbacks: {
forward: "Animate--slideInLeft"
},
callbacks: {
// to make a nice transition with 2 pages as the same time
// we are playing with absolute positioning for element we are removing
// & we need live metrics to have something great
@@ -490,9 +490,9 @@ wrapper on each page (to avoid differences of DOM between pages)
```html
<script>
var disqus_shortname = 'YOURSHORTNAME'
, disqus_identifier = 'PAGEID'
, disqus_url = 'PAGEURL'
, disqus_script = 'embed.js'
var disqus_identifier = 'PAGEID'
var disqus_url = 'PAGEURL'
var disqus_script = 'embed.js'
(function(d,s) {
s = d.createElement('script');s.async=1;s.src = '//' + disqus_shortname + '.disqus.com/'+disqus_script;
(d.getElementsByTagName('head')[0]).appendChild(s);
@@ -507,9 +507,9 @@ wrapper on each page (to avoid differences of DOM between pages)
<!-- if (blah blah) { // eventual server side test to know wheter or not you include this script -->
<script>
var disqus_shortname = 'YOURSHORTNAME'
, disqus_identifier = 'PAGEID'
, disqus_url = 'PAGEURL'
, disqus_script = 'embed.js'
var disqus_identifier = 'PAGEID'
var disqus_url = 'PAGEURL'
var disqus_script = 'embed.js'
// here we will only load the disqus <script> if not already loaded
if (!window.DISQUS) {

View File

@@ -1,56 +0,0 @@
var pkg = require("./package.json")
, gulp = require("gulp")
, plumber = require("gulp-plumber")
///
// JS Lint
///
var jshint = require("gulp-jshint")
, jsonFiles = [".jshintrc", "*.json"]
, jsFiles = ["*.js", "src/**/*.js"]
gulp.task("scripts.lint", function() {
gulp.src([].concat(jsonFiles).concat(jsFiles))
.pipe(plumber())
.pipe(jshint(".jshintrc"))
.pipe(jshint.reporter("jshint-stylish"))
})
///
// JS Code Sniffing
///
var jscs = require("gulp-jscs")
gulp.task("scripts.cs", function() {
gulp.src(jsFiles)
.pipe(plumber())
.pipe(jscs())
})
// JS Alias
gulp.task("scripts", ["scripts.lint", "scripts.cs"])
///
// Watch
///
gulp.task("watch", function() {
gulp.watch(jsFiles, ["scripts"])
})
///
// 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

@@ -26,11 +26,26 @@
},
"homepage": "https://github.com/MoOx/pjax",
"devDependencies": {
"jshint-stylish": "^0.1.5",
"gulp-jscs": "^0.3.2",
"gulp-plumber": "^0.5.6",
"connect": "^2.14.4",
"connect-livereload": "^0.3.2",
"gulp": "^3.5.6",
"gulp-autoprefixer": "0.0.7",
"gulp-browserify": "^0.5.0",
"gulp-gh-pages": "^0.2.0",
"gulp-jscs": "^0.3.2",
"gulp-jshint": "^1.5.1",
"buildbranch": "0.0.1"
"gulp-livereload": "^1.3.1",
"gulp-plumber": "^0.5.6",
"gulp-rework": "^0.2.2",
"gulp-util": "^2.2.14",
"jshint-stylish": "^0.1.5",
"minimist": "0.0.8",
"opn": "^0.1.1",
"rework": "^0.20.2",
"rework-calc": "^0.2.1",
"rework-vars": "^2.0.0",
"rimraf": "^2.2.6",
"tape": "^2.12.3",
"uglifyify": "^2.1.1"
}
}

View File