Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Jscrambler 101 - How to use the CLI

Introduction

Last time, we talked about Jscrambler’s Code Locks, and how they could be used to Protect your JavaScript and enforce licenses. We’ve decided to take a step back from our transformations, and show you a simple way to protect your code through our command line.

Let’s take a sample project:

Note that there’s a subfolder structure. Inside the js folder, we have a dontProtect.js file that we don’t want to protect with Jscrambler, but we do want to protect the clock.js and the index.html files.

Ignore files

We’ll start by creating a .jscramblerignore file in order to ignore the dontProtect.js file.

The .jscramblerignore file should be placed at the root of your project. If you choose to zip the project from inside the sample project folder, the .jscramblerignore file should be at the same level as index.html.

Here, the .jscramblerignore file will have the following:

js/dontProtect.js  

If you want to include the sample project folder in your zip file, then the .jscramblerignore file should be at the same level as this folder.

In this case, the .jscramblerignore file would have the following:

sample project/js/dontProtect.js  

You can also use .jscramblerignore for folders, and to include certain files in the protection process. For example:

#ignore all files in js folder
sample project/js/

#except for clock.js
!sample project/js/clock.js

Now we’ll be ready to protect our application.

Download jscrambler.json

First, we have to go to Jscrambler’s Dashboard and create an Application by clicking the Create App button.

Once you’re inside the app select the application mode and the transformations you want to apply:

Once that’s done, download your selections to a jscrambler.json file by clicking on the blue download icon.

Installing the CLI

Let’s continue by installing the CLI through node’s package manager:

$npm install -g jscrambler

Now let’s zip our project, and remember to include the .jscramblerignore file. For ease, we will place our jscrambler.json file next to our zip file, but they could be in different locations.

Now, open your terminal, and after navigating to the same folder where you have your zip and jscrambler.json file, run the following:

$jscrambler -c jscrambler.json -o protected sampleProject.zip

This means that the sampleProject.zip will be protected and placed in the protected folder.

If you open the dontProtect.js file you’ll notice that no changes occurred in this file.

Conclusion

That’s it! Your project has been protected by Jscrambler. You can check out other options to protect your files here, and also check out our ignore files documentation.

Remember to contact our support team through email address if you have any questions.



This post first appeared on Jscrambler, please read the originial post: here

Share the post

Jscrambler 101 - How to use the CLI

×

Subscribe to Jscrambler

Get updates delivered right to your inbox!

Thank you for your subscription

×