chore: default exports

This commit is contained in:
calebboyd
2017-04-12 09:03:06 -05:00
parent 0d67b1dd4c
commit ac4ca3fe56
19 changed files with 140 additions and 110 deletions
+23 -19
View File
@@ -1,19 +1,21 @@
import { compose } from 'app-builder'
import { bundle } from './bundle'
import { compose, PromiseConfig } from 'app-builder'
import bundle from './bundle'
import { NexeCompiler } from './compiler'
import { argv } from './options'
import { cli } from './cli'
import { download } from './download'
import { artifacts } from './artifacts'
import { patches } from './patches'
import { argv, normalizeOptionsAsync } from './options'
import cli from './cli'
import download from './download'
import artifacts from './artifacts'
import patches from './patches'
import { EOL } from 'os'
import { longStackTraces, Promise } from 'bluebird'
import { error } from './logger'
PromiseConfig.constructor = Promise
longStackTraces()
export function compile (compilerOptions, callback) {
const compiler = new NexeCompiler(compilerOptions)
async function compile (compilerOptions, callback) {
const options = await normalizeOptionsAsync(compilerOptions)
const compiler = new NexeCompiler(options)
compiler.log.verbose('Compiler options:' +
EOL + JSON.stringify(compiler.options, null, 4)
@@ -23,28 +25,30 @@ export function compile (compilerOptions, callback) {
bundle,
cli,
download,
(nexeCompiler, next) => {
return next().then(() => {
return nexeCompiler.buildAsync()
})
async (_, next) => {
await next()
return compiler.buildAsync()
},
artifacts,
patches,
compiler.options.patches
)
return Promise.resolve(nexe(compiler)).asCallback(callback)
return nexe(compiler).asCallback(callback)
}
export function isNexe (callback) {
function isNexe (callback) {
return Promise.resolve(Boolean(process.__nexe)).asCallback(callback)
}
export {
argv
argv,
isNexe,
compile
}
if (require.main === module || process.__nexe) {
compile(argv).catch((e) => {
error(e.stack, () => process.exit(1))
})
compile(argv)
.catch((e) => {
error(e.stack, () => process.exit(e.exitCode || 1))
})
}