UNPKG

electron-forge

Version:

A complete tool for building modern Electron applications

139 lines (116 loc) 7.08 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <base data-ice="baseUrl" href="../../"> <title data-ice="title">api/publish.js | API Document</title> <link type="text/css" rel="stylesheet" href="css/style.css"> <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> <script src="script/prettify/prettify.js"></script> <script src="script/manual.js"></script> </head> <body class="layout-container" data-ice="rootContainer"> <header> <a href="./">Home</a> <a href="identifiers.html">Reference</a> <a href="source.html">Source</a> <a data-ice="repoURL" href="https://github.com/electron-userland/electron-forge" class="repo-url-github">Repository</a> <div class="search-box"> <span> <img src="./image/search.png"> <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> </span> <ul class="search-result"></ul> </div> </header> <nav class="navigation" data-ice="nav"><div> <ul> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-import">import</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-init">init</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-install">install</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-lint">lint</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-make">make</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-package">package</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-publish">publish</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-start">start</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-ImportOptions">ImportOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-InitOptions">InitOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-InstallOptions">InstallOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-LintOptions">LintOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-MakeOptions">MakeOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-PackageOptions">PackageOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-PublishOptions">PublishOptions</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-StartOptions">StartOptions</a></span></span></li> </ul> </div> </nav> <div class="content" data-ice="content"><h1 data-ice="title">api/publish.js</h1> <pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import &apos;colors&apos;; import asyncOra from &apos;../util/ora-handler&apos;; import getForgeConfig from &apos;../util/forge-config&apos;; import readPackageJSON from &apos;../util/read-package-json&apos;; import requireSearch from &apos;../util/require-search&apos;; import resolveDir from &apos;../util/resolve-dir&apos;; import make from &apos;./make&apos;; /** * @typedef {Object} PublishOptions * @property {string} [dir=process.cwd()] The path to the app to be published * @property {boolean} [interactive=false] Whether to use sensible defaults or prompt the user visually * @property {string} [authToken] An authentication token to use when publishing * @property {string} [tag=packageJSON.version] The string to tag this release with * @property {string} [target=github] The publish target * @property {MakeOptions} [makeOptions] Options object to passed through to make() */ /** * Publish an Electron application into the given target service. * * @param {PublishOptions} providedOptions - Options for the Publish method * @return {Promise} Will resolve when the publish process is complete */ export default async (providedOptions = {}) =&gt; { // eslint-disable-next-line prefer-const, no-unused-vars let { dir, interactive, authToken, tag, target, makeOptions } = Object.assign({ dir: process.cwd(), interactive: false, tag: null, makeOptions: {}, target: &apos;github&apos;, }, providedOptions); const makeResults = await make(makeOptions); dir = await resolveDir(dir); if (!dir) { // eslint-disable-next-line no-throw-literal throw &apos;Failed to locate publishable Electron application&apos;; } const artifacts = makeResults.reduce((accum, arr) =&gt; { accum.push(...arr); return accum; }, []); const packageJSON = await readPackageJSON(dir); const forgeConfig = await getForgeConfig(dir); let publisher; await asyncOra(`Resolving publish target: ${`${target}`.cyan}`, async () =&gt; { publisher = requireSearch(__dirname, [ `./publishers/${target}.js`, `electron-forge-publisher-${target}`, ]); if (!publisher) { throw `Could not find a publish target with the name: ${target}`; // eslint-disable-line } }); await publisher(artifacts, packageJSON, forgeConfig, authToken, tag); }; </code></pre> </div> <footer class="footer"> Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.5.2)</span><img src="./image/esdoc-logo-mini-black.png"></a> </footer> <script src="script/search_index.js"></script> <script src="script/search.js"></script> <script src="script/pretty-print.js"></script> <script src="script/inherited-summary.js"></script> <script src="script/test-summary.js"></script> <script src="script/inner-link.js"></script> <script src="script/patch-for-local.js"></script> </body> </html>