thedesk/app/node_modules/builder-util-runtime/out/publishOptions.js.map
2019-09-12 23:38:13 +09:00

2 lines
11 KiB
Plaintext

{"version":3,"sources":["../src/publishOptions.ts"],"names":[],"mappings":";;;;;;;;AAoGA;AACM,SAAU,SAAV,CAAoB,OAApB,EAA4C,WAAA,GAAsB,YAAlE,EAA8E;AAClF,SAAO,GAAG,OAAO,CAAC,QAAR,IAAoB,OAAO,MAAM,OAAO,CAAC,IAAR,IAAgB,WAAW,EAAtE;AACD;;AAkHK,SAAU,wBAAV,CAAmC,aAAnC,EAAsE;AAC1E,QAAM,QAAQ,GAAG,aAAa,CAAC,QAA/B;;AACA,MAAI,QAAQ,KAAK,IAAjB,EAAuB;AACrB,WAAO,KAAK,CAAE,aAAF,CAAZ;AACD;;AACD,MAAI,QAAQ,KAAK,QAAjB,EAA2B;AACzB,WAAO,SAAS,CAAE,aAAF,CAAhB;AACD;;AACD,QAAM,IAAI,KAAJ,CAAU,2BAA2B,QAAQ,EAA7C,CAAN;AACD;;AAED,SAAS,KAAT,CAAe,OAAf,EAAiC;AAC/B,MAAI,GAAJ;;AACA,MAAI,OAAO,CAAC,QAAR,IAAoB,IAAxB,EAA8B;AAC5B,IAAA,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,EAA3C;AACD,GAFD,MAGK,IAAI,OAAO,CAAC,MAAR,CAAe,QAAf,CAAwB,GAAxB,CAAJ,EAAkC;AACrC,QAAI,OAAO,CAAC,MAAR,IAAkB,IAAtB,EAA4B;AAC1B,YAAM,IAAI,KAAJ,CAAU,gBAAgB,OAAO,CAAC,MAAM,4CAAxC,CAAN;AACD,KAHoC,CAKrC;;;AACA,QAAI,OAAO,CAAC,MAAR,KAAmB,WAAvB,EAAoC;AAClC,MAAA,GAAG,GAAG,4BAA4B,OAAO,CAAC,MAAM,EAAhD;AACD,KAFD,MAGK;AACH,MAAA,GAAG,GAAG,cAAc,OAAO,CAAC,MAAM,kBAAkB,OAAO,CAAC,MAAM,EAAlE;AACD;AACF,GAZI,MAaA,IAAI,OAAO,CAAC,MAAR,KAAmB,YAAvB,EAAqC;AACxC,IAAA,GAAG,GAAG,WAAW,OAAO,CAAC,MAAM,OAAO,OAAO,CAAC,MAAM,mBAApD;AACD,GAFI,MAGA;AACH,IAAA,GAAG,GAAG,WAAW,OAAO,CAAC,MAAM,mBAA/B;AACD;;AACD,SAAO,UAAU,CAAC,GAAD,EAAM,OAAO,CAAC,IAAd,CAAjB;AACD;;AAED,SAAS,UAAT,CAAoB,GAApB,EAAiC,CAAjC,EAA6D;AAC3D,MAAI,CAAC,IAAI,IAAL,IAAa,CAAC,CAAC,MAAF,GAAW,CAA5B,EAA+B;AAC7B,QAAI,CAAC,CAAC,CAAC,UAAF,CAAa,GAAb,CAAL,EAAwB;AACtB,MAAA,GAAG,IAAI,GAAP;AACD;;AACD,IAAA,GAAG,IAAI,CAAP;AACD;;AACD,SAAO,GAAP;AACD;;AAED,SAAS,SAAT,CAAmB,OAAnB,EAAyC;AACvC,MAAI,OAAO,CAAC,IAAR,IAAgB,IAApB,EAA0B;AACxB,UAAM,IAAI,KAAJ,CAAU,iBAAV,CAAN;AACD;;AACD,MAAI,OAAO,CAAC,MAAR,IAAkB,IAAtB,EAA4B;AAC1B,UAAM,IAAI,KAAJ,CAAU,mBAAV,CAAN;AACD;;AACD,SAAO,UAAU,CAAC,WAAW,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,yBAA1C,EAAqE,OAAO,CAAC,IAA7E,CAAjB;AACD,C","sourcesContent":["export type PublishProvider = \"github\" | \"bintray\" | \"s3\" | \"spaces\" | \"generic\" | \"custom\"\n\n// typescript-json-schema generates only PublishConfiguration if it is specified in the list, so, it is not added here\nexport type AllPublishOptions = string | GithubOptions | S3Options | SpacesOptions | GenericServerOptions | BintrayOptions | CustomPublishOptions\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport interface PublishConfiguration {\n /**\n * The provider.\n */\n readonly provider: PublishProvider\n\n /**\n * @private\n * win-only\n */\n publisherName?: Array<string> | null\n\n /**\n * @private\n * win-only\n */\n readonly updaterCacheDirName?: string | null\n\n /**\n * Whether to publish auto update info files.\n *\n * Auto update relies only on the first provider in the list (you can specify several publishers).\n * Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.\n *\n * @default true\n */\n readonly publishAutoUpdate?: boolean\n}\n\n// https://github.com/electron-userland/electron-builder/issues/3261\nexport interface CustomPublishOptions extends PublishConfiguration {\n [index: string]: any\n}\n\n/**\n * [GitHub](https://help.github.com/articles/about-releases/) options.\n *\n * GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.\n * Define `GH_TOKEN` environment variable.\n */\nexport interface GithubOptions extends PublishConfiguration {\n /**\n * The provider. Must be `github`.\n */\n readonly provider: \"github\"\n\n /**\n * The repository name. [Detected automatically](#github-repository-and-bintray-package).\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * Whether to use `v`-prefixed tag name.\n * @default true\n */\n readonly vPrefixedTagName?: boolean\n\n /**\n * The host (including the port if need).\n * @default github.com\n */\n readonly host?: string | null\n\n /**\n * The protocol. GitHub Publisher supports only `https`.\n * @default https\n */\n readonly protocol?: \"https\" | \"http\" | null\n\n /**\n * The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions).\n */\n readonly token?: string | null\n\n /**\n * Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update#private-github-update-repo).\n */\n readonly private?: boolean | null\n\n /**\n * The type of release. By default `draft` release will be created.\n *\n * Also you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRE_RELEASE`is set to `true` — `prerelease`.\n * @default draft\n */\n releaseType?: \"draft\" | \"prerelease\" | \"release\" | null\n}\n\n/** @private */\nexport function githubUrl(options: GithubOptions, defaultHost: string = \"github.com\") {\n return `${options.protocol || \"https\"}://${options.host || defaultHost}`\n}\n\n/**\n * Generic (any HTTP(S) server) options.\n * In all publish options [File Macros](/file-patterns#file-macros) are supported.\n */\nexport interface GenericServerOptions extends PublishConfiguration {\n /**\n * The provider. Must be `generic`.\n */\n readonly provider: \"generic\"\n\n /**\n * The base url. e.g. `https://bucket_name.s3.amazonaws.com`.\n */\n readonly url: string\n\n /**\n * The channel.\n * @default latest\n */\n readonly channel?: string | null\n\n /**\n * Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.\n */\n readonly useMultipleRangeRequest?: boolean\n}\n\nexport interface BaseS3Options extends PublishConfiguration {\n /**\n * The update channel.\n * @default latest\n */\n channel?: string | null\n\n /**\n * The directory path.\n * @default /\n */\n readonly path?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n}\n\nexport interface S3Options extends BaseS3Options {\n /**\n * The provider. Must be `s3`.\n */\n readonly provider: \"s3\"\n\n /**\n * The bucket name.\n */\n readonly bucket: string\n\n /**\n * The region. Is determined and set automatically when publishing.\n */\n region?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n\n /**\n * The type of storage to use for the object.\n * @default STANDARD\n */\n readonly storageClass?: \"STANDARD\" | \"REDUCED_REDUNDANCY\" | \"STANDARD_IA\" | null\n\n /**\n * Server-side encryption algorithm to use for the object.\n */\n readonly encryption?: \"AES256\" | \"aws:kms\" | null\n\n /**\n * The endpoint URI to send requests to. The default endpoint is built from the configured region.\n * The endpoint should be a string like `https://{service}.{region}.amazonaws.com`.\n */\n readonly endpoint?: string | null\n}\n\n/**\n * [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options.\n * Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables.\n */\nexport interface SpacesOptions extends BaseS3Options {\n /**\n * The provider. Must be `spaces`.\n */\n readonly provider: \"spaces\"\n\n /**\n * The space name.\n */\n readonly name: string\n\n /**\n * The region (e.g. `nyc3`).\n */\n readonly region: string\n}\n\nexport function getS3LikeProviderBaseUrl(configuration: PublishConfiguration) {\n const provider = configuration.provider\n if (provider === \"s3\") {\n return s3Url((configuration as S3Options))\n }\n if (provider === \"spaces\") {\n return spacesUrl((configuration as SpacesOptions))\n }\n throw new Error(`Not supported provider: ${provider}`)\n}\n\nfunction s3Url(options: S3Options) {\n let url: string\n if (options.endpoint != null) {\n url = `${options.endpoint}/${options.bucket}`\n }\n else if (options.bucket.includes(\".\")) {\n if (options.region == null) {\n throw new Error(`Bucket name \"${options.bucket}\" includes a dot, but S3 region is missing`)\n }\n\n // special case, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro\n if (options.region === \"us-east-1\") {\n url = `https://s3.amazonaws.com/${options.bucket}`\n }\n else {\n url = `https://s3-${options.region}.amazonaws.com/${options.bucket}`\n }\n }\n else if (options.region === \"cn-north-1\") {\n url = `https://${options.bucket}.s3.${options.region}.amazonaws.com.cn`\n }\n else {\n url = `https://${options.bucket}.s3.amazonaws.com`\n }\n return appendPath(url, options.path)\n}\n\nfunction appendPath(url: string, p: string | null | undefined): string {\n if (p != null && p.length > 0) {\n if (!p.startsWith(\"/\")) {\n url += \"/\"\n }\n url += p\n }\n return url\n}\n\nfunction spacesUrl(options: SpacesOptions) {\n if (options.name == null) {\n throw new Error(`name is missing`)\n }\n if (options.region == null) {\n throw new Error(`region is missing`)\n }\n return appendPath(`https://${options.name}.${options.region}.digitaloceanspaces.com`, options.path)\n}\n\n/**\n * [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).\n * Define `BT_TOKEN` environment variable.\n */\nexport interface BintrayOptions extends PublishConfiguration {\n /**\n * The provider. Must be `bintray`.\n */\n readonly provider: \"bintray\"\n\n /**\n * The Bintray package name.\n */\n readonly package?: string | null\n\n /**\n * The Bintray repository name.\n * @default generic\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * The Bintray component (Debian only).\n */\n readonly component?: string | null\n\n /**\n * The Bintray distribution (Debian only).\n * @default stable\n */\n readonly distribution?: string | null\n\n /**\n * The Bintray user account. Used in cases where the owner is an organization.\n */\n readonly user?: string | null\n\n readonly token?: string | null\n}\n"],"sourceRoot":""}