7 releases
0.2.5 | Jul 7, 2024 |
---|---|
0.2.4 | Jul 7, 2024 |
0.2.1 | Jun 26, 2024 |
0.1.0 | Jun 25, 2024 |
#52 in Build Utils
105KB
2K
SLoC
Jundler
The JavaScript executable bundler for Node.js projects.
Jundler is a tool that bundles your Node.js project into a single executable file. It uses the new Single Executable Application API to bundle your project, which can then be run on any platform without needing to install Node.js or any dependencies.
Why Jundler?
Jundler, unlike other executable bundlers (like pkg, boxednode, or js2bin), uses the latest Single Executable Application API. And, unlike other bundlers, Jundler is written in Rust, which makes it faster and more efficient!
For more features, see the FAQ.
Requirements
- A working installation of
npm
andnpx
. Note that you do not need to havenode
installed, as Jundler will download a local copy matching your OS, architecture, and desired version. cargo
to install fromcrates.io
.
Usage
Jundler will automatically bundle your JavaScript files into a single standalone file. You will need to both a sea-config.json
file and the ubiquitous package.json
file in the root of your project.
To use Jundler, simply run the following command in your terminal:
jundler <path-to-nodejs-project>
Run jundler --help
for more information on how to use Jundler.
FAQ
Wait! Something broke! What do I do?
Because both Jundler and the Single Executable Application API are new and changing rapidly, things can break overnight. If something breaks, please open an issue on the Jundler GitHub repository and I'll get back to you when feasable.
I'm getting an import error when I run my bundled executable. What do I do?
This is a known issue with the Single Executable Application API, as it does not support import
or require
. Jundler automagically fixes this by bundling your project with ESBuild, which will automatically convert all import
statements to require
statements. If you're still having issues, please open an issue on the Jundler GitHub repository.
[!NOTE] To manually tell Jundler to bundle your project use the
--bundle
/-b
flag.jundler <path-to-nodejs-project> --bundle
Does Jundler support TypeScript?
Yup. Jundler will automagically detect typescript --- ESBuild does the rest!
[!NOTE] If Jundler is having issues with your TypeScript project, try running
jundler <path-to-nodejs-project> --bundle
to bundle your project manually.
My project is giving some weird erorr relating to node-gyp
. What happened?
This is a known issue with the Single Executable Application API. Jundler can't fix this for you (yet!), as it involves packaging the binary in such a way that the dependent API can use it as if it was installed on raw Node.js. If you're having issues with node-gyp
or node-pre-gyp
, please open an issue on the Jundler GitHub repository.
Does Jundler support cross-compilation?
Yes! Just specify the OS and architecture you want to build using the -o
and -a
flags respectively.
Does Jundler support codesigning for macOS?
Yes, so long as you're on a macOS machine yourself. Jundler will automatically codesign your executable without any additional input from you!
[!WARNING] If you're building for macOS on a different platform, the binary will have to be manually signed on a macOS machine. Jundler should give you a warning about this.
Does Jundler support codesigning for Windows?
Not yet, but since windows doesn't require codesigning for binaries to run (it will just give you a warning), this should be fine for now. All Windows binaries need to be manually signed on a Windows machine after being built.
Why the name "Jundler"?
Because it sounded funny and I liked it. :p
TODO
- Auto-detect TS / Modules and bundle accordingly
- Unit test separate build steps
- Auto-download of Node.js host runtime to make the process work w/o Node.js installed (still requires
npm
/npx
to be installed) - Cross-compilation
- Codesigning for macOS
- Redesign CLI + allow for cleaning cache dir.
- Unit-test ESBuild integration
- Spinners/progress bars + better UI
- Codesigning for Windows
- Better error handling
- Integration testing on test projects
Dependencies
~16–30MB
~485K SLoC