Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Npm postinstall for linux / windows #1266

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions _postinstall.js
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@
},
"scripts": {
"test": "make test",
"postinstall": "./node_modules/protractor/bin/webdriver-manager update --versions.chrome=2.24"
"postinstall": "node _postinstall.js"
}
}