electron-prebuilt
Advanced tools
Comparing version 0.25.1 to 0.25.2-1
@@ -5,9 +5,11 @@ #!/usr/bin/env node | ||
var path = require('path') | ||
var pathExists = require('path-exists') | ||
var mkdir = require('mkdirp') | ||
var nugget = require('nugget') | ||
var extract = require('extract-zip') | ||
var fs = require('fs') | ||
var getHomePath = require('home-path')() | ||
var platform = os.platform() | ||
var arch = os.arch() | ||
var version = '0.25.1' | ||
var version = '0.25.2' | ||
var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip' | ||
@@ -26,23 +28,22 @@ var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip' | ||
var shebang = { | ||
darwin: '#!/bin/bash\n', | ||
linux: '#!/bin/bash\n', | ||
win32: '' | ||
} | ||
var cache = path.join(getHomePath, './.electron') | ||
var argv = { | ||
darwin: '"$@"', | ||
linux: '"$@"', | ||
win32: '%*' // does this work with " " in the args? | ||
if (!paths[platform]) throw new Error('Unknown platform: ' + platform) | ||
// use cache if possible | ||
if (pathExists.sync(path.join(cache, filename))) { | ||
extractFile() | ||
} else { | ||
mkdir(cache, function(err) { | ||
if (err) return onerror(err) | ||
nugget(url, {target: filename, dir: cache, resume: true, verbose: true}, extractFile) | ||
}) | ||
} | ||
if (!paths[platform]) throw new Error('Unknown platform: ' + platform) | ||
nugget(url, {target: filename, dir: __dirname, resume: true, verbose: true}, function (err) { | ||
function extractFile (err) { | ||
if (err) return onerror(err) | ||
fs.writeFileSync(path.join(__dirname, 'path.txt'), paths[platform]) | ||
fs.writeFileSync(path.join(__dirname, 'run.bat'), shebang[platform] + '"' + paths[platform] + '" ' + argv[platform]) | ||
extract(path.join(__dirname, filename), {dir: path.join(__dirname, 'dist')}, function (err) { | ||
extract(path.join(cache, filename), {dir: path.join(__dirname, 'dist')}, function (err) { | ||
if (err) return onerror(err) | ||
}) | ||
}) | ||
} |
{ | ||
"name": "electron-prebuilt", | ||
"version": "0.25.1", | ||
"version": "0.25.2-1", | ||
"description": "Install electron (formerly called atom-shell) prebuilts using npm", | ||
@@ -11,6 +11,7 @@ "repository": { | ||
"install": "node install.js", | ||
"test": "tape test/*.js" | ||
"test": "tape test/*.js", | ||
"cache-clean": "rimraf ~/.electron" | ||
}, | ||
"bin": { | ||
"electron": "run.bat" | ||
"electron": "cli.js" | ||
}, | ||
@@ -20,5 +21,9 @@ "main": "index.js", | ||
"extract-zip": "^1.0.3", | ||
"nugget": "^1.2.0" | ||
"home-path": "^0.1.1", | ||
"mkdirp": "^0.5.0", | ||
"nugget": "^1.2.0", | ||
"path-exists": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "^2.3.3", | ||
"tape": "^3.0.1" | ||
@@ -25,0 +30,0 @@ }, |
var tape = require('tape') | ||
var electron = require('../') | ||
var fs = require('fs') | ||
var path = require('path'); | ||
var pathExists = require('path-exists') | ||
var getHomePath = require('home-path')() | ||
tape('has binary', function(t) { | ||
t.ok(fs.existsSync(electron), 'electron was downloaded') | ||
tape('has local binary', function(t) { | ||
t.ok(pathExists.sync(electron), 'electron was downloaded') | ||
t.end() | ||
}) | ||
}) | ||
tape('has cache folder', function(t) { | ||
t.ok(pathExists.sync(path.join(getHomePath, './.electron')), 'cache exists') | ||
t.end() | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
5339
60
2
5
2
9
1
+ Addedhome-path@^0.1.1
+ Addedmkdirp@^0.5.0
+ Addedpath-exists@^1.0.0
+ Addedhome-path@0.1.2(transitive)
+ Addedpath-exists@1.0.0(transitive)