diff --git a/README.md b/README.md index d22771c..8832d3a 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,8 @@ compile({ - default: true - #### `build: boolean` - Build node from source, passing this flag tells nexe to download and build from source. Subsequently using this flag will cause nexe to use the previously built binary. To rebuild, first add [`--clean`](#clean-boolean) - - #### `asset: string` - - Provide a pre-built nexe binary asset, this can either be an http or https URL or a file path. + - #### `remote: string` + - Provide a custom remote location for fetching pre-built nexe binaries from. This can either be an HTTP or HTTPS URL or a file path. - default: `null` - #### `python: string` - On Linux this is the path pointing to your python2 executable diff --git a/src/compiler.ts b/src/compiler.ts index a4b8a70..b7c756f 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -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()) } diff --git a/src/options.ts b/src/options.ts index 54a1e3b..06ed876 100644 --- a/src/options.ts +++ b/src/options.ts @@ -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 [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:')}