mystyk 2026.6.0 → 2026.7.0
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/src/utils/version-check.js +19 -12
package/package.json
CHANGED
|
@@ -39,6 +39,15 @@ function compareVersions(a, b) {
|
|
|
39
39
|
* Returns true if should continue, false if updating
|
|
40
40
|
*/
|
|
41
41
|
export async function checkVersionAndUpdate(currentVersion) {
|
|
42
|
+
// Check if we just updated (env flag from previous run)
|
|
43
|
+
if (process.env.MYSTYK_JUST_UPDATED) {
|
|
44
|
+
const fromVersion = process.env.MYSTYK_UPDATED_FROM || '?';
|
|
45
|
+
console.log();
|
|
46
|
+
console.log(chalk.bgGreen.black(' ✓ ACTUALIZADO ') + chalk.green(` ${fromVersion} → ${currentVersion}`));
|
|
47
|
+
console.log();
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
try {
|
|
43
52
|
const latestVersion = await getLatestVersion();
|
|
44
53
|
|
|
@@ -47,14 +56,10 @@ export async function checkVersionAndUpdate(currentVersion) {
|
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
50
|
-
//
|
|
51
|
-
console.log();
|
|
52
|
-
console.log(chalk.bgYellow.black(' UPDATE ') + chalk.yellow(` Nueva versión disponible`));
|
|
53
|
-
console.log();
|
|
54
|
-
console.log(chalk.gray(` Instalada: `) + chalk.red(currentVersion));
|
|
55
|
-
console.log(chalk.gray(` Disponible: `) + chalk.green(latestVersion));
|
|
59
|
+
// Show update banner
|
|
56
60
|
console.log();
|
|
57
|
-
console.log(chalk.
|
|
61
|
+
console.log(chalk.bgYellow.black(' ↻ UPDATE ') + chalk.yellow(` Descargando v${latestVersion}...`));
|
|
62
|
+
console.log(chalk.gray(` (tienes v${currentVersion})`));
|
|
58
63
|
console.log();
|
|
59
64
|
|
|
60
65
|
const args = process.argv.slice(2);
|
|
@@ -62,14 +67,16 @@ export async function checkVersionAndUpdate(currentVersion) {
|
|
|
62
67
|
return new Promise((resolve) => {
|
|
63
68
|
const child = spawn('npx', [`${PACKAGE_NAME}@${latestVersion}`, ...args], {
|
|
64
69
|
stdio: 'inherit',
|
|
65
|
-
shell: true
|
|
70
|
+
shell: true,
|
|
71
|
+
env: {
|
|
72
|
+
...process.env,
|
|
73
|
+
MYSTYK_JUST_UPDATED: '1',
|
|
74
|
+
MYSTYK_UPDATED_FROM: currentVersion
|
|
75
|
+
}
|
|
66
76
|
});
|
|
67
77
|
|
|
68
78
|
child.on('error', () => {
|
|
69
|
-
console.log();
|
|
70
|
-
console.log(chalk.red(` ✗ Error actualizando.`));
|
|
71
|
-
console.log(chalk.gray(` Ejecuta manualmente: npx ${PACKAGE_NAME}@latest`));
|
|
72
|
-
console.log();
|
|
79
|
+
console.log(chalk.red(` ✗ Error. Ejecuta: npx ${PACKAGE_NAME}@latest`));
|
|
73
80
|
resolve(true);
|
|
74
81
|
});
|
|
75
82
|
|