Nexe : Cara compile aplikasi node js menjadi .exe




Install dependency nexe

npm i nexe -g

Untuk mengetahui penggunaan perintah dan fungsi nexe 
npx nexe -h

Untuk melakukan compile :

npx nexe . -t "windows-ia32-10.13.0"
Option

input: string
Input bundle file path
default: stdin or the current directory's main file (package.json)
output: string
Output executable file path
default: same as name with an OS specific extension.
target: string | object
An object or string describing platform-arch-version. e.g. 'windows-ia32-10.13.0'
each segment is optional, and will be merged with the current environment

Examples: (full list)

'win32-x86-10.13.0
{ platform: 'alpine' }
darwin-10.13.0
linux-x64
macos-10.13.0
See test/target.spec.ts

If the build flag is set, the platform portion of the target is ignored.
default: process
bundle: string | boolean
If a string is provided it must be a valid relative module path and should provide an export with the following signature:
export function createBundle (options: NexeOptions): Promise<string>
default: true
name: string
Module friendly name of the application
default: basename of the input file, or nexe_${Date.now()}
cwd: string
Directory nexe will operate on as though it is the cwd
default: process.cwd()
mangle: boolean
If set to false, nexe will not include the virtual filesystem (your application and resources) on the output.
This will cause the output to error as an "Invalid Binary" unless a userland patch alters the contents of lib/_third_party_main.js in the nodejs source.
default: true
build: boolean
Build node from source, passing this flag tells nexe to download and build from source. Subsequently using this flag will cause nexe to use the previously built binary. To rebuild, first add --clean
remote: string
Provide a custom remote location for fetching pre-built nexe binaries from. This can either be an HTTP or HTTPS URL.
default: null
asset: string
Provide a pre-built nexe binary asset, this is a file path is resolved relative to cwd.
python: string
On Linux this is the path pointing to your python2 executable
On Windows this is the directory where python can be accessed
default: null
flags: string[]
Array of node runtime flags to build node with.
Example: ['--expose-gc']
default: []
configure: string[]
Array of arguments for the node build configure step
Example: ['--with-dtrace', '--dest-cpu=x64']
default: []
make: string[]
Array of arguments for the node build make step
default: []
vcBuild: string[]
Options for windows build
default: ['nosign', 'release']
snapshot: string
path to a file to be used as the warmup snapshot for the build
default: null
resources: string[]
Array of globs with files to include in the build
Example: ['./public/**/*']
default: []
temp: string
Path to use for storing nexe's build files
Override in the env with NEXE_TEMP
default: ~/.nexe
ico: string
Path to a user provided icon to be used (Windows only). Requires --build to be set.
rc: object
Settings for patching the node.rc configuration file (Windows only).
Example (keys may vary depending on the version. Reference the file linked above):
  {
    CompanyName: "ACME Corp",
    PRODUCTVERSION: "17,3,0,0",
    FILEVERSION: "1,2,3,4"
    ...
  }
default: {}
clean: boolean
If included, nexe will remove temporary files for the accompanying configuration and exit
enableNodeCli: boolean
Enable the original Node CLI (will prevent application cli from working).
Node CLI arguments passed via the NODE_OPTIONS environment variable will still be processed. NODE_OPTIONS support can be disabled with the --without-node-options configure flag.
default: false
fakeArgv: boolean
fake the entry point file name (process.argv[1]). If nexe was used with stdin this will be '[stdin]'.
ghToken: string
Provide a Github Token for accessing nexe releases
This is usually needed in CI environments
default: process.env.GITHUB_TOKEN
sourceUrl: string
Provide an alternate url for the node source code
Note: temporary files will still be created for this under the specified version
loglevel: string
Set the loglevel, info, silent, or verbose
default: 'info'
patches: NexePatch[]
Userland patches for patching or modifying node source
default: []
plugins: NexePatch[]
Userland plugins for modifying nexe executable behavior
default: []




Posting Komentar

Lebih baru Lebih lama