diff --git a/.gitignore b/.gitignore index 48a2e24..665aa21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ components build +node_modules diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6b4c1a9 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,14 @@ +{ + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "sub": true, + "undef": true, + "boss": true, + "eqnull": true, + "node": true, + "es5": true +} diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..3a1fedd --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,47 @@ +/* + * grunt-wpt-page + * https://github.com/sideroad/grunt-wpt-page + * + * Copyright (c) 2013 sideroad + * Licensed under the MIT license. + */ + +'use strict'; + +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + jshint: { + all: [ + 'index.js', + ], + options: { + jshintrc: '.jshintrc', + }, + }, + + clean: ['build', 'components'], + + // Build component + componentbuild: { + pages: { + options: { + install: true + }, + src: '.', + dest: 'build' + } + } + + }); + + // These plugins provide necessary tasks. + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-component-build'); + + // By default, lint and run all tests. + grunt.registerTask('default', ['jshint', 'clean', 'componentbuild']); + +}; diff --git a/index.html b/index.html index 434de59..214ce4a 100644 --- a/index.html +++ b/index.html @@ -2,8 +2,8 @@ - - + + Grunt WebPageTest @@ -187,9 +187,5 @@

Detail

- - \ No newline at end of file diff --git a/index.js b/index.js index 3b7e3e1..95b0409 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,7 @@ +/*global Morris: true */ + (function( Morris ){ + 'use strict'; var $ = require('jquery'), _ = require('lodash'), @@ -77,7 +80,7 @@ }, filters: { convertToDate: function(time){ - return moment(time*1000).format('LLL') + return moment(time*1000).format('LLL'); }, totalBytes: function(data){ var total = _.reduce(data, function(memo, val, key){ diff --git a/package.json b/package.json new file mode 100644 index 0000000..5e586ce --- /dev/null +++ b/package.json @@ -0,0 +1,43 @@ +{ + "name": "grunt-wpt-page", + "description": "Keep tracking webpagetest score", + "homepage": "https://github.com/sideroad/grunt-wpt-page", + "author": { + "name": "sideroad", + "email": "sideroad.jp@gmail.com", + "url": "http://sideroad.secret.jp/" + }, + "repository": { + "type": "git", + "url": "git://github.com/sideroad/grunt-wpt-page.git" + }, + "bugs": { + "url": "https://github.com/sideroad/grunt-wpt-page/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/sideroad/grunt-wpt-page/blob/master/LICENSE-MIT" + } + ], + "main": "Gruntfile.js", + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "test": "grunt test" + }, + "devDependencies": { + "grunt": "~0.4.0", + "grunt-component-build": "^0.5.0", + "grunt-contrib-clean": "^0.5.0", + "grunt-contrib-jshint": "~0.1.1" + }, + "peerDependencies": { + "grunt": "~0.4.0" + }, + "keywords": [ + "gruntplugin" + ], + "dependencies": {} +}