fix: snapshot gyp variable name after node 11 (#606)

this changed from `embed_script` to `v8_embed_script` after node 11
This commit is contained in:
Antonio Nuno Monteiro
2019-04-09 03:14:16 +01:00
committed by Caleb Boyd
parent 448f4270ea
commit 6fc2ed9519
+8 -2
View File
@@ -1,5 +1,6 @@
import { resolve } from 'path'
import { NexeCompiler } from '../compiler'
import { semverGt } from '../util'
export default async function(compiler: NexeCompiler, next: () => Promise<void>) {
const { snapshot, warmup, cwd } = compiler.options
@@ -8,13 +9,18 @@ export default async function(compiler: NexeCompiler, next: () => Promise<void>)
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()