forked from n9/bootstrap-datepicker
-
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.
Add basic npm support and Gruntfile, move tests to grunt
- Loading branch information
1 parent
e4b39c6
commit 537d254
Showing
10 changed files
with
130 additions
and
225 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
instrumented/ | ||
tests/coverage.html | ||
docs/_build | ||
node_modules/ | ||
_build |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
instrumented/ | ||
tests/coverage.html | ||
docs/_build | ||
node_modules/ | ||
_build/ |
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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
install: | ||
- npm install -g jshint jscs | ||
before_script: | ||
- cd ./tests | ||
- echo "new Date().toString();" | phantomjs | ||
script: | ||
- jshint ../js/bootstrap-datepicker.js ../js/locales/*.js | ||
- jscs -c ../.jscs.json ../js/bootstrap-datepicker.js ../js/locales/*.js | ||
- phantomjs run-qunit.js tests.html | ||
- npm install -g grunt-cli |
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,93 @@ | ||
/* global module, require */ | ||
module.exports = function(grunt){ | ||
require('load-grunt-tasks')(grunt); | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
qunit: { | ||
all: ['tests/tests.html'] | ||
}, | ||
jshint: { | ||
options: { | ||
jshintrc: true | ||
}, | ||
gruntfile: ['Gruntfile.js'], | ||
main: ['js/bootstrap-datepicker.js'], | ||
locales: ['js/locales/*js'] | ||
}, | ||
jscs: { | ||
/* grunt-contrib-jscs notes: | ||
0.1.2 works | ||
0.1.3 inifite loops on postinstall | ||
0.1.4 doesn't seem to hit all targets when run "grunt jscs" | ||
*/ | ||
gruntfile: ['Gruntfile.js'], | ||
main: ['js/bootstrap-datepicker.js'], | ||
locales: ['js/locales/*js'] | ||
}, | ||
less: { | ||
standalone: { | ||
files: { | ||
'_build/datepicker.standalone.css': 'build/build_standalone.less', | ||
'_build/datepicker3.standalone.css': 'build/build_standalone3.less' | ||
} | ||
}, | ||
css: { | ||
files: { | ||
'_build/datepicker.css': 'build/build.less', | ||
'_build/datepicker3.css': 'build/build3.less' | ||
} | ||
}, | ||
repo: { | ||
files: { | ||
'css/datepicker.css': 'build/build_standalone.less', | ||
'css/datepicker3.css': 'build/build_standalone3.less' | ||
} | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
compress: true, | ||
mangle: true | ||
}, | ||
main: { | ||
options: { | ||
sourceMap: function(dest){ | ||
return dest.replace('.min.js', '.js.map'); | ||
} | ||
}, | ||
files: { | ||
'_build/bootstrap-datepicker.min.js': 'js/bootstrap-datepicker.js', | ||
'_build/bootstrap-datepicker.locales.min.js': 'js/locales/*.js' | ||
} | ||
}, | ||
locales: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'js/locales/', | ||
src: ['*.js', '!*.min.js'], | ||
dest: '_build/locales/', | ||
rename: function(dest, name){ | ||
return dest + name.replace(/\.js$/, '.min.js'); | ||
} | ||
}] | ||
} | ||
}, | ||
cssmin: { | ||
all: { | ||
files: { | ||
'_build/datepicker.standalone.min.css': '_build/datepicker.standalone.css', | ||
'_build/datepicker.min.css': '_build/datepicker.css', | ||
'_build/datepicker3.standalone.min.css': '_build/datepicker3.standalone.css', | ||
'_build/datepicker3.min.css': '_build/datepicker3.css' | ||
} | ||
} | ||
}, | ||
clean: ['_build'] | ||
}); | ||
|
||
grunt.registerTask('lint', 'Lint all js files with jshint and jscs', ['jshint', 'jscs']); | ||
grunt.registerTask('test', 'Lint files and run unit tests', ['lint', 'qunit']); | ||
grunt.registerTask('finish', 'Prepares repo for commit [test, less:repo]', ['test', 'less:repo']); | ||
grunt.registerTask('dist', 'Builds minified files', ['less:css', 'less:standalone', 'cssmin', 'uglify']); | ||
}; |
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,16 @@ | ||
{ | ||
"scripts": { | ||
"test": "grunt test" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.4.2", | ||
"load-grunt-tasks": "~0.2.1", | ||
"grunt-contrib-jshint": "~0.8.0", | ||
"grunt-contrib-jscs": "0.1.2", | ||
"grunt-contrib-qunit": "~0.3.0", | ||
"grunt-contrib-less": "~0.9.0", | ||
"grunt-contrib-uglify": "~0.2.7", | ||
"grunt-contrib-cssmin": "~0.7.0", | ||
"grunt-contrib-clean": "~0.5.0" | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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