Skip to content

Commit cdb9c0f

Browse files
committed
Bug fixes in release-postinstall.js
1. Removes arch() detection on Windows 2. Fix windows artifact name
1 parent d9cdad3 commit cdb9c0f

File tree

2 files changed

+6
-92
lines changed

2 files changed

+6
-92
lines changed

dist/release-postinstall.js

+3-46
Original file line numberDiff line numberDiff line change
@@ -47,45 +47,6 @@ function copyRecursive(srcDir, dstDir) {
4747
return results;
4848
}
4949

50-
function arch() {
51-
/**
52-
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
53-
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
54-
* See: https://twitter.com/feross/status/776949077208510464
55-
*/
56-
if (process.platform === "win32") {
57-
var useEnv = false;
58-
try {
59-
useEnv = !!(
60-
process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT)
61-
);
62-
} catch (err) {}
63-
64-
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
65-
66-
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
67-
var isWOW64 = false;
68-
try {
69-
isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative"));
70-
} catch (err) {}
71-
72-
return isWOW64 ? "x64" : "x86";
73-
}
74-
75-
/**
76-
* On Linux, use the `getconf` command to get the architecture.
77-
*/
78-
if (process.platform === "linux") {
79-
var output = cp.execSync("getconf LONG_BIT", { encoding: "utf8" });
80-
return output === "64\n" ? "x64" : "x86";
81-
}
82-
83-
/**
84-
* If none of the above, assume the architecture is 32-bit.
85-
*/
86-
return process.arch;
87-
}
88-
8950
// implementing it b/c we don't want to depend on fs.copyFileSync which appears
9051
9152
function copyFileSync(sourcePath, destPath) {
@@ -105,7 +66,7 @@ function copyFileSync(sourcePath, destPath) {
10566
var copyPlatformBinaries = (platformPath, foldersToCopy) => {
10667
var platformBuildPath = path.join(__dirname, platformPath);
10768

108-
let foldersToCopy, binariesToCopy;
69+
let binariesToCopy;
10970

11071
binariesToCopy = Object.keys(packageJson.bin).map(function (name) {
11172
return packageJson.bin[name];
@@ -150,14 +111,10 @@ try {
150111
console.log("Could not create _export folder");
151112
}
152113

153-
const platformArch = arch();
114+
const platformArch = process.arch;
154115
switch (platform) {
155116
case "win32":
156-
if (platformArch !== "x64") {
157-
console.warn("error: x86 is currently not supported on Windows");
158-
process.exit(1);
159-
}
160-
copyPlatformBinaries("platform-esy-npm-release-windows-x64", [
117+
copyPlatformBinaries("platform-esy-npm-release-win32-x64", [
161118
"bin",
162119
"_export",
163120
]);

release-postinstall.js

+3-46
Original file line numberDiff line numberDiff line change
@@ -47,45 +47,6 @@ function copyRecursive(srcDir, dstDir) {
4747
return results;
4848
}
4949

50-
function arch() {
51-
/**
52-
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
53-
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
54-
* See: https://twitter.com/feross/status/776949077208510464
55-
*/
56-
if (process.platform === "win32") {
57-
var useEnv = false;
58-
try {
59-
useEnv = !!(
60-
process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT)
61-
);
62-
} catch (err) {}
63-
64-
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
65-
66-
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
67-
var isWOW64 = false;
68-
try {
69-
isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative"));
70-
} catch (err) {}
71-
72-
return isWOW64 ? "x64" : "x86";
73-
}
74-
75-
/**
76-
* On Linux, use the `getconf` command to get the architecture.
77-
*/
78-
if (process.platform === "linux") {
79-
var output = cp.execSync("getconf LONG_BIT", { encoding: "utf8" });
80-
return output === "64\n" ? "x64" : "x86";
81-
}
82-
83-
/**
84-
* If none of the above, assume the architecture is 32-bit.
85-
*/
86-
return process.arch;
87-
}
88-
8950
// implementing it b/c we don't want to depend on fs.copyFileSync which appears
9051
9152
function copyFileSync(sourcePath, destPath) {
@@ -105,7 +66,7 @@ function copyFileSync(sourcePath, destPath) {
10566
var copyPlatformBinaries = (platformPath, foldersToCopy) => {
10667
var platformBuildPath = path.join(__dirname, platformPath);
10768

108-
let foldersToCopy, binariesToCopy;
69+
let binariesToCopy;
10970

11071
binariesToCopy = Object.keys(packageJson.bin).map(function (name) {
11172
return packageJson.bin[name];
@@ -150,14 +111,10 @@ try {
150111
console.log("Could not create _export folder");
151112
}
152113

153-
const platformArch = arch();
114+
const platformArch = process.arch;
154115
switch (platform) {
155116
case "win32":
156-
if (platformArch !== "x64") {
157-
console.warn("error: x86 is currently not supported on Windows");
158-
process.exit(1);
159-
}
160-
copyPlatformBinaries("platform-esy-npm-release-windows-x64", [
117+
copyPlatformBinaries("platform-esy-npm-release-win32-x64", [
161118
"bin",
162119
"_export",
163120
]);

0 commit comments

Comments
 (0)