<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Christopher Sandvik</title>
    <description>The latest articles on DEV Community by Christopher Sandvik (@csandman).</description>
    <link>https://dev.to/csandman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F307625%2F365f81ca-ad4f-45e9-84d8-fecaa84f9dfc.png</url>
      <title>DEV Community: Christopher Sandvik</title>
      <link>https://dev.to/csandman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/csandman"/>
    <language>en</language>
    <item>
      <title>How I made my first successful open-source project</title>
      <dc:creator>Christopher Sandvik</dc:creator>
      <pubDate>Fri, 28 Oct 2022 22:47:43 +0000</pubDate>
      <link>https://dev.to/csandman/how-i-made-my-first-successful-open-source-project-3moo</link>
      <guid>https://dev.to/csandman/how-i-made-my-first-successful-open-source-project-3moo</guid>
      <description>&lt;p&gt;&lt;em&gt;This post was originally &lt;a href="https://medium.com/p/31f2334947a7" rel="noopener noreferrer"&gt;published to Medium&lt;/a&gt; on Oct 17, 2022 and the stats listed below have been updated for this post&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For the first time since I started my career in web development, I can say I’ve made a successful piece of open-source software, because today my TypeScript package &lt;a href="https://github.com/csandman/chakra-react-select" rel="noopener noreferrer"&gt;chakra-react-select&lt;/a&gt; just passed 1 million total downloads.&lt;/p&gt;

&lt;p&gt;What is Chakra React Select? It’s just your standard dropdown select component made for React applications, styled to match the UI component library &lt;a href="https://chakra-ui.com/" rel="noopener noreferrer"&gt;Chakra UI&lt;/a&gt;. However, it’s not entirely my own creation. Instead it’s a wrapper for the majorly popular &lt;a href="https://react-select.com/home" rel="noopener noreferrer"&gt;React Select&lt;/a&gt;, which, for a long time, was &lt;a href="https://www.youtube.com/watch?v=yS0jUnmBujE" rel="noopener noreferrer"&gt;the most starred React project on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3436%2F1%2A_sEZenG3dlaQefczw8KYHQ.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3436%2F1%2A_sEZenG3dlaQefczw8KYHQ.gif" alt="chakra-react-select in action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are some stats showing how far the package has come:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It has been &lt;a href="https://npm-stat.com/charts.html?package=chakra-react-select&amp;amp;from=2021-09-13&amp;amp;to=2022-10-27" rel="noopener noreferrer"&gt;downloaded &lt;strong&gt;1,156,328&lt;/strong&gt; times&lt;/a&gt; from &lt;a href="https://www.npmjs.com/" rel="noopener noreferrer"&gt;NPM&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is currently being downloaded &lt;strong&gt;51,561&lt;/strong&gt; times per week and rising&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/csandman/chakra-react-select/stargazers" rel="noopener noreferrer"&gt;There are &lt;strong&gt;466&lt;/strong&gt; people (including myself of course) who have starred the project on GitHub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/csandman/chakra-react-select/network/dependents" rel="noopener noreferrer"&gt;It is being used in &lt;strong&gt;669&lt;/strong&gt; open source repositories and &lt;strong&gt;23&lt;/strong&gt; open source packages hosted on GitHub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The most popular package it is being used in currently is &lt;a href="https://github.com/rjsf-team/react-jsonschema-form" rel="noopener noreferrer"&gt;&lt;strong&gt;react-jsonschema-form&lt;/strong&gt;&lt;/a&gt;, which currently has over &lt;a href="https://github.com/rjsf-team/react-jsonschema-form/stargazers" rel="noopener noreferrer"&gt;&lt;strong&gt;12,000&lt;/strong&gt; stars&lt;/a&gt; on GitHub&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project all came about in April 2021, when I started searching for a multi select component I could use with Chakra UI that didn’t completely diverge from it’s design system. I wanted a searchable dropdown that allowed me to select multiple states, or something along those lines. I quickly realized I was not alone in this search as I found &lt;a href="https://github.com/chakra-ui/chakra-ui/issues/38" rel="noopener noreferrer"&gt;many&lt;/a&gt; &lt;a href="https://github.com/chakra-ui/chakra-ui/issues/140" rel="noopener noreferrer"&gt;many&lt;/a&gt; &lt;a href="https://github.com/chakra-ui/chakra-ui/issues/1293" rel="noopener noreferrer"&gt;issues&lt;/a&gt; on their &lt;a href="https://github.com/chakra-ui/chakra-ui/issues/4311" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; &lt;a href="https://github.com/chakra-ui/chakra-pro-issues/issues/5" rel="noopener noreferrer"&gt;repo&lt;/a&gt; &lt;a href="https://github.com/chakra-ui/chakra-ui/discussions/3479" rel="noopener noreferrer"&gt;requesting&lt;/a&gt; a &lt;a href="https://github.com/chakra-ui/chakra-ui/discussions/3382" rel="noopener noreferrer"&gt;component&lt;/a&gt; for &lt;a href="https://github.com/chakra-ui/chakra-ui/discussions/3479" rel="noopener noreferrer"&gt;this&lt;/a&gt; &lt;a href="https://github.com/chakra-ui/chakra-ui/discussions/2830" rel="noopener noreferrer"&gt;purpose&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There were a few custom components people had made for this purpose, but none of them fit for my specific use case.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5236%2F1%2A0Vu7Lgq9rfTziFtZHGsk9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5236%2F1%2A0Vu7Lgq9rfTziFtZHGsk9g.png" alt="chakra-react-select compared to some alternatives"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few people &lt;a href="https://github.com/chakra-ui/chakra-ui/issues/1293#issuecomment-755307022" rel="noopener noreferrer"&gt;mentioned&lt;/a&gt; that one possibility would be for the creators of Chakra to simply wrap React Select, as it is already a mature package that is highly customizable. However, it didn’t seem like they were going to take that route, and there didn’t seem to be any timeline for them implementing their own. So I figured I’d give it a shot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2800%2F1%2AhELNybzX-6Eg_wLrQOjaKQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2800%2F1%2AhELNybzX-6Eg_wLrQOjaKQ.png" alt="Chakra UI’s built in single select vs. React Select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started off with the basics and just customized the styles of React Select using &lt;a href="https://react-select.com/styles" rel="noopener noreferrer"&gt;their great styling system&lt;/a&gt; until it didn’t look out of place. I was pretty happy with the result so I figured I’d share my creation with the Chakra community as &lt;a href="https://gist.github.com/csandman/c687a9fb4275112f281ab9a5701457e4" rel="noopener noreferrer"&gt;a simple GitHub Gist&lt;/a&gt; with &lt;a href="https://codesandbox.io/s/chakra-ui-react-select-648uv?file=/chakra-react-select.js" rel="noopener noreferrer"&gt;a CodeSandbox demo&lt;/a&gt; to go along with it. I quickly began getting &lt;a href="https://github.com/chakra-ui/chakra-ui/issues/140#issuecomment-825235474" rel="noopener noreferrer"&gt;positive responses&lt;/a&gt; and a decent level of interaction on the gist. Since then it has received 30 stars and been forked 10 times. On top of that, the demo has been viewed 37,800+ times and been forked 433 times.&lt;/p&gt;

&lt;p&gt;All of the interaction it received motivated me to make it better, so, over time, I made quite a few changes to the gist in an attempt to improve it. However, I soon realized that making edits to a gist is not a great way to push out updates. I figured that, for the most part, only people who were seeing it for the first time would actually see those changes and once they copied the code into their projects, most would probably not look at it again.&lt;/p&gt;

&lt;p&gt;So finally, 27 revisions on the gist later, I decided to make it into &lt;a href="https://www.npmjs.com/package/chakra-react-select" rel="noopener noreferrer"&gt;an NPM package&lt;/a&gt;. Going into it, there were some big challenges I knew I would face. The most obvious being that one of the big draws of Chakra UI is that it’s written entirely in TypeScript, a language I had never used before. I knew that if I wanted to make the package as useful as I could, then it would have to be written in TypeScript so users would have the best developer experience possible. The other big issue, and one of the main reasons I didn’t make it into a package sooner, was that I knew there would be difficulties in allowing people to customize the component.&lt;/p&gt;

&lt;p&gt;Despite these glaring issues I gave it a shot anyway. And on Sep 13, 2021 I made my &lt;a href="https://github.com/csandman/chakra-react-select/commit/ece740feee9720e836121da0f83d8fe85e456801" rel="noopener noreferrer"&gt;first commit&lt;/a&gt; to the new repo and &lt;a href="https://www.npmjs.com/package/chakra-react-select/v/1.0.0" rel="noopener noreferrer"&gt;published the first version to NPM&lt;/a&gt;. I started off very basic. I just wanted it to work in the same way my gist did- with no TypeScript in sight. And, having barely made any NPM packages, this took a bit of figuring out. I ended up publishing 10 versions that day, none of which worked, so I decided to put it down for a bit and come back to it later.&lt;/p&gt;

&lt;p&gt;After a week (and &lt;a href="https://gist.github.com/csandman/c687a9fb4275112f281ab9a5701457e4?permalink_comment_id=3898650#gistcomment-3898650" rel="noopener noreferrer"&gt;some prompting&lt;/a&gt;), I decided to give it another shot. Once I changed the build tool I was using from &lt;a href="https://www.npmjs.com/package/microbundle" rel="noopener noreferrer"&gt;microbundle&lt;/a&gt; to &lt;a href="https://www.npmjs.com/package/rollup" rel="noopener noreferrer"&gt;rollup&lt;/a&gt; (and published another 10 versions), I had a working package I was satisfied with. I shared it on a few of the relevant issues on the Chakra UI repo but quickly realized that the next step would be converting the whole thing to TypeScript.&lt;/p&gt;

&lt;p&gt;Luckily for me, I wasn’t starting from scratch. A large portion of the comments on the original gist were about adding TypeScript support and a &lt;a href="https://gist.github.com/bbovenzi/76a28701b7933420655925eefaa03dd5" rel="noopener noreferrer"&gt;couple&lt;/a&gt; &lt;a href="https://gist.github.com/csandman/c687a9fb4275112f281ab9a5701457e4?permalink_comment_id=3758944#gistcomment-3758944" rel="noopener noreferrer"&gt;people&lt;/a&gt; lent a hand. These versions helped tremendously in getting started considering I had no TypeScript experience. I published the first (semi) functional TS version three days later, but it wasn’t until a few months later that the types actually worked properly.&lt;/p&gt;

&lt;p&gt;Soon after that someone made &lt;a href="https://github.com/csandman/chakra-react-select/issues/2" rel="noopener noreferrer"&gt;the first issue&lt;/a&gt; on the repo. As I had anticipated, it was asking about how to customize the styles further than I already had. three people commented on the issue requesting the same thing shortly after that, so I knew I had to figure something out. However, the solution definitely did not come quickly.&lt;/p&gt;

&lt;p&gt;It wasn’t until three months later (Jan 2021) that I finally figured out a good solution. In order to make it customizable in a unified way, I had to make a replacement for every sub-component that makes up React Select so they could be styled as Chakra components. On top of that, I had to make an entirely new styling system in parallel to React Select’s own. The process required me to &lt;a href="https://github.com/csandman/chakra-react-select/pull/25" rel="noopener noreferrer"&gt;add a ton of new code&lt;/a&gt; to the package but by the end of it I was very satisfied with how it worked. On Jan 4, 2022 I released &lt;a href="https://github.com/csandman/chakra-react-select/releases/tag/v2.0.0" rel="noopener noreferrer"&gt;chakra-react-select@2.0.0&lt;/a&gt; and finally put all the customization requests to rest.&lt;/p&gt;

&lt;p&gt;The next problem to tackle was fixing the TypeScript integration. I hadn’t realized it, but for the entire time up until this point, none of the prop types on the component were being enforced properly. On top of that, it was &lt;a href="https://github.com/csandman/chakra-react-select/issues/5" rel="noopener noreferrer"&gt;brought to my attention&lt;/a&gt; that &lt;a href="https://github.com/JedWatson/react-select/releases/tag/react-select%405.0.0" rel="noopener noreferrer"&gt;react-select@5.0.0&lt;/a&gt;, which included built in TypeScript support was released one day before I released my &lt;a href="https://github.com/csandman/chakra-react-select/releases/tag/v1.2.0" rel="noopener noreferrer"&gt;original TS compatible version&lt;/a&gt; that was made to work specifically with &lt;a href="mailto:react-select@4"&gt;react-select@4&lt;/a&gt;. Perfect timing right?&lt;/p&gt;

&lt;p&gt;Less than a week after releasing v2 I had a chance to sit down and really dig into how the types worked for React Select v5. Finally I had a breakthrough, and with some major structural changes I had a version that was fully TypeScript compatible. These changes were released in &lt;a href="https://github.com/csandman/chakra-react-select/releases/tag/v3.0.0" rel="noopener noreferrer"&gt;v3.0.0&lt;/a&gt; on Jan 10, 2022, and I was finally confident that the whole package was production ready for Vanilla JS and TypeScript applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5944%2F1%2AbyMifv8CgGvFR1SEiVHnTQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5944%2F1%2AbyMifv8CgGvFR1SEiVHnTQ.png" alt="The progress of chakra-react-select since the release of v3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It seems that the users agreed it was production ready at that point because from there on the downloads/week then steadily rose up to the point it’s at today. I also noticed a major change in the types of issues that were being filed on the repo. All of a sudden they went from “why can’t I do X with this package” and “none of the types are working” to simple questions about how to actually use it. There were still some bugs to work through after the release of v3 of course, but they were more about polishing it up than major app breaking issues. For the most part since then, I’ve added a few new features (some contributed by others), fleshed out &lt;a href="https://github.com/csandman/chakra-react-select#readme" rel="noopener noreferrer"&gt;the documentation&lt;/a&gt;, and answered questions as people have had them.&lt;/p&gt;

&lt;p&gt;Overall, making this package has been a great experience. I’ve learned a ton about different build tools, how TypeScript works (which I now use in all of my production applications), and how to support an open-source community. I’ve also learned about the struggles open-source maintainers deal with when supporting a project, such as receiving the same question multiple times or being forced to tell people that their feature request can’t be added. But even taking the struggles into account, I’m happy I started this project and I’m very proud of how far it’s come!&lt;/p&gt;




&lt;p&gt;There’s a few pieces of advice I would give anyone trying to break into the open-source space;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Find a gap, somewhere there is a clear need for something, and fill it. I’ve made things in the past that have been unique enough to not have many alternatives, but there wasn’t a clear need for them in the first place. In this case I only made this package because I needed it for myself and just so happened to have a community looking for something similar. Because of that, I was able to get my package out there simply by linking to it in those places where people were asking for it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When you’re just starting off, try and answer all questions, no matter how dumb they might seem. As the person who made the software some questions may seem trivial or obvious to you but they might not be as clearly described in your documentation as you think. An added benefit of this is that the more issues/discussions you answer, the more content people will have to look through before asking questions in the future.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adding to number 2- if you find yourself getting the same question over and over, try and highlight those things more in your documentation. Good documentation will save you time explaining things down the road, and your users will help you understand what they need for the documentation to be more clear and complete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You don’t need to host an entire website for your documentation, especially if your project isn’t that big. The README on your GitHub repo can be plenty, and sometimes its easier to find what you’re looking for with a good old ctrl/cmd + f. However, including complete functional examples certainly helps. In the case of React components, I recommend linking to &lt;a href="https://codesandbox.io/" rel="noopener noreferrer"&gt;CodeSandbox&lt;/a&gt; examples so people can see different use cases in action and tinker with the implementation themselves.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At the end of the day, just start making things! You never know what might take off unless you put your code out there and you can’t put your code out there if you don’t code things in the first place.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
