DEV Community

Cover image for Hide & Seek Code: Part II
Visakh Vijayan
Visakh Vijayan

Posted on • Edited on

3 3

Hide & Seek Code: Part II

If you are new here, then please visit our earlier article over here for some context.

After the last article we were trying to find out ways to improve upon the approach but at the same time didn't want to do anything crazy either.

That is when we found out about Buddy. Buddy is one of those easy DIY devops tools out there. Best part is the UI and how easy it is to create a deployment pipeline.

Modifying package.json

Okay so back to our task. We added this line in our package.json file under the build script.

"build": "nest build && mkdir -p build && node obfuscate.js && find ./build -name '*.ts' -type f -delete && cp package.json build/",
Enter fullscreen mode Exit fullscreen mode

The above line creates a folder called build, obfuscates(make it unreadable) and remove all the .ts files. We also had to copy our package.json file into the build folder so that we can install our dependencies at our destination.

Let's lay some pipes

Then we setup a pipeline in Buddy.
Alt Text

We made 3 actions. Actions are more like a sequence of steps.

  1. The first one "Execute" created a build folder and obfuscated code.
    Alt Text

  2. The second one copied the build folder to the client's server.
    Alt Text

  3. The third one basically started the project.
    Alt Text

Feel good moment

Once the actions were setup we started our pipeline and kept looking at this "feels good" UI while it was running.
Alt Text

After the pipeline completed, we logged into our server and were able to see our instance running. Phew!!! And this is how our code looks now. Not the best of encryption, but pretty hard to read/modify.

Alt Text

What we feel

This solved our problem to a major extent. The only drawback we found was the speed of execution. It takes around 2-3 minutes for the entire process to complete. But we are sure there are ways to optimize it. So we are looking forward to it.

Let us know your comments.

Happy programming!!!

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay