electron-mksnapshot
Advanced tools
Comparing version 9.0.1 to 9.0.2
@@ -1,7 +0,7 @@ | ||
var fs = require('fs') | ||
var path = require('path') | ||
var electronDownload = require('electron-download') | ||
var extractZip = require('extract-zip') | ||
var versionToDownload = require('./package').version | ||
var archToDownload = process.env.npm_config_arch | ||
const fs = require('fs') | ||
const path = require('path') | ||
const { downloadArtifact } = require('@electron/get') | ||
const extractZip = require('extract-zip') | ||
const versionToDownload = require('./package').version | ||
let archToDownload = process.env.npm_config_arch | ||
@@ -26,21 +26,23 @@ if (process.arch.indexOf('arm') === 0) { | ||
function download (version, callback) { | ||
electronDownload({ | ||
function download (version) { | ||
return downloadArtifact({ | ||
version: version, | ||
mksnapshot: true, | ||
artifactName: 'mksnapshot', | ||
platform: process.env.npm_config_platform, | ||
arch: archToDownload, | ||
strictSSL: process.env.npm_config_strict_ssl === 'true', | ||
rejectUnauthorized: process.env.npm_config_strict_ssl === 'true', | ||
quiet: ['info', 'verbose', 'silly', 'http'].indexOf(process.env.npm_config_loglevel) === -1 | ||
}, callback) | ||
}) | ||
} | ||
function processDownload (err, zipPath) { | ||
if (err != null) throw err | ||
extractZip(zipPath, { dir: path.join(__dirname, 'bin') }, function (error) { | ||
if (error != null) throw error | ||
if (process.platform !== 'win32') { | ||
var mksnapshotPath = path.join(__dirname, 'bin', 'mksnapshot') | ||
async function attemptDownload (version) { | ||
try { | ||
const targetFolder = path.join(__dirname, 'bin') | ||
const zipPath = await download(version) | ||
await extractZip(zipPath, { dir: targetFolder }) | ||
const platform = process.env.npm_config_platform || process.platform | ||
if (platform !== 'win32') { | ||
const mksnapshotPath = path.join(__dirname, 'bin', 'mksnapshot') | ||
if (fs.existsSync(mksnapshotPath)) { | ||
fs.chmod(path.join(__dirname, 'bin', 'mksnapshot'), '755', function (error) { | ||
fs.chmod(mksnapshotPath, '755', function (error) { | ||
if (error != null) throw error | ||
@@ -50,13 +52,16 @@ }) | ||
} | ||
}) | ||
} catch (err) { | ||
// attempt to fall back to semver minor | ||
const parts = version.split('.') | ||
const baseVersion = `${parts[0]}.${parts[1]}.0` | ||
// don't recurse infinitely | ||
if (baseVersion === version) { | ||
throw err | ||
} else { | ||
await attemptDownload(baseVersion) | ||
} | ||
} | ||
} | ||
download(versionToDownload, function (err, zipPath) { | ||
if (err) { | ||
var versionSegments = versionToDownload.split('.') | ||
var baseVersion = versionSegments[0] + '.' + versionSegments[1] + '.0' | ||
download(baseVersion, processDownload) | ||
} else { | ||
processDownload(err, zipPath) | ||
} | ||
}) | ||
attemptDownload(versionToDownload) |
{ | ||
"name": "electron-mksnapshot", | ||
"version": "9.0.1", | ||
"version": "9.0.2", | ||
"description": "Electron version of the mksnapshot binary", | ||
@@ -15,3 +15,3 @@ "repository": "https://github.com/electron/mksnapshot", | ||
"dependencies": { | ||
"electron-download": "^4.1.0", | ||
"@electron/get": "^1.12.2", | ||
"extract-zip": "^2.0.0", | ||
@@ -18,0 +18,0 @@ "fs-extra": "^7.0.1", |
@@ -44,2 +44,12 @@ # Electron mksnapshot | ||
``` | ||
## Overriding the version downloaded | ||
The version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable. | ||
```sh | ||
# Install mksnapshot for Electron v8.3.0 | ||
ELECTRON_CUSTOM_VERSION=8.3.0 npm install | ||
``` | ||
## Generating snapshots for ARM hardware | ||
@@ -46,0 +56,0 @@ |
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
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
12299
176
78
10
+ Added@electron/get@^1.12.2
+ Added@electron/get@1.14.1(transitive)
+ Added@sindresorhus/is@0.14.0(transitive)
+ Added@szmarczak/http-timer@1.1.2(transitive)
+ Addedboolean@3.2.0(transitive)
+ Addedcacheable-request@6.1.0(transitive)
+ Addedclone-response@1.0.3(transitive)
+ Addedconfig-chain@1.1.13(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddefer-to-connect@1.1.3(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddetect-node@2.1.0(transitive)
+ Addedduplexer3@0.1.5(transitive)
+ Addedencodeurl@1.0.2(transitive)
+ Addedenv-paths@2.2.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes6-error@4.1.1(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedfs-extra@8.1.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-stream@4.1.0(transitive)
+ Addedglobal-agent@3.0.0(transitive)
+ Addedglobal-tunnel-ng@2.7.1(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedgot@9.6.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhttp-cache-semantics@4.1.1(transitive)
+ Addedjson-buffer@3.0.0(transitive)
+ Addedkeyv@3.1.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlowercase-keys@1.0.12.0.0(transitive)
+ Addedmatcher@3.0.0(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addednormalize-url@4.5.1(transitive)
+ Addednpm-conf@1.1.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedp-cancelable@1.1.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedprepend-http@2.0.0(transitive)
+ Addedprogress@2.0.3(transitive)
+ Addedproto-list@1.2.4(transitive)
+ Addedresponselike@1.0.2(transitive)
+ Addedroarr@2.15.4(transitive)
+ Addedsemver@6.3.17.6.3(transitive)
+ Addedsemver-compare@1.0.0(transitive)
+ Addedserialize-error@7.0.1(transitive)
+ Addedsprintf-js@1.1.3(transitive)
+ Addedsumchecker@3.0.1(transitive)
+ Addedto-readable-stream@1.0.0(transitive)
+ Addedtunnel@0.0.6(transitive)
+ Addedtype-fest@0.13.1(transitive)
+ Addedurl-parse-lax@3.0.0(transitive)
- Removedelectron-download@^4.1.0
- Removedajv@6.12.6(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.21.0.3(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddebug@2.6.93.2.7(transitive)
- Removeddeep-extend@0.6.0(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedelectron-download@4.1.1(transitive)
- Removedenv-paths@1.0.0(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedfs-extra@4.0.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimist@1.2.8(transitive)
- Removedms@2.0.0(transitive)
- Removednugget@2.2.0(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedobject-keys@0.4.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpretty-bytes@4.0.2(transitive)
- Removedprogress-stream@1.2.0(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrc@1.2.8(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsingle-line-log@1.1.2(transitive)
- Removedspeedometer@0.1.4(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedsumchecker@2.0.2(transitive)
- Removedthrottleit@0.0.2(transitive)
- Removedthrough2@0.2.3(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedxtend@2.1.2(transitive)