Compare commits

...

1 Commits

Author SHA1 Message Date
calebboyd c9c9b5a0a3 fix: mount vfs relative to execPath instead of cwd 2019-04-08 11:10:33 -05:00
4 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "nexe", "name": "nexe",
"version": "3.0.3", "version": "3.0.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "nexe", "name": "nexe",
"description": "Create a single executable out of your Node.js application", "description": "Create a single executable out of your Node.js application",
"license": "MIT", "license": "MIT",
"version": "3.0.3", "version": "3.0.4",
"contributors": [ "contributors": [
"Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)", "Craig Condon <craig.j.condon@gmail.com> (http://crcn.io)",
"Jared Allard <jaredallard@outlook.com>", "Jared Allard <jaredallard@outlook.com>",
+6 -5
View File
@@ -31,14 +31,15 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
} }
originalFsMethods = Object.assign({}, fs) originalFsMethods = Object.assign({}, fs)
nexeBinary = binary nexeBinary = binary
const { blobPath, resources: manifest } = binary const { blobPath, resources: manifest } = binary,
const { resourceStart, stat } = binary.layout { resourceStart, stat } = binary.layout,
const directories: { [key: string]: { [key: string]: boolean } } = {}, directories: { [key: string]: { [key: string]: boolean } } = {},
notAFile = '!@#$%^&*', notAFile = '!@#$%^&*',
isWin = process.platform.startsWith('win'), isWin = process.platform.startsWith('win'),
isString = (x: any): x is string => typeof x === 'string' || x instanceof String, isString = (x: any): x is string => typeof x === 'string' || x instanceof String,
noop = () => {}, noop = () => {},
path = require('path') path = require('path'),
baseDir = path.dirname(process.execPath)
let log = (text: string) => true let log = (text: string) => true
if ((process.env.DEBUG || '').toLowerCase().includes('nexe:require')) { if ((process.env.DEBUG || '').toLowerCase().includes('nexe:require')) {
@@ -52,7 +53,7 @@ function shimFs(binary: NexeBinary, fs: any = require('fs')) {
if (!isString(filepath)) { if (!isString(filepath)) {
return notAFile return notAFile
} }
let key = path.resolve(filepath) let key = path.resolve(baseDir, filepath)
if (isWin && key.substr(1, 2) === ':\\') { if (isWin && key.substr(1, 2) === ':\\') {
key = key[0].toUpperCase() + key.substr(1) key = key[0].toUpperCase() + key.substr(1)
+5 -1
View File
@@ -22,7 +22,11 @@ export default function(compiler: NexeCompiler, next: () => Promise<void>) {
compiler.shims.push( compiler.shims.push(
wrap(` wrap(`
if (!process.send) { if (!process.send) {
process.argv.splice(1,0, require.resolve(${JSON.stringify(compiler.entrypoint)})) const path = require('path')
const entry = path.resolve(path.dirname(process.execPath),${JSON.stringify(
compiler.entrypoint
)})
process.argv.splice(1,0, entry)
} }
`) `)
) )