jenkins-bot has submitted this change and it was merged.
Change subject: Add npm entry point
......................................................................
Add npm entry point
Change-Id: If04653306e13d428c2c69f8500fe0e477174d046
---
M .gitignore
M .jshintignore
M .jshintrc
A Gruntfile.js
A package.json
M resources/js/chartFormatHelpers.js
M resources/js/fundraising_charts.js
7 files changed, 97 insertions(+), 12 deletions(-)
Approvals:
Awight: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.gitignore b/.gitignore
index 98b092a..1689d7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-.svn
*~
*.kate-swp
.*.swp
+node_modules/**
diff --git a/.jshintignore b/.jshintignore
index 9f73a1b..0a892e2 100644
--- a/.jshintignore
+++ b/.jshintignore
@@ -1,3 +1,5 @@
-modules/ext.fundraisingChart.chartsjs
-modules/ext.fundraisingChart.d3
-modules/ext.fundraisingChart.topojson
+modules/ext.fundraisingChart.chartsjs/**
+modules/ext.fundraisingChart.d3/**
+modules/ext.fundraisingChart.datamaps/**
+modules/ext.fundraisingChart.topojson/**
+node_modules/**
diff --git a/.jshintrc b/.jshintrc
index 0967ef4..5aa4b04 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1 +1,28 @@
-{}
+{
+ // Enforcing
+ "bitwise": true,
+ "eqeqeq": true,
+ "freeze": true,
+ "latedef": "nofunc",
+ "noarg": true,
+ "nonew": true,
+ "undef": true,
+ "unused": false,
+ "strict": false,
+
+ // Relaxing
+ "es5": false,
+
+ // Environment
+ "browser": true,
+ "jquery": true,
+
+ "globals": {
+ "mediaWiki": false,
+ "moment": true,
+ "circleThroughColors": false,
+ "Chart": false,
+ "Datamap": false,
+ "console": true
+ }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..35b8c1b
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,34 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+ grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+ grunt.loadNpmTasks( 'grunt-jsonlint' );
+ grunt.loadNpmTasks( 'grunt-banana-checker' );
+
+ grunt.initConfig( {
+ jshint: {
+ options: {
+ jshintrc: true
+ },
+ all: [
+ '**/*.js',
+ '!node_modules/**',
+ '!modules/ext.fundraisingChart.chartsjs/**',
+ '!modules/ext.fundraisingChart.d3/**',
+ '!modules/ext.fundraisingChart.datamaps/**',
+ '!modules/ext.fundraisingChart.topojson/**'
+ ]
+ },
+ banana: {
+ all: 'i18n/'
+ },
+ jsonlint: {
+ all: [
+ '**/*.json',
+ '!node_modules/**'
+ ]
+ }
+ } );
+
+ grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana' ] );
+ grunt.registerTask( 'default', 'test' );
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..ec97d7b
--- /dev/null
+++ b/package.json
@@ -0,0 +1,12 @@
+{
+ "scripts": {
+ "test": "grunt test"
+ },
+ "devDependencies": {
+ "grunt": "0.4.5",
+ "grunt-cli": "0.1.13",
+ "grunt-banana-checker": "0.4.0",
+ "grunt-contrib-jshint": "1.0.0",
+ "grunt-jsonlint": "1.0.7"
+ }
+}
diff --git a/resources/js/chartFormatHelpers.js
b/resources/js/chartFormatHelpers.js
index 9f90065..62af44b 100644
--- a/resources/js/chartFormatHelpers.js
+++ b/resources/js/chartFormatHelpers.js
@@ -1,3 +1,5 @@
+/*jshint -W121 */
+
/**
* Cycle through available colors to generate a colors array of any specified
length.
* For general use in chart widgets.
@@ -60,14 +62,17 @@
return val;
}
-function convertStringDatesToMoments(dataSet){
+function convertStringDatesToMoments( dataSet ) {
- dataSet.forEach(function(row,i){
+ dataSet.forEach( function ( row ) {
+ var d;
+ var dateString;
+ var newDate;
d = row.date;
- dateString = d.slice(0,10);
- newDate = moment(dateString);
+ dateString = d.slice( 0, 10 );
+ newDate = moment( dateString );
row.date = newDate;
- });
+ } );
return dataSet;
@@ -78,11 +83,11 @@
//TODO: test this because I'm just slapping it in here for later (isn't
used right now)
var today = moment().format('YYYY-MM-DD'),
one_year_ago = moment().subtract('months', 11),
- yesterday = moment(today).subtract('days', 31),
one_yr_ago_month = (one_year_ago.month()),
months = [];
+ var i;
- for(i = one_yr_ago_month; i<one_yr_ago_month+12; i++){
+ for ( i = one_yr_ago_month; i<one_yr_ago_month+12; i++ ) {
var m = moment().add('months', i).month();
months.push(moment().month(m).format('MMM'));
}
diff --git a/resources/js/fundraising_charts.js
b/resources/js/fundraising_charts.js
index 8d9e800..5e946de 100644
--- a/resources/js/fundraising_charts.js
+++ b/resources/js/fundraising_charts.js
@@ -135,6 +135,8 @@
jsonDataSource = $('#' + el_id).attr('data-chartdata');
var setData = function(){
+ var formattedData;
+ var context;
//check the dataSet's format and proceed accordingly
formattedData = formatData(dataSet),
context = $( '#' + el_id.replace('Area','') ).get( 0
).getContext( '2d' );
@@ -165,6 +167,8 @@
jsonDataSource = $('#' + el_id).attr('data-chartdata');
var setData = function(){
+ var context;
+ var formattedData;
//check the dataSet's format and proceed accordingly
formattedData = formatData(dataSet),
context = $( '#' + el_id.replace('Area','') ).get( 0
).getContext( '2d' );
@@ -194,6 +198,7 @@
//var dataSet,
var jsonDataSource = $('#' + el_id).attr('data-chartdata');
+ var setData;
setData = function( dataSet ){
--
To view, visit https://gerrit.wikimedia.org/r/275557
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If04653306e13d428c2c69f8500fe0e477174d046
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/FundraisingChart
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits