Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a2526d3bc | |||
| c8310ce3bc | |||
| bb356a967b |
@@ -1,4 +1,7 @@
|
||||
language: node_js
|
||||
before_install:
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install -y g++-multilib
|
||||
node_js:
|
||||
- '6'
|
||||
script: npm run asset-compile
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<p align="center">Nexe is a command-line utility that compiles your Node.js application into a single executable file.</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://cloud.githubusercontent.com/assets/5818726/26533446/ce19ee5a-43de-11e7-9540-caf7ebd93370.gif"/>
|
||||
<img src="https://user-images.githubusercontent.com/5818726/30999006-df7e0ae0-a497-11e7-96db-9ce87ae67b34.gif"/>
|
||||
</p>
|
||||
|
||||
## Motivation and Features
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "nexe",
|
||||
"description": "Create a single executable out of your Node.js application",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-rc.9",
|
||||
"version": "2.0.0-rc.10",
|
||||
"contributors": [
|
||||
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
|
||||
"Jared Allard <jaredallard@outlook.com>",
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@ export interface NexeOptions {
|
||||
native: any
|
||||
empty: boolean
|
||||
sourceUrl?: string
|
||||
enableStdIn?: boolean
|
||||
python?: string
|
||||
loglevel: 'info' | 'silent' | 'verbose'
|
||||
silent?: boolean
|
||||
@@ -82,7 +83,7 @@ const alias = {
|
||||
l: 'loglevel',
|
||||
'fake-argv': 'fakeArgv'
|
||||
}
|
||||
const argv = parseArgv(process.argv, { alias, default: defaults })
|
||||
const argv = parseArgv(process.argv, { alias, default: { ...defaults, enableStdIn: true } })
|
||||
const g = c.gray
|
||||
let help = `
|
||||
${c.bold('nexe <entry-file> [options]')}
|
||||
|
||||
+15
-12
@@ -5,15 +5,18 @@ import { readFileAsync, dequote, isWindows } from '../util'
|
||||
import { NexeCompiler } from '../compiler'
|
||||
import { NexeTarget } from '../target'
|
||||
|
||||
function readStreamAsync(stream: NodeJS.ReadableStream): PromiseLike<string> {
|
||||
function getStdIn(stdin: NodeJS.ReadStream): Promise<string> {
|
||||
return new Promise(resolve => {
|
||||
let input = ''
|
||||
stream.setEncoding('utf-8')
|
||||
stream.on('data', (x: string) => {
|
||||
input += x
|
||||
})
|
||||
stream.once('end', () => resolve(dequote(input)))
|
||||
stream.resume && stream.resume()
|
||||
let out = ''
|
||||
stdin
|
||||
.setEncoding('utf8')
|
||||
.on('readable', () => {
|
||||
let current
|
||||
while ((current = stdin.read())) {
|
||||
out += current
|
||||
}
|
||||
})
|
||||
.on('end', () => resolve(out))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -34,9 +37,9 @@ function readStreamAsync(stream: NodeJS.ReadableStream): PromiseLike<string> {
|
||||
export default async function cli(compiler: NexeCompiler, next: () => Promise<void>) {
|
||||
const { log } = compiler
|
||||
let stdInUsed = false
|
||||
if (!process.stdin.isTTY) {
|
||||
if (!process.stdin.isTTY && compiler.options.enableStdIn) {
|
||||
stdInUsed = true
|
||||
compiler.input = await readStreamAsync(process.stdin)
|
||||
compiler.input = await getStdIn(process.stdin)
|
||||
}
|
||||
|
||||
await next()
|
||||
@@ -53,10 +56,10 @@ export default async function cli(compiler: NexeCompiler, next: () => Promise<vo
|
||||
if (e) {
|
||||
reject(e)
|
||||
} else if (compiler.output) {
|
||||
chmodSync(compiler.output, '755')
|
||||
chmodSync(compiler.output, '755') //todo fix erroneous rw mode change
|
||||
step.log(
|
||||
`Entry: '${stdInUsed
|
||||
? '[stdin]'
|
||||
? compiler.options.empty ? '[empty]' : '[stdin]'
|
||||
: compiler.options.input}' written to: ${compiler.output}`
|
||||
)
|
||||
resolve(compiler.quit())
|
||||
|
||||
@@ -66,13 +66,12 @@ async function build () {
|
||||
|
||||
const stop = keepalive()
|
||||
if (target.platform === 'alpine') {
|
||||
await runAlpineBuild(target, nexe.version.split('.')[0])
|
||||
await runAlpineBuild(target)
|
||||
} else {
|
||||
await nexe.compile(options)
|
||||
}
|
||||
stop()
|
||||
|
||||
|
||||
if (await pathExistsAsync(output)) {
|
||||
await assertNexeBinary(output)
|
||||
const gitRelease = await getLatestGitRelease({ headers })
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import got = require('got')
|
||||
import execa = require('execa')
|
||||
import { appendFileSync } from 'fs'
|
||||
|
||||
function alpine (target: NexeTarget, nexeVersion: string) {
|
||||
function alpine (target: NexeTarget) {
|
||||
return `
|
||||
FROM ${target.arch === 'x64' ? '' : 'i386/'}alpine:3.4
|
||||
RUN apk add --no-cache curl make gcc g++ binutils-gold python linux-headers paxctl libgcc libstdc++ git vim tar gzip wget
|
||||
@@ -26,8 +26,8 @@ RUN rm /nexe_temp/\${NODE_VERSION}/out/Release/node && \
|
||||
`.trim()
|
||||
}
|
||||
|
||||
export async function runAlpineBuild (target: NexeTarget, nexeVersion: string) {
|
||||
await writeFileAsync('Dockerfile', alpine(target, nexeVersion))
|
||||
export async function runAlpineBuild (target: NexeTarget) {
|
||||
await writeFileAsync('Dockerfile', alpine(target))
|
||||
const outFilename = 'nexe-alpine-build-log.txt'
|
||||
await writeFileAsync(outFilename, '')
|
||||
let output: any = []
|
||||
|
||||
Reference in New Issue
Block a user