UNPKG

35.2 kBHTMLView Raw
1<!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6 <title>Documentation for @karimsa/wiz v0.10.1</title>
7
8 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
9 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.9/styles/agate.min.css">
10
11 <style>
12 .sidebar {
13 background-color: #343131;
14 }
15
16 .sidebar a:hover,
17 .sidebar a:active,
18 .sidebar a:focus,
19 .sidebar .active a {
20 background-color: #4e4a4a;
21 }
22
23 html,
24 body,
25 .h-100 {
26 height: 100%;
27 }
28
29 .min-h-100 {
30 min-height: 100%;
31 }
32
33 .text-pink {
34 color: #e83e8c;
35 }
36
37 .main {
38 background-color: #eaeaea;
39 }
40
41 pre {
42 border-radius: .3rem;
43 }
44
45 pre > code.hljs {
46 padding: 1rem;
47 }
48
49 h6 {
50 text-transform: uppercase;
51 color: #777;
52 font-size: .8rem;
53 margin: 2rem 0;
54 }
55
56 .col-auto.sidebar {
57 min-width: 25%;
58 }
59
60 .dir-link {
61 position: relative;
62 }
63
64 .dir-link::before {
65 content: '📁';
66 position: absolute;
67 left: -.25rem;
68 font-size: .8rem;
69 margin-top: .25rem;
70 }
71 </style>
72 </head>
73
74 <body>
75 <div class="container-fluid h-100">
76 <div class="row h-100 overflow-hidden">
77 <div class="col-auto sidebar h-100 py-4 overflow-auto">
78 <div class="text-center p-4 rounded-lg bg-primary">
79 <h5 class="font-weight-bold text-white">@karimsa/wiz</h5>
80 <p class="text-white mb-0">v0.10.1<span class="px-2">&bull;</span>e2f5e70
81<span class="px-2"></span><a class="text-white mr-2" href="https://github.com/karimsa/wiz"><i class="fab fa-github-square"></i></a>
82 <a class="text-white" href="https://wiz.js.org"><i class="fas fa-link"></i></a></p>
83 </div>
84
85 <ul class="nav flex-column nav-pills nav-fill mt-4">
86 <li class="nav-item text-left">
87 <a href="#" class="nav-link text-white" data-file="__README__">Overview</a>
88
89 <ul class="nav flex-column nav-pills nav-pill pl-3">
90
91 <li class="nav-item text-left">
92 <a href="#getting-started" class="nav-link text-white">Getting Started</a>
93 </li>
94
95 <li class="nav-item text-left">
96 <a href="#license" class="nav-link text-white">License</a>
97 </li>
98
99 </ul>
100 </li>
101
102 <li class="nav-item text-left">
103 <a class="nav-link text-white disabled">Sources</a>
104
105 <ul class="nav nav-pills flex-column pl-3">
106
107 <li class="nav-item text-left">
108 <a class="nav-link text-white disabled dir-link">commands</a>
109
110 <ul class="nav nav-pills flex-column pl-3">
111
112
113 <li class="nav-item text-left">
114 <a href="#" data-file="/home/circleci/repo/src/commands/bench.js" class="nav-link text-white">bench.js</a>
115 </li>
116
117 <li class="nav-item text-left">
118 <a href="#" data-file="/home/circleci/repo/src/commands/build.js" class="nav-link text-white">build.js</a>
119 </li>
120
121 <li class="nav-item text-left">
122 <a href="#" data-file="/home/circleci/repo/src/commands/doc.js" class="nav-link text-white">doc.js</a>
123 </li>
124
125 <li class="nav-item text-left">
126 <a href="#" data-file="/home/circleci/repo/src/commands/lint.js" class="nav-link text-white">lint.js</a>
127 </li>
128
129 <li class="nav-item text-left">
130 <a href="#" data-file="/home/circleci/repo/src/commands/profile.js" class="nav-link text-white">profile.js</a>
131 </li>
132
133 <li class="nav-item text-left">
134 <a href="#" data-file="/home/circleci/repo/src/commands/test.js" class="nav-link text-white">test.js</a>
135 </li>
136
137 </ul>
138
139 </li>
140
141 <li class="nav-item text-left">
142 <a class="nav-link text-white disabled dir-link">profiler</a>
143
144 <ul class="nav nav-pills flex-column pl-3">
145
146 <li class="nav-item text-left">
147 <a class="nav-link text-white disabled dir-link">reporters</a>
148
149 <ul class="nav nav-pills flex-column pl-3">
150
151
152 <li class="nav-item text-left">
153 <a href="#" data-file="/home/circleci/repo/src/profiler/reporters/cli.js" class="nav-link text-white">cli.js</a>
154 </li>
155
156 </ul>
157
158 </li>
159
160
161 <li class="nav-item text-left">
162 <a href="#" data-file="/home/circleci/repo/src/profiler/index.js" class="nav-link text-white">index.js</a>
163 </li>
164
165 </ul>
166
167 </li>
168
169
170 <li class="nav-item text-left">
171 <a href="#" data-file="/home/circleci/repo/src/bench.js" class="nav-link text-white">bench.js</a>
172 </li>
173
174 <li class="nav-item text-left">
175 <a href="#" data-file="/home/circleci/repo/src/cli.js" class="nav-link text-white">cli.js</a>
176 </li>
177
178 <li class="nav-item text-left">
179 <a href="#" data-file="/home/circleci/repo/src/config.js" class="nav-link text-white">config.js</a>
180 </li>
181
182 <li class="nav-item text-left">
183 <a href="#" data-file="/home/circleci/repo/src/fs.js" class="nav-link text-white">fs.js</a>
184 </li>
185
186 <li class="nav-item text-left">
187 <a href="#" data-file="/home/circleci/repo/src/glob.js" class="nav-link text-white">glob.js</a>
188 </li>
189
190 <li class="nav-item text-left">
191 <a href="#" data-file="/home/circleci/repo/src/lock.js" class="nav-link text-white">lock.js</a>
192 </li>
193
194 <li class="nav-item text-left">
195 <a href="#" data-file="/home/circleci/repo/src/perf.js" class="nav-link text-white">perf.js</a>
196 </li>
197
198 <li class="nav-item text-left">
199 <a href="#" data-file="/home/circleci/repo/src/setup.js" class="nav-link text-white">setup.js</a>
200 </li>
201
202 <li class="nav-item text-left">
203 <a href="#" data-file="/home/circleci/repo/src/spawn.js" class="nav-link text-white">spawn.js</a>
204 </li>
205
206 <li class="nav-item text-left">
207 <a href="#" data-file="/home/circleci/repo/src/utils.js" class="nav-link text-white">utils.js</a>
208 </li>
209
210 </ul>
211
212 </li>
213 </ul>
214 </div>
215
216 <div class="col main h-100 px-md-5 py-4 overflow-auto d-flex" id="scroll-container">
217 <div class="container">
218 <div class="row">
219 <div class="col p-md-5 bg-white rounded-lg" role="main">
220 <h1 align="center">wiz</h1>
221<p align="center">Zero config toolchain to manage JS projects with simplicity.</p>
222<p align="center">
223 <a href="https://circleci.com/gh/karimsa/wiz">
224 <img src="https://circleci.com/gh/karimsa/wiz.svg?style=svg" alt="CircleCI">
225 </a>
226</p>
227
228<p><strong>Features:</strong></p>
229<ul>
230<li><strong>Build projects:</strong> wraps <a href="https://github.com/rollup/rollup">rollup</a> with a pipeline to build libraries, tools, &amp; APIs.</li>
231<li><strong>Lint projects:</strong> wraps <a href="https://github.com/eslint/eslint">eslint</a> with strict, non-configurable defaults (and bumps performance).</li>
232<li><strong>Test projects:</strong> wraps <a href="http://github.com/facebook/jest">jest</a> with dynamic defaults.</li>
233<li><strong>Benchmark projects:</strong> provides a benchmark runner.</li>
234<li><strong>Profile projects:</strong> provides an instrumentation-based CPU profiler to isolate bottlenecks.</li>
235</ul>
236<h2 id="getting-started"><a class="text-body" href="#getting-started">Getting Started</a></h2><ol>
237<li>Install <code>wiz</code> via <code>npm install --save-dev @karimsa/wiz</code>.</li>
238<li>See <a href="http://wiz.js.org/">documentation</a>.</li>
239</ol>
240<h2 id="license"><a class="text-body" href="#license">License</a></h2><p>Licensed under MIT license.</p>
241<p>Copyright &copy; 2019-present Karim Alibhai. All rights reserved.</p>
242
243 </div>
244 </div>
245 </div>
246 </div>
247 </div>
248 </div>
249
250 <script async src="https://kit.fontawesome.com/7d12e17cf9.js"></script>
251 <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.9/highlight.min.js"></script>
252 <script>
253 !function() {
254 var main = document.querySelector('[role="main"]')
255 var scrollContainer = document.getElementById('scroll-container')
256 var docs = {
257 "__README__": "<h1 align=\"center\">wiz</h1>\n<p align=\"center\">Zero config toolchain to manage JS projects with simplicity.</p>\n<p align=\"center\">\n <a href=\"https://circleci.com/gh/karimsa/wiz\">\n <img src=\"https://circleci.com/gh/karimsa/wiz.svg?style=svg\" alt=\"CircleCI\">\n </a>\n</p>\n\n<p><strong>Features:</strong></p>\n<ul>\n<li><strong>Build projects:</strong> wraps <a href=\"https://github.com/rollup/rollup\">rollup</a> with a pipeline to build libraries, tools, &amp; APIs.</li>\n<li><strong>Lint projects:</strong> wraps <a href=\"https://github.com/eslint/eslint\">eslint</a> with strict, non-configurable defaults (and bumps performance).</li>\n<li><strong>Test projects:</strong> wraps <a href=\"http://github.com/facebook/jest\">jest</a> with dynamic defaults.</li>\n<li><strong>Benchmark projects:</strong> provides a benchmark runner.</li>\n<li><strong>Profile projects:</strong> provides an instrumentation-based CPU profiler to isolate bottlenecks.</li>\n</ul>\n<h2 id=\"getting-started\"><a class=\"text-body\" href=\"#getting-started\">Getting Started</a></h2><ol>\n<li>Install <code>wiz</code> via <code>npm install --save-dev @karimsa/wiz</code>.</li>\n<li>See <a href=\"http://wiz.js.org/\">documentation</a>.</li>\n</ol>\n<h2 id=\"license\"><a class=\"text-body\" href=\"#license\">License</a></h2><p>Licensed under MIT license.</p>\n<p>Copyright &copy; 2019-present Karim Alibhai. All rights reserved.</p>\n",
258 "/home/circleci/repo/src/bench.js": "<h2>bench.js</h2><h6>Description</h6><p class=\"lead\"><p>For documentation on benchmarks, please see: <code>src/commands/bench.js</code></p>\n</p>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">runAllBenchmarks</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">benchmark</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p>This function registers benchmarks to the benchmark runner. For most basic use,\npass a string title describing the benchmark and a handler to run the benchmark.</p>\n<p>Benchmark titles should be unique across your codebase. This is verified by the\nbenchmark registration and the process will fail if you use a non-unique title.</p>\n<p><strong>Advanced: Using currying</strong></p>\n<p>The benchmark function also supports currying handlers to perform custom setup.\nYou can think of this as synonymous to <code>beforeEach()</code> in mocha. The way that\nthis works is that functions will be executed in the order that they are passed\nin order to create a set of arguments that should be passed to the final handler\nupon each invocation of the benchmark. The <code>b</code> object is never re-instantiated, but\nthe values returned by <code>b.N()</code> will change and should not be cached by setup\nhandlers.</p>\n<h6 id=\"example\">Example</h6>\n<pre><code class=\"language-javascript\">import { benchmark } from &#39;@karimsa/wiz/bench&#39;\n\nimport { createApi } from &#39;../__tests__/helpers&#39;\n\nasync function setup(b) {\n const api = await createApi({ version: &#39;v1&#39; })\n await api.setupUsers(10)\n\n return {\n b,\n api,\n }\n}\n\nbenchmark(&#39;my custom benchmark&#39;, setup, async ({ b, api }) =&gt; {\n // b.resetTimer() is unnecessary here since the execution\n // time of &#39;setup()&#39; is completely ignored by the runner\n\n for (let i = 0; i &lt; b.N(); ++i) {\n await api.addRecord({ i })\n }\n})</code></pre>\n</p>\n\t\t\t\t</div>",
259 "/home/circleci/repo/src/cli.js": "<h2>cli.js</h2><h6>Description</h6><p class=\"lead\"><h2 id=\"project-structure\">Project structure</h2>\n<p>Though using <code>wiz</code> does not have any configuration or project setup, there are a few rules that are imposed onto\nprojects.</p>\n<ul>\n<li>All source files must be located within <code>src/</code>. Each wiz command depends on this rule &amp; will error out if you try to break it.</li>\n<li>All test files must be match the glob <code>src/**\\/__tests__/test-*.js</code>.</li>\n<li>All benchmark files must match the glob <code>src/**\\/__bench__/bench-*.js</code>.</li>\n<li>All entrypoints must exist top-level in <code>src/</code> and must be named something other than <code>index.js</code>.</li>\n</ul>\n<p>&quot;Hidden&quot; files and directories (prefixed with a <code>.</code>) will always be ignored.</p>\n<p>When wiz is called, it will create a local directory to store its cache within called <code>.wiz</code>. It will also ensure that this folder is added to your <code>.gitignore</code> file. On a CI system, this folder is ignored if it exists and not created if it doesn’t.</p>\n</p>",
260 "/home/circleci/repo/src/commands/bench.js": "<h2>commands/bench.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">benchCommand</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p>Writing benchmarks with <code>wiz</code> involves understanding a bit about how benchmarks are run. The benchmark\nrunner consists of two parts - a utility that is imported from <code>@karimsa/wiz/bench</code> and the benchmark CLI\nthat is invoked by calling <code>wiz bench</code>. Here&#39;s a sample benchmark:</p>\n<pre><code class=\"language-javascript\">import { benchmark } from &#39;@karimsa/wiz/bench&#39;\n\nfunction fib(n) {\n if (n &lt; 2) {\n return 1\n }\n return fib(n - 1) + fib(n - 2)\n}\n\nbenchmark(&#39;fib(10)&#39;, async b =&gt; {\n for (let i = 0; i &lt; b.N(); ++i) {\n fib(10)\n }\n})</code></pre>\n<p>The <code>@karimsa/wiz/bench</code> import exposes a single function called <code>benchmark</code> which allows your script to\nregister benchmarks. This function takes two arguments: a title for the benchmark and a function to run the\nbenchmark. The function that runs the benchmark may be synchronous or it may be asynchronous in which case it\n<strong>must</strong> return a promise.</p>\n<p>Your benchmark function will receive a single parameter: the <code>b</code> object. Which has the following methods:</p>\n<ul>\n<li><strong>resetTimer()</strong>: Resets the benchmark timer. Useful for running after you do any expensive setup for your\nbenchmark.</li>\n<li><strong>N()</strong>: Returns the number of times you should execute the code you wish to mention.</li>\n</ul>\n<p>The benchmark runner calls each benchmark function multiple times. Each time, the number returned by <code>b.N()</code> will\nbe larger. For the duration of a single call to the benchmark function, the value will stay the same. The value\nbegins at 1 and keeps increasing until the benchmark function timer exceeds the duration of 1 second. Once it does,\nthe benchmark statistics like the number of operations per second and time per operation will be written to the\nconsole.</p>\n<p>When imported into a node process, <code>@karimsa/wiz/bench</code> schedules the benchmark execution for the next tick of\nthe event loop. This means that you can run any benchmark file by simply using node (i.e.\n<code>node src/__bench__/bench-my-benchmark.js</code>). However, when you run <code>wiz bench</code>, it will only run benchmarks in\nfiles that match the glob <code>src/**\\/__bench__/bench-*.js</code>.</p>\n<p>Benchmarks are executed serially within the node process to ensure that parallel tasks do not interfere with benchmark\nresults.</p>\n<p>As a side note, the benchmark runner does not cache anything at all so every call to the runner will execute a\nfresh benchmark run.</p>\n<h3 id=\"running-specific-benchmarks\">Running specific benchmarks</h3>\n<p>To run some benchmarks but not others, you can change the benchmark registration function to <code>benchmark.only</code>\ninstead of <code>benchmark</code>. Like so:</p>\n<pre><code class=\"language-javascript\">import { benchmark } from &#39;@karimsa/wiz/bench&#39;\n\nbenchmark.only(&#39;run me&#39;, async b =&gt; {\n // ...\n})\n\nbenchmark(&#39;but not me&#39;, async b =&gt; {\n // ...\n})</code></pre>\n<p>The benchmark runner that comes with <code>wiz</code> is quite similar to the one that is built into the <code>testing</code> package\nfor <code>go</code>. As such, I recommend reading Dave Cheney&#39;s blog post on\n<a href=\"https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go\">How to write benchmarks in Go</a>.</p>\n</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">benchFlags</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p>List of the possible command-line flags that can be used with <code>wiz bench</code>.\nThey are listed in camel case, but should be passed in kebab case. For more\ninformation on the flags, you should run <code>wiz bench --help</code>. For less formal\ninformation, here are some examples.</p>\n<p><strong>Finding bottlenecks in your code</strong></p>\n<p>There&#39;s a few different ways to profile your benchmark execution. The simplest is\nto use the builtin profiler using the <code>--profile</code> flag. It is a good practice to add\n<code>.only()</code> to the specific benchmarks that you want to profile. This will allow you to\nisolate the profiler output to a single case.</p>\n<p>The benchmark runner is designed to allow you to profile your benchmark using the node\ninspector as well. Let&#39;s say that the benchmark you want to profile is in\n<code>src/__bench__/bench-example.js</code>. You can inspect this with a few different tools:</p>\n<ul>\n<li>With Chrome DevTools: <code>node --inspect-brk src/__bench__/bench-example.js</code> (<a href=\"https://nodejs.org/en/docs/inspector\">more info</a>)</li>\n<li>With V8: <code>node --prof src/__bench__/bench-example.js</code> (<a href=\"https://nodejs.org/en/docs/guides/simple-profiling/\">more info</a>)</li>\n<li>With 0x: <code>0x -o src/__bench__/bench-example.js</code> (<a href=\"http://npmjs.org/0x\">more info</a>)</li>\n</ul>\n<p><strong>Customizing execution time</strong></p>\n<p>You can use the <code>--benchTime</code> flag to customize the amount of time to wait for\nbenchmarks to complete. For example, using <code>--benchTime=5000</code> will gradually increase\nthe value for <code>b.N()</code> until benchmarks take longer than 5s to complete.</p>\n<pre><code class=\"language-shell\">$ wiz bench # waits for 1s for each benchmark\n$ wiz bench --benchTime=5000 # waits for 5s for each benchmark\n$ wiz bench --benchTime=10000 # waits for 10s for each benchmark</code></pre>\n<p><strong>Setting upper limit for benchmark iterations</strong></p>\n<p>This is more of a safety feature than anything. In the event that it might be dangerous\nto over-execute a benchmark, you can use the <code>--benchRuns</code> flag to set an upper limit on\nthe value that <code>b.N()</code> can reach. By default, this is unbounded. If you provide a value,\njust know that it may deter the results of your benchmark if the value is too low.</p>\n</p>\n\t\t\t\t</div>",
261 "/home/circleci/repo/src/commands/build.js": "<h2>commands/build.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">buildCommand</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p><strong>Usage</strong></p>\n<p>To build an entrypoint with wiz, you simply need to do <code>wiz build [path to entrypoint]</code>.\nThis will take the input file (which <strong>must</strong> be located top-level in <code>src/</code>) and build\nit into the current directory, with <code>.dist.js</code> file extension instead of <code>.js</code>. wiz ensures\nthat <code>*.dist.js</code> exists in your <code>.gitignore</code> so all output files are ignored.</p>\n<p>Since rollup does not currently having persistence caching builtin, there is no cache written\nout by wiz either. However, wiz may wrap rollup with a custom cache in the future which would\nexist in <code>.wiz</code>. As with linting, to reset the cache, you can simply run <code>rm -rf .wiz</code> - this\noperation is always safe.</p>\n<p><strong>Internals</strong></p>\n<p>The build tool is wrapped around wiz, and the build pipeline is as follows:</p>\n<ul>\n<li><code>rollup-plugin-commonjs</code>: to support commonjs sources.</li>\n<li><code>rollup-plugin-json</code>: to import JSON files with regular imports.</li>\n<li><code>rollup-plugin-replace</code>: to replace <code>process.env.NODE_ENV</code> with production, and\nany environment overrides given to wiz.</li>\n<li><code>rollup-plugin-babel</code>: to transform your JS syntax into syntax that is supported\nby your current node version.</li>\n<li><code>terser</code>: to drop dead code, constant fold, and optimize pure functions. Mangling\nand obfuscation are skipped.</li>\n<li><code>add-shebang</code>: adds a shebang for node to the start of the output file.</li>\n<li><code>chmod</code>: adds execution privileges to output file.</li>\n</ul>\n</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">buildFlags</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p><strong>Changing build destination</strong></p>\n<p>The <code>--output</code> flag allows you to customize the filename of the build output.\nBy default, is it <code>[basename].dist.js</code> where <code>[basename]</code> is the basename of the\ninput source file. This might be desirable since when the file is located within\nyour source files, its parent directory names help add meaning to the file&#39;s\npurpose. However, as an output file, it has no parent directory so it might need\na more detailed filename.</p>\n<pre><code class=\"language-shell\">$ wiz build src/foo.js\n# Builds into foo.dist.js\n$ wiz build src/foo.js -o bar.dist.js\n# Builds into bar.dist.js</code></pre>\n<p><strong>Passing custom environment variables</strong></p>\n<p>The <code>--env</code> flag can be used to override environment variables that are known\nat compile-time. For instance, <code>NODE_ENV</code> is always overriden by default within\n<code>wiz</code> to allow projects to differentiate between their build environment vs. their\nexecution environment.</p>\n<p>Aside from <code>NODE_ENV</code>, you can make custom overrides too. Here&#39;s an example:</p>\n<pre><code class=\"language-javascript\">// src/foo.js\nconsole.log(&#39;%s, world&#39;, process.env.MESSAGE || &#39;Hello&#39;)</code></pre>\n<p>Building this with <code>wiz build src/foo.js</code> would output:</p>\n<pre><code class=\"language-javascript\">// foo.dist.js\nconsole.log(&#39;%s, world&#39;, process.env.MESSAGE || &#39;Hello&#39;)</code></pre>\n<p>Building this with <code>wiz build src/foo.js -e MESSAGE=Bye</code> would output:</p>\n<pre><code class=\"language-javascript\">// foo.dist.js\nconsole.log(&#39;%s, world&#39;, &#39;Bye&#39;)</code></pre>\n</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">createBundle</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
262 "/home/circleci/repo/src/commands/doc.js": "<h2>commands/doc.js</h2><h6>Description</h6><p class=\"lead\"><p>Command to generate documentation from local\nsource files. For usage information, see help output\nviewable by running <code>wiz doc --help</code>.</p>\n</p>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">docCommand</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p>Executes documentation generation on all source files\npart of the local repository.</p>\n</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">docFlags</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p><code>--open</code> opens <code>docs/index.html</code> in the default browser after building the\ndocumentation.</p>\n</p>\n\t\t\t\t</div>",
263 "/home/circleci/repo/src/commands/lint.js": "<h2>commands/lint.js</h2><h6>Description</h6><p class=\"lead\"><p>Check source files for formatting issues &amp; quality.</p>\n</p>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">lintFlags</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">lintCommand</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
264 "/home/circleci/repo/src/commands/profile.js": "<h2>commands/profile.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">profileCommand</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
265 "/home/circleci/repo/src/commands/test.js": "<h2>commands/test.js</h2><h6>Description</h6><p class=\"lead\"><p>Runs tests via jest for the project.</p>\n</p>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">testFlags</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">testCommand</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
266 "/home/circleci/repo/src/config.js": "<h2>config.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">mainDirectory</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">isCI</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">WizNodeEnv</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p>This NODE_ENV will get replaced at build-time</p>\n</p>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">CurrentNodeEnv</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<p class=\"lead mb-5\"><p>This one is dynamic</p>\n</p>\n\t\t\t\t</div>",
267 "/home/circleci/repo/src/fs.js": "<h2>fs.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">readFile</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">writeFile</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">readdir</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">stat</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">mkdir</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">chmod</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">open</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">close</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">unlink</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
268 "/home/circleci/repo/src/glob.js": "<h2>glob.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">findSourceFiles</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
269 "/home/circleci/repo/src/lock.js": "<h2>lock.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">unsafeAcquireLock</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">acquireLock</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
270 "/home/circleci/repo/src/perf.js": "<h2>perf.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">shouldMeasurePerf</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">measure</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">observeEntries</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">enableHooks</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
271 "/home/circleci/repo/src/profiler/index.js": "<h2>profiler/index.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">constant</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">profileFlags</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">injectProfiler</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
272 "/home/circleci/repo/src/profiler/reporters/cli.js": "<h2>profiler/reporters/cli.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">cliReporter</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
273 "/home/circleci/repo/src/setup.js": "<h2>setup.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">setup</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
274 "/home/circleci/repo/src/spawn.js": "<h2>spawn.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">spawn</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>",
275 "/home/circleci/repo/src/utils.js": "<h2>utils.js</h2>\n\t\t\t\t<div>\n\t\t\t\t\t<div class=\"d-flex align-items-center mt-5 mb-3\">\n\t\t\t\t\t\t<span class=\"badge badge-primary mr-2\">function</span>\n\t\t\t\t\t\t<h4 class=\"d-inline-block mb-0\">ttywrite</h4>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t\n\t\t\t\t</div>"
276}
277
278 function scrollToTop({ stepSize }) {
279 if (scrollContainer.scrollTop > 1) {
280 stepSize = stepSize || (scrollContainer.scrollTop / 100)
281 scrollContainer.scrollTop -= stepSize
282 requestAnimationFrame(function() {
283 scrollToTop({ stepSize })
284 })
285 }
286 }
287
288 function updateAfterRender() {
289 document.querySelectorAll('pre > code').forEach(block => {
290 hljs.highlightBlock(block)
291 })
292 }
293
294 document.querySelectorAll('a[data-file]').forEach(fileLink => {
295 fileLink.addEventListener('click', evt => {
296 evt.preventDefault()
297 main.innerHTML = docs[fileLink.getAttribute('data-file')]
298
299 updateAfterRender()
300 })
301 })
302
303 updateAfterRender()
304 }()
305 </script>
306 </body>
307 </html>
\No newline at end of file