Initial commit
This commit is contained in:
5
node_modules/electron-download/CODE_OF_CONDUCT.md
generated
vendored
Normal file
5
node_modules/electron-download/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Code of Conduct
|
||||
|
||||
This project is a part of the Electron ecosystem. As such, all contributions to this project follow
|
||||
[Electron's code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md)
|
||||
where appropriate.
|
||||
29
node_modules/electron-download/LICENSE
generated
vendored
Normal file
29
node_modules/electron-download/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, Electron Userland
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
8
node_modules/electron-download/collaborators.md
generated
vendored
Normal file
8
node_modules/electron-download/collaborators.md
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
## Collaborators
|
||||
|
||||
electron-download is only possible due to the excellent work of the following collaborators:
|
||||
|
||||
<table><tbody><tr><th align="left">maxogden</th><td><a href="https://github.com/maxogden">GitHub/maxogden</a></td></tr>
|
||||
<tr><th align="left">mafintosh</th><td><a href="https://github.com/mafintosh">GitHub/mafintosh</a></td></tr>
|
||||
<tr><th align="left">fritx</th><td><a href="https://github.com/fritx">GitHub/fritx</a></td></tr>
|
||||
</tbody></table>
|
||||
30
node_modules/electron-download/lib/arch.js
generated
vendored
Normal file
30
node_modules/electron-download/lib/arch.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
const execSync = require('child_process').execSync
|
||||
|
||||
module.exports = {
|
||||
host: function host (quiet) {
|
||||
const arch = process.arch
|
||||
if (arch === 'arm') {
|
||||
switch (process.config.variables.arm_version) {
|
||||
case '6':
|
||||
return module.exports.uname()
|
||||
case '7':
|
||||
return 'armv7l'
|
||||
default:
|
||||
if (!quiet) {
|
||||
console.warn(`WARNING: Could not determine specific ARM arch. Detected ARM version: ${JSON.stringify(process.config.variables.arm_version)}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return arch
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the arch name from the `uname` utility.
|
||||
*/
|
||||
uname: function uname () {
|
||||
return execSync('uname -m').toString().trim()
|
||||
}
|
||||
}
|
||||
18
node_modules/electron-download/lib/cli.js
generated
vendored
Executable file
18
node_modules/electron-download/lib/cli.js
generated
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
const download = require('./')
|
||||
const minimist = require('minimist')
|
||||
|
||||
const opts = minimist(process.argv.slice(2))
|
||||
|
||||
if (opts['strict-ssl'] === false) {
|
||||
opts.strictSSL = false
|
||||
}
|
||||
|
||||
download(opts, (err, zipPath) => {
|
||||
if (err) throw err
|
||||
console.log('Downloaded zip:', zipPath)
|
||||
process.exit(0)
|
||||
})
|
||||
336
node_modules/electron-download/lib/index.js
generated
vendored
Normal file
336
node_modules/electron-download/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
'use strict'
|
||||
|
||||
const arch = require('./arch')
|
||||
const debug = require('debug')('electron-download')
|
||||
const envPaths = require('env-paths')
|
||||
const fs = require('fs-extra')
|
||||
const rc = require('rc')
|
||||
const nugget = require('nugget')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const pathExists = require('path-exists')
|
||||
const semver = require('semver')
|
||||
const sumchecker = require('sumchecker')
|
||||
|
||||
class ElectronDownloader {
|
||||
constructor (opts) {
|
||||
this.opts = Object.assign({ autoDownload: true }, opts)
|
||||
if (this.opts.force && !this.opts.autoDownload) {
|
||||
throw new Error('force and autoDownload options are incompatible for Electron Download')
|
||||
}
|
||||
|
||||
this.npmrc = {}
|
||||
try {
|
||||
rc('npm', this.npmrc)
|
||||
} catch (error) {
|
||||
console.error(`Error reading npm configuration: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
get baseUrl () {
|
||||
if (this.version.indexOf('nightly') !== -1) {
|
||||
return process.env.NPM_CONFIG_ELECTRON_NIGHTLY_MIRROR ||
|
||||
process.env.npm_config_electron_nightly_mirror ||
|
||||
process.env.npm_package_config_electron_nightly_mirror ||
|
||||
process.env.ELECTRON_NIGHTLY_MIRROR ||
|
||||
this.opts.nightly_mirror ||
|
||||
'https://github.com/electron/nightlies/releases/download/v'
|
||||
}
|
||||
return process.env.NPM_CONFIG_ELECTRON_MIRROR ||
|
||||
process.env.npm_config_electron_mirror ||
|
||||
process.env.npm_package_config_electron_mirror ||
|
||||
process.env.ELECTRON_MIRROR ||
|
||||
this.opts.mirror ||
|
||||
'https://github.com/electron/electron/releases/download/v'
|
||||
}
|
||||
|
||||
get middleUrl () {
|
||||
return process.env.NPM_CONFIG_ELECTRON_CUSTOM_DIR ||
|
||||
process.env.npm_config_electron_custom_dir ||
|
||||
process.env.npm_package_config_electron_custom_dir ||
|
||||
process.env.ELECTRON_CUSTOM_DIR ||
|
||||
this.opts.customDir ||
|
||||
this.version
|
||||
}
|
||||
|
||||
get urlSuffix () {
|
||||
return process.env.NPM_CONFIG_ELECTRON_CUSTOM_FILENAME ||
|
||||
process.env.npm_config_electron_custom_filename ||
|
||||
process.env.npm_package_config_electron_custom_filename ||
|
||||
process.env.ELECTRON_CUSTOM_FILENAME ||
|
||||
this.opts.customFilename ||
|
||||
this.filename
|
||||
}
|
||||
|
||||
get arch () {
|
||||
return this.opts.arch || arch.host(this.quiet)
|
||||
}
|
||||
|
||||
get cache () {
|
||||
const cacheLocation = this.opts.cache || process.env.ELECTRON_CACHE
|
||||
if (cacheLocation) return cacheLocation
|
||||
|
||||
const oldCacheDirectory = path.join(os.homedir(), './.electron')
|
||||
if (pathExists.sync(path.join(oldCacheDirectory, this.filename))) {
|
||||
return oldCacheDirectory
|
||||
}
|
||||
// use passed argument or XDG environment variable fallback to OS default
|
||||
return envPaths('electron', {suffix: ''}).cache
|
||||
}
|
||||
|
||||
get cachedChecksum () {
|
||||
return path.join(this.cache, `${this.checksumFilename}-${this.version}`)
|
||||
}
|
||||
|
||||
get cachedZip () {
|
||||
return path.join(this.cache, this.filename)
|
||||
}
|
||||
|
||||
get checksumFilename () {
|
||||
return 'SHASUMS256.txt'
|
||||
}
|
||||
|
||||
get checksumUrl () {
|
||||
return `${this.baseUrl}${this.middleUrl}/${this.checksumFilename}`
|
||||
}
|
||||
|
||||
get filename () {
|
||||
const type = `${this.platform}-${this.arch}`
|
||||
const suffix = `v${this.version}-${type}`
|
||||
|
||||
if (this.chromedriver) {
|
||||
// Chromedriver started using Electron's version in asset name in 1.7.0
|
||||
if (semver.gte(this.version, '1.7.0')) {
|
||||
return `chromedriver-${suffix}.zip`
|
||||
} else {
|
||||
return `chromedriver-v2.21-${type}.zip`
|
||||
}
|
||||
} else if (this.mksnapshot) {
|
||||
return `mksnapshot-${suffix}.zip`
|
||||
} else if (this.ffmpeg) {
|
||||
return `ffmpeg-${suffix}.zip`
|
||||
} else if (this.symbols) {
|
||||
return `electron-${suffix}-symbols.zip`
|
||||
} else if (this.dsym) {
|
||||
return `electron-${suffix}-dsym.zip`
|
||||
} else {
|
||||
return `electron-${suffix}.zip`
|
||||
}
|
||||
}
|
||||
|
||||
get platform () {
|
||||
return this.opts.platform || os.platform()
|
||||
}
|
||||
|
||||
get proxy () {
|
||||
let proxy
|
||||
if (this.npmrc && this.npmrc.proxy) proxy = this.npmrc.proxy
|
||||
if (this.npmrc && this.npmrc['https-proxy']) proxy = this.npmrc['https-proxy']
|
||||
|
||||
return proxy
|
||||
}
|
||||
|
||||
get quiet () {
|
||||
return this.opts.quiet || process.stdout.rows < 1
|
||||
}
|
||||
|
||||
get strictSSL () {
|
||||
let strictSSL = true
|
||||
if (this.opts.strictSSL === false || this.npmrc['strict-ssl'] === false) {
|
||||
strictSSL = false
|
||||
}
|
||||
|
||||
return strictSSL
|
||||
}
|
||||
|
||||
get force () {
|
||||
return this.opts.force || false
|
||||
}
|
||||
|
||||
get symbols () {
|
||||
return this.opts.symbols || false
|
||||
}
|
||||
|
||||
get dsym () {
|
||||
return this.opts.dsym || false
|
||||
}
|
||||
|
||||
get chromedriver () {
|
||||
return this.opts.chromedriver || false
|
||||
}
|
||||
|
||||
get mksnapshot () {
|
||||
return this.opts.mksnapshot || false
|
||||
}
|
||||
|
||||
get ffmpeg () {
|
||||
return this.opts.ffmpeg || false
|
||||
}
|
||||
|
||||
get url () {
|
||||
return process.env.ELECTRON_DOWNLOAD_OVERRIDE_URL ||
|
||||
`${this.baseUrl}${this.middleUrl}/${this.urlSuffix}`
|
||||
}
|
||||
|
||||
get verifyChecksumNeeded () {
|
||||
return !this.opts.disableChecksumSafetyCheck && semver.gte(this.version, '1.3.2')
|
||||
}
|
||||
|
||||
get version () {
|
||||
return this.opts.version
|
||||
}
|
||||
|
||||
get headers () {
|
||||
return this.opts.headers
|
||||
}
|
||||
|
||||
checkForCachedChecksum (cb) {
|
||||
pathExists(this.cachedChecksum)
|
||||
.then(exists => {
|
||||
if (exists && !this.force) {
|
||||
this.verifyChecksum(cb)
|
||||
} else {
|
||||
this.downloadChecksum(cb)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkForCachedZip (cb) {
|
||||
pathExists(this.cachedZip).then(exists => {
|
||||
if (exists && !this.force) {
|
||||
debug('zip exists', this.cachedZip)
|
||||
this.checkIfZipNeedsVerifying(cb)
|
||||
} else if (this.opts.autoDownload) {
|
||||
this.ensureCacheDir(cb)
|
||||
} else {
|
||||
cb(new Error(`File: "${this.cachedZip}" does not exist locally and autoDownload is false`))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
checkIfZipNeedsVerifying (cb) {
|
||||
if (this.verifyChecksumNeeded) {
|
||||
debug('Verifying zip with checksum')
|
||||
return this.checkForCachedChecksum(cb)
|
||||
}
|
||||
return cb(null, this.cachedZip)
|
||||
}
|
||||
|
||||
createCacheDir (cb) {
|
||||
fs.mkdirs(this.cache, (err) => {
|
||||
if (err) {
|
||||
if (err.code !== 'EACCES') return cb(err)
|
||||
// try local folder if homedir is off limits (e.g. some linuxes return '/' as homedir)
|
||||
const localCache = path.resolve('./.electron')
|
||||
return fs.mkdirs(localCache, function (err) {
|
||||
if (err) return cb(err)
|
||||
cb(null, localCache)
|
||||
})
|
||||
}
|
||||
cb(null, this.cache)
|
||||
})
|
||||
}
|
||||
|
||||
downloadChecksum (cb) {
|
||||
this.downloadFile(this.checksumUrl, this.cachedChecksum, cb, this.verifyChecksum.bind(this))
|
||||
}
|
||||
|
||||
downloadFile (url, cacheFilename, cb, onSuccess) {
|
||||
const tempFileName = `tmp-${process.pid}-${(ElectronDownloader.tmpFileCounter++).toString(16)}-${path.basename(cacheFilename)}`
|
||||
debug('downloading', url, 'to', this.cache)
|
||||
const nuggetOpts = {
|
||||
target: tempFileName,
|
||||
dir: this.cache,
|
||||
resume: true,
|
||||
quiet: this.quiet,
|
||||
strictSSL: this.strictSSL,
|
||||
proxy: this.proxy,
|
||||
headers: this.headers
|
||||
}
|
||||
nugget(url, nuggetOpts, (errors) => {
|
||||
if (errors) {
|
||||
// nugget returns an array of errors but we only need 1st because we only have 1 url
|
||||
return this.handleDownloadError(cb, errors[0])
|
||||
}
|
||||
|
||||
this.moveFileToCache(tempFileName, cacheFilename, cb, onSuccess)
|
||||
})
|
||||
}
|
||||
|
||||
downloadIfNotCached (cb) {
|
||||
if (!this.version) return cb(new Error('must specify version'))
|
||||
debug('info', {cache: this.cache, filename: this.filename, url: this.url})
|
||||
this.checkForCachedZip(cb)
|
||||
}
|
||||
|
||||
downloadZip (cb) {
|
||||
this.downloadFile(this.url, this.cachedZip, cb, this.checkIfZipNeedsVerifying.bind(this))
|
||||
}
|
||||
|
||||
ensureCacheDir (cb) {
|
||||
debug('creating cache dir')
|
||||
this.createCacheDir((err, actualCache) => {
|
||||
if (err) return cb(err)
|
||||
this.opts.cache = actualCache // in case cache dir changed
|
||||
this.downloadZip(cb)
|
||||
})
|
||||
}
|
||||
|
||||
handleDownloadError (cb, error) {
|
||||
if (error.message.indexOf('404') === -1) return cb(error)
|
||||
if (this.symbols) {
|
||||
error.message = `Failed to find Electron symbols v${this.version} for ${this.platform}-${this.arch} at ${this.url}`
|
||||
} else {
|
||||
error.message = `Failed to find Electron v${this.version} for ${this.platform}-${this.arch} at ${this.url}`
|
||||
}
|
||||
|
||||
return cb(error)
|
||||
}
|
||||
|
||||
moveFileToCache (filename, target, cb, onSuccess) {
|
||||
const cache = this.cache
|
||||
debug('moving', filename, 'from', cache, 'to', target)
|
||||
fs.rename(path.join(cache, filename), target, (err) => {
|
||||
if (err) {
|
||||
fs.unlink(cache, cleanupError => {
|
||||
try {
|
||||
if (cleanupError) {
|
||||
console.error(`Error deleting cache file: ${cleanupError.message}`)
|
||||
}
|
||||
} finally {
|
||||
cb(err)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
onSuccess(cb)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
verifyChecksum (cb) {
|
||||
const options = {}
|
||||
if (semver.lt(this.version, '1.3.5')) {
|
||||
options.defaultTextEncoding = 'binary'
|
||||
}
|
||||
const checker = new sumchecker.ChecksumValidator('sha256', this.cachedChecksum, options)
|
||||
checker.validate(this.cache, this.filename).then(() => {
|
||||
cb(null, this.cachedZip)
|
||||
}, (err) => {
|
||||
fs.unlink(this.cachedZip, (fsErr) => {
|
||||
if (fsErr) return cb(fsErr)
|
||||
cb(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
ElectronDownloader.tmpFileCounter = 0
|
||||
|
||||
module.exports = function download (opts, cb) {
|
||||
try {
|
||||
const downloader = new ElectronDownloader(opts)
|
||||
downloader.downloadIfNotCached(cb)
|
||||
} catch (err) {
|
||||
cb(err)
|
||||
}
|
||||
}
|
||||
91
node_modules/electron-download/package.json
generated
vendored
Normal file
91
node_modules/electron-download/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"_from": "electron-download@^4.1.0",
|
||||
"_id": "electron-download@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==",
|
||||
"_location": "/electron-download",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "electron-download@^4.1.0",
|
||||
"name": "electron-download",
|
||||
"escapedName": "electron-download",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.1.tgz",
|
||||
"_shasum": "02e69556705cc456e520f9e035556ed5a015ebe8",
|
||||
"_spec": "electron-download@^4.1.0",
|
||||
"_where": "/home/super/Downloads/destfolder/node_modules/electron",
|
||||
"author": {
|
||||
"name": "max ogden"
|
||||
},
|
||||
"bin": {
|
||||
"electron-download": "lib/cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/electron-userland/electron-download/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"debug": "^3.0.0",
|
||||
"env-paths": "^1.0.0",
|
||||
"fs-extra": "^4.0.1",
|
||||
"minimist": "^1.2.0",
|
||||
"nugget": "^2.0.1",
|
||||
"path-exists": "^3.0.0",
|
||||
"rc": "^1.2.1",
|
||||
"semver": "^5.4.1",
|
||||
"sumchecker": "^2.0.2"
|
||||
},
|
||||
"deprecated": "Please use @electron/get moving forward.",
|
||||
"description": "download electron prebuilt binary zips from github releases",
|
||||
"devDependencies": {
|
||||
"eslint": "^4.4.1",
|
||||
"eslint-config-standard": "^10.2.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-plugin-node": "^5.1.1",
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"sinon": "^6.1.4",
|
||||
"tape": "^4.8.0",
|
||||
"temp": "^0.8.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "standard",
|
||||
"parserOptions": {
|
||||
"sourceType": "script"
|
||||
},
|
||||
"rules": {
|
||||
"strict": [
|
||||
"error"
|
||||
],
|
||||
"prefer-const": [
|
||||
"error"
|
||||
]
|
||||
}
|
||||
},
|
||||
"homepage": "https://github.com/electron-userland/electron-download#readme",
|
||||
"keywords": [],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"name": "electron-download",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/electron-userland/electron-download.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"test": "npm run unit-tests && npm run lint",
|
||||
"unit-tests": "tape test/*.js"
|
||||
},
|
||||
"version": "4.1.1"
|
||||
}
|
||||
106
node_modules/electron-download/readme.md
generated
vendored
Normal file
106
node_modules/electron-download/readme.md
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
# electron-download
|
||||
|
||||
[](https://travis-ci.org/electron-userland/electron-download)
|
||||
[](https://ci.appveyor.com/project/electron-bot/electron-download/branch/master)
|
||||
|
||||
[](https://www.npmjs.com/package/electron-download)
|
||||
|
||||
Downloads an Electron release zip from GitHub.
|
||||
|
||||
Used by [electron-prebuilt](https://npmjs.org/electron-prebuilt) and [electron-packager](https://npmjs.org/electron-packager)
|
||||
|
||||
### Usage
|
||||
|
||||
**Note: Requires Node >= 4.0 to run.**
|
||||
|
||||
```shell
|
||||
$ npm install --global electron-download
|
||||
$ electron-download --version=0.31.1
|
||||
```
|
||||
|
||||
```javascript
|
||||
const download = require('electron-download')
|
||||
|
||||
download({
|
||||
version: '0.25.1',
|
||||
arch: 'ia32',
|
||||
platform: 'win32',
|
||||
cache: './zips'
|
||||
}, function (err, zipPath) {
|
||||
// zipPath will be the path of the zip that it downloaded.
|
||||
// If the zip was already cached it will skip
|
||||
// downloading and call the cb with the cached zip path.
|
||||
// If it wasn't cached it will download the zip and save
|
||||
// it in the cache path.
|
||||
})
|
||||
```
|
||||
|
||||
If you don't specify `arch` or `platform` args it will use the built-in `os` module to get the values from the current OS. Specifying `version` is mandatory. If there is a `SHASUMS256.txt` file available for the `version`, the file downloaded will be validated against its checksum to ensure that it was downloaded without errors.
|
||||
|
||||
You can also use `electron-download` to download the `chromedriver`, `ffmpeg`,
|
||||
`mksnapshot`, and symbols assets for a specific Electron release. This can be
|
||||
configured by setting the `chromedriver`, `ffmpeg`, `mksnapshot`, or
|
||||
`symbols` property to `true` in the specified options object. Only one of
|
||||
these options may be specified per download call.
|
||||
|
||||
You can force a re-download of the asset and the `SHASUM` file by setting the
|
||||
`force` option to `true`.
|
||||
|
||||
If you would like to override the mirror location, three options are available. The mirror URL is composed as `url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME`.
|
||||
|
||||
You can set the `ELECTRON_MIRROR` or [`NPM_CONFIG_ELECTRON_MIRROR`](https://docs.npmjs.com/misc/config#environment-variables) environment variable or `mirror` opt variable to use a custom base URL for grabbing Electron zips. The same pattern applies to `ELECTRON_CUSTOM_DIR` and `ELECTRON_CUSTOM_FILENAME`:
|
||||
|
||||
```plain
|
||||
## Electron Mirror of China
|
||||
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
|
||||
|
||||
## or for a local mirror
|
||||
ELECTRON_MIRROR="https://10.1.2.105/"
|
||||
ELECTRON_CUSTOM_DIR="our/internal/filePath"
|
||||
ELECTRON_CUSTOM_FILENAME="electron.zip"
|
||||
```
|
||||
|
||||
You can set ELECTRON_MIRROR in `.npmrc` as well, using the lowercase name:
|
||||
|
||||
```plain
|
||||
electron_mirror=https://10.1.2.105/
|
||||
electron_custom_dir="our/internal/filePath"
|
||||
electron_custom_filename="electron.zip"
|
||||
```
|
||||
|
||||
You can also set the same variables in your project's package.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"name" : "my-electron-project",
|
||||
"config" : {
|
||||
"electron_mirror": "https://10.1.2.105/",
|
||||
"electron_custom_dir": "our/internal/filePath",
|
||||
"electron_custom_filename": "electron.zip"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The order of precedence is:
|
||||
|
||||
1. npm config or .npmrc, uppercase (`process.env.NPM_CONFIG_ELECTRON_*`)
|
||||
1. npm config or .npmrc, lowercase(`process.env.npm_config_electron_*`)
|
||||
1. package.json (`process.env.npm_package_config_electron_*`)
|
||||
1. environment variables (`process.env.ELECTRON_*`)
|
||||
1. the options given to `download`
|
||||
1. defaults
|
||||
|
||||
You can also disable checksum validation if you really want to (this is in
|
||||
general a bad idea). Do this by setting `disableChecksumSafetyCheck` to `true`
|
||||
in the options object. Use this only when testing local build of Electron,
|
||||
if you have internal builds of Electron you should generate the SHASUMS file
|
||||
yourself and let `electron-download` still perform its hash validations.
|
||||
|
||||
### Cache location
|
||||
The location of the cache depends on the operating system, the defaults are:
|
||||
- Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||
- MacOS: `~/Library/Caches/electron/`
|
||||
- Windows: `$LOCALAPPDATA/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||
|
||||
You can set the `ELECTRON_CACHE` environment variable to set cache location explicitly.
|
||||
|
||||
Reference in New Issue
Block a user