Paladox has uploaded a new change for review.
https://gerrit.wikimedia.org/r/280759
Change subject: Add npm entry point and fix js
......................................................................
Add npm entry point and fix js
Bug: T63632
Change-Id: I3f1d307d8a89a1e4245918e91a1953c4c131d8d1
---
M .gitignore
A .jshintignore
A .jshintrc
A Gruntfile.js
A package.json
M resources/jquery.instantImage.js
M resources/sii.instantImage.js
7 files changed, 73 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticImageInput
refs/changes/59/280759/1
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
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..04c3a97
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,23 @@
+{
+ // Enforcing
+ "bitwise": true,
+ "eqeqeq": true,
+ "freeze": true,
+ "latedef": "nofunc",
+ "noarg": true,
+ "nonew": true,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+
+ // Relaxing
+ "es5": false,
+
+ // Environment
+ "browser": true,
+ "jquery": true,
+
+ "globals": {
+ "mediaWiki": false
+ }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..36b6671
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,30 @@
+/*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/**'
+ ]
+ },
+ 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..0ee955e
--- /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.5.0",
+ "grunt-contrib-jshint": "1.0.0",
+ "grunt-jsonlint": "1.0.7"
+ }
+}
diff --git a/resources/jquery.instantImage.js b/resources/jquery.instantImage.js
index ff37bfe..e1bfc2e 100644
--- a/resources/jquery.instantImage.js
+++ b/resources/jquery.instantImage.js
@@ -7,7 +7,8 @@
* @author Jeroen De Dauw <jeroendedauw at gmail dot com>
*/
-(function( $, mw ) { $.fn.instantImage = function( options ) {
+( function( $, mw ) {
+ $.fn.instantImage = function( options ) {
var settings = $.extend( {
'imagename': 'Beatles',
@@ -206,4 +207,5 @@
this.init();
} );
-}; })( window.jQuery, window.mediaWiki );
+};
+}( jQuery, mediaWiki ) );
diff --git a/resources/sii.instantImage.js b/resources/sii.instantImage.js
index c1aa054..52decb8 100644
--- a/resources/sii.instantImage.js
+++ b/resources/sii.instantImage.js
@@ -7,7 +7,7 @@
* @author Jeroen De Dauw <jeroendedauw at gmail dot com>
*/
-(function( $, mw ) {
+( function( $, mw ) {
$( document ).ready( function() {
// Find all instant image inputs in the form.
@@ -52,4 +52,4 @@
} );
} );
-})( window.jQuery, window.mediaWiki );
\ No newline at end of file
+}( jQuery, mediaWiki ) );
--
To view, visit https://gerrit.wikimedia.org/r/280759
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f1d307d8a89a1e4245918e91a1953c4c131d8d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticImageInput
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits