@cg3/equip 0.5.0 → 0.5.1
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/equip.js +16 -2
- package/package.json +1 -1
package/bin/equip.js
CHANGED
|
@@ -158,8 +158,17 @@ function spawnTool(pkg, command, extraArgs, toolName) {
|
|
|
158
158
|
env: { ...process.env, EQUIP_VERSION },
|
|
159
159
|
});
|
|
160
160
|
child.on("close", (code) => {
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
// Always reconcile state — install may have succeeded even if
|
|
162
|
+
// the tool exited non-zero (e.g. user cancelled a post-install prompt)
|
|
163
|
+
if (toolName) {
|
|
164
|
+
try {
|
|
165
|
+
const changed = reconcileState(toolName, pkg);
|
|
166
|
+
if (changed > 0) {
|
|
167
|
+
process.stderr.write(`\n equip: tracked ${toolName} on ${changed} platform${changed === 1 ? "" : "s"}\n`);
|
|
168
|
+
}
|
|
169
|
+
} catch (e) {
|
|
170
|
+
process.stderr.write(`\n[equip] state reconciliation failed: ${e.message}\n`);
|
|
171
|
+
}
|
|
163
172
|
}
|
|
164
173
|
process.exit(code || 0);
|
|
165
174
|
});
|
|
@@ -182,6 +191,8 @@ function reconcileState(toolName, pkg) {
|
|
|
182
191
|
const _fs = require("fs");
|
|
183
192
|
const _path = require("path");
|
|
184
193
|
|
|
194
|
+
let count = 0;
|
|
195
|
+
|
|
185
196
|
for (const [id, def] of PLATFORM_REGISTRY) {
|
|
186
197
|
// Quick check: is this platform present?
|
|
187
198
|
const dirFound = def.detection.dirs.some(fn => dirExists(fn()));
|
|
@@ -223,7 +234,10 @@ function reconcileState(toolName, pkg) {
|
|
|
223
234
|
} catch {}
|
|
224
235
|
|
|
225
236
|
trackInstall(toolName, pkg, id, record);
|
|
237
|
+
count++;
|
|
226
238
|
}
|
|
239
|
+
|
|
240
|
+
return count;
|
|
227
241
|
}
|
|
228
242
|
|
|
229
243
|
// ─── Main ───────────────────────────────────────────────────
|