feat: allow setting NODE_OPTIONS. (#448)

This commit is contained in:
bruce-one
2018-02-02 09:29:49 +11:00
committed by Caleb Boyd
parent 9a81cc2fa2
commit 133d1919fa
2 changed files with 13 additions and 3 deletions
+10 -2
View File
@@ -5,8 +5,16 @@ export default async function disableNodeCli(compiler: NexeCompiler, next: () =>
return next()
}
const nodeccMarker = "argv[index][0] == '-'"
const nodeccMarker = 'argv[index][0] =='
await compiler.replaceInFileAsync(
'src/node.cc',
`${nodeccMarker} '-'`,
// allow NODE_OPTIONS, introduced in 8.0
parseInt(compiler.target.version.split('.')[0]) >= 8
? `(${nodeccMarker} is_env ? '-' : ']')`
: `(${nodeccMarker} ']')`
)
await compiler.replaceInFileAsync('src/node.cc', nodeccMarker, nodeccMarker.replace('-', ']'))
return next()
}