mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-09 13:15:37 +03:00
15d988d441
Previously, we used to verify the snapshot script by running it in a new, empty context (similar to the one that `mksnapshot` creates when generating the startup blob). However, this context was being created using the Node version that `script/build` was executed with. Such version may not match the Node version shipped with Electron, and could thus cause the build script to report "false negatives" when verifying the snapshot script. For instance, running `script/build` with Node 4 would cause it to throw an error when encountering keywords like `async`/`await`, even if they're 100% supported in Electron 1.6.9. With this commit we are changing the snapshot verification code to use the Node version bundled in Electron in order to avoid the aforementioned mismatches.
7 lines
279 B
JavaScript
Executable File
7 lines
279 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
const fs = require('fs')
|
|
const vm = require('vm')
|
|
const snapshotScriptPath = process.argv[2]
|
|
const snapshotScript = fs.readFileSync(snapshotScriptPath, 'utf8')
|
|
vm.runInNewContext(snapshotScript, undefined, {filename: snapshotScriptPath, displayErrors: true})
|