UNPKG

electron-forge

Version:

A complete tool for building modern Electron applications

258 lines (257 loc) 8.5 kB
<!doctype html> <html lang="en"> <head> <title>Code coverage report for init/init-custom.js</title> <meta charset="utf-8" /> <link rel="stylesheet" href="../prettify.css" /> <link rel="stylesheet" href="../base.css" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type='text/css'> .coverage-summary .sorter { background-image: url(../sort-arrow-sprite.png); } </style> </head> <body> <div class='wrapper'> <div class='pad1'> <h1> <a href="../index.html">All files</a> / <a href="index.html">init</a> init-custom.js </h1> <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">82.14% </span> <span class="quiet">Statements</span> <span class='fraction'>23/28</span> </div> <div class='fl pad1y space-right2'> <span class="strong">64.29% </span> <span class="quiet">Branches</span> <span class='fraction'>9/14</span> </div> <div class='fl pad1y space-right2'> <span class="strong">100% </span> <span class="quiet">Functions</span> <span class='fraction'>4/4</span> </div> <div class='fl pad1y space-right2'> <span class="strong">82.14% </span> <span class="quiet">Lines</span> <span class='fraction'>23/28</span> </div> </div> </div> <div class='status-line high'></div> <pre><table class="coverage"> <tr><td class="line-count quiet">1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">17x</span> <span class="cline-any cline-yes">14x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-yes">3x</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import debug from 'debug'; import fs from 'fs-promise'; import glob from 'glob'; import resolvePackage from 'resolve-package'; import ora from 'ora'; import path from 'path'; &nbsp; import { copy } from './init-starter-files'; import asyncOra from '../util/ora-handler'; import installDepList from '../util/install-dependencies'; &nbsp; const d = debug('electron-forge:init:custom'); &nbsp; export default async (dir, template, lintStyle) =&gt; { let templateModulePath; await asyncOra(`Locating custom template: "${template}"`, async () =&gt; { try { templateModulePath = await resolvePackage(`electron-forge-template-${template}`); d('using global template'); } catch (err) { <span class="cstat-no" title="statement not covered" > try {</span> <span class="cstat-no" title="statement not covered" > templateModulePath = require(`electron-forge-template-${template}`);</span> <span class="cstat-no" title="statement not covered" > d('using local template');</span> } catch (err2) { // eslint-disable-next-line no-throw-literal <span class="cstat-no" title="statement not covered" > throw `Failed to locate custom template: "${template}"\n\nTry \`npm install -g electron-forge-template-${template}\``;</span> } } }); &nbsp; let templateModule = require(templateModulePath); &nbsp; templateModule = templateModule.default || templateModule; &nbsp; await asyncOra('Installing Template Dependencies', async () =&gt; { d('installing dependencies'); await installDepList(dir, templateModule.dependencies || <span class="branch-1 cbranch-no" title="branch not covered" >[])</span>; d('installing devDependencies'); await installDepList(dir, templateModule.devDependencies || <span class="branch-1 cbranch-no" title="branch not covered" >[],</span> true); }); &nbsp; await asyncOra('Copying Template Files', async () =&gt; { const templateDirectory = templateModule.templateDirectory; <span class="missing-if-branch" title="else path not taken" >E</span>if (templateDirectory) { const tmplPath = templateDirectory; <span class="missing-if-branch" title="if path not taken" >I</span>if (!path.isAbsolute(templateDirectory)) { // eslint-disable-next-line no-throw-literal <span class="cstat-no" title="statement not covered" > throw `Custom template path needs to be absolute, this is an issue with "electron-forge-template-${template}"`;</span> } &nbsp; const files = glob.sync(path.resolve(tmplPath, '**/*')); &nbsp; for (const file of files) { if ((await fs.stat(file)).isFile()) { await copy(file, path.resolve(dir, path.relative(tmplPath, file).replace(/^_/, '.'))); } } } }); &nbsp; <span class="missing-if-branch" title="else path not taken" >E</span>if (typeof templateModule.postCopy === 'function') { await Promise.resolve(templateModule.postCopy(dir, ora.ora, lintStyle)); } }; &nbsp;</pre></td></tr> </table></pre> <div class='push'></div><!-- for sticky footer --> </div><!-- /wrapper --> <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 15 2017 17:22:43 GMT+1100 (AEDT) </div> </div> <script src="../prettify.js"></script> <script> window.onload = function () { if (typeof prettyPrint === 'function') { prettyPrint(); } }; </script> <script src="../sorter.js"></script> </body> </html>