From 1b16e4ee73553f47673873e8ae033f2b4f4c7ce9 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 22 Jan 2024 17:28:47 +0100 Subject: [PATCH] fix: refs #5483 push & clean fixes --- myt-clean.js | 2 +- myt-push.js | 28 ++++++++++++++-------------- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/myt-clean.js b/myt-clean.js index 93801d3..db37150 100644 --- a/myt-clean.js +++ b/myt-clean.js @@ -29,7 +29,7 @@ class Clean extends Command { static reporter = { versionsArchived: function(nVersions) { if (nVersions) - console.log(` -> ${oldVersions.length} versions archived.`); + console.log(` -> ${nVersions} versions archived.`); else console.log(` -> No versions archived.`); }, diff --git a/myt-push.js b/myt-push.js index 3862312..fca5b9a 100644 --- a/myt-push.js +++ b/myt-push.js @@ -47,7 +47,7 @@ class Push extends Command { + `\n -> Commit: ${version.gitCommit}` ); }, - version(version, error) { + version(version, dir, error) { let actionMsg; let number, color; @@ -59,27 +59,27 @@ class Push extends Command { color = 'cyan'; } else { actionMsg = '[W]'.yellow; - switch(action) { + switch(error) { case 'badVersion': - number = '?????'; - color = 'yellow'; - break; - case 'wrongDirectory': number = '*****'; color = 'gray'; break; + case 'wrongDirectory': + number = '?????'; + color = 'yellow'; + break; } } const numberMsg = `[${number}]`[color]; - console.log('', `${actionMsg}${numberMsg}`.bold, version.name); + console.log('', `${actionMsg}${numberMsg}`.bold, version?.name || dir); }, logScript(script) { let actionMsg; - if (script.apply) - actionMsg = '[+]'.green; - else if (!script.matchRegex) + if (!script.matchRegex) actionMsg = '[W]'.yellow; + else if (script.apply) + actionMsg = '[+]'.green; else actionMsg = '[I]'.blue; @@ -245,19 +245,19 @@ class Push extends Command { let apply = false; if (!version) - this.emit('version', version, 'wrongDirectory'); + this.emit('version', version, versionDir, 'wrongDirectory'); else if (version.number.length != dbVersion.number.length) - this.emit('version', version, 'badVersion'); + this.emit('version', version, versionDir, 'badVersion'); else apply = version.apply; if (apply) showLog = true; - if (showLog) this.emit('version', version); + if (showLog) this.emit('version', version, versionDir); if (!apply) continue; for (const script of version.scripts) { this.emit('logScript', script); - if (!script.apply) continue; + if (!script.apply || !script.matchRegex) continue; let err; try { diff --git a/package-lock.json b/package-lock.json index 422ae1b..0aa85c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@verdnatura/myt", - "version": "1.5.28", + "version": "1.5.29", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@verdnatura/myt", - "version": "1.5.28", + "version": "1.5.29", "license": "GPL-3.0", "dependencies": { "@sqltools/formatter": "^1.2.5", diff --git a/package.json b/package.json index bd1d0b1..60a0b6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@verdnatura/myt", - "version": "1.5.28", + "version": "1.5.29", "author": "Verdnatura Levante SL", "description": "MySQL version control", "license": "GPL-3.0",