fix: refs #5483 push & clean fixes

This commit is contained in:
Juan Ferrer 2024-01-22 17:28:47 +01:00
parent 44957a2275
commit 1b16e4ee73
4 changed files with 18 additions and 18 deletions

View File

@ -29,7 +29,7 @@ class Clean extends Command {
static reporter = { static reporter = {
versionsArchived: function(nVersions) { versionsArchived: function(nVersions) {
if (nVersions) if (nVersions)
console.log(` -> ${oldVersions.length} versions archived.`); console.log(` -> ${nVersions} versions archived.`);
else else
console.log(` -> No versions archived.`); console.log(` -> No versions archived.`);
}, },

View File

@ -47,7 +47,7 @@ class Push extends Command {
+ `\n -> Commit: ${version.gitCommit}` + `\n -> Commit: ${version.gitCommit}`
); );
}, },
version(version, error) { version(version, dir, error) {
let actionMsg; let actionMsg;
let number, color; let number, color;
@ -59,27 +59,27 @@ class Push extends Command {
color = 'cyan'; color = 'cyan';
} else { } else {
actionMsg = '[W]'.yellow; actionMsg = '[W]'.yellow;
switch(action) { switch(error) {
case 'badVersion': case 'badVersion':
number = '?????';
color = 'yellow';
break;
case 'wrongDirectory':
number = '*****'; number = '*****';
color = 'gray'; color = 'gray';
break; break;
case 'wrongDirectory':
number = '?????';
color = 'yellow';
break;
} }
} }
const numberMsg = `[${number}]`[color]; const numberMsg = `[${number}]`[color];
console.log('', `${actionMsg}${numberMsg}`.bold, version.name); console.log('', `${actionMsg}${numberMsg}`.bold, version?.name || dir);
}, },
logScript(script) { logScript(script) {
let actionMsg; let actionMsg;
if (script.apply) if (!script.matchRegex)
actionMsg = '[+]'.green;
else if (!script.matchRegex)
actionMsg = '[W]'.yellow; actionMsg = '[W]'.yellow;
else if (script.apply)
actionMsg = '[+]'.green;
else else
actionMsg = '[I]'.blue; actionMsg = '[I]'.blue;
@ -245,19 +245,19 @@ class Push extends Command {
let apply = false; let apply = false;
if (!version) if (!version)
this.emit('version', version, 'wrongDirectory'); this.emit('version', version, versionDir, 'wrongDirectory');
else if (version.number.length != dbVersion.number.length) else if (version.number.length != dbVersion.number.length)
this.emit('version', version, 'badVersion'); this.emit('version', version, versionDir, 'badVersion');
else else
apply = version.apply; apply = version.apply;
if (apply) showLog = true; if (apply) showLog = true;
if (showLog) this.emit('version', version); if (showLog) this.emit('version', version, versionDir);
if (!apply) continue; if (!apply) continue;
for (const script of version.scripts) { for (const script of version.scripts) {
this.emit('logScript', script); this.emit('logScript', script);
if (!script.apply) continue; if (!script.apply || !script.matchRegex) continue;
let err; let err;
try { try {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@verdnatura/myt", "name": "@verdnatura/myt",
"version": "1.5.28", "version": "1.5.29",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@verdnatura/myt", "name": "@verdnatura/myt",
"version": "1.5.28", "version": "1.5.29",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@sqltools/formatter": "^1.2.5", "@sqltools/formatter": "^1.2.5",

View File

@ -1,6 +1,6 @@
{ {
"name": "@verdnatura/myt", "name": "@verdnatura/myt",
"version": "1.5.28", "version": "1.5.29",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "MySQL version control", "description": "MySQL version control",
"license": "GPL-3.0", "license": "GPL-3.0",