@nyex/nyex 0.1.2-beta → 0.1.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nyex.js +31 -24
- package/package.json +5 -5
package/bin/nyex.js
CHANGED
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const crypto = require("crypto");
|
|
7
|
-
const { spawn, execSync } = require("child_process");
|
|
8
|
-
const pkg = require("../package.json");
|
|
7
|
+
const { spawn, execSync } = require("child_process");
|
|
8
|
+
const pkg = require("../package.json");
|
|
9
|
+
const META_PACKAGE = pkg.name || "@nyex/nyex";
|
|
10
|
+
const PLATFORM_PACKAGE = "@nyex/nyex-win32-x64-msvc";
|
|
11
|
+
const INSTALL_TAG = "beta";
|
|
9
12
|
|
|
10
13
|
function candidateGlobalNodeModuleDirs() {
|
|
11
14
|
const dirs = [];
|
|
@@ -42,15 +45,15 @@ function formatInstallHelp({ platform, arch, expectedPackage }) {
|
|
|
42
45
|
lines.push(`Detected platform: ${platform}-${arch}`);
|
|
43
46
|
lines.push(`Expected package: ${expectedPackage}`);
|
|
44
47
|
lines.push("");
|
|
45
|
-
lines.push("How to fix:");
|
|
46
|
-
lines.push(" 1) Reinstall the meta package (this should pull the platform binary automatically):");
|
|
47
|
-
lines.push(
|
|
48
|
-
lines.push(" 2) If that still doesn't install the platform binary, install it explicitly:");
|
|
49
|
-
lines.push(` npm i -g ${expectedPackage}
|
|
48
|
+
lines.push("How to fix:");
|
|
49
|
+
lines.push(" 1) Reinstall the meta package (this should pull the platform binary automatically):");
|
|
50
|
+
lines.push(` npm i -g ${META_PACKAGE}@${INSTALL_TAG}`);
|
|
51
|
+
lines.push(" 2) If that still doesn't install the platform binary, install it explicitly:");
|
|
52
|
+
lines.push(` npm i -g ${expectedPackage}@${INSTALL_TAG}`);
|
|
50
53
|
lines.push("");
|
|
51
54
|
lines.push("If you are testing local .tgz files:");
|
|
52
55
|
lines.push(" 1) Install the platform .tgz first");
|
|
53
|
-
lines.push(
|
|
56
|
+
lines.push(` 2) Then install the ${META_PACKAGE} .tgz`);
|
|
54
57
|
return lines.join("\n");
|
|
55
58
|
}
|
|
56
59
|
|
|
@@ -63,8 +66,8 @@ function resolveBinary() {
|
|
|
63
66
|
const platform = process.platform;
|
|
64
67
|
const arch = process.arch;
|
|
65
68
|
|
|
66
|
-
if (platform === "win32" && arch === "x64") {
|
|
67
|
-
const expectedPackage =
|
|
69
|
+
if (platform === "win32" && arch === "x64") {
|
|
70
|
+
const expectedPackage = PLATFORM_PACKAGE;
|
|
68
71
|
const candidatePkgJsonPaths = [];
|
|
69
72
|
|
|
70
73
|
// First, try normal Node resolution (works when the platform package is an optionalDependency).
|
|
@@ -125,9 +128,9 @@ function verifyBinaryIntegrity({ expectedPackage, binPath, shaPath }) {
|
|
|
125
128
|
"",
|
|
126
129
|
`Expected: ${shaPath}`,
|
|
127
130
|
"",
|
|
128
|
-
"How to fix:",
|
|
129
|
-
` npm uninstall -g ${expectedPackage}`,
|
|
130
|
-
|
|
131
|
+
"How to fix:",
|
|
132
|
+
` npm uninstall -g ${expectedPackage}`,
|
|
133
|
+
` npm i -g ${META_PACKAGE}@${INSTALL_TAG}`,
|
|
131
134
|
"",
|
|
132
135
|
"If you are testing local .tgz files, re-run the staging script then reinstall:",
|
|
133
136
|
" scripts\\npm\\stage-windows-binary.ps1 ...",
|
|
@@ -138,7 +141,11 @@ function verifyBinaryIntegrity({ expectedPackage, binPath, shaPath }) {
|
|
|
138
141
|
throw err;
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
|
|
144
|
+
// Support both checksum formats:
|
|
145
|
+
// <sha256>
|
|
146
|
+
// <sha256> nyex.exe
|
|
147
|
+
const expectedRaw = fs.readFileSync(shaPath, "utf8").trim().toLowerCase();
|
|
148
|
+
const expected = expectedRaw.split(/\s+/)[0];
|
|
142
149
|
const actual = crypto
|
|
143
150
|
.createHash("sha256")
|
|
144
151
|
.update(fs.readFileSync(binPath))
|
|
@@ -152,9 +159,9 @@ function verifyBinaryIntegrity({ expectedPackage, binPath, shaPath }) {
|
|
|
152
159
|
"",
|
|
153
160
|
`Path: ${shaPath}`,
|
|
154
161
|
"",
|
|
155
|
-
"How to fix:",
|
|
156
|
-
` npm uninstall -g ${expectedPackage}`,
|
|
157
|
-
|
|
162
|
+
"How to fix:",
|
|
163
|
+
` npm uninstall -g ${expectedPackage}`,
|
|
164
|
+
` npm i -g ${META_PACKAGE}@${INSTALL_TAG}`,
|
|
158
165
|
].join("\n")
|
|
159
166
|
);
|
|
160
167
|
// Recoverable: a sibling global platform install may still be valid.
|
|
@@ -168,15 +175,15 @@ function verifyBinaryIntegrity({ expectedPackage, binPath, shaPath }) {
|
|
|
168
175
|
"NYEX binary integrity check failed. Refusing to execute nyex.exe.",
|
|
169
176
|
"",
|
|
170
177
|
`Binary: ${binPath}`,
|
|
171
|
-
`Expected: ${
|
|
178
|
+
`Expected: ${expectedRaw}`,
|
|
172
179
|
`Actual: ${actual}`,
|
|
173
180
|
"",
|
|
174
|
-
"Remediation:",
|
|
175
|
-
` npm uninstall -g ${expectedPackage}
|
|
176
|
-
" npm cache clean --force",
|
|
177
|
-
|
|
178
|
-
].join("\n")
|
|
179
|
-
);
|
|
181
|
+
"Remediation:",
|
|
182
|
+
` npm uninstall -g ${expectedPackage} ${META_PACKAGE}`,
|
|
183
|
+
" npm cache clean --force",
|
|
184
|
+
` npm i -g ${META_PACKAGE}@${INSTALL_TAG}`,
|
|
185
|
+
].join("\n")
|
|
186
|
+
);
|
|
180
187
|
// Fatal: we found a binary + checksum pair that disagree.
|
|
181
188
|
err.nyex_fatal = true;
|
|
182
189
|
throw err;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyex/nyex",
|
|
3
|
-
"version": "0.1.2-beta",
|
|
3
|
+
"version": "0.1.2-beta.2",
|
|
4
4
|
"description": "Nyex CLI (private beta)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://nyex.ai",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"nyex": "bin/nyex.js"
|
|
19
19
|
},
|
|
20
20
|
"optionalDependencies": {
|
|
21
|
-
"@nyex/nyex-win32-x64-msvc": "0.1.2-beta"
|
|
21
|
+
"@nyex/nyex-win32-x64-msvc": "0.1.2-beta.1"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
22
25
|
},
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=18"
|
|
25
|
-
},
|
|
26
26
|
"files": [
|
|
27
27
|
"bin/nyex.js",
|
|
28
28
|
"LICENSE",
|