Alokai and Magento 2 Instance Running Locally in Minutes with the New CLI Tool

Explore by Category:

Product

Alokai and Magento 2 Instance Running Locally in Minutes with the New CLI Tool

Untitled_design_(2).png

Sergii Kirianov

March 22, 2023

Everyone says that developers are lazy. That's right, we are indeed lazy – but also hardworking, even if that may seem contradictory. We're willing to spend hours and days automating something that would only take 10 minutes to do manually, and while it may be debatable whether this actually saves us time in the long run, we believe it's worth the effort. If you can't relate to this statement, I certainly can. This is the story of how I was lazy, yet hardworking.

Why A New CLI Tool?

When I joined  Alokai  as a Developer Advocate, one of the first things I had to do was to thoroughly learn our product. To accomplish this, I decided to use and evaluate it myself. I began with our Magento 2 Integration, as it is open-source and free, making it an accessible option for other developers.

However, it was not an easy task. Although the documentation was clear and easy to follow, and the CLI tool was pretty straightforward, it still took me quite some time to complete. My biggest challenge was installing a Magento 2 instance locally, as I had no prior experience with Magento. It was quite challenging to find the necessary settings and configurations to run it in tandem with Alokai.

I must admit, there were some gaps in the documentation. Not anymore though!

Anyway, after installing and configuring both Alokai and Magento 2, I remembered the quote: "Developers are lazy." If someone wants to try our product, they don't want to waste hours setting it up. Almost everything in the setup can and should be automated. Ideally, the setup should take no more than 10 minutes. This is where the story of the new CLI tool begins.

How I built it

After some trial and error, and hours spent picking the right colors and libraries to use, it was finally ready. What started as an experiment during a cold Polish night has become a part of our core GitHub repository and is now available for everyone to use in Beta!

It was also built “in public,” as you can see in this tweet:

graphic1.png
Our CLI was initially written in TypeScript, and this new feature is no different. During the development process, I tried multiple libraries and found that I enjoyed using the default Node.js child_process.spawn approach. As for the user interface, I fell in love with the clack/prompts library by  @n_moore . Although I had to rewrite half of the existing logic, the change was worth it. The overall look of the process is now much cleaner.
graphic2.png

Initially, I wanted to leave all the logs from child processes available to the user so they could see what was installed on their machine. However, this was later removed in favor of minimalism and aesthetics. Since it is an open-source project, you can create your own issue if you want to contribute and add flags for extended information output or maybe even run the command without emojis 😅.

You can check the existing issues or create your own on the  Alokai project .

Final Result

To be completely honest, it turned out much better than I initially thought! The beta release looks great, has been tested, and works as expected.

Once the Alokai community has tried it out and suggested additional features, I'm confident it will become the ultimate tool for installing and configuring Alokai and Magento 2 instances locally.

You can try it out right now! Run the following command in your terminal and confirm that you want to install Magento 2 locally:

npx @vue-storefront/cli init

In conclusion, the new CLI tool for Alokai and Magento 2 instance running locally is a great addition to the development process. It saves time, simplifies the installation and configuration process, and can be easily customized to fit the user's needs.

As an open-source project, it welcomes contributions and suggestions from the community, which will undoubtedly make it even better in the future. This tool is a testament to the hard work of lazy developers, who are always looking for ways to optimize their workflow and make their lives easier.

So, if you're a developer and you're looking for an easier way to set up and configure Alokai and Magento 2 instances locally, give the new CLI tool a try! It's free, open-source, and can save you hours of time. And if you have any suggestions or ideas for how to improve it, feel free to contribute to the project on GitHub. Happy developing! ✨

Share:

Share:

shape

Ready to dive in? Schedule a demo

Get a live, personalised demo with one of our awesome product specialists.