From c76edb7c0b9870da1125f6bcf4e551241942e85b Mon Sep 17 00:00:00 2001 From: calebboyd Date: Mon, 31 Dec 2018 08:49:04 -0600 Subject: [PATCH] chore: expose build on compiler --- package-lock.json | 2 +- package.json | 2 +- src/compiler.ts | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74f4816..58dba7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nexe", - "version": "3.0.0-beta.12", + "version": "3.0.0-beta.13", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 10412f5..a53de62 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": "3.0.0-beta.12", + "version": "3.0.0-beta.13", "contributors": [ "Craig Condon (http://crcn.io)", "Jared Allard ", diff --git a/src/compiler.ts b/src/compiler.ts index 3f3d686..d4ccddd 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -1,6 +1,6 @@ import { delimiter, dirname, normalize, join } from 'path' import { Buffer } from 'buffer' -import { createReadStream } from 'fs' +import { createReadStream, ReadStream } from 'fs' import { spawn } from 'child_process' import { Logger, LogStep } from './logger' import { @@ -40,17 +40,16 @@ export class NexeCompiler { * Epoch of when compilation started */ private start = Date.now() + private compileStep: LogStep | undefined + public log = new Logger(this.options.loglevel) /** * Copy of process.env */ - private env = { ...process.env } + public env = { ...process.env } /** * Virtual FileSystem */ - private bundle: Bundle - - private compileStep: LogStep | undefined - public log = new Logger(this.options.loglevel) + public bundle: Bundle /** * Root directory for the source of the current build */ @@ -94,7 +93,7 @@ export class NexeCompiler { /** * The file path of node binary */ - private nodeSrcBinPath: string + public nodeSrcBinPath: string constructor(public options: NexeOptions) { const { python } = (this.options = options) @@ -226,7 +225,7 @@ export class NexeCompiler { ]) } - private async _buildAsync() { + public async build(): Promise { this.compileStep!.log( `Configuring node build${ this.options.configure.length ? ': ' + this.options.configure : '...' @@ -306,7 +305,7 @@ export class NexeCompiler { binary = await this._fetchPrebuiltBinaryAsync(target) } if (await this._shouldCompileBinaryAsync(binary, location)) { - binary = await this._buildAsync() + binary = await this.build() step.log('Node binary compiled') } return this._assembleDeliverable(binary!)