diff --git a/README.md b/README.md index 85f94ea..c73229d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ License

-

npm i nexe@beta -g

+

npm i nexe -g

Nexe is a command-line utility that compiles your Node.js application into a single executable file.

@@ -16,7 +16,6 @@ ## Motivation and Features -- Supports production ready builds - Self contained applications - Ability to run multiple applications with *different* node.js runtimes. - Distribute binaries without needing node / npm. @@ -34,34 +33,31 @@ - stdin interface - `rollup -c | nexe --resource ./public/**/* -o my-app.exe` + `rollup -c | nexe --resource "./public/**/*" -o my-app.exe` For more CLI options see: `nexe --help` -## Including Additional Resources +# Advanced -Additional resources can be added to the binary by passing `-r glob/pattern/**/*`. These included files can be read in the application by using `fs.readFile` or `fs.readFileSync` +## Resources + +Additional files or resources can be added to the binary by passing `-r "glob/pattern/**/*"`. These included files can be read in the application by using `fs.readFile` or `fs.readFileSync` ## Compiling Node -By default `nexe` will attempt to download a pre-built executable. However, some users may want to customize the way node is built, either by changing the flags, providing a different icon, or different executable details. To build node, use the `build` option/flag - -Nexe also exposes its patching pipeline to the user. This allows the application of simple patching of node sources prior to compilation. +By default `nexe` will attempt to download a pre-built executable. However, It may be unavailable ([github releases](https://github.com/nexe/nexe/releases)) +or you may want to customize what is built. See `nexe --help` for a list of options available when passing the `--build` option. ## Node.js API -Using Nexe Programatically - #### Example - ```javascript const { compile } = require('nexe') compile({ input: './my-app.js', - output: './my-app.exe', - build: true, //builds node + build: true, //required to use patches patches: [ async (compiler, next) => { await compiler.setFileContentsAsync( @@ -78,17 +74,16 @@ compile({ ### `options` - - #### `build: boolean` - - Build node from source (required in beta) - #### `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` - - Dash seperated platform-architecture-version. e.g. `'win32-ia32-6.10.3'` - - default: `[process.platform, process.arch, process.version.slice(1)].join('-')` + - #### `target: string | object` + - Combination of platform-arch-version. e.g. `'win32-ia32-6.10.3'` + - each segment is optional, and will be merged with the current environment + - 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: @@ -105,9 +100,8 @@ compile({ - #### `cwd: string` - Directory nexe will operate on as though it is the cwd - default: process.cwd() - - #### `version: string` - - The Node version you're building for - - default: `process.version.slice(1)` + - #### `build: boolean` + - Build node from source - #### `python: string` - On Linux this is the path pointing to your python2 executable - On Windows this is the directory where `python` can be accessed @@ -143,12 +137,13 @@ compile({ - Example: `{ CompanyName: "ACME Corp" }` - default: `{}` - #### `clean: boolean` - - If included, nexe will remove temporary files for accompanying configuration and exit + - 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) - default: `false` - #### `sourceUrl: string` - - Provide an alternate url for the node source. Should be a `.tar.gz` + - 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'` @@ -180,10 +175,10 @@ For examples, see the built in patches: [src/patches](src/patches) Any modifications made to `NexeFile#contents` will be maintained in the cache _without_ the need to explicitly write them back out, e.g. using `NexeCompiler#setFileContentsAsync`. -### Native Modules +## Native Modules Nexe has a plugin built for use with [fuse-box](http://fuse-box.org) > 2.2.1. This plugin currently supports modules that require `.node` files and those that use the `bindings` module. -Take a look at the [example](examples/native-build/build.js) +Take a look at the (windows) [example](examples/native-build/build.js) - [ ] Implement support `node-pre-gyp#find`. diff --git a/package-lock.json b/package-lock.json index 180ce6e..ec5ec51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nexe", - "version": "2.0.0-rc.3", + "version": "2.0.0-rc.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b3df19f..2504e3f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nexe", "description": "Create a single executable out of your Node.js application", "license": "MIT", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.5", "contributors": [ "Craig Condon (http://crcn.io)", "Jared Allard ", diff --git a/src/options.ts b/src/options.ts index 5888a2a..96ebec2 100644 --- a/src/options.ts +++ b/src/options.ts @@ -6,7 +6,7 @@ import { getTarget, NexeTarget } from './target' import { EOL } from 'os' import * as c from 'chalk' -export const nexeVersion = '2.0.0-rc.4' +export const nexeVersion = '2.0.0-rc.5' export interface NexePatch { (compiler: NexeCompiler, next: () => Promise): Promise @@ -73,15 +73,13 @@ const alias = { f: 'flag', c: 'configure', m: 'make', - s: 'snapshot', h: 'help', l: 'loglevel', 'fake-argv': 'fakeArgv' } const argv = parseArgv(process.argv, { alias, default: defaults }) const g = c.gray -const help = - ` +let help = ` ${c.bold('nexe [options]')} ${c.underline.bold('Options:')} @@ -92,7 +90,6 @@ ${c.bold('nexe [options]')} -n --name ${g('=my-app')} -- main app module name -r --resource -- *embed files (glob) within the binary - -s --snapshot -- path to a warmup snapshot ${c.underline.bold('Building from source:')} @@ -101,6 +98,7 @@ ${c.bold('nexe [options]')} -f --flag -- *v8 flags to include during compilation -c --configure -- *arguments to the configure step -m --make -- *arguments to the make/build step + --snapshot -- path to a warmup snapshot --ico -- file name for alternate icon file (windows) --rc-* -- populate rc file options (windows) --sourceUrl -- pass an alternate source (node.tar.gz) url @@ -116,7 +114,8 @@ ${c.bold('nexe [options]')} --silent -- disable logging --verbose -- set logging to verbose - -* variable key name * option can be used more than once`.trim() + EOL + -* variable key name * option can be used more than once`.trim() +help = EOL + help + EOL function flatten(...args: any[]): string[] { return ([] as string[]).concat(...args).filter(x => x)