@dragon-den/drapkg
v0.5.0-b5
Published
`drapkg`, also known as Dragon Packager, is a utility designed to create distributable binaries for Node.js applications. It acts as a streamlined wrapper around the powerful `pkg` tool, simplifying the process of bundling your application into a single e
Downloads
580
Readme
Dragon Packager (@dragon-den/drapkg) Usage Guide
drapkg, also known as Dragon Packager, is a utility designed to create distributable binaries for Node.js applications. It acts as a streamlined wrapper around the powerful pkg tool, simplifying the process of bundling your application into a single executable file.
Installation
To use drapkg, you can install it globally using npm:
npm install -g @dragon-den/drapkgAlternatively, you can use npx to run drapkg without installing it globally:
npx @dragon-den/drapkg [options] <input_file>Running Dragon Packager
Once installed globally, you can run drapkg directly from your terminal. drapkg primarily takes your application's entry point as an argument and handles the packaging process.
drapkg [options] <application_entry_file>Core Functionality
Dragon Packager simplifies the use of the pkg tool by providing sensible default configurations, especially for target operating systems and architectures.
Example: Building an Executable
To build an executable for your application using drapkg, you would typically provide your application's main JavaScript file:
# Assuming your application's entry point is 'dist/index.js'
drapkg dist/index.jsBy default, drapkg will attempt to build binaries for Node.js 18 on common platforms, including Linux (x64), Windows (x64), and macOS (x64).
Passing pkg Options
You can pass additional options directly to the underlying pkg tool through drapkg. For example, to specify a custom output path or target specific platforms:
drapkg --output my-app-executable --targets node18-linux-x64 dist/index.jsFor a comprehensive list of available options, please refer to the official pkg documentation.
