Node.js JXcore Packaging
Node.js is an open-source, cross-platform runtime environment for server-side and network applications.
JXcore is a multi-threaded distribution of Node.js that can run directly in a thread-safe, multi-threaded manner without requiring any changes to your existing code.
This article mainly introduces JXcore's packaging functionality.
JXcore Installation
Download the JXcore installation package and extract it. The extracted directory provides the jx binary file command, which we will mainly use next.
Step 1, Download
Download the JXcore installation packagehttps://github.com/jxcore/jxcore-release, you need to download the installation package based on your own system environment.
1. Windows platform download:Download(Windows x64 (V8))。
2. Linux/OSX installation command:
$ curl https://raw.githubusercontent.com/jxcore/jxcore/master/tools/jx_install.sh | bash
If permissions are insufficient, you can use the following command:
$ curl https://raw.githubusercontent.com/jxcore/jxcore/master/tools/jx_install.sh | sudo bash
If the above steps are performed correctly, using the following command will output version number information:
$ jx --version v0.10.32
Package Code
For example, our Node.js project contains the following files, where index.js is the main file:
drwxr-xr-x 2 root root 4096 Nov 13 12:42 images -rwxr-xr-x 1 root root 30457 Mar 6 12:19 index.htm -rwxr-xr-x 1 root root 30452 Mar 1 12:54 index.js drwxr-xr-x 23 root root 4096 Jan 15 03:48 node_modules drwxr-xr-x 2 root root 4096 Mar 21 06:10 scripts drwxr-xr-x 2 root root 4096 Feb 15 11:56 style
Next, we use thejxcommand to package the above project, and specify index.js as the main file of the Node.js project:
$ jx package index.js index
If the above command executes successfully, the following two files will be generated:
index.jxpThis is an intermediate file that contains the complete project information that needs to be compiled.
index.jxThis is a binary file with complete package information that can run on the client.
Loading JX Files
Node.js project operation:
$ node index.js command_line_arguments
After compiling with JXcore, we can use the following command to execute the generated jx binary file:
$ jx index.jx command_line_arguments
For more JXcore installation references:https://github.com/jxcore/jxcore/blob/master/doc/INSTALLATION.md。
For more JXcore features, you can refer to the official website:https://github.com/jxcore/jxcore。
Other Extensions