Jdrewniak has uploaded a new change for review.
https://gerrit.wikimedia.org/r/248579
Change subject: expanding gulp tasks
......................................................................
expanding gulp tasks
Change-Id: I7692b4f1ae9406d544222f8d39569aad38023bc4
---
M gulpfile.js
M package.json
2 files changed, 38 insertions(+), 22 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/portals
refs/changes/79/248579/1
diff --git a/gulpfile.js b/gulpfile.js
index 42ebe5b..13f1770 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,11 +1,34 @@
-
var gulp = require('gulp'),
gulpLoadPlugins = require('gulp-load-plugins');
+var argv = require('yargs').argv;
+
var plugins = gulpLoadPlugins();
-var baseDir = "dev/wikipedia.org/";
-var prodDir = "prod/wikipedia.org/";
+var portalParam = argv.portal;
+
+if (!portalParam && process.argv[2] !== "help") {
+ console.log("\x1b[31m");
+ console.log("Error: please specify the portal you wish to build.");
+ console.log("Type gulp help for more information.");
+ console.log("\x1b[0m");
+ process.exit(1);
+}
+
+var baseDir = "dev/"+portalParam;
+var prodDir = "prod/"+portalParam;
+
+gulp.task('help', function () {
+ console.log();
+
console.log('+---------------------------------------------------------------------------------------+');
+ console.log('| ===== USAGE =====
|');
+
console.log('+---------------------------------------------------------------------------------------+');
+ console.log('| gulp --portal wikipedia.org - build specified
portal page |');
+ console.log('| gulp inline-assets --portal wikipedia.org - build specified
inline CSS and JS assets|');
+ console.log('| gulp lint --portal wikipedia.org - run jslint on
JS files on portal |');
+
console.log('+---------------------------------------------------------------------------------------+');
+ console.log();
+});
gulp.task('inline-assets', function(){
gulp.src(baseDir+"index.html")
@@ -18,4 +41,10 @@
.pipe(gulp.dest(prodDir));
});
-gulp.task('default', ['inline-assets']);
\ No newline at end of file
+gulp.task('lint', function(){
+ gulp.src(baseDir+"assets/js/*.js")
+ .pipe(plugins.jshint(".jshintrc"))
+ .pipe(plugins.jshint.reporter('default'));
+});
+
+gulp.task('default', ['lint','inline-assets']);
\ No newline at end of file
diff --git a/package.json b/package.json
index b19c94c..18c657b 100644
--- a/package.json
+++ b/package.json
@@ -1,24 +1,11 @@
-{
- "name": "portals",
- "version": "1.0.0",
- "description": "",
- "main": "gulpfile.js",
- "dependencies": {
+{ "dependencies": {},
+ "devDependencies": {
"gulp": "^3.9.0",
"gulp-inline": "^0.1.0",
"gulp-load-plugins": "^1.0.0",
"gulp-minify-css": "^1.2.1",
"gulp-uglify": "^1.4.2",
- "gulp-jshint": "^1.11.2"
- },
- "devDependencies": {},
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "ssh://[email protected]:29418/wikimedia/portals"
- },
- "author": "",
- "license": "ISC"
+ "gulp-jshint": "^1.11.2",
+ "yargs": "^3.29.0"
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/248579
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7692b4f1ae9406d544222f8d39569aad38023bc4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/portals
Gerrit-Branch: master
Gerrit-Owner: Jdrewniak <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits