@remem-ai/remem 0.5.104 → 0.5.141
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/package.json +1 -1
- package/scripts/install.js +48 -0
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -94,6 +94,49 @@ function sha256(file) {
|
|
|
94
94
|
return hash.digest("hex");
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
function shouldCodesign(platform = process.platform, arch = process.arch) {
|
|
98
|
+
return platform === "darwin" && arch === "arm64";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function codesignBinary(binary, options = {}) {
|
|
102
|
+
const platform = options.platform || process.platform;
|
|
103
|
+
const arch = options.arch || process.arch;
|
|
104
|
+
if (!shouldCodesign(platform, arch)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const spawn = options.spawnSync || spawnSync;
|
|
108
|
+
const result = spawn("codesign", ["--force", "--sign", "-", binary], {
|
|
109
|
+
encoding: "utf8",
|
|
110
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
111
|
+
timeout: 5000,
|
|
112
|
+
});
|
|
113
|
+
if (result.error) {
|
|
114
|
+
throw new Error(`codesign failed for ${binary}: ${result.error.message}`);
|
|
115
|
+
}
|
|
116
|
+
if (result.status !== 0) {
|
|
117
|
+
const reason = (result.stderr || result.stdout || `exit ${result.status}`).trim();
|
|
118
|
+
throw new Error(`codesign failed for ${binary}: ${reason}`);
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function smokeBinary(binary, options = {}) {
|
|
124
|
+
const spawn = options.spawnSync || spawnSync;
|
|
125
|
+
const result = spawn(binary, ["--version"], {
|
|
126
|
+
encoding: "utf8",
|
|
127
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
128
|
+
timeout: 5000,
|
|
129
|
+
});
|
|
130
|
+
if (result.error) {
|
|
131
|
+
throw new Error(`installed remem binary is not executable: ${result.error.message}`);
|
|
132
|
+
}
|
|
133
|
+
if (result.status !== 0) {
|
|
134
|
+
const reason = (result.stderr || result.stdout || `exit ${result.status}`).trim();
|
|
135
|
+
throw new Error(`installed remem binary failed --version: ${reason}`);
|
|
136
|
+
}
|
|
137
|
+
return (result.stdout || result.stderr || "").trim();
|
|
138
|
+
}
|
|
139
|
+
|
|
97
140
|
function expectedAssetFile(key) {
|
|
98
141
|
if (!/^(darwin|linux)-(arm64|x64)$/.test(key)) {
|
|
99
142
|
throw new Error(`Unsupported release asset platform key: ${key}`);
|
|
@@ -167,6 +210,8 @@ async function main() {
|
|
|
167
210
|
if (tar.status !== 0) throw new Error(`tar exited with status ${tar.status}`);
|
|
168
211
|
|
|
169
212
|
fs.chmodSync(binary, 0o755);
|
|
213
|
+
codesignBinary(binary);
|
|
214
|
+
smokeBinary(binary);
|
|
170
215
|
console.log(`Installed remem binary to ${binary}`);
|
|
171
216
|
} finally {
|
|
172
217
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
@@ -183,5 +228,8 @@ if (require.main === module) {
|
|
|
183
228
|
module.exports = {
|
|
184
229
|
BASE_URL,
|
|
185
230
|
VERSION,
|
|
231
|
+
codesignBinary,
|
|
186
232
|
resolveAsset,
|
|
233
|
+
shouldCodesign,
|
|
234
|
+
smokeBinary,
|
|
187
235
|
};
|