Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b74bdfc53b | |||
| 927820a5ec | |||
| 4ef98bdc8a | |||
| 90d7beb4f3 | |||
| 55c95b4663 | |||
| fe5aa0be09 |
@@ -87,8 +87,17 @@ compile({
|
||||
- Output executable file path
|
||||
- default: same as `name` with an OS specific extension.
|
||||
- #### `target: string | object`
|
||||
- Combination of platform-arch-version. e.g. `'win32-ia32-6.10.3'`
|
||||
- An object or string describing platform-arch-version. e.g. `'windows-ia32-6.10.3'`
|
||||
- each segment is optional, and will be merged with the current environment
|
||||
- Examples: ([full list](https://github.com/nexe/nexe/releases))
|
||||
- `'win32-x86-8.6.0`
|
||||
- `{ platform: 'alpine' }`
|
||||
- `darwin-8.6.0`
|
||||
- `linux-x64`
|
||||
- `macos-8.4.0`
|
||||
|
||||
See [test/target.spec.ts](test/target.spec.ts)
|
||||
- If the [`build`](#build-boolean) 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
|
||||
@@ -120,7 +129,7 @@ compile({
|
||||
- #### `make: string[]`
|
||||
- Array of arguments for the node build make step, on windows this step recieves options for vcBuild.bat
|
||||
- default: `[]` or `['nosign', 'release']` for non windows systems
|
||||
- #### `make: string[]`
|
||||
- #### `vcBuild: string[]`
|
||||
- Alias for `make` option
|
||||
- #### `snapshot: string`
|
||||
- path to a file to be used as the warmup snapshot for the build
|
||||
@@ -171,8 +180,7 @@ compile({
|
||||
|
||||
Patches and Plugins are just a middleware functions that take two arguments, the `compiler`, and `next`. The compiler is described below, and `next` ensures that the pipeline continues. Its invocation should always be awaited or returned to ensure correct behavior. Patches also require that [`--build`](#build-boolean) be set, while plugins do not.
|
||||
|
||||
For examples, see the built in patches: [src/patches](src/patches)
|
||||
A plugin
|
||||
For examples, see the built in patches: [src/patches](src/patches).
|
||||
|
||||
### `NexeCompiler`
|
||||
|
||||
@@ -196,16 +204,15 @@ Any modifications made to `NexeFile#contents` will be maintained in the cache _w
|
||||
|
||||
## 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 (windows) [example](examples/native-build/build.js)
|
||||
Any `.node` binding can be used with nexe. These library files will be bundled and written alongside the resulting binary at runtime. Currently, nexe supports modules loaded directly (`.node` files) and those loaded with the `'bindings'` module. It does not yet support modules using `node-pre-gyp#find`.
|
||||
|
||||
- [ ] Implement support `node-pre-gyp#find`.
|
||||
Its important to note: unless your native module conditionally loads each platform binary. Nexe builds with native modules will be platform specific. Eg. You will no longer be able to use cross platform builds.
|
||||
|
||||
## Maintainers
|
||||
Nexe builds with native modules will need to target the same version, platform and architecture as the platform hosting the module. At least until [N-API](https://github.com/nodejs/abi-stable-node) is fully propegated
|
||||
|
||||
[](https://jaredallard.me/) | [](https://github.com/calebboyd) | [](https://github.com/ckarper) | [](https://github.com/dgreif) |
|
||||
---|---|---|---
|
||||
[Jared Allard](https://github.com/jaredallard) | [Caleb Boyd](http://github.com/calebboyd) | [Christopher Karper](https://github.com/ckarper) | [Dustin Greif](https://github.com/dgreif) |
|
||||
TODO
|
||||
|
||||
- [ ] Implement support for `node-pre-gyp#find`.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -221,6 +228,11 @@ Testing
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## Maintainers
|
||||
|
||||
[](https://jaredallard.me/) | [](https://github.com/calebboyd) | [](https://github.com/ckarper) | [](https://github.com/dgreif) |
|
||||
---|---|---|---
|
||||
[Jared Allard](https://github.com/jaredallard) | [Caleb Boyd](http://github.com/calebboyd) | [Christopher Karper](https://github.com/ckarper) | [Dustin Greif](https://github.com/dgreif) |
|
||||
|
||||
### Former
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
"name": "nexe",
|
||||
"description": "Create a single executable out of your Node.js application",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-rc.10",
|
||||
"version": "2.0.0-rc.12",
|
||||
"contributors": [
|
||||
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
||||
"Jared Allard <jaredallard@outlook.com>",
|
||||
@@ -37,7 +37,7 @@
|
||||
"app-builder": "^5.1.0",
|
||||
"chalk": "^1.1.3",
|
||||
"download": "^6.2.0",
|
||||
"fuse-box": "2.2.31",
|
||||
"fuse-box": "2.3.1-beta.23",
|
||||
"globby": "^6.1.0",
|
||||
"minimist": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
|
||||
@@ -2,21 +2,23 @@
|
||||
"name": "nexe-daemon",
|
||||
"version": "1.0.0",
|
||||
"description": "Plugin for nexe to create installable services",
|
||||
"main": "index.js",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"clean": "rimraf *.js",
|
||||
"build": "tsc",
|
||||
"postpublish": "npm run clean"
|
||||
},
|
||||
"files": [
|
||||
"*.js",
|
||||
"lib",
|
||||
"winsw.exe"
|
||||
],
|
||||
"author": "Caleb Boyd",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"nexe": "^2.0.0-rc.6",
|
||||
"rimraf": "^2.6.2",
|
||||
"typescript": "^2.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"nexe": "^2.0.0-rc.11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,12 @@ export default function daemon (compiler: NexeCompiler<DaemonOptions>, next: ()
|
||||
if (compiler.target.platform !== 'windows') {
|
||||
return next()
|
||||
}
|
||||
|
||||
compiler.addResource(
|
||||
'./nexe/plugin/daemon/winsw.exe',
|
||||
readFileSync(require.resolve('./winsw.exe'))
|
||||
readFileSync(require.resolve('../winsw.exe'))
|
||||
)
|
||||
const name = compiler.options.name,
|
||||
options = compiler.options.daemon.windows,
|
||||
options = compiler.options.daemon && compiler.options.daemon.windows || {},
|
||||
defaults: NexeDaemonOptions = {
|
||||
id: name,
|
||||
name,
|
||||
@@ -37,7 +36,7 @@ export default function daemon (compiler: NexeCompiler<DaemonOptions>, next: ()
|
||||
}
|
||||
|
||||
compiler.addResource(
|
||||
'./nexe/plugin/daemon/winsw-config.xml',
|
||||
'./nexe/plugin/daemon/winsw.xml',
|
||||
Buffer.from(renderWinswConfig(Object.assign(defaults, options)))
|
||||
)
|
||||
compiler.addResource(
|
||||
|
||||
@@ -1,4 +1,69 @@
|
||||
console.log('hello world')
|
||||
if (true) {
|
||||
console.log('wat')
|
||||
const installCommands = ['-i', '--install']
|
||||
const installIndex = process.argv.findIndex(x => installCommands.includes(x))
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
import * as cp from 'child_process'
|
||||
|
||||
function mkdirp (r: string, t?: any): any {
|
||||
;(t = t || null), (r = path.resolve(r))
|
||||
try {
|
||||
fs.mkdirSync(r), (t = t || r)
|
||||
} catch (c) {
|
||||
if ('ENOENT' === c.code) (t = mkdirp(path.dirname(r), t)), mkdirp(r, t)
|
||||
else {
|
||||
var i
|
||||
try {
|
||||
i = fs.statSync(r)
|
||||
} catch (r) {
|
||||
throw c
|
||||
}
|
||||
if (!i.isDirectory()) throw c
|
||||
}
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
if (~installIndex) {
|
||||
console.log('DIRECTORY FOUND')
|
||||
const directory = process.argv[installIndex + 1]
|
||||
if (directory) {
|
||||
mkdirp(path.dirname(directory))
|
||||
const filename = path.join(directory, path.basename(process.execPath))
|
||||
const readStream = fs.createReadStream(process.execPath)
|
||||
const writeStream = fs.createWriteStream(filename)
|
||||
|
||||
const onError = function () {
|
||||
readStream.removeAllListeners()
|
||||
writeStream.removeAllListeners()
|
||||
//TODO
|
||||
}
|
||||
|
||||
readStream
|
||||
.on('error', onError)
|
||||
.pipe(writeStream)
|
||||
.on('error', onError)
|
||||
.on('close', () => {
|
||||
const winsw = filename.replace('.exe', '-service.exe')
|
||||
fs.writeFileSync(
|
||||
winsw,
|
||||
fs.readFileSync('./nexe/plugin/daemon/winsw.exe')
|
||||
)
|
||||
fs.writeFileSync(
|
||||
filename.replace('.exe', '-service.xml'),
|
||||
fs.readFileSync('./nexe/plugin/daemon/winsw.xml')
|
||||
)
|
||||
installService(winsw)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log("DIRECTORY NOT FOUND")
|
||||
require('./nexe/plugin/daemon/app.js')
|
||||
}
|
||||
|
||||
function installService (filename: string) {
|
||||
cp.exec(filename + ' install', (error) => {
|
||||
if (error && !error.message.includes('already exists')) {
|
||||
throw error
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1458,9 +1458,9 @@ negotiator@0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
|
||||
|
||||
nexe@^2.0.0-rc.6:
|
||||
version "2.0.0-rc.6"
|
||||
resolved "https://registry.yarnpkg.com/nexe/-/nexe-2.0.0-rc.6.tgz#b3990bb67098a93bc488b21ad88aee67b62cf0d5"
|
||||
nexe@^2.0.0-rc.11:
|
||||
version "2.0.0-rc.11"
|
||||
resolved "https://registry.yarnpkg.com/nexe/-/nexe-2.0.0-rc.11.tgz#cd06fc91da8db008fffa6dde1a9a8dd6decf2c35"
|
||||
dependencies:
|
||||
app-builder "^5.1.0"
|
||||
chalk "^1.1.3"
|
||||
|
||||
+2
-2
@@ -241,8 +241,8 @@ function normalizeOptionsAsync(input?: Partial<NexeOptions>): Promise<NexeOption
|
||||
return x
|
||||
}
|
||||
|
||||
options.plugins = options.plugins.map(requireDefault)
|
||||
options.patches = options.patches.map(requireDefault)
|
||||
options.plugins = flatten(opts.plugin, options.plugins).map(requireDefault)
|
||||
options.patches = flatten(opts.patch, options.patches).map(requireDefault)
|
||||
|
||||
Object.keys(alias)
|
||||
.filter(k => k !== 'rc')
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ export default async function cli(compiler: NexeCompiler, next: () => Promise<vo
|
||||
let stdInUsed = false
|
||||
if (!process.stdin.isTTY && compiler.options.enableStdIn) {
|
||||
stdInUsed = true
|
||||
compiler.input = await getStdIn(process.stdin)
|
||||
compiler.input = dequote(await getStdIn(process.stdin))
|
||||
}
|
||||
|
||||
await next()
|
||||
|
||||
@@ -28,6 +28,7 @@ const prettyPlatform: { [key: string]: NodePlatform } = {
|
||||
//TODO arm
|
||||
const prettyArch: { [key: string]: NodeArch } = {
|
||||
x86: 'x86',
|
||||
amd64: 'x64',
|
||||
ia32: 'x86',
|
||||
x32: 'x86',
|
||||
x64: 'x64'
|
||||
|
||||
@@ -10,7 +10,9 @@ describe('Targets', () => {
|
||||
['win-ia32-6.11.2', 'windows-x86-6.11.2'],
|
||||
[{ version: '6.11.2', platform: 'win', arch: 'ia32' }, 'windows-x86-6.11.2'],
|
||||
['win32-x64-6.11.2', 'windows-x64-6.11.2'],
|
||||
['win-amd64-6.11.2', 'windows-x64-6.11.2'],
|
||||
['darwin-x64-v8.4.0', 'mac-x64-8.4.0'],
|
||||
['macos-x64-v8.4.0', 'mac-x64-8.4.0'],
|
||||
['static-x86-6.10.3', 'alpine-x86-6.10.3'],
|
||||
['linux-x32', `linux-x86-${process.version.slice(1)}`],
|
||||
['alpine-notsupported-6.10.3', `alpine-${arch}-6.10.3`],
|
||||
|
||||
@@ -90,6 +90,12 @@ acorn-jsx@^4.0.1:
|
||||
dependencies:
|
||||
acorn "^5.0.3"
|
||||
|
||||
acorn-object-rest-spread@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn-object-rest-spread/-/acorn-object-rest-spread-1.1.0.tgz#78699aefdd18ec3182caadadf52e2697c048f476"
|
||||
dependencies:
|
||||
acorn "^5.0.3"
|
||||
|
||||
acorn@^2.6.4:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7"
|
||||
@@ -993,14 +999,15 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
|
||||
mkdirp ">=0.5 0"
|
||||
rimraf "2"
|
||||
|
||||
fuse-box@2.2.31:
|
||||
version "2.2.31"
|
||||
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.2.31.tgz#36d267a6c6a79952a9c1fb7d1643c1949a6d42f5"
|
||||
fuse-box@2.3.1-beta.23:
|
||||
version "2.3.1-beta.23"
|
||||
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.3.1-beta.23.tgz#9681d732fe80be8ffc467e5af98c5d82986782e8"
|
||||
dependencies:
|
||||
acorn "^5.0.3"
|
||||
acorn-es7 "^0.1.0"
|
||||
acorn-es7-plugin "^1.1.7"
|
||||
acorn-jsx "^4.0.1"
|
||||
acorn-object-rest-spread "^1.1.0"
|
||||
ansi "^0.3.1"
|
||||
app-root-path "^2.0.1"
|
||||
base64-img "^1.0.3"
|
||||
|
||||
Reference in New Issue
Block a user