<?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: Luis Felipe Zaguini</title>
    <description>The latest articles on DEV Community by Luis Felipe Zaguini (@zaguiini).</description>
    <link>https://dev.to/zaguiini</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%2F250012%2F0e720863-d4a6-471a-af8d-9410164b0263.jpg</url>
      <title>DEV Community: Luis Felipe Zaguini</title>
      <link>https://dev.to/zaguiini</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zaguiini"/>
    <language>en</language>
    <item>
      <title>The quickest way to test changes in your forked React library</title>
      <dc:creator>Luis Felipe Zaguini</dc:creator>
      <pubDate>Fri, 17 Dec 2021 00:04:13 +0000</pubDate>
      <link>https://dev.to/zaguiini/the-quickest-way-to-test-changes-in-your-forked-react-library-4f9b</link>
      <guid>https://dev.to/zaguiini/the-quickest-way-to-test-changes-in-your-forked-react-library-4f9b</guid>
      <description>&lt;p&gt;I found that I was repeating myself in a fairly easy-to-automate task: create a React sandbox so I could easily test my projects in an isolated environment.&lt;/p&gt;

&lt;p&gt;Then, I rolled up my sleeves and end up creating my first command-line application! It's called &lt;code&gt;create-sandbox&lt;/code&gt; ✨&lt;/p&gt;

&lt;p&gt;The first thing that might come to mind is "how is it different from codesandbox.io?"&lt;/p&gt;

&lt;p&gt;Well -- codesandbox.io, despite being a great project that I do use extensively, only allows the installation of published packages. Not only that, it does not let you browse &lt;code&gt;node_modules&lt;/code&gt;, making it impossible to change the source code.&lt;/p&gt;

&lt;p&gt;It also does not support &lt;a href="https://docs.npmjs.com/cli/v8/commands/npm-link" rel="noopener noreferrer"&gt;linking&lt;/a&gt;, therefore you cannot iterate changes in your library in real-time.&lt;/p&gt;

&lt;p&gt;You can run it like that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-sandbox &amp;lt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;source&lt;/code&gt; is either a Git repository URL (it doesn't matter if it's SSH or HTTPS) or an existing folder in your file system.&lt;/p&gt;

&lt;p&gt;For testing, I'll pick my own &lt;a href="//git@github.com:zaguiini/use-data-structures.git"&gt;use-data-structures&lt;/a&gt; library. As one can guess, it exposes a few hooks that enables powerful data structures inside React. Let's go!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;➜  npx create-sandbox git@github.com:zaguiini/use-data-structures.git

✔ Cloned successfully
✔ React sandbox created successfully
✔ Project dependencies installed
✔ Dependencies linked

  Done!

  Now enter the `use-data-structures-sandbox` directory,
  run `yarn start` and enjoy your development sandbox!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And 💥! My sandbox is created!&lt;/p&gt;

&lt;p&gt;When running &lt;code&gt;yarn start&lt;/code&gt; in my sandbox folder, along with &lt;code&gt;yarn start&lt;/code&gt; in my forked project, I can test my changes in real-time!&lt;/p&gt;

&lt;p&gt;This is my usage in the sandbox:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3hjfgg9aj9kxsx41l9k4.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3hjfgg9aj9kxsx41l9k4.png" alt="Sandbox usage source code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is what I see in the browser:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fasvfq8m5csrt2efbsbov.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fasvfq8m5csrt2efbsbov.png" alt="Sandbox output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now look what happens when I change the &lt;code&gt;peek&lt;/code&gt; method return value in my forked project to &lt;code&gt;blue da ba dee da ba di&lt;/code&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4va9bkekw114gsd8pom.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4va9bkekw114gsd8pom.png" alt="Forked project changes reflected in real-time"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pretty cool, right?! It only took me a single command to clone the repository, create a sandbox, link the forked project and start iterating over it. A cool thing is that &lt;code&gt;create-sandbox&lt;/code&gt; uses whatever project manager the forked package uses, be it NPM or Yarn.&lt;/p&gt;

&lt;p&gt;This is just the beginning. Right now, &lt;code&gt;create-sandbox&lt;/code&gt; only works on simple React projects. In the future, monorepos will be supported.&lt;/p&gt;

&lt;p&gt;Not only that -- I'm planning to support &lt;em&gt;other&lt;/em&gt; JavaScript frameworks, such as Vue, Angular and even Svelte, if possible!&lt;/p&gt;

&lt;p&gt;The future looks bright, indeed. If you're wondering how I did that, &lt;a href="https://github.com/zaguiini/create-sandbox" rel="noopener noreferrer"&gt;here's the repository&lt;/a&gt;. It has the full roadmap, along with documentation! Come join us!&lt;/p&gt;

&lt;p&gt;Thanks for reading! Let me know if there are any questions.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>tooling</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
