Skip to content

ArthurHub/single-executable-bootstrap

Repository files navigation

Node.js Single Executable Bootstrap Application

node -> pkg -> bootstrap -> run

WIP

Utility to package a Node.js app into a single executable file requiring zero dependencies.

Strategy

Package node.exe, node_modules folder, and app bundle.js into a single node executable created with pkg. Running the executable bootstraps node by extracting the embedded node app and running it in a temporary folder.

Flow

  1. Bundle node app into a single js file with as many node modules dependencies as possible.
    1. Using whatever bundler
    2. Excluding node dependencies that cannot be bundled. For using workers, external utils, etc.
  2. Create a separate node_modules folder of the node dependencies that could not be bundled
    1. Running npm install
    2. Cleaning node_modules folder from symlinks and non-prod files.
  3. Archive the node_modules folder
  4. Archive selected node.exe executable
  5. Create a single executable file using pkg that executes bootstrap.js and incudes node_modules archive, node.exe archive, and app bundle file.
  6. Running the node-executable created by pkg
    1. Create a temp folder for the node app
    2. Extract node.exe
    3. Extract node_modules
    4. Copy app bundle
    5. Run node app with the extracted node and app bundle tmpfolder/node.exe tmpfolder/bundle.js

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published