<?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: Sachin Singh</title>
    <description>The latest articles on DEV Community by Sachin Singh (@scssyworks).</description>
    <link>https://dev.to/scssyworks</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%2F1101128%2F8e4bc296-a149-499c-8fee-b4ae36fb2e20.jpeg</url>
      <title>DEV Community: Sachin Singh</title>
      <link>https://dev.to/scssyworks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/scssyworks"/>
    <language>en</language>
    <item>
      <title>Rollup-scripts: "An ambitious project for JS/TS libraries"</title>
      <dc:creator>Sachin Singh</dc:creator>
      <pubDate>Wed, 14 Jun 2023 06:33:20 +0000</pubDate>
      <link>https://dev.to/scssyworks/rollup-scripts-an-ambitious-project-for-rollup-lai</link>
      <guid>https://dev.to/scssyworks/rollup-scripts-an-ambitious-project-for-rollup-lai</guid>
      <description>&lt;p&gt;Recently, I started working on a new project called &lt;strong&gt;"Rollup Scripts"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;More details on the project can be found here: &lt;a href="https://github.com/scssyworks/rollup-scripts"&gt;https://github.com/scssyworks/rollup-scripts&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The name &lt;strong&gt;Rollup Scripts&lt;/strong&gt; is derived from a very popular bundler named &lt;code&gt;Rollup&lt;/code&gt;. It's a collection of scripts which simplifies the task of setting up project source files. Let me explain...&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up a project
&lt;/h2&gt;

&lt;p&gt;When starting a new project, the initial setup phase often involves creating a basic folder structure and configuring essential files like &lt;code&gt;rollup.config.js&lt;/code&gt;, &lt;code&gt;.babelrc&lt;/code&gt;, and &lt;code&gt;.eslintrc.json&lt;/code&gt;. These foundational components form the backbone of any &lt;code&gt;JavaScript&lt;/code&gt; project.&lt;/p&gt;

&lt;p&gt;To illustrate, here's a typical project structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;app name&amp;gt;
|
-- src
|   |
|   --index.js
|
-- package.json
|
-- .gitignore
|
-- rollup.config.js
|
-- .eslintrc.json
|
-- .babelrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Furthermore, numerous dependencies such as &lt;code&gt;rollup&lt;/code&gt;, &lt;code&gt;eslint&lt;/code&gt;, &lt;code&gt;eslint-plugin-*&lt;/code&gt;, &lt;code&gt;@babel/core&lt;/code&gt;, &lt;code&gt;@babel/preset-*&lt;/code&gt;, &lt;code&gt;@babel/plugin-*&lt;/code&gt;, &lt;code&gt;@rollup/plugin-*&lt;/code&gt;, and more need to be installed. The list can be quite extensive!&lt;/p&gt;

&lt;p&gt;Undoubtedly, the most laborious aspect of this process is the constant iteration required to fine-tune the setup and achieve a satisfactory configuration. This refining process often consumes nearly half of the total time dedicated to building the project.&lt;/p&gt;

&lt;p&gt;But what if I told you there's a better way? What if I told you that you have the choice to focus on what truly matters: &lt;strong&gt;creating a library?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing &lt;code&gt;rollup-scripts&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;In this guide, I will demonstrate how effortlessly you can set up your own &lt;code&gt;JavaScript&lt;/code&gt; library project.&lt;/p&gt;

&lt;p&gt;Step 1: Establishing the Folder Structure&lt;br&gt;
Begin by creating a root folder named &lt;code&gt;src&lt;/code&gt; and an entry file called &lt;code&gt;index.js&lt;/code&gt;. Feel free to use &lt;code&gt;index.mjs&lt;/code&gt;, &lt;code&gt;index.ts&lt;/code&gt;, or &lt;code&gt;index.mts&lt;/code&gt; based on your preference.&lt;/p&gt;

&lt;p&gt;Step 2: Installing the Required Dev Dependency&lt;br&gt;
To proceed, install &lt;code&gt;rollup-scripts&lt;/code&gt; as the sole dev dependency. It includes everything you need for the setup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-D&lt;/span&gt; &lt;span class="nt"&gt;--save-exact&lt;/span&gt; rollup-scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3: Configuring npm Scripts&lt;br&gt;
To streamline your workflow, configure the following npm scripts in your &lt;code&gt;package.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rollup-scripts build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rollup-scripts lint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"init"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rollup-scripts init"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;package.json&lt;/p&gt;

&lt;p&gt;That's it! You're now ready to dive into developing your incredible library without any further setup hassle.&lt;/p&gt;

</description>
      <category>rollup</category>
      <category>bundler</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
