Node.js Packaging - Node.js

What is Node.js Packaging?

JXcore, that is an open source challenge, introduces a unique characteristic for packaging and encryption of source documents and other assets into JX packages.

Consider you have a large project along with many files. JXcore can p.c. all of them into a single report to simplify the distribution. This bankruptcy offers a short overview of the whole method starting from putting in JXcore.

JXcore installation

Putting in JXcore is quite simple. Here we have provided step-by-step commands on a way to set up JXcore to your device. Follow the steps given under –

Step 1

Download the JXcore package from http://jxcore.com/downloads/, as per your operating system and machine architecture. We downloaded a package for Cenots running on 64-bit machine.

Step 2

Unpack the downloaded file jx_rh64.zipand copy the jx binary into /usr/bin or may be in any other directory based on your system setup.

Step 3

Set your PATH variable appropriately to run jx from anywhere you like.

Step 4

You can verify your installation by issuing a simple command as shown below. You should find it working and printing its version number as follows −

Packaging the Code

Consider you have a project with the following directories where you kept all your files including Node.js, main file, index.js, and all the modules installed locally.

To package the above project, you simply need to go inside this directory and issue the following jx command. Assuming index.js is the entry file for your Node.js project −

Here you could have used any other package name instead of index. We have used index because we wanted to keep our main file name as index.jx. However, the above command will pack everything and will create the following two files −

  • index.jxp This is an intermediate file which contains the complete project detail needed to compile the project.
  • index.jx This is the binary file having the complete package that is ready to be shipped to your client or to your production environment.

Launching JX File

Consider your original Node.js project was running as follows −

After compiling your package using JXcore, it can be started as follows −

To know more on JXcore, you can check its official website

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Node.js Topics