From f3d8b7998e8930489b430ac51db5dbd9054f0320 Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 7 Dec 2016 13:30:58 +0100 Subject: [PATCH 1/5] Update package.json From 8f99aa73513c0d36446a53ade1454ac1c37c189a Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 7 Dec 2016 13:32:05 +0100 Subject: [PATCH 2/5] Update package.json From 4f7ba565770fe575179edf24873fd6185dc0ffb1 Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 7 Dec 2016 23:47:55 +0100 Subject: [PATCH 3/5] Update package.json From 2911737d0c04b7d13f0eba4c408b8b536bb89e95 Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 8 Dec 2016 00:14:05 +0100 Subject: [PATCH 4/5] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f6747967..79f00337 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,6 @@ }, "scripts": { "test": "make test", - "postinstall": "./node_modules/protractor/bin/webdriver-manager update --versions.chrome=2.24" + "postinstall": "node _postinstall.js" } } From 420e48160423fc3083234dfc7fee3a63e1479a1b Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 8 Dec 2016 00:17:51 +0100 Subject: [PATCH 5/5] Create _postinstall.js --- _postinstall.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 _postinstall.js diff --git a/_postinstall.js b/_postinstall.js new file mode 100644 index 00000000..4b41aded --- /dev/null +++ b/_postinstall.js @@ -0,0 +1,42 @@ +/* + * _postinstall.js is a script that runs automatically after the `npm install` + */ +// Get platform from node +var os = require('os'); +var platform = os.platform(); + +if (platform === 'darwin' || platform == 'linux') { + // Call child process and execute + var exec = require('child_process').exec; + + exec('./node_modules/protractor/bin/webdriver-manager update --versions.chrome=2.24', function (error, stdout, stderr) { + console.log('Setting up Selenium Server'); + console.log(stdout); + + if (error !== null) { + console.log(error); + } else { + console.log('Selenium Server setup was successful.'); + } + }); + + return; +} else if (platform === 'win32') { + var exec = require('child_process').exec; + + exec('node.exe node_modules/protractor/bin/webdriver-manager update --versions.chrome=2.24', function (error, stdout, stderr) { + console.log('Setting up Selenium Server'); + console.log(stdout); + + if (error !== null) { + console.log(error); + } else { + console.log('Selenium Server setup was successful.'); + } + }); + + return; +} + +console.error('Unknown environment. Please log an issue at https://github.com/marmelab/ng-admin/issues:', platform); +process.exit(1);