-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Default '--version' value? #122
Comments
Yeah this would awesome! As I have just had an issue where we were building from old versions of Electron as we had the versions hard-coded in the gruntfiles. So to have it default to latest version if none is specified would be perfect. |
Oh it's awesome that i'm just viewing another issue opened by you.. quite a coincidence! |
You may be interested in PR #94. |
@malept cool |
I've written a little build.js script which doesn't rely on npm as a module (sort of, it uses the global npm cli) and can pinpoint both the local and latest version and handle timeouts. function run_cmd(cmd, args, callBack ) {
var spawn = require('child_process').spawn;
var child = spawn(cmd, args);
var resp = "";
child.stdout.on('data', function (buffer) { resp += buffer.toString() });
child.stdout.on('end', function() { callBack (resp) });
return child;
}
function latestElectronVersion(versionCallback){
var proc, timeout;
console.log('Looking up latest Electron version...');
var proc = run_cmd('npm',['view','electron-prebuilt','version'],function(versionString){
versionCallback(versionString.trim());
clearTimeout(timeout);
});
timeout = setTimeout(function() {
console.error('Latest Electron version lookup timed out');
proc.kill();
process.exit(1);
}, 1000 * 10); // 10s
}
function localElectronVersion(versionCallback){
console.log('Looking up local Electron version...');
run_cmd('npm',['list', 'electron-prebuilt', '--json'], function(json){
versionCallback(JSON.parse(json).dependencies['electron-prebuilt'].version);
});
} I use this as part of my build script, and I plan on moving more build options to my package.json to help center my configs: var package = require('./package.json');
latestElectronVersion(function(version){
build({
'platform': 'darwin',
'arch': 'x64',
'version': version,
'name': package.name,
'app-version': package.version,
'dir': './',
'out': './build',
'ignore': '\.\/build',
'overwrite': true,
'icon': 'Icon.icns',
'prune' : true
});
}); but I think it'd make more send to have |
#94 has been merged, it defaults to the Electron version specified by |
cool |
As index.js#L153 it seems that the --version flag is required
But it seems to bring troubles to writing build scripts
Can we auto detect from '~/.electron' directory and fetch the latest version as default?
Or any tips? Thanks. 😄
Also, default '--platform' and '--arch'?
The text was updated successfully, but these errors were encountered: