-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from esy/prometheansacrifice/fix-postinstall
Bug fixes in release-postinstall.js
- Loading branch information
Showing
2 changed files
with
6 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,45 +47,6 @@ function copyRecursive(srcDir, dstDir) { | |
return results; | ||
} | ||
|
||
function arch() { | ||
/** | ||
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit | ||
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative. | ||
* See: https://twitter.com/feross/status/776949077208510464 | ||
*/ | ||
if (process.platform === "win32") { | ||
var useEnv = false; | ||
try { | ||
useEnv = !!( | ||
process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT) | ||
); | ||
} catch (err) {} | ||
|
||
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows"; | ||
|
||
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application. | ||
var isWOW64 = false; | ||
try { | ||
isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative")); | ||
} catch (err) {} | ||
|
||
return isWOW64 ? "x64" : "x86"; | ||
} | ||
|
||
/** | ||
* On Linux, use the `getconf` command to get the architecture. | ||
*/ | ||
if (process.platform === "linux") { | ||
var output = cp.execSync("getconf LONG_BIT", { encoding: "utf8" }); | ||
return output === "64\n" ? "x64" : "x86"; | ||
} | ||
|
||
/** | ||
* If none of the above, assume the architecture is 32-bit. | ||
*/ | ||
return process.arch; | ||
} | ||
|
||
// implementing it b/c we don't want to depend on fs.copyFileSync which appears | ||
// only in [email protected] | ||
function copyFileSync(sourcePath, destPath) { | ||
|
@@ -105,7 +66,7 @@ function copyFileSync(sourcePath, destPath) { | |
var copyPlatformBinaries = (platformPath, foldersToCopy) => { | ||
var platformBuildPath = path.join(__dirname, platformPath); | ||
|
||
let foldersToCopy, binariesToCopy; | ||
let binariesToCopy; | ||
|
||
binariesToCopy = Object.keys(packageJson.bin).map(function (name) { | ||
return packageJson.bin[name]; | ||
|
@@ -150,14 +111,10 @@ try { | |
console.log("Could not create _export folder"); | ||
} | ||
|
||
const platformArch = arch(); | ||
const platformArch = process.arch; | ||
switch (platform) { | ||
case "win32": | ||
if (platformArch !== "x64") { | ||
console.warn("error: x86 is currently not supported on Windows"); | ||
process.exit(1); | ||
} | ||
copyPlatformBinaries("platform-esy-npm-release-windows-x64", [ | ||
copyPlatformBinaries("platform-esy-npm-release-win32-x64", [ | ||
"bin", | ||
"_export", | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,45 +47,6 @@ function copyRecursive(srcDir, dstDir) { | |
return results; | ||
} | ||
|
||
function arch() { | ||
/** | ||
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit | ||
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative. | ||
* See: https://twitter.com/feross/status/776949077208510464 | ||
*/ | ||
if (process.platform === "win32") { | ||
var useEnv = false; | ||
try { | ||
useEnv = !!( | ||
process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT) | ||
); | ||
} catch (err) {} | ||
|
||
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows"; | ||
|
||
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application. | ||
var isWOW64 = false; | ||
try { | ||
isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative")); | ||
} catch (err) {} | ||
|
||
return isWOW64 ? "x64" : "x86"; | ||
} | ||
|
||
/** | ||
* On Linux, use the `getconf` command to get the architecture. | ||
*/ | ||
if (process.platform === "linux") { | ||
var output = cp.execSync("getconf LONG_BIT", { encoding: "utf8" }); | ||
return output === "64\n" ? "x64" : "x86"; | ||
} | ||
|
||
/** | ||
* If none of the above, assume the architecture is 32-bit. | ||
*/ | ||
return process.arch; | ||
} | ||
|
||
// implementing it b/c we don't want to depend on fs.copyFileSync which appears | ||
// only in [email protected] | ||
function copyFileSync(sourcePath, destPath) { | ||
|
@@ -105,7 +66,7 @@ function copyFileSync(sourcePath, destPath) { | |
var copyPlatformBinaries = (platformPath, foldersToCopy) => { | ||
var platformBuildPath = path.join(__dirname, platformPath); | ||
|
||
let foldersToCopy, binariesToCopy; | ||
let binariesToCopy; | ||
|
||
binariesToCopy = Object.keys(packageJson.bin).map(function (name) { | ||
return packageJson.bin[name]; | ||
|
@@ -150,14 +111,10 @@ try { | |
console.log("Could not create _export folder"); | ||
} | ||
|
||
const platformArch = arch(); | ||
const platformArch = process.arch; | ||
switch (platform) { | ||
case "win32": | ||
if (platformArch !== "x64") { | ||
console.warn("error: x86 is currently not supported on Windows"); | ||
process.exit(1); | ||
} | ||
copyPlatformBinaries("platform-esy-npm-release-windows-x64", [ | ||
copyPlatformBinaries("platform-esy-npm-release-win32-x64", [ | ||
"bin", | ||
"_export", | ||
]); | ||
|