From 6fc2ed95193c2649097f91f8698518bb31c12db8 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Tue, 9 Apr 2019 03:14:16 +0100 Subject: [PATCH] fix: snapshot gyp variable name after node 11 (#606) this changed from `embed_script` to `v8_embed_script` after node 11 --- src/patches/snapshot.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/patches/snapshot.ts b/src/patches/snapshot.ts index c500498..f74204d 100644 --- a/src/patches/snapshot.ts +++ b/src/patches/snapshot.ts @@ -1,5 +1,6 @@ import { resolve } from 'path' import { NexeCompiler } from '../compiler' +import { semverGt } from '../util' export default async function(compiler: NexeCompiler, next: () => Promise) { const { snapshot, warmup, cwd } = compiler.options @@ -8,13 +9,18 @@ export default async function(compiler: NexeCompiler, next: () => Promise) return next() } + const variablePrefix = semverGt(compiler.target.version, '11.0.0') ? 'v8_' : '' + await compiler.replaceInFileAsync( compiler.configureScript, 'def configure_v8(o):', - `def configure_v8(o):\n o['variables']['embed_script'] = r'${resolve( + `def configure_v8(o):\n o['variables']['${variablePrefix}embed_script'] = r'${resolve( cwd, snapshot - )}'\n o['variables']['warmup_script'] = r'${resolve(cwd, warmup || snapshot)}'` + )}'\n o['variables']['${variablePrefix}warmup_script'] = r'${resolve( + cwd, + warmup || snapshot + )}'` ) return next()