jenkins-bot has submitted this change and it was merged.
Change subject: Update npm configuations to be able to run npm install
......................................................................
Update npm configuations to be able to run npm install
This allows us to run grunt from inside www/ instead of having to move it
to parent directory.
Also update packages
Update grunt to 0.4.5
Update grunt-contrib-copy to 1.0.0
Update grunt-contrib-jshint to 1.0.0
Update browserify to 13.0.0
Add package grunt-jsonlint for linting json files.
Change-Id: Iaf286b1dc4af2948896d2dbd37697f06b440850d
---
M .gitignore
M .jshintignore
A package.json
A www/.jshintignore
A www/.jshintrc
M www/Gruntfile.js
M www/package.json
7 files changed, 153 insertions(+), 106 deletions(-)
Approvals:
Niedzielski: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.gitignore b/.gitignore
index aaba1ad..277201b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,8 @@
scripts/backup.ab
# Node modules for the js
-www/node_modules
+node_modules/
+www/node_modules/
www/bundle*.js
www/abusefilter.js
www/preview.js
diff --git a/.jshintignore b/.jshintignore
index e655b25..27a235c 100644
--- a/.jshintignore
+++ b/.jshintignore
@@ -1,2 +1,4 @@
www/lib/*
app/src/main/assets/*
+node_modules/
+www/node_modules/
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..fee3ea2
--- /dev/null
+++ b/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "wikipedia-android",
+ "description": "This file exists only as workaround for CI",
+ "private": true,
+ "scripts": {
+ "test": "cd www/ && npm install && npm test"
+ }
+}
diff --git a/www/.jshintignore b/www/.jshintignore
new file mode 100644
index 0000000..057ed21
--- /dev/null
+++ b/www/.jshintignore
@@ -0,0 +1,2 @@
+lib/*
+node_modules/
diff --git a/www/.jshintrc b/www/.jshintrc
new file mode 100644
index 0000000..d3f1852
--- /dev/null
+++ b/www/.jshintrc
@@ -0,0 +1,18 @@
+{
+ "globals": {
+ "console": true,
+ "require": true,
+ "module": true,
+ "marshaller": true
+ },
+
+ "browser": true,
+ "curly": true,
+ "eqeqeq": true,
+ "forin": false,
+ "onevar": false,
+ "trailing": true,
+ "undef" : true,
+ "unused": true,
+ "supernew": true
+}
diff --git a/www/Gruntfile.js b/www/Gruntfile.js
index b614c64..2af1305 100644
--- a/www/Gruntfile.js
+++ b/www/Gruntfile.js
@@ -1,100 +1,116 @@
+/*jshint node:true */
module.exports = function ( grunt ) {
- var allScriptFiles = [
- "js/bridge.js",
- "js/main.js",
- "js/utilities.js",
- "js/transformer.js",
- "js/transforms/*.js",
- "js/transforms/service/*.js",
- "js/actions.js",
- "js/disambig.js",
- "js/editaction.js",
- "js/issues.js",
- "js/loader.js",
- "js/night.js",
- "js/preview.js",
- "js/rtlsupport.js",
- "js/sections.js",
- "tests/*.js"
- ];
- var allHTMLFiles = [
- "index.html",
- "tests/index.html"
- ];
- var distFolder = "../app/src/main/assets/";
+ var allScriptFiles = [
+ "js/bridge.js",
+ "js/main.js",
+ "js/utilities.js",
+ "js/transformer.js",
+ "js/transforms/*.js",
+ "js/transforms/service/*.js",
+ "js/actions.js",
+ "js/disambig.js",
+ "js/editaction.js",
+ "js/issues.js",
+ "js/loader.js",
+ "js/night.js",
+ "js/preview.js",
+ "js/rtlsupport.js",
+ "js/sections.js",
+ "tests/*.js"
+ ];
+ var allHTMLFiles = [
+ "index.html",
+ "tests/index.html"
+ ];
+ var distFolder = "../app/src/main/assets/";
- grunt.loadNpmTasks( 'grunt-browserify' );
- grunt.loadNpmTasks( 'grunt-contrib-jshint' );
- grunt.loadNpmTasks( 'grunt-contrib-copy' );
- grunt.loadNpmTasks( 'grunt-contrib-watch' );
+ grunt.loadNpmTasks( 'grunt-contrib-jshint' );
+ grunt.loadNpmTasks( 'grunt-jsonlint' );
+ grunt.loadNpmTasks( 'grunt-browserify' );
+ grunt.loadNpmTasks( 'grunt-contrib-copy' );
+ grunt.loadNpmTasks( 'grunt-contrib-watch' );
- grunt.initConfig( {
- pkg: grunt.file.readJSON( "package.json" ),
- browserify: {
- dist: {
- files: {
- "bundle.js": [
- "js/bridge.js",
- "js/main.js",
- "js/utilities.js",
- "js/transformer.js",
- "js/transforms/*.js",
- "js/transforms/service/*.js",
- "js/actions.js",
- "js/disambig.js",
- "js/editaction.js",
- "js/issues.js",
- "js/loader.js",
- "js/night.js",
- "js/preview.js",
- "js/rtlsupport.js",
- "js/sections.js"
- ],
- "bundle-test.js": [
- "js/loader.js",
- "js/main.js",
- "js/bridge.js",
- "tests/*.js"
- ],
- "preview.js": [
- "js/loader.js",
- "js/bridge.js",
- "js/night.js",
- "js/actions.js",
- "js/preview.js",
- "js/rtlsupport.js",
- "js/util.js"
- ]
- }
- }
- },
- jshint: {
- allFiles: allScriptFiles,
- options: {
- jshintrc: ".jshintrc"
- }
- },
- copy: {
- main: {
- files: [
- // App files
- { src: [ "bundle.js", "index.html" ], dest: distFolder },
+ grunt.initConfig( {
+ pkg: grunt.file.readJSON( "package.json" ),
+ jshint: {
+ options: {
+ jshintrc: true
+ },
+ all: [
+ '../*.js',
+ '**/*.js',
+ '!node_modules/**',
+ '!lib/**'
+ ]
+ },
+ jsonlint: {
+ all: [
+ '../**/*.json',
+ '**/*.json',
+ '!../www/node_modules/**',
+ '!node_modules/**'
+ ]
+ },
+ browserify: {
+ dist: {
+ files: {
+ "bundle.js": [
+ "js/bridge.js",
+ "js/main.js",
+ "js/utilities.js",
+ "js/transformer.js",
+ "js/transforms/*.js",
+ "js/transforms/service/*.js",
+ "js/actions.js",
+ "js/disambig.js",
+ "js/editaction.js",
+ "js/issues.js",
+ "js/loader.js",
+ "js/night.js",
+ "js/preview.js",
+ "js/rtlsupport.js",
+ "js/sections.js"
+ ],
+ "bundle-test.js": [
+ "js/loader.js",
+ "js/main.js",
+ "js/bridge.js",
+ "tests/*.js"
+ ],
+ "preview.js": [
+ "js/loader.js",
+ "js/bridge.js",
+ "js/night.js",
+ "js/actions.js",
+ "js/preview.js",
+ "js/rtlsupport.js",
+ "js/util.js"
+ ]
+ }
+ }
+ },
+ copy: {
+ main: {
+ files: [
+ // App files
+ { src: [ "bundle.js", "index.html" ],
dest: distFolder },
- // Test files
- { src: [ "bundle-test.js", "tests/index.html" ], dest:
distFolder },
+ // Test files
+ { src: [ "bundle-test.js",
"tests/index.html" ], dest: distFolder },
- // Preview files
- { src: [ "preview.js", "preview.html" ], dest: distFolder
},
- ]
- }
- },
- watch: {
- scripts: {
- files: allScriptFiles.concat( allHTMLFiles ),
- tasks: [ "default" ]
- }
- }
- } );
+ // Preview files
+ { src: [ "preview.js", "preview.html"
], dest: distFolder },
+ ]
+ }
+ },
+ watch: {
+ scripts: {
+ files: allScriptFiles.concat( allHTMLFiles ),
+ tasks: [ "default" ]
+ }
+ }
+ } );
- grunt.registerTask( 'default', [ 'browserify', 'copy' ] );
+ grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'browserify',
'copy' ] );
+ grunt.registerTask( 'default', 'test' );
};
diff --git a/www/package.json b/www/package.json
index adbca5f..da756c1 100644
--- a/www/package.json
+++ b/www/package.json
@@ -1,16 +1,16 @@
{
- "name": "wikipedia-android",
- "description": "JS files required for the Wikipedia Android app",
- "repository": "https://gerrit.wikimedia.org/r/apps/android/wikipedia",
- "version": "0.1.0",
+ "private": true,
+ "scripts": {
+ "test": "grunt test"
+ },
"devDependencies": {
- "browserify": "~12.0.1",
- "grunt": "~0.4.2",
- "grunt-browserify": "~4.0.1",
- "grunt-cli": "~0.1.13",
- "grunt-contrib-copy": "~0.8.2",
- "grunt-contrib-jshint": "~0.11.3",
- "grunt-contrib-less": "~1.1.0",
- "grunt-contrib-watch": "~0.6.1"
+ "grunt": "0.4.5",
+ "grunt-cli": "0.1.13",
+ "browserify": "13.0.0",
+ "grunt-browserify": "4.0.1",
+ "grunt-contrib-copy": "1.0.0",
+ "grunt-contrib-jshint": "1.0.0",
+ "grunt-jsonlint": "1.0.7",
+ "grunt-contrib-watch": "0.6.1"
}
}
--
To view, visit https://gerrit.wikimedia.org/r/273504
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf286b1dc4af2948896d2dbd37697f06b440850d
Gerrit-PatchSet: 21
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Niedzielski <[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