Jdlrobson has submitted this change and it was merged.

Change subject: Handle all the Node.js dependencies the same way
......................................................................


Handle all the Node.js dependencies the same way

Add jshint as a dependency to package.json. Enforce minimum versions
for jshint and autoless.

Now everytime a Node.js Makefile task is run, it checks if the
dependencies are up-to-date and the versions can be updated easily for
everyone working on MobileFrontend.

Change-Id: I68de83ffcd383bc6dbb28af6af8b407998097ddf
---
M Makefile
M package.json
D scripts/less.sh
A scripts/nodecheck.sh
4 files changed, 22 insertions(+), 21 deletions(-)

Approvals:
  Jdlrobson: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/Makefile b/Makefile
index 1a2a47f..7e59e4e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,17 +2,20 @@
 
 .PHONY: less
 
-jshinttests:
-       jshint tests/javascripts/* --config .jshintrc
+nodecheck:
+       @scripts/nodecheck.sh
 
-jshint: jshinttests
-       jshint javascripts/* --config .jshintrc
+jshinttests: nodecheck
+       @node_modules/.bin/jshint tests/javascripts/* --config .jshintrc
 
-less:
-       @scripts/less.sh --no-watch
+jshint: nodecheck jshinttests
+       @node_modules/.bin/jshint javascripts/* --config .jshintrc
 
-lesswatch:
-       @scripts/less.sh
+less: nodecheck
+       @node_modules/.bin/autoless --no-watch less/ stylesheets/
+
+lesswatch: nodecheck
+       @node_modules/.bin/autoless less/ stylesheets/
 
 phpunit:
        cd ${MW_INSTALL_PATH}/tests/phpunit && php phpunit.php --configuration 
${MW_INSTALL_PATH}/extensions/MobileFrontend/tests/mfe.suite.xml 
--group=MobileFrontend
diff --git a/package.json b/package.json
index bb41d87..2be056e 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,9 @@
 {
        "name": "MobileFrontend-dependencies",
        "description": "Node.js dependencies used in MobileFrontend",
+       "version": "0.0.1",
        "dependencies": {
-               "autoless": "*"
+               "jshint": ">=1.1.0",
+               "autoless": ">=0.1.4"
        }
 }
diff --git a/scripts/less.sh b/scripts/less.sh
deleted file mode 100755
index a83b24e..0000000
--- a/scripts/less.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-if command -v npm > /dev/null ; then
-  if npm list autoless | grep "(empty)" > /dev/null ; then
-    echo "Installing autoless..."
-    npm install autoless
-  fi
-  node_modules/.bin/autoless $1 less/ stylesheets/
-else
-  echo "You need to install Node.JS to compile LESS files!"
-  echo "See http://nodejs.org/";
-  exit 1
-fi
diff --git a/scripts/nodecheck.sh b/scripts/nodecheck.sh
new file mode 100755
index 0000000..3ee0f83
--- /dev/null
+++ b/scripts/nodecheck.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+if command -v npm > /dev/null ; then
+  npm install
+else
+  echo "You need to install Node.JS!"
+  echo "See http://nodejs.org/";
+  exit 1
+fi

-- 
To view, visit https://gerrit.wikimedia.org/r/60601
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I68de83ffcd383bc6dbb28af6af8b407998097ddf
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: JGonera <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to