From 9f22309949bf8207cb9e4566f917d5bdd0324a01 Mon Sep 17 00:00:00 2001 From: calebboyd Date: Tue, 26 Jan 2021 07:16:14 -0600 Subject: [PATCH] feat: add asset flag for using cached artifact --- package-lock.json | 2 +- package.json | 2 +- src/compiler.ts | 11 ++++------- src/options.ts | 2 ++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc758dc..c712b5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nexe", - "version": "4.0.0-beta.16", + "version": "4.0.0-beta.17", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8678b3b..3ded5c2 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": "4.0.0-beta.16", + "version": "4.0.0-beta.17", "contributors": [ "Craig Condon (http://crcn.io)", "Jared Allard ", diff --git a/src/compiler.ts b/src/compiler.ts index dde3b18..f33014e 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -110,13 +110,7 @@ export class NexeCompiler { //SOMEDAY iterate over multiple targets with `--outDir` this.targets = options.targets as NexeTarget[] this.target = this.targets[0] - if ( - !( - options.remote.startsWith('http://') || - options.remote.startsWith('https://') || - options.remote.startsWith('file://') - ) - ) { + if (!/https?\:\/\//.test(options.remote)) { throw new NexeError( `Invalid remote URI scheme (must be http, https, or file): ${options.remote}` ) @@ -198,6 +192,9 @@ export class NexeCompiler { } public getNodeExecutableLocation(target?: NexeTarget) { + if (this.options.asset) { + 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 9d43420..b736b12 100644 --- a/src/options.ts +++ b/src/options.ts @@ -22,6 +22,7 @@ export interface NexeOptions { targets: (string | NexeTarget)[] name: string remote: string + asset: string cwd: string fs: boolean | string[] flags: string[] @@ -77,6 +78,7 @@ const alias = { i: 'input', o: 'output', v: 'version', + a: 'asset', t: 'target', b: 'build', n: 'name',