<?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: Zuygui</title>
    <description>The latest articles on DEV Community by Zuygui (@zuygui).</description>
    <link>https://dev.to/zuygui</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%2F1229804%2F6764b2c5-60aa-493f-9802-43d79170f7fa.png</url>
      <title>DEV Community: Zuygui</title>
      <link>https://dev.to/zuygui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zuygui"/>
    <language>en</language>
    <item>
      <title>Flow Updater JSON Creator</title>
      <dc:creator>Zuygui</dc:creator>
      <pubDate>Sat, 09 Dec 2023 17:38:23 +0000</pubDate>
      <link>https://dev.to/zuygui/flow-updater-json-creator-2855</link>
      <guid>https://dev.to/zuygui/flow-updater-json-creator-2855</guid>
      <description>&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/zuygui" rel="noopener noreferrer"&gt;
        zuygui
      &lt;/a&gt; / &lt;a href="https://github.com/zuygui/flowupdater-json-creator" rel="noopener noreferrer"&gt;
        flowupdater-json-creator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Create JSON file compatibles with Flow Updater from command line.
    &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;Flow Updater JSON Creator : Generate JSONs compatible with Flow Updater.&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;
  &lt;a href="https://github.com/zuygui/flowupdater-json-creator#todo" rel="noopener noreferrer"&gt;TODO&lt;/a&gt; •
  &lt;a href="https://github.com/zuygui/flowupdater-json-creator#key-features" rel="noopener noreferrer"&gt;Key Features&lt;/a&gt; •
  &lt;a href="https://github.com/zuygui/flowupdater-json-creator#installation" rel="noopener noreferrer"&gt;Installation&lt;/a&gt; •
  &lt;a href="https://github.com/zuygui/flowupdater-json-creator#usage" rel="noopener noreferrer"&gt;Usage&lt;/a&gt; •
  &lt;a href="https://github.com/zuygui/flowupdater-json-creator#contributing" rel="noopener noreferrer"&gt;Contributing&lt;/a&gt; •
  &lt;a href="https://github.com/zuygui/flowupdater-json-creator#license" rel="noopener noreferrer"&gt;License&lt;/a&gt;
&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Support other mods providers (Modrinth, etc.)&lt;/li&gt;
&lt;li&gt;Add custom json targets (MCP, External Files, etc.)&lt;/li&gt;
&lt;li&gt;Add compatibles version getter from ModLoader's API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any suggestions, feel free to open an issue or a pull request.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;📁 Generate JSON files compatible with [Flow Updater].&lt;/li&gt;
&lt;li&gt;🚀 Easy-to-use interface for creating configuration files.&lt;/li&gt;
&lt;li&gt;🔧 Customize JSON settings to match your requirements.&lt;/li&gt;
&lt;li&gt;📝 Documented code for easy integration into other projects.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Download from Releases&lt;/h3&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Download the latest release from the &lt;a href="https://github.com/zuygui/flowupdater-json-creator/releases" rel="noopener noreferrer"&gt;Releases&lt;/a&gt; page.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;

&lt;p&gt;Requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.rust-lang.org/tools/install" rel="nofollow noopener noreferrer"&gt;Rust&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/zuygui/flow-updater-json-creator.git&lt;/pre&gt;

&lt;/div&gt;

&lt;ol start="2"&gt;
&lt;li&gt;Navigate to the project directory:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c1"&gt;cd&lt;/span&gt; flow-updater-json-creator&lt;/pre&gt;

&lt;/div&gt;

&lt;ol start="3"&gt;
&lt;li&gt;Build the application:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;cargo build --bin flowupdater-json-creator --release&lt;/pre&gt;

&lt;/div&gt;

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

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Run the application:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;/path/to/flow-updater-json-creator/flowupdater-json-creator&lt;/pre&gt;

&lt;/div&gt;


&lt;ol start="2"&gt;

&lt;li&gt;

&lt;p&gt;Follow the on-screen instructions to generate your JSON files.&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Once generated, you can…&lt;/p&gt;


&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/zuygui/flowupdater-json-creator" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;While discussing and assisting people on the &lt;a href="https://discord.gg/zJkc7nZHRk" rel="noopener noreferrer"&gt;Support Launcher&lt;/a&gt; Discord server, a discord server for helping people to make customs Minecraft launchers, I realized that creating JSON files compatible with &lt;a href="https://github.com/FlowArg/FlowUpdater" rel="noopener noreferrer"&gt;Flow Updater&lt;/a&gt; was time-consuming and tedious. This led me to the idea of developing a command-line tool to replace &lt;a href="https://github.com/FlowArg/FlowUpdaterJsonCreator" rel="noopener noreferrer"&gt;the existing desktop application&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flow Updater
&lt;/h2&gt;

&lt;p&gt;Flow updater is a Java library to install, update and launch Minecraft (retrieved from officials servers) and mods loaded through Forge or any other mods loader. To load the mod list and other configurations, it is possible to host a JSON file and pass it into the library, ... So a JSON compatible with FlowUpdater looks like :&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; JSON (JavaScript Object Notation) is a data file format easy to read and write for humans and machines.&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;"curseFiles"&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"projectID"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;123456&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;random&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;curseforge&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;project&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;id&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"fileID"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;123456&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;random&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;curseforge&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;file&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;id&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;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;Writing this JSON is very tedious and time-consuming because you have to find the project id and the file id for each mod. So I decided to write a CLI tool to make this task easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;p&gt;To build this software, I had to utilize several tools, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://rust-lang.com" rel="noopener noreferrer"&gt;Rust&lt;/a&gt;, a compiled functional programming language developed by Mozilla (the company behind Firefox).&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Lutetium-Vanadium/requestty/" rel="noopener noreferrer"&gt;Request TTY&lt;/a&gt;, a Rust crate that facilitates the creation of command-line forms.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.curseforge.com/" rel="noopener noreferrer"&gt;Eternal API&lt;/a&gt;, the new Curseforge API, which allows me to retrieve the necessary information from mods for JSON generation.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/serde-rs/json" rel="noopener noreferrer"&gt;Serde JSON&lt;/a&gt;, an extension of the &lt;code&gt;serde&lt;/code&gt; crate that enables the serialization and deserialization of Rust structs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I've only mentioned the most significant elements present in the &lt;a href="https://github.com/zuygui/flowupdater-json-creator" rel="noopener noreferrer"&gt;source code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The goal
&lt;/h2&gt;

&lt;p&gt;I wanna replace the Java application (GUI) by a CLI application in Rust. I also wanna make the application more fast and accessible. Finally, I wanna add new features to the application like locals mods support and archives exports.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Steps
&lt;/h2&gt;

&lt;p&gt;I began by developing a wrapper for the CurseForge API, which turned out to be a lengthy and challenging process but constituted the bulk of the work. Next, I coded the CLI, which was relatively straightforward. Instead of using the &lt;a href="https://github.com/clap-rs/clap" rel="noopener noreferrer"&gt;&lt;code&gt;clap&lt;/code&gt;&lt;/a&gt; crate, a Rust tool for generating CLIs, I opted for the following line of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Vec&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;args&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.collect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code snippet captures the input to the program: the &lt;code&gt;main&lt;/code&gt; function defines an immutable variable called &lt;code&gt;args&lt;/code&gt;, which is a vector (a list with indefinite length, for the sake of simplicity here) of type &lt;code&gt;String&lt;/code&gt;. Thus, we obtain a list of all the arguments given when executing the binary file (including the application's name). I concluded the development of the first version with the JSON file generation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;Due to my heavy workload with school, I have less time to continue making progress on the project. This does not mean that I'm abandoning it; I'm simply moving forward at a slower pace. I sincerely thank &lt;a href="https://github.com/Bricklou" rel="noopener noreferrer"&gt;Bricklou&lt;/a&gt; for helping me maintain the project. We are actively working on creating new features.&lt;/p&gt;

&lt;h2&gt;
  
  
  The refactoring
&lt;/h2&gt;

&lt;p&gt;With &lt;a href="https://github.com/bricklou" rel="noopener noreferrer"&gt;Bricklou&lt;/a&gt;, we have decided to refactor all the code of the app for a better readability and a better maintainability. The first version of code are always available at the &lt;a href="https://github.com/zuygui/flowupdater/tree/old" rel="noopener noreferrer"&gt;old&lt;/a&gt; branch. The new version of the code is available at the &lt;a href="https://github.com/zuygui/flowupdater" rel="noopener noreferrer"&gt;master&lt;/a&gt; branch. I've migrated all the backend code to the backend in a rust crate called &lt;a href="https://crates.io/crates/fujc_api" rel="noopener noreferrer"&gt;fujc_api&lt;/a&gt; for a better integration to the (future) GUI app and CLI. Why have two backend when we can have one ?&lt;br&gt;
For install the crate, you can use the following command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo add fujc_api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or add the following line to your &lt;code&gt;Cargo.toml&lt;/code&gt; file :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="py"&gt;fujc_api&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"0.1.0"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The GUI
&lt;/h2&gt;

&lt;p&gt;Bricklou suggested to implement a GUI app for a better accessibility. It's not already implemented but we are working on. We are using &lt;a href="https://www.qt.io/" rel="noopener noreferrer"&gt;Qt&lt;/a&gt; for the GUI app, Qt XML, and the Qt binding for Rust. The source code isn't available yet but it will be available soon.&lt;/p&gt;

&lt;h2&gt;
  
  
  Credits
&lt;/h2&gt;

&lt;p&gt;I wanna thank &lt;a href="https://github.com/bricklou" rel="noopener noreferrer"&gt;Bricklou&lt;/a&gt; for maintening the project with me. I also wanna thank &lt;a href="https://github.com/FlowArg" rel="noopener noreferrer"&gt;FlowArg&lt;/a&gt; for creating the original project. Finally, I wanna thank &lt;a href="https://github.com/Asthowen" rel="noopener noreferrer"&gt;Asthowen&lt;/a&gt; for helping me with Github CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Thank you for reading this article on my blog. I hope you enjoyed it. Please feel free to leave a comment and give the GitHub repository of this blog a star ⭐.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
