@energypatrikhu/node-exe-compile
v1.0.0
Published
A small config based wrapper for @yao-pkg/pkg (fork of vercel's pkg package), using esbuild to minify and bundle the script specified in the config file, then using pkg it compiles to an exe file
Downloads
92
Maintainers
Readme
node-exe-compile
node-exe-compile
is a small config based wrapper for @yao-pkg/pkg (fork of vercel's pkg package)
it is using esbuild to minify and bundle the script specified in the config file, then using pkg
it compiles to an exe
file
Warning
This package is not well tested, and may not work as expected, use at your own risk, the package was tested on Windows and Linux, but may not work on other platforms
Usage
Install the package
npm install -D @energypatrikhu/node-exe-compile
Add the following scripts to your
package.json
{ "scripts": { "compile": "node-exe-compile" } }
Start the script
this creates an example configuration file, that later can be modified to set the compiled name and others..
npm run compile
After that is done, you have to start
node-exe-compile
againnow the script minifies and then compiles the given script to an executable
npm run compile
Configuration
The generated configuration file is almost identical to the default configuration file needed for the pkg
package, with a few additions
name
: the name of the file after compilingmain
: this is the location of the main file, commonlysrc/index.[ts,js]
bin
: the path to the minified and bundled script (this most of the times does not need to be changed)autoCopy
: this is a boolean value, if set totrue
it will copy the needed files to the output directorypkg
: pkg optionstargets
: NodeJS version (latest == node20)assets
: when using packages that has.node
extension the value has to be set, otherwise it may fail to startoutputPath
: the path where the executable will be builtadditional
: this contains the additional settings forpkg
compress
: the compression used at complile time- ...