<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Luke Deniston on Medium]]></title>
        <description><![CDATA[Stories by Luke Deniston on Medium]]></description>
        <link>https://medium.com/@lukedeniston?source=rss-5284870bbe15------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bXi8GIgU1VNeJM0a0fYI0A.jpeg</url>
            <title>Stories by Luke Deniston on Medium</title>
            <link>https://medium.com/@lukedeniston?source=rss-5284870bbe15------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 03:14:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lukedeniston/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How To Write A Really, *Really* Ambitious SPA in 2019]]></title>
            <link>https://medium.com/@lukedeniston/how-to-write-a-really-really-ambitious-spa-in-2019-60fc38de89db?source=rss-5284870bbe15------2</link>
            <guid isPermaLink="false">https://medium.com/p/60fc38de89db</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[yarn-workspace]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[yarn]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <dc:creator><![CDATA[Luke Deniston]]></dc:creator>
            <pubDate>Sun, 11 Aug 2019 00:00:00 GMT</pubDate>
            <atom:updated>2019-08-15T16:27:24.193Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Using ember-engines and yarn workspaces to maximize happiness.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQ44uetgQxDqvySnryFzKw.jpeg" /><figcaption>Obligatory stock photo of a blueprint.</figcaption></figure><p>Over the past few years a few technologies have matured to the point where writing a really, <em>really</em> ambitious (enterprise!) web application is pretty darn easy. Specifically:</p><ul><li>Yarn workspaces, and their support across the greater javascript ecosystem</li><li>Ember.js and its embrace of native classes</li><li>Ember Engines, which brings lazy loading and code encapsulation</li></ul><p>This is not a guide on how to get started with any of these things. This is not a “Hello World!” or “TODO” example. This article is a brain dump of how to architect a <em>ginormous</em> single page web application, while still maintaining developer ergonomics and customer happiness.</p><p>As a general rule of thumb, if your app has less than 100 routes, you don’t need to do this. Just use vanilla Ember/React/Vue whatever and you’ll be (mostly) just fine. But a few hundred routes? Or a few thousand? Then keep reading.</p><h3>Obligatory Background Section</h3><p>I’ve been doing web dev for over a decade, with the past 5 or so years mostly working with Ember. I’ve tried a few different approaches: monoliths, microservices, serverless, macroservices, monoserviceless. Some of those worked well, and some of them didn’t. Some of those are words I just made up. Each approach has its pros and cons, but after years of experimenting we’ve finally found the <em>One True Architecture</em> (at least for us).</p><p>We started with a monolithic front end that talked to microservice back ends. That was <strong>awful</strong> (for the front end).</p><p>Then we made a bunch of separate Ember apps that mirrored our back end architecture. We made some internal addons for shared code and to provide a cohesive user experience. That was <strong>better</strong>.</p><p>Then we started making separate engines instead of separate apps, so we could share services and avoid a hard refresh as users navigated features. This turned out to be <strong>much worse</strong> for developers, but <strong>much better</strong> for customers. We would get into situations where a bug might need pull requests in the internal addon, then the engine (bumping the internal addon version), then the host app (updating the engine version). Three pull requests for one bug is just not conducive for developer happiness (or engineering velocity). But from the customers perspective, navigating between features was much faster, now that the entire page didn’t need to rerender.</p><h3>Yarn Workspaces Are So Amazing, I’m Serious Right Now You Guys</h3><p>Yarn workspaces solve these issues perfectly. You can easily have a host application, a bunch of engines, and some shared addons in a single repo. Getting started is straightforward. Just add a package.json in the root that looks like this:</p><pre>{<br>  &quot;private&quot;: true,<br>  &quot;workspaces&quot;: [<br>    &quot;packages/*&quot;<br>  ]<br>}</pre><p>Then make a file structure that looks like this:</p><pre>root<br>└─ packages<br>   ├─ host-app<br>   ├─ engine-1<br>   ├─ engine-2<br>   └─ shared-addon</pre><p>Now if the host-app declares engine-1 as a dependency, it will just bring in the folder in your repo (as long as the version in engine-1/package.json matches what you&#39;ve declared as a dependency). What&#39;s more, live reload will detect if you&#39;ve made changes in the engine and reload the host app with your new code! Lazy loading of engines makes sure you&#39;re not bloating the initial payload, and the code encapsulation and isolation you get means that you can upgrade and refactor one engine without being afraid that you&#39;re breaking features elsewhere.</p><p>If you’re new to Ember Engines, be sure to go read the <a href="http://ember-engines.com/guide/">excellent guide</a>. Read it thoroughly, don’t just skim it like I did. You might lose half a day wondering why your tests aren’t working and then you’ll realize that you’re lazily loading the engine and you didn’t read <a href="http://ember-engines.com/guide/testing#testingforlazyengines">the section about that</a> in the guide. Not that I did that…</p><h3>Stupid Workspace Tricks¹</h3><p>And by stupid I mean <strong>AMAZING</strong>. Some tips and tricks I found while working with engines.</p><h4>Shared Config Files</h4><p>One of the packages we added to our workspace is called shared-files. It&#39;s where we store things like ESLint and TypeScript configurations. This makes it easy to keep things consistent across packages. Most of our .eslintrc.js files now just look like this:</p><pre>module.exports = require(&quot;shared-files/eslint.config.js&quot;);</pre><p>And our tsconfig.json files looks like:</p><pre>{<br>  &quot;extends&quot;: &quot;../shared-files/tsconfig.json&quot;,<br>  &quot;compilerOptions&quot;: {<br>    // etc...<br>  }<br>}</pre><h4>Global Resolutions</h4><p>You’ll want some dependencies to be on the same version for all your packages. This is especially true for things like Ember Engines, since the host and the engine will need to be updated in lockstep. Simply add a resolutions block to the root package.json file:</p><pre>{<br>  &quot;private&quot;: true,<br>  &quot;workspaces&quot;: [<br>    &quot;packages/*&quot;<br>  ],<br>  &quot;resolutions&quot;: {<br>    &quot;**/ember-engines&quot;: &quot;0.8.2&quot;<br>  }<br>}</pre><p>Then your individual packages can declare the dependency like so:</p><pre>&quot;ember-engines&quot;: &quot;*&quot;</pre><h4>Sharing Code With Other Repos</h4><p>As we migrate our codebase to this New World Order², we needed a way to share some business logic with our older standalone Ember apps. The solution was to make a new package in the workspace specifically for sharing logic in and out of the workspace. Since each package in your workspace is still a normal package, you can publish any individual package to a registry to be consumed in other applications.</p><p>This comes with one significant caveat. Since we’re not publishing our other packages we can’t refer to them inside of our new published package. That means the other <em>Stupid Workspace Tricks</em> won’t work here.</p><h3>Sound neat? Come join us!</h3><p>We’re building some exciting things over at <a href="https://home.agrian.com/">Agrian Inc.</a> and we’re looking for some great engineers to join our team either remotely or in person at our office in Fresno, California. If you’re interested, drop us a line at <a href="/service/mailto:careers@agrian.com">careers@agrian.com</a>.</p><p>[1]: In case you don’t get <a href="https://www.youtube.com/watch?v=D8zEBRRw1oI">the reference</a>.<br>[2]: This is, of course, a reference to <a href="https://mtg.gamepedia.com/New_World_Order">Magic: The Gathering</a>.</p><p>Header image by <a href="https://pixabay.com/users/Wokandapix-614097/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=964629">Wokandapix</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=964629">Pixabay</a>.</p><p><em>Originally published at </em><a href="http://luketheobscure.github.io/how-to-write-an-ambitious-app"><em>http://luketheobscure.github.io</em></a><em> on August 11, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60fc38de89db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ember + WebAssembly Just Got Way Easier]]></title>
            <link>https://medium.com/@lukedeniston/ember-webassembly-just-got-way-easier-1e4ec6ca40ab?source=rss-5284870bbe15------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e4ec6ca40ab</guid>
            <category><![CDATA[webassembly]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Luke Deniston]]></dc:creator>
            <pubDate>Thu, 26 Jul 2018 03:47:00 GMT</pubDate>
            <atom:updated>2018-07-26T04:03:26.491Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ol><li>Install <a href="https://github.com/ef4/ember-auto-import">ember-auto-import</a></li><li>Import Wasm modules with import(&#39;path/to/wasm&#39;)</li><li>That’s all the steps. You’re done!</li></ol><h3>Background + Complaining</h3><p>WebAssembly is probably the most exciting and frustrating technology to come around in a while. The promise of WebAssembly is awesome: true write once, run anywhere technology, that runs in a VM that users already have (a browser!). But as is often the case, the reality is not quite that rosy. The only officially supported types are all numeric (as in you can’t pass in a string or get one back from a Wasm module). The process for loading Wasm modules is not as simple as many how-to’s would have you believe. And the debugging story is still mostly non-existent.</p><p>To fill in the gaps there’s a handful of community solutions that make things easier. The <a href="https://rustwasm.github.io/">Rust and WebAssembly</a> project aims to “facilitate high-level interactions between wasm modules and javascript” (via the <a href="https://rustwasm.github.io/wasm-bindgen/">wasm-bindgen</a> package). In other words, it generates wrapper code that let’s you pass in and receive non-numeric types to your Wasm modules. <a href="https://github.com/rustwasm/wasm-pack">Wasm-pack</a> makes it dead simple to build and publish Rust code to easily consumed NPM packages.</p><p><a href="https://webpack.js.org/">Webpack</a> recently added support for importing Wasm modules like those generated by wasm-pack. So instead of doing some sort of dance with WebAssembly.instantiateStreaming(fetch(&#39;foo&#39;), { imports..., webpack users can just call import(&#39;foo&#39;) and work with the result just like any other imported module (albeit an asynchronous one).</p><h3>So what does that have to do with Ember?</h3><p><a href="https://eaf4.com/">Edward Faulkner</a> has been quietly working on a little package called <a href="https://github.com/ef4/ember-auto-import">ember-auto-import</a> as a solution for easily importing node modules into Ember apps. He recently landed a patch that allows the use of dynamic import(...) statements. Since ember-auto-import uses Webpack under the hood, this happens to make using Wasm modules dead simple inside an Ember app!</p><p>I made a simple Ember app to showcase how easy this is. <a href="https://github.com/luketheobscure/wasm-example/commit/07477bc2b02ace0e6c347a3f9729d7284ca1be9d">Here’s the relevant commit</a> where I import a Wasm module.</p><p>The only caveat I can think of is you need to make sure all the generated assets get deployed. Since it’s not javascript, it obviously can’t get rolled up into you application.js or vendor.js files. Normal ember build commands generate all the correct files, just double check your deploy scripts. 🐹</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e4ec6ca40ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Eight Ember Addons I Use On Every Project]]></title>
            <link>https://medium.com/@lukedeniston/the-eight-ember-addons-i-use-on-every-project-8393bea3c96f?source=rss-5284870bbe15------2</link>
            <guid isPermaLink="false">https://medium.com/p/8393bea3c96f</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[ember-cli]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Luke Deniston]]></dc:creator>
            <pubDate>Tue, 20 Jun 2017 07:01:50 GMT</pubDate>
            <atom:updated>2017-06-20T07:01:50.564Z</atom:updated>
            <content:encoded><![CDATA[<p>The depth and breadth of the Ember addon ecosystem can be overwhelming to novice developers. Installing a new addon can feel like a gamble, since you often don’t know what the pitfalls are until after you’ve lived with it in your codebase for a while. <a href="https://emberobserver.com/">Ember Observer</a> does a good job providing some metrics, but there’s nothing like a referral from someone who’s dealt with an addon firsthand. With this in mind here’s my list of addons that, without exception, I install on every single Ember project I work on.</p><h3>1. <a href="http://www.ember-power-select.com/">ember-power-select</a></h3><p>I’ve yet to work on a project where I didn’t need to use a select menu. While the built in Ember helpers do a fine job with the basics, ember-power-select blows it away in terms of features and composability. It’s elegantly architectured so that it works well out of the box, but overriding any aspect is simple. Search, multi-select, and promise support are just the beginning. There’s a Bootstrap theme and Material theme, and any of the specifics can even be overridden with SASS variables. It’s very actively developed, issues are usually promptly addressed, and pull requests are quite welcome.</p><p>The developer also has the distinction of having given <a href="https://www.youtube.com/watch?v=MpFudGJn2J0">the most entertaining tech talk</a> I’ve ever seen.</p><h3>2. <a href="https://github.com/rwjblue/ember-cli-template-lint">ember-cli-template-lint</a> / <a href="https://github.com/rwjblue/ember-template-lint">ember-template-lint</a></h3><p>There’s less to say about ember-cli-template-lint simply because it’s a “set it and forget it” sort of addon. It’s so simple and intuitive I usually forget to install it until an issue pops up and I’m left wondering why template-lint didn’t catch it (at which point I facepalm and get it installed). I wouldn’t be surprised if this becomes one of the default addons that ships with ember-cli at some point in the future.</p><p>This does everything from indentation checking, bare strings checks (so you don’t forget to translate something), to phishing protection with the <a href="https://github.com/rwjblue/ember-template-lint#link-rel-noopener">lint-rel-noopener</a> rule. It’s dead simple to turn rules on and off, or even define your own custom rule.</p><h3>3. <a href="https://github.com/kimroen/ember-cli-document-title">ember-cli-document-title</a></h3><p>Not particularly exciting, but no less important. ember-cli-document-title makes it dead simple to provide intelligent document titles on a route-by-route basis. You can roll up the titles to provide a nice breadcrumbs-esque document title (like “Home &gt; Products &gt; Widgets”), or provide dynamic segments in your title with data from your models. It may seem unimportant in the age of a gajillion browser tabs, but if you’ve ever looked at your “Back” menu only to see a long list of the same name you know how important accurate document titles can be.</p><h3>4. <a href="https://ember-concurrency.com/">ember-concurrency</a></h3><p>Ember-concurrency is hard to summarize, but once you start using it, it completely changes the way you write your code. At it’s heart it exposes a Task primitive, which can be invoked like an action or called like a function. A TaskInstance can be cancelled, queued or restarted. You can easily access the property&#39;s last returned value, as well as its current state.</p><p>Consider a simple save action from a form. A naive implementation would simply wire a button up to with something like {{action &#39;save&#39;}}. A slightly more experienced programmer knows to guard against repeated clicks, so puts in some sort of logic to prevent repeated calls to save. An even more experienced programmer would know to also update the UI to give the user feedback. This is trivial with ember-concurrency. A basic save property might look like this:</p><pre>saveModel: task(function * () {<br>  try {<br>    yield this.get(&#39;model&#39;).save()<br>  } catch(e) {<br>    // Handle failure<br>  }  <br>}).drop()</pre><p>While your template looks like this:</p><pre>&lt;button onclick={{action (perform saveModel) disabled={{saveModel.isRunning}}&gt;<br>  Save<br>&lt;/button&gt;</pre><h3>5. <a href="https://github.com/kategengler/ember-cli-code-coverage">ember-cli-code-coverage</a> / <a href="https://github.com/sglanzer/ember-cli-blanket">ember-cli-blanket</a></h3><p>For the uninitiated, code coverage is the percentage of your code that’s hit while your tests are running. While it doesn’t give insight into the depth or quality of your tests, having an overview of the <em>breadth</em> of your tests can be crucial. Most CI solutions support failing the build if coverage drops below a certain metric, or drops from one commit to the next. These addons also make it easy to see which lines aren’t getting hit, and give you a file-by-file percentage so you can see which areas of your application need better coverage.</p><p>ember-cli-blanket has been deprecated in favor of ember-cli-code-coverage, but sadly there&#39;s <a href="https://github.com/kategengler/ember-cli-code-coverage/issues/55">an issue</a> with using ember-cli-code-coverage with CoffeeScript, so there&#39;s a few projects of mine that are stuck with ember-cli-blanket (even though that has <a href="https://github.com/sglanzer/ember-cli-blanket/issues/162">an issue</a> with &gt; QUnit 2.2.2).</p><h3>6. <a href="http://ember-cli-deploy.com/">ember-cli-deploy</a></h3><p>This addon is hands down <em>amazing</em>. While there’s quite a bit of decisions to be made in the setup, the documentation is excellent, and there’s a myriad of plugins available to support most configurations. It even supports the ability to instantly activate or rollback to a specific revision. Deployments are stressful times for everyone else, but those of us in ember-cli land can rest easy thanks to the hard work put in by the ember-cli-deploy team.</p><p>Moving towards true “Continuous Delivery” has been my goal for the last year or two, and thanks to good code coverage metrics and pain-free deploys I’m closer than ever to pulling the trigger on having automatic push-to-production every time we merge to master (I’m not quite there yet, but my projects with good code coverage have gone from monthly deploys to daily). I should mention that <a href="https://yarnpkg.com/en/">Yarn</a> is also a piece of that puzzle (consistent dependency installations), although we technically had the same functionality with <a href="https://docs.npmjs.com/cli/shrinkwrap">npm-shrinkwrap</a>, but shrinkwrap was a nightmare to work with.</p><h3>7. <a href="http://www.ember-cli-mirage.com/">ember-cli-mirage</a></h3><p>Mirage is a key part of writing acceptance tests. It’s essentially a mock server that can run during your tests, intercepting requests and spitting back fixture data. Mirage takes things a step further by introducing models, serializers, and a persistence layer on top of the route configuration. Mirage is such a <em>de facto</em> part of my workflow, I honestly don’t know how to write a complex acceptance test without it. The author was on a <a href="http://emberweekend.com/episodes/not-a-mirage-anymore">recent episode of Ember Weekend</a> where he talked about the future of Ember Mirage. He’s got some exciting things coming down the pike, including automatic discovery of your Ember models, which will reduce even further the boilerplate needed to write an acceptance test. It sounds like when he’s done with it, the only setup needed to write an entire <a href="https://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a> acceptance test will be a single this.resource(&#39;foo-model&#39;) entry in a configuration file!</p><h3>8. <a href="https://github.com/DockYard/ember-composable-helpers">ember-composable-helpers</a></h3><p>This is a handy little collection of template helpers that can alleviate a lot of the boilerplate that can sometimes clutter up your components or controllers. Consider a typical controller with a a property like newModels: computed.filterBy(&#39;model.isNew&#39;) and a template like:</p><pre>{{#each newModel as |foo|}}<br>  {{foo.title}}<br>{{/each}}</pre><p>Not only is the newModels property essentially boilerplate, but we&#39;ve lost a bit of the context. Imagine a lazy developer who instead names that property something like newM or even worse models (I&#39;ve seen it happen). That can make it difficult to reason about what&#39;s going on in your template without constantly checking the underlying controller. With ember-composable-helpers we can get rid of the property. The helpers were also designed with &quot;composability&quot; in mind, so you can mix and match to suit your needs. Adding some sorting to this example would give us this:</p><pre>{{#each (sort-by &quot;title&quot; (filter-by &quot;isNew&quot; model)) as |foo|}}</pre><p>There’s a lot of helpers available, including some neat action and math helpers. There’s a separate repo for <a href="https://github.com/romulomachado/ember-cli-string-helpers">string helpers</a>. The helpers can also be opted into via your configuration ember-cli-build.js so if your only interested in one or two you don&#39;t have to include the whole library in your app.</p><h3>Honorable Mentions</h3><p>It was hard to trim the list down to just the addons that I use on <em>every</em> project. Here’s a few honorable mentions that are worth checking out, but may not be necessary given the requirements of your application:</p><ul><li><a href="https://github.com/yapplabs/ember-wormhole">ember-wormhole</a>: For when you need to render something outside of the DOM element of you template.</li><li><a href="http://ember-animation.github.io/liquid-fire/">liquid-fire</a>: Easy animations, including on a per-route basis.</li><li><a href="https://github.com/kategengler/ember-feature-flags">ember-feature-flags</a>: Easily turn on or off parts of your application. Includes test helpers for toggling them on the fly.</li><li><a href="https://github.com/aexmachina/ember-cli-sass">ember-cli-sass</a>: Despite all the advances in CSS, I still prefer using a preprocessor like <a href="http://sass-lang.com/">SASS</a>. This addon makes it simple.</li><li><a href="https://github.com/ebryn/ember-component-css">ember-component-css</a>: Easily scope your styles to a component. Only not in the top 8 because I forgot it while I was writing this article!</li><li><a href="https://percy.io/">ember-percy</a>: Visual regression testing as-a-service! They’ve got a nice free tier to try it out.</li><li><a href="https://github.com/ember-a11y/ember-a11y">ember-a11y</a>: Accessibility helpers. Dead simple to make sure your application works with screen readers.</li><li><a href="http://offirgolan.github.io/ember-cp-validations/">ember-cp-validations</a>: Powerful validation library driven by computed properties.</li><li><a href="http://ember-simple-auth.com/">ember-simple-auth</a>: If you do any kind of authentication, you should check this out.</li><li><a href="https://github.com/csantero/ember-sinon">ember-sinon</a>: Nice shim for <a href="http://sinonjs.org/">Sinon</a> for spies, stubs and mocks.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8393bea3c96f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>