Skip to content

Commit

Permalink
Merge pull request #11 from mjmasn/master
Browse files Browse the repository at this point in the history
Update phantomjs & npm dependencies
  • Loading branch information
justengland authored Dec 18, 2016
2 parents f491dea + d925654 commit 327333e
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
.env
context.json
*.env
32 changes: 0 additions & 32 deletions build-phantomjs.sh

This file was deleted.

17 changes: 8 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ exports.handler = function( event, context ) {
fs = require('fs'),
os = require('os'),
http = require('http'),
phantomDownloadPath = "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64-symbols.tar.bz2",
childProcess = require('child_process');

// Get the path to the phantomjs application
function getPhantomFileName(callback) {
var nodeModulesPath = path.join(__dirname, 'node_modules');
var nodeModulesPath = path.join(__dirname, 'node_modules', 'phantomjs-prebuilt');
fs.exists(nodeModulesPath, function(exists) {
if (exists) {
callback(path.join(__dirname, 'node_modules','phantomjs', 'bin', 'phantomjs'));
callback(path.join(__dirname, 'node_modules','phantomjs-prebuilt', 'bin', 'phantomjs'));
}
else {
callback(path.join(__dirname, 'phantomjs'));
Expand All @@ -25,11 +24,11 @@ exports.handler = function( event, context ) {
// Call the phantomjs script
function callPhantom(callback) {
getPhantomFileName(function(phantomJsPath) {

var childArgs = [
path.join(__dirname, 'phantomjs-script.js')
];

// replace default phantomjs script with something the invoker sent
if (event && event.code) {
childArgs[0] = generateTmpScript()
Expand All @@ -48,20 +47,20 @@ exports.handler = function( event, context ) {

console.log('Calling phantom: ', phantomJsPath, childArgs);
var ls = childProcess.execFile(phantomJsPath, childArgs);

ls.stdout.on('data', function (data) { // register one or more handlers
console.log(data);
});

ls.stderr.on('data', function (data) {
console.log('phantom error ---:> ' + data);
});

ls.on('exit', function (code) {
console.log('child process exited with code ' + code);
callback();
});

});
}

Expand Down
Binary file removed libicudata.so.50
Binary file not shown.
Binary file removed libicui18n.so.50
Binary file not shown.
Binary file removed libicuio.so.50
Binary file not shown.
Binary file removed libicule.so.50
Binary file not shown.
Binary file removed libiculx.so.50
Binary file not shown.
Binary file removed libicutest.so.50
Binary file not shown.
Binary file removed libicutu.so.50
Binary file not shown.
Binary file removed libicuuc.so.50
Binary file not shown.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"homepage": "https://github.com/rebelmail/node-lambda-template",
"dependencies": {},
"devDependencies": {
"aws-sdk": "^2.1.39",
"mocha": "^2.3.2",
"node-lambda": "^0.8.5",
"phantomjs": "^1.9.17"
"aws-sdk": "^2.7.8",
"mocha": "^3.2.0",
"node-lambda": "^0.8.11",
"phantomjs-prebuilt": "^2.1.13"
},
"scripts": {
"setup": "node-lambda setup",
Expand Down
Binary file modified phantomjs
Binary file not shown.

0 comments on commit 327333e

Please sign in to comment.