@electron/get
Advanced tools
Comparing version 1.10.0 to 1.12.0
import { ElectronArtifactDetails } from './types'; | ||
export declare function getArtifactFileName(details: ElectronArtifactDetails): string; | ||
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): string; | ||
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise<string>; |
@@ -33,3 +33,3 @@ "use strict"; | ||
} | ||
function getArtifactRemoteURL(details) { | ||
async function getArtifactRemoteURL(details) { | ||
const opts = details.mirrorOptions || {}; | ||
@@ -42,2 +42,7 @@ let base = mirrorVar('mirror', opts, BASE_URL); | ||
const file = mirrorVar('customFilename', opts, getArtifactFileName(details)); | ||
// Allow customized download URL resolution. | ||
if (opts.resolveAssetURL) { | ||
const url = await opts.resolveAssetURL(details); | ||
return url; | ||
} | ||
return `${base}${path}/${file}`; | ||
@@ -44,0 +49,0 @@ } |
@@ -7,4 +7,6 @@ "use strict"; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
@@ -11,0 +13,0 @@ }; |
@@ -26,3 +26,3 @@ "use strict"; | ||
function download(version, options) { | ||
return downloadArtifact(Object.assign({}, options, { version, platform: process.platform, arch: process.arch, artifactName: 'electron' })); | ||
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' })); | ||
} | ||
@@ -55,3 +55,3 @@ exports.download = download; | ||
const fileName = artifact_utils_1.getArtifactFileName(artifactDetails); | ||
const url = artifact_utils_1.getArtifactRemoteURL(artifactDetails); | ||
const url = await artifact_utils_1.getArtifactRemoteURL(artifactDetails); | ||
const cache = new Cache_1.Cache(artifactDetails.cacheRoot); | ||
@@ -58,0 +58,0 @@ // Do not check if the file exists in the cache when force === true |
@@ -7,5 +7,22 @@ import { Downloader } from './Downloader'; | ||
nightly_mirror?: string; | ||
/** | ||
* The base URL of the mirror to download from, | ||
* e.g https://github.com/electron/electron/releases/download | ||
*/ | ||
mirror?: string; | ||
/** | ||
* The name of the directory to download from, | ||
* often scoped by version number e.g 'v4.0.4' | ||
*/ | ||
customDir?: string; | ||
/** | ||
* The name of the asset to download, | ||
* e.g 'electron-v4.0.4-linux-x64.zip' | ||
*/ | ||
customFilename?: string; | ||
/** | ||
* A function allowing customization of the url returned | ||
* from getArtifactRemoteURL(). | ||
*/ | ||
resolveAssetURL?: (opts: DownloadOptions) => Promise<string>; | ||
} | ||
@@ -12,0 +29,0 @@ export interface ElectronDownloadRequest { |
import { ElectronArtifactDetails } from './types'; | ||
export declare function getArtifactFileName(details: ElectronArtifactDetails): string; | ||
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): string; | ||
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise<string>; |
@@ -30,3 +30,3 @@ import { ensureIsTruthyString } from './utils'; | ||
} | ||
export function getArtifactRemoteURL(details) { | ||
export async function getArtifactRemoteURL(details) { | ||
const opts = details.mirrorOptions || {}; | ||
@@ -39,4 +39,9 @@ let base = mirrorVar('mirror', opts, BASE_URL); | ||
const file = mirrorVar('customFilename', opts, getArtifactFileName(details)); | ||
// Allow customized download URL resolution. | ||
if (opts.resolveAssetURL) { | ||
const url = await opts.resolveAssetURL(details); | ||
return url; | ||
} | ||
return `${base}${path}/${file}`; | ||
} | ||
//# sourceMappingURL=artifact-utils.js.map |
@@ -6,4 +6,6 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
@@ -10,0 +12,0 @@ }; |
@@ -22,3 +22,3 @@ import debug from 'debug'; | ||
export function download(version, options) { | ||
return downloadArtifact(Object.assign({}, options, { version, platform: process.platform, arch: process.arch, artifactName: 'electron' })); | ||
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' })); | ||
} | ||
@@ -50,3 +50,3 @@ /** | ||
const fileName = getArtifactFileName(artifactDetails); | ||
const url = getArtifactRemoteURL(artifactDetails); | ||
const url = await getArtifactRemoteURL(artifactDetails); | ||
const cache = new Cache(artifactDetails.cacheRoot); | ||
@@ -53,0 +53,0 @@ // Do not check if the file exists in the cache when force === true |
@@ -7,5 +7,22 @@ import { Downloader } from './Downloader'; | ||
nightly_mirror?: string; | ||
/** | ||
* The base URL of the mirror to download from, | ||
* e.g https://github.com/electron/electron/releases/download | ||
*/ | ||
mirror?: string; | ||
/** | ||
* The name of the directory to download from, | ||
* often scoped by version number e.g 'v4.0.4' | ||
*/ | ||
customDir?: string; | ||
/** | ||
* The name of the asset to download, | ||
* e.g 'electron-v4.0.4-linux-x64.zip' | ||
*/ | ||
customFilename?: string; | ||
/** | ||
* A function allowing customization of the url returned | ||
* from getArtifactRemoteURL(). | ||
*/ | ||
resolveAssetURL?: (opts: DownloadOptions) => Promise<string>; | ||
} | ||
@@ -12,0 +29,0 @@ export interface ElectronDownloadRequest { |
{ | ||
"name": "@electron/get", | ||
"version": "1.10.0", | ||
"version": "1.12.0", | ||
"description": "Utility for downloading artifacts from different versions of Electron", | ||
@@ -50,4 +50,4 @@ "main": "dist/cjs/index.js", | ||
"ts-jest": "^24.0.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.5" | ||
"typedoc": "^0.17.2", | ||
"typescript": "^3.8.0" | ||
}, | ||
@@ -54,0 +54,0 @@ "lint-staged": { |
@@ -38,2 +38,12 @@ # @electron/get | ||
To specify another location to download Electron assets from, the following options are | ||
available: | ||
* `mirrorOptions` Object | ||
* `mirror` String (optional) - The base URL of the mirror to download from. | ||
* `nightly_mirror` String (optional) - The Electron nightly-specific mirror URL. | ||
* `customDir` String (optional) - The name of the directory to download from, often scoped by version number. | ||
* `customFilename` String (optional) - The name of the asset to download. | ||
* `resolveAssetURL` Function (optional) - A function allowing customization of the url used to download the asset. | ||
Anatomy of a download URL, in terms of `mirrorOptions`: | ||
@@ -40,0 +50,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
74172
1092
143