@maravilla-labs/cli 0.1.8 → 0.1.9
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/postinstall.js +9 -0
- package/scripts/update.js +19 -3
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -204,6 +204,7 @@ async function install() {
|
|
|
204
204
|
// Decide whether to download based on current vs requested version
|
|
205
205
|
const force = process.env.MARAVILLA_FORCE_INSTALL === '1';
|
|
206
206
|
let requested = null;
|
|
207
|
+
// Handle both "cli-v0.1.9" and "v0.1.9" formats
|
|
207
208
|
const m = tag.match(/v(\d+\.\d+\.\d+)/);
|
|
208
209
|
if (m) requested = m[1];
|
|
209
210
|
|
|
@@ -250,6 +251,14 @@ async function install() {
|
|
|
250
251
|
|
|
251
252
|
const innerDir = path.join(tmpDir, art);
|
|
252
253
|
const srcPath = path.join(innerDir, EXECUTABLE);
|
|
254
|
+
|
|
255
|
+
// Remove existing binary first to ensure clean replacement
|
|
256
|
+
try {
|
|
257
|
+
await fs.promises.unlink(INSTALL_PATH);
|
|
258
|
+
} catch (e) {
|
|
259
|
+
// File might not exist, that's okay
|
|
260
|
+
}
|
|
261
|
+
|
|
253
262
|
await fs.promises.copyFile(srcPath, INSTALL_PATH);
|
|
254
263
|
await fs.promises.chmod(INSTALL_PATH, 0o755);
|
|
255
264
|
log(chalk.green(`Installed to ${INSTALL_PATH}`));
|
package/scripts/update.js
CHANGED
|
@@ -111,11 +111,27 @@ async function main() {
|
|
|
111
111
|
log(`Updating to ${chalk.cyan(tag)}`);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
// Force the specific version we want
|
|
115
|
+
const env = {
|
|
116
|
+
...process.env,
|
|
117
|
+
MARAVILLA_FORCE_INSTALL: '1',
|
|
118
|
+
MARAVILLA_VERSION: tag // Pass the tag to ensure we get the right version
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const result = await new Promise((resolve) => {
|
|
122
|
+
const child = spawn(process.execPath, [postinstall], { stdio: 'inherit', env });
|
|
117
123
|
child.on('exit', (code) => resolve(code ?? 0));
|
|
118
124
|
});
|
|
125
|
+
|
|
126
|
+
// Verify the update worked
|
|
127
|
+
if (result === 0) {
|
|
128
|
+
const newVersion = await currentVersion();
|
|
129
|
+
if (newVersion) {
|
|
130
|
+
log(chalk.green(`✅ Successfully updated to v${newVersion}`));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return result;
|
|
119
135
|
}
|
|
120
136
|
|
|
121
137
|
main().then((code) => process.exit(code)).catch((e) => {
|