fix: replace --asset option with --remote option (#760)

This commit is contained in:
Aral Balkan
2020-04-28 15:07:34 +01:00
committed by Caleb Boyd
parent 01c977bb3c
commit 0a2e8dba00
3 changed files with 15 additions and 18 deletions
+11 -10
View File
@@ -108,14 +108,18 @@ export class NexeCompiler {
//SOMEDAY iterate over multiple targets with `--outDir`
this.targets = options.targets as NexeTarget[]
this.target = this.targets[0]
if (options.asset && options.asset.startsWith('http')) {
this.remoteAsset = options.asset
} else {
if (!options.remote.startsWith('http')) {
throw new NexeError(`Invalid remote URL (must be HTTP/HTTPS): ${options.remote}`)
}
this.remoteAsset = options.remote + this.target.toString()
if (
!(
options.remote.startsWith('http://') ||
options.remote.startsWith('https://') ||
options.remote.startsWith('file://')
)
) {
throw new NexeError(
`Invalid remote URI scheme (must be http, https, or file): ${options.remote}`
)
}
this.remoteAsset = options.remote + this.target.toString()
this.src = join(this.options.temp, this.target.version)
this.configureScript = configure + (semverGt(this.target.version, '10.10.0') ? '.py' : '')
this.nodeSrcBinPath = isWindows
@@ -200,9 +204,6 @@ export class NexeCompiler {
}
public getNodeExecutableLocation(target?: NexeTarget) {
if (this.options.asset && !this.options.asset.startsWith('http')) {
return resolve(this.options.cwd, this.options.asset)
}
if (target) {
return join(this.options.temp, target.toString())
}
+2 -6
View File
@@ -21,7 +21,7 @@ export interface NexeOptions {
output: string
targets: (string | NexeTarget)[]
name: string
asset: string
remote: string
cwd: string
fs: boolean | string[]
flags: string[]
@@ -39,7 +39,6 @@ export interface NexeOptions {
native: any
mangle: boolean
ghToken: string
remote: string
sourceUrl?: string
enableStdIn?: boolean
python?: string
@@ -82,14 +81,12 @@ const alias = {
b: 'build',
n: 'name',
r: 'resource',
a: 'asset',
p: 'python',
f: 'flag',
c: 'configure',
m: 'make',
h: 'help',
l: 'loglevel',
e: 'remote',
'fake-argv': 'fakeArgv',
'gh-token': 'ghToken',
}
@@ -104,9 +101,8 @@ ${c.bold('nexe <entry-file> [options]')}
-t --target -- node version description
-n --name -- main app module name
-r --resource -- *embed files (glob) within the binary
-a --asset -- alternate asset path, file or url pointing to a base (nexe) binary
--remote -- alternate location (URL) to download pre-built base (nexe) binaries from
--plugin -- extend nexe runtime behavior
-e --remote -- third-party remote location (URL) to download pre-built releases from
${c.underline.bold('Building from source:')}