builder-util-runtime
Advanced tools
Comparing version 1.0.2 to 1.0.3
export { CancellationToken, CancellationError } from "./CancellationToken"; | ||
export { HttpError, HttpExecutor, DownloadOptions, DigestTransform, RequestHeaders, safeGetHeader, configureRequestOptions, configureRequestOptionsFromUrl, safeStringifyJson, parseJson } from "./httpExecutor"; | ||
export { BintrayOptions, GenericServerOptions, GithubOptions, PublishConfiguration, S3Options, s3Url, Publish, githubUrl, PublishProvider } from "./publishOptions"; | ||
export { BintrayOptions, GenericServerOptions, GithubOptions, PublishConfiguration, S3Options, SpacesOptions, BaseS3Options, getS3LikeProviderBaseUrl, Publish, githubUrl, PublishProvider } from "./publishOptions"; | ||
export { UpdateInfo, VersionInfo, PackageFileInfo } from "./updateInfo"; | ||
@@ -5,0 +5,0 @@ export { parseDn } from "./rfc2253Parser"; |
@@ -87,6 +87,6 @@ "use strict"; | ||
Object.defineProperty(exports, "s3Url", { | ||
Object.defineProperty(exports, "getS3LikeProviderBaseUrl", { | ||
enumerable: true, | ||
get: function () { | ||
return (_publishOptions || _load_publishOptions()).s3Url; | ||
return (_publishOptions || _load_publishOptions()).getS3LikeProviderBaseUrl; | ||
} | ||
@@ -93,0 +93,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export declare type PublishProvider = "github" | "bintray" | "s3" | "generic"; | ||
export declare type PublishProvider = "github" | "bintray" | "s3" | "spaces" | "generic"; | ||
export declare type AllPublishOptions = string | GithubOptions | S3Options | GenericServerOptions | BintrayOptions; | ||
@@ -77,2 +77,20 @@ export declare type Publish = AllPublishOptions | Array<AllPublishOptions> | null; | ||
} | ||
export interface BaseS3Options extends PublishConfiguration { | ||
/** | ||
* The update channel. | ||
* @default latest | ||
*/ | ||
channel?: string | null; | ||
/** | ||
* The directory path. | ||
* @default / | ||
*/ | ||
readonly path?: string | null; | ||
/** | ||
* The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822). | ||
* | ||
* @default public-read | ||
*/ | ||
readonly acl?: "private" | "public-read" | null; | ||
} | ||
/** | ||
@@ -85,3 +103,3 @@ * [Amazon S3](https://aws.amazon.com/s3/) options. `https` must be used, so, if you use direct Amazon S3 endpoints, format `https://s3.amazonaws.com/bucket_name` [must be used](http://stackoverflow.com/a/11203685/1910191). And do not forget to make files/directories public. | ||
*/ | ||
export interface S3Options extends PublishConfiguration { | ||
export interface S3Options extends BaseS3Options { | ||
/** | ||
@@ -96,16 +114,6 @@ * The provider. Must be `s3`. | ||
/** | ||
* The directory path. | ||
* @default / | ||
*/ | ||
readonly path?: string | null; | ||
/** | ||
* The region. Is determined and set automatically when publishing. | ||
*/ | ||
readonly region?: string | null; | ||
region?: string | null; | ||
/** | ||
* The channel. | ||
* @default latest | ||
*/ | ||
readonly channel?: string | null; | ||
/** | ||
* The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822). | ||
@@ -124,7 +132,25 @@ * | ||
} | ||
/** @private */ | ||
export declare function s3Url(options: S3Options): string; | ||
/** | ||
* [Bintray](https://bintray.com/) options. | ||
* [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options. | ||
* Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables. | ||
*/ | ||
export interface SpacesOptions extends BaseS3Options { | ||
/** | ||
* The provider. Must be `spaces`. | ||
*/ | ||
readonly provider: "spaces"; | ||
/** | ||
* The space name. | ||
*/ | ||
readonly name: string; | ||
/** | ||
* The region (e.g. `nyc3`). | ||
*/ | ||
readonly region: string; | ||
} | ||
export declare function getS3LikeProviderBaseUrl(configuration: PublishConfiguration): string; | ||
/** | ||
* [Bintray](https://bintray.com/) options. Requires an API key. An API key can be obtained from the user [profile](https://bintray.com/profile/edit) page ("Edit Your Profile" -> API Key). | ||
* Define `BT_TOKEN` environment variable. | ||
*/ | ||
export interface BintrayOptions extends PublishConfiguration { | ||
@@ -131,0 +157,0 @@ /** |
@@ -8,3 +8,3 @@ "use strict"; | ||
exports.githubUrl = githubUrl; | ||
exports.s3Url = s3Url; | ||
exports.getS3LikeProviderBaseUrl = getS3LikeProviderBaseUrl; | ||
function githubUrl(options) { | ||
@@ -15,3 +15,12 @@ let defaultHost = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "github.com"; | ||
} | ||
/** @private */ | ||
function getS3LikeProviderBaseUrl(configuration) { | ||
const provider = configuration.provider; | ||
if (provider === "s3") { | ||
return s3Url(configuration); | ||
} | ||
if (provider === "spaces") { | ||
return spacesUrl(configuration); | ||
} | ||
throw new Error(`Not supported provider: ${provider}`); | ||
} | ||
function s3Url(options) { | ||
@@ -26,3 +35,3 @@ let url; | ||
} else { | ||
if (!options.region) { | ||
if (options.region == null) { | ||
throw new Error(`Bucket name "${options.bucket}" includes a dot, but S3 region is missing`); | ||
@@ -38,2 +47,15 @@ } | ||
} | ||
function spacesUrl(options) { | ||
if (options.name == null) { | ||
throw new Error(`name is missing`); | ||
} | ||
if (options.region == null) { | ||
throw new Error(`region is missing`); | ||
} | ||
let url = `https://${options.name}.${options.region}.digitaloceanspaces.com`; | ||
if (options.path != null) { | ||
url += `/${options.path}`; | ||
} | ||
return url; | ||
} | ||
//# sourceMappingURL=publishOptions.js.map |
{ | ||
"name": "builder-util-runtime", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "out/index.js", | ||
@@ -5,0 +5,0 @@ "author": "Vladimir Krivosheev", |
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
135169
1519