Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
7 changed files
with
153 additions
and
106 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
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,2 +1,4 @@ | ||
www/lib/* | ||
app/src/main/assets/* | ||
node_modules/ | ||
www/node_modules/ |
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,8 @@ | ||
{ | ||
"name": "wikipedia-android", | ||
"description": "This file exists only as workaround for CI", | ||
"private": true, | ||
"scripts": { | ||
"test": "cd www/ && npm install && npm test" | ||
} | ||
} |
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,2 @@ | ||
lib/* | ||
node_modules/ |
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,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 | ||
} |
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,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' ); | ||
}; |
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,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" | ||
} | ||
} |