diff --git a/lib/phantomjs.js b/lib/phantomjs.js index 6dc10fd20..e57306825 100644 --- a/lib/phantomjs.js +++ b/lib/phantomjs.js @@ -8,6 +8,8 @@ var fs = require('fs') var path = require('path') var spawn = require('child_process').spawn +var isLambda = require('is-lambda') +var phantomjsLambda = require('phantomjs-for-lambda') var Promise = require('es6-promise').Promise @@ -20,6 +22,12 @@ try { exports.path = path.resolve(__dirname, location.location) exports.platform = location.platform exports.arch = location.arch + + if(isLambda) { + exports.path = phantomjsLambda.path + exports.platform = "linux" + exports.arch = "x64" + } } catch(e) { // Must be running inside install script. exports.path = null @@ -32,6 +40,10 @@ try { */ exports.version = '2.1.1' +if(isLambda) { + exports.version = phantomjsLambda.version +} + /** * Returns a clean path that helps avoid `which` finding bin files installed diff --git a/package.json b/package.json index ccd9fadea..966f4e89f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,9 @@ "extract-zip": "~1.5.0", "fs-extra": "~1.0.0", "hasha": "~2.2.0", + "is-lambda": "^1.0.0", "kew": "~0.7.0", + "phantomjs-for-lambda": "^1.0.0", "progress": "~1.1.8", "request": "~2.79.0", "request-progress": "~2.0.1",