<?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 Dan Cherouny on Medium]]></title>
        <description><![CDATA[Stories by Dan Cherouny on Medium]]></description>
        <link>https://medium.com/@dcherouny?source=rss-a8c1e18ab59c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*P7rP3YusVp58Y85N.</url>
            <title>Stories by Dan Cherouny on Medium</title>
            <link>https://medium.com/@dcherouny?source=rss-a8c1e18ab59c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 10:51:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dcherouny/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[Uploading Source Maps to Sentry with Webpack]]></title>
            <link>https://medium.com/inturn-eng/uploading-source-maps-to-sentry-with-webpack-ed29cc82b01d?source=rss-a8c1e18ab59c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed29cc82b01d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[sentry]]></category>
            <category><![CDATA[sourcemap]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[circleci]]></category>
            <dc:creator><![CDATA[Dan Cherouny]]></dc:creator>
            <pubDate>Thu, 08 Nov 2018 18:01:22 GMT</pubDate>
            <atom:updated>2019-02-15T10:56:49.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZgRkdxPkYoBav_2I" /><figcaption>“round gray framed compass on brown map” by <a href="https://unsplash.com/@whoishimesh?utm_source=medium&amp;utm_medium=referral">Himesh Kumar Behera</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>NOTE: This article has been updated to use the new Sentry SDK</h3><p>Prereqs:</p><ul><li><a href="https://sentry.io/welcome/">Sentry</a> — Open-source error tracking that helps developers monitor and fix crashes in real time.</li><li><a href="https://docs.sentry.io/error-reporting/quickstart/?platform=browsernpm">@sentry/browser</a> — Sentry SDK for JavaScript</li><li><a href="https://webpack.js.org/">Webpack</a> — Webpack is an open-source JavaScript module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.</li></ul><p>If you’re like us at <a href="https://www.inturn.co/">INTURN</a>, you’ve found great value in having live error tracking integrated with your apps. Not only can you see if there are any issues in your production applications, but you can hook up error tracking to any environment and see when and where an error is thrown. After doing some research, we chose Sentry for our error tracking because of its ability to track in multiple environments, and across multiple releases.</p><p>When hooking this up to our front-end application, we used React’s Error Boundaries to manage our calls to Sentry with this bit of code:</p><pre>import React from &#39;react&#39;;<br>import InternalErrorBoundary from &#39;react-error-boundary&#39;;<br>import * as Sentry from &#39;@sentry/browser&#39;;</pre><pre>const defaultOnErrorHandler = (error, stack) =&gt; {<br>  console.error(error, stack);</pre><pre>  Sentry.captureException(error);<br>};</pre><pre>const ErrorBoundary = props =&gt; (<br>  &lt;InternalErrorBoundary<br>    onError={defaultOnErrorHandler}<br>    {...props}<br>  /&gt;<br>);</pre><pre>export default ErrorBoundary;</pre><p>This way, whenever an Error Boundary is hit, we send a request to Sentry with the error and stack information. While we have a few other custom exceptions, the majority of the errors in our app are reported this way. At the end of the day, it was a simple way to get a ton of information about any errors our users see.</p><p>After some time using Sentry in our production app, we noticed a couple issues with how our errors were being reported. The first issue was that we had no context in terms of which version of our software was throwing this error. The second, and most important, was that we were getting minified code in our reports, which made it difficult to figure out where the actual issue was in our files. We decided to make these two improvements to our Sentry setup:</p><ul><li>Adding versions to our Sentry reporting by using git’s SHA-1 hash</li><li>Adding source maps to our error traces</li></ul><p>Adding versions to Sentry seemed like the low-hanging fruit, so we decided to tackle that first. In setting up Sentry, we had created a sentry.js file that housed our configuration for Sentry (if you need help doing this, see the Sentry docs <a href="https://docs.sentry.io/learn/configuration/?platform=javascript">here</a>). This config accepts a release key, and since we already pass that into our build command as process.env.GIT_SHA1, we added that to our Sentry config. And just like that, errors were attached to a specific git hash!</p><p>Now for adding source maps. The easiest solution was to build and bundle them with our application, but there are many obvious issues with doing this (security, bundle size, etc.). So we did some digging, and the first thing that we found was <a href="https://github.com/getsentry/sentry-webpack-plugin">sentry-webpack-plugin</a>, which we were excited about. Reading the docs, it seemed like a pretty simple setup to get source maps hooked up to Sentry.</p><p>Unfortunately, two days later, we still couldn’t figure out how to get it working. We re-read the docs and tried every configuration that might make sense, but still got nothing. We weren’t even seeing files attempting to be uploaded to Sentry (if you had success with this plugin, please let us know what you did!).</p><p>This is when frustration started to kick in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xb_B-h9xbJBObcwQ" /><figcaption>“grayscale photography of woman opening her mouth while hanging her hands near her face” by <a href="https://unsplash.com/@gmat07?utm_source=medium&amp;utm_medium=referral">Gabriel Matula</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>After no success with the plugin, we decided to try using Sentry’s CLI tool, <a href="https://github.com/getsentry/sentry-cli">sentry-cli</a>. The first step was to yarn add -D @sentry/cli. Then, we needed to figure out how to use sentry-cli. After reading the docs <a href="https://docs.sentry.io/learn/cli/releases/#upload-source-maps?platform=javascript#upload-source-maps">here</a>, we were able to access our projects with this command:</p><pre>yarn sentry-cli --auth-token=${SENTRY_API_KEY} projects --org={SENTRY_ORG} list</pre><p>NOTE: If you haven’t created an API Key for Sentry, you can do so by following <a href="https://sentry.io/settings/account/api/auth-tokens/">this link</a> (just make sure to enable the project:write option or you won’t be able to upload your source maps).</p><p>Now that we were able to access the project, let’s try to create a release using the following command:</p><pre>yarn sentry-cli --auth-token=${SENTRY_API_KEY} releases --org={SENTRY_ORG} --project={SENTRY_PROJECT_NAME} new test-release</pre><p>This creates a new release in Sentry called test-release , which you should be able to see in your Sentry web app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*YPy9hQ-C7L68NOzNOjNr9w.png" /></figure><p>NOTE: If you are using a git hash for your release name, the title of the release will be shown as a short version of that hash. However, <em>actual</em> release name is the full git hash. This threw us for quite some time, but hopefully our pain can save you some.</p><p>The next step is to upload some source maps to a release, but first, we need some generated source maps to upload.</p><p>During your build process, you want to make sure that you build source map files. For us, this meant turning the sourceMap option on in UglifyJsPlugin , and adding SourceMapDevToolPlugin to our build with the following configuration (appending the sourceMappingURL is required in Sentry’s docs):</p><pre>new webpack.SourceMapDevToolPlugin({<br>  filename: &#39;[name].[hash].js.map&#39;,<br>  exclude: [&#39;vendor&#39;],<br>  append: &#39;//# sourceMappingURL=[url]&#39;,<br>}),</pre><p>Next, you need to upload these files to Sentry with the following command:</p><pre>yarn sentry-cli --auth-token=${SENTRY_API_KEY} releases --org={SENTRY_ORG} --project={SENTRY_PROJECT_NAME} files ${GIT_SHA1} upload-sourcemaps &quot;./dist/*.js.map&quot; --url-prefix &quot;~/dist/&quot;</pre><p>This assumes you’re using the git hash for your release name, but if you’re not, you just need to substitute the GIT_SHA1 with whatever name or variable you decide to use for your release name. Just make sure it matches whatever is set in your app’s sentry.js file.</p><p>Also, you’ll notice we added a --url-prefix . This was the last big hurdle for us to jump over to get these source maps working. Essentially, Sentry’s source map paths must match the file names exactly. We noticed that since we’re using a dist directory for our assets, we needed to prefix the url when we upload to Sentry. If you get stuck here, just check the names of the source maps in webpack’s output and compare it to the name of the uploaded files in your Sentry release.</p><p>One final step here is to delete the generated source maps before you put this app into production, so clients don’t see them. We do this in our builds by running rm -rf ./dist/*.js.map after we upload.</p><p>And that’s it! You should see the source maps uploaded to your release in Sentry, and when you use a version of your app that has the same release name set in its sentry.js file, the source maps will be applied in Sentry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xO_PZDthkSXQzGjA" /><figcaption>Photo by <a href="https://unsplash.com/@rawpixel?utm_source=medium&amp;utm_medium=referral">rawpixel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed29cc82b01d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/inturn-eng/uploading-source-maps-to-sentry-with-webpack-ed29cc82b01d">Uploading Source Maps to Sentry with Webpack</a> was originally published in <a href="https://medium.com/inturn-eng">inturn-eng</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Atomic Design and Our Component Library]]></title>
            <link>https://medium.com/inturn-eng/atomic-design-and-our-component-library-42ae1988aa4f?source=rss-a8c1e18ab59c------2</link>
            <guid isPermaLink="false">https://medium.com/p/42ae1988aa4f</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[component-libraries]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Dan Cherouny]]></dc:creator>
            <pubDate>Fri, 24 Aug 2018 20:50:45 GMT</pubDate>
            <atom:updated>2018-08-24T20:50:45.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1zQrbEnwLDMkRhOv" /><figcaption>Photo by <a href="https://unsplash.com/@joelfilip?utm_source=medium&amp;utm_medium=referral">Joel Filipe</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Prereqs</h3><ul><li><a href="http://bradfrost.com/blog/post/atomic-web-design/">Atomic Web Design</a> — Design System for Applications</li><li><a href="https://github.com/storybooks/storybook">Storybook</a> — UI Component Development Library</li></ul><h3>Intro</h3><p>Over the past several months, we have been in the process of moving our React components over to a component library (CL). This library, imported as a node package, is seen as an agnostic third-party library from which we import components for use in our main app. As we grew this CL, two things happened: our design team asked for an easy way to view all the components available to them (more on that later), and we also noticed some patterns emerge in terms of component hierarchy.</p><h4>Pattern 1:</h4><p>Many of our components followed Atomic Design principles. We had our own base components that overwrote HTML elements, other small components that used those base components, and so on, up to our page views.</p><h4>Pattern 2:</h4><p>While we were trying to keep our components agnostic, there was inevitably some business logic required for select components. Since we were keeping our CL sterile, these components did not seem to have a place there. Looking at these two patterns, we had lots of questions. Let’s take a look at some of these questions and walk through the answers we found.</p><h3>How do we define the different Atomic stages?</h3><p>Atomic Design defines five component stages:</p><h4>Atoms:</h4><p>These are the basic building blocks of the application. Just like atoms IRL, everything else is built with them. After looking at our component directory, we noticed that the most basic component that can be built on is a native HTML element. Since those already exist, we turned to components that overwrite existing HTML functionality. This includes our &lt;Button /&gt;, &lt;Icon /&gt;, &lt;Input /&gt; components, and a few more. Every other component will be built on these Atoms.</p><h4>Molecules:</h4><p>Molecules are basic elements that combine Atoms and organize them in a way that makes sense for given designs. Continuing with the same logic, we saw that about half of our components in the CL were simple and grouped multiple Atoms together. This posed a few more questions for us, which I’ll tackle in the next section, but generally this seemed to make sense.</p><h4>Organisms:</h4><p>Organisms are more complex components that combine Molecules. This one we struggled with. At first, it made sense that Organisms were made up of Molecules. As we went down this road of thought, we came up with the restraint that components were only allowed to import components which were a lower stage than themselves. This brought up a lot of discussion due to the fact that, depending on the component, you could have n number of stages due to how components might be assembled. For instance, if you have a &lt;Table /&gt; that has &lt;Row /&gt; components, and that row renders a &lt;Cell /&gt;, which itself has an &lt;Input /&gt; inside of it, how are all those defined in this Atom, Molecule, Organism pattern? We realized that if we are fitting our components into a discrete number of stages, we could not use this pattern. After a lot of white-boarding, we decided to define our Organisms as complex components which are more defined visually than by looking at the code. In the example above, the &lt;Table /&gt;would be an Organism, but the &lt;Row /&gt; would be a Molecule. We couldn&#39;t determine a hard rule for how to discriminate between Organisms and Molecules, but since context is important here, we are ok with that.</p><h4>Templates:</h4><p>We decided to ignore Templates for our purposes. Since Atomic Design was made for designers, Templates are defined as more of a deliverable and can be ignored.</p><h4>Pages:</h4><p>Pages are the highest-level component that contains all your Organisms, Molecules, and Atoms. Pages, or Views as we call them, are the main component that your router loads when rendering. This was a very easy distinction.</p><h3>What limitations should we place on components in different stages of the Atomic Design hierarchy?</h3><p>Ok, so we know what our stages are, but how do our definitions line up with the actual components that we have developed? A lot of it was obvious. Our &lt;Button /&gt; should be an Atom, but what about our &lt;Well /&gt; component?</p><pre>const Well = ({<br> children,<br> style,<br>}) =&gt; (<br> &lt;div style={{<br>   padding: 16,<br>   backgroundColor: ${getColor(&#39;neutral&#39;, 3),<br>   border: `1px solid ${getColor(&#39;neutral&#39;, 2)}`,<br>   …style<br> }}&gt;<br>   {children}<br> &lt;/div&gt;<br>);</pre><p>It’s rendering a div with some style attached to it. (Actually, it renders a styled component, but for this purpose, we used a React style prop.) Does this make it an Atom because it only renders a base HTML element? Does it make it a Molecule because it adds functionality to the div? This is where we decided to make a few rules:</p><ul><li>Atoms cannot import other Atoms or Molecules</li><li>Atoms will only include base functionality that we are adding to our application. Adding these two rules seemed to make everything fall into place. In the case of our &lt;Well /&gt;, we are not <em>replacing</em> the functionality of a div, we are simply <em>decorating</em> it. Because of this, it gets put into the Molecule bucket. If we were to ever write a &lt;Div /&gt; component, that would be added to our Atoms. Other examples of Atom components could be an &lt;Animation /&gt; or &lt;Text /&gt;. This was a big distinction for us that became clear after defining Rule 2. In the case of Rule 1, we had realized there might be some confusion between Atoms and Molecules, and decided to add that rule to make a clear separation between the two. If you import a Molecule, you are Molecule or higher. With these two rules, we felt that we had a clear distinction for all components in our CL.</li></ul><h3>Where do components with business logic belong?</h3><p>After some discussion, we came to the realization that not all components belong in the CL. If we continuously use a component that looks something like this:</p><pre>const inturnContainer = ({ body }) =&gt; (<br> &lt;div&gt;<br>   &lt;H3&gt;INTURN&lt;/H3&gt;<br>   &lt;H4&gt;{translate(&#39;select_favorite_apple&#39;)&lt;/H4&gt;<br>   &lt;Paragraph&gt;{body}&lt;/Paragraph&gt;<br> &lt;/div&gt;<br>)</pre><p>Does that really belong in our CL? It looks very much like this component is not agnostic to business logic, based on two headers having set text. Where do components like this belong? Well, the answer is they belong in our app. It sounds obvious, but we realized that some components belong in our app instead of the CL because they are specific to our use case. This is also the case for our Pages or any other container component. This is not to say that we couldn’t make a base &lt;Page/&gt; component in our CL, but the specific implementation of that Page should be built in our app.</p><h3>Moving Forward</h3><p>As we implement these changes, we are also making sure that we add all of our components to an instance of Storybook that we set up. This ensures that our design team will have access to all of the components available, allowing us to reduce waste by minimizing the amount of new and one-off components that are developed. So, to answer the question of, &quot;What&#39;s the point of doing this?&quot; we can add, &quot;Improve product development lifecycle,&quot; to the list. Growing our CL will now be as simple as recognizing where a new component fits in this cycle, developing the component proper, and adding it to our Storybook instance. The result will be cleaner component directories, clearer division of the moving parts in our dev lifecycle, and better communication with our designers. So, all in all, happier employees and better processes. Sounds like a win to me!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42ae1988aa4f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/inturn-eng/atomic-design-and-our-component-library-42ae1988aa4f">Atomic Design and Our Component Library</a> was originally published in <a href="https://medium.com/inturn-eng">inturn-eng</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>