<?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: flamewave000</title>
    <description>The latest articles on DEV Community by flamewave000 (@flamewave000).</description>
    <link>https://dev.to/flamewave000</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%2F2158605%2F084422bb-b830-4e31-9d98-4e30a18e3814.png</url>
      <title>DEV Community: flamewave000</title>
      <link>https://dev.to/flamewave000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/flamewave000"/>
    <language>en</language>
    <item>
      <title>DOIT: A Simpler Build Script</title>
      <dc:creator>flamewave000</dc:creator>
      <pubDate>Wed, 02 Oct 2024 20:02:26 +0000</pubDate>
      <link>https://dev.to/flamewave000/doit-yet-another-build-script-4o0k</link>
      <guid>https://dev.to/flamewave000/doit-yet-another-build-script-4o0k</guid>
      <description>&lt;p&gt;So I hate most build tools. Makefile is waaay too complex and finicky, Gradle is slow and also not very intuitive. NPM suuuper slow, and lacking any decent features. Gulp is as slow or slower than NPM, but does have a lot of features... if you want all the dependencies.&lt;/p&gt;

&lt;p&gt;Don't get me wrong! Makefile, Gradle, NPM and Gulp all have their uses. But sometimes I'm making a simple little side project, and I just want to quickly write a super basic build script that runs super fast to put all my commands into. I recently ran into this using Docker, where I was sticking all of my compose commands into the scripts field of an NPM package.json just so I could avoid typing things out all the time.&lt;/p&gt;

&lt;p&gt;I googled around and couldn't find a decent alternative that wasn't just "Make a shell script".&lt;/p&gt;

&lt;h2&gt;
  
  
  So I Made My Own: &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;Find it on GitHub: DOIT&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I used it as an opportunity to learn Rust for the first time, and created the scripting language called &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt;. You can add targets and variables, and the CLI is super easy to use. The interesting part is that it is not an interpreter. Instead it locally Transpiles the script to C++ and then compiles that to an executable with the GCC, before cleaning up. Then subsequent calls just execute the executable directly, unless a change is made to the &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt; script. This makes the &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt; tool execute in milliseconds, compared to NPM's seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why C++?
&lt;/h2&gt;

&lt;p&gt;Well I wanted to transpile to Rust, but I also didn't want people to HAVE to install Rust in order to use the tool, and pretty much everyone already has GCC preinstalled.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does it Work?
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt; tool detects a local script (or the path to one can be provided) and then looks for a local &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt; build directory. If the script is new, or has been changed, &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt; transpiles it to C++ and then runs the GCC. It then immediately runs the newly minted executable. If the script is not new, and has not been changed since the last time &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;DOIT&lt;/a&gt; ran, then it simply runs the executable immediately and exits.&lt;/p&gt;

&lt;p&gt;The CLI is simply: &lt;code&gt;$ doit my_target "John" "Smith"&lt;/code&gt;, and the local script is a single file named &lt;code&gt;do.it&lt;/code&gt;. Which looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;my_target &lt;span class="o"&gt;{&lt;/span&gt;
    @ My silly target &lt;span class="nb"&gt;help &lt;/span&gt;documentation
    &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hows it going! &lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="c"&gt;# It's really that simple&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Help!
&lt;/h2&gt;

&lt;p&gt;I also added some fun extras, like customizable Help Documentation. I often times will leave a project for a month or two and then come back and not remember what any of my scripts do. So I waste time reading them to figure it out. With this, you can run&lt;/p&gt;
&lt;h2&gt;
  
  
  Open Source
&lt;/h2&gt;

&lt;p&gt;I made the whole thing open-source and my motto for it is truly &lt;a href="https://en.wikipedia.org/wiki/KISS_principle" rel="noopener noreferrer"&gt;KISS&lt;/a&gt;. If you want it to do more, then you probably should be using something better suited. The script can do quite a lot, but I don't want it to grow in complexity like Make or Gradle.&lt;/p&gt;

&lt;p&gt;Instead it has a basic feature-set and is super fast and easy to write and maintain a script.&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%2F62vdz8zv8b71mcdbm995.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62vdz8zv8b71mcdbm995.gif"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/flamewave000" rel="noopener noreferrer"&gt;
        flamewave000
      &lt;/a&gt; / &lt;a href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;
        doit
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple transpiler that creates an executable program from a basic script
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;DOIT&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;The DOIT scripting language is a very simple and basic script for doing common tasks in a project folder. It has built in &lt;code&gt;--help&lt;/code&gt; support that is generated from the script itself. Good for quick and simple tasks that aren't complicated and don't need something more complicated like a Makefile.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Why?&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;So I know you can just use something like a Makefile to build things, but I get quickly frustrated with Makefiles and their crazy complexity. Most of the time I just want something I can put my simple CLI commands in that's easy to modify and maintain. I've previously used NPM for this, but it is painfully slow to run. So instead I built my own basic scripting language that gets transpiled to C++ and then compiled by the GCC to a very fast executable file.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Install&lt;/h2&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Self Build&lt;/h3&gt;

&lt;/div&gt;


&lt;ol&gt;

&lt;li&gt;Build the project following &lt;a href="https://github.com/flamewave000/doit#Build" rel="noopener noreferrer"&gt;Build&lt;/a&gt;
&lt;/li&gt;

&lt;li&gt;Link the executable to…&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/flamewave000/doit" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>rust</category>
      <category>cpp</category>
      <category>gcc</category>
    </item>
  </channel>
</rss>
