diff --git a/db.js b/db.js index f871b2b..1170381 100644 --- a/db.js +++ b/db.js @@ -1,8 +1,6 @@ const Database = require("@hedystia/db"); const fs = require("fs"); const packageData = require("./package.json"); -const wait = require("./src/util/wait"); -const printText = require("./src/util/printText"); const migrationDB = require("./src/db/migrations"); const migrations = new Database("./src/db/store/migrations.ht", packageData.author); @@ -13,25 +11,17 @@ const executeDBCode = new Promise((resolve) => { (async () => { process.stdout.clearLine(); process.stdout.cursorTo(0); - const checkDB = "\x1b[97mReviewing database\x1b[0m"; - printText(checkDB, 0); - await wait(checkDB.length * 100 + 1000); + console.log("\x1b[97mReviewing database\x1b[0m"); if (!fs.existsSync("./src/db/store/migrations.ht")) { console.log("\n"); - const migrationStart = "\x1b[97mStarting the creation of the migrations table\x1b[0m"; - printText(migrationStart, 0); - await wait(migrationStart.length * 100 + 1000); + console.log("\x1b[97mStarting the creation of the migrations table\x1b[0m"); console.log(""); migrations.createTable("version", ["date"]); - const migrationDone = "\x1b[95mThe creation of the migration table has been completed\x1b[0m"; - printText(migrationDone, 0); - await wait(migrationDone.length * 100 + 1000); + console.log("\x1b[95mThe creation of the migration table has been completed\x1b[0m"); } await migrationDB(migrations, config); console.log("\n"); - const checkDBDone = "\x1b[92mI finish the review of the database\x1b[0m"; - printText(checkDBDone, 0); - await wait(checkDBDone.length * 100 + 1000); + console.log("\x1b[92mI finish the review of the database\x1b[0m"); resolve(); })(); }); diff --git a/src/db/migrations/2024-05-09T00-20-59.327Z.js b/src/db/migrations/2024-05-09T00-20-59.327Z.js index 60cf440..a0349f4 100644 --- a/src/db/migrations/2024-05-09T00-20-59.327Z.js +++ b/src/db/migrations/2024-05-09T00-20-59.327Z.js @@ -1,6 +1,4 @@ const readline = require("readline"); -const wait = require("../../util/wait"); -const printText = require("../../util/printText"); function getPrefix() { return new Promise((resolve) => { @@ -10,22 +8,15 @@ function getPrefix() { }); const askPrefix = async () => { console.log(""); - const pref = "\x1b[93mTell me the prefix you want to use\x1b[0m"; - printText(pref, 0); - await wait(pref.length * 100 + 1000); rl.question("\x1b[93mTell me the prefix you want to use\x1b[94m\n⤳\x1b[0m ", (input) => { const prefix = input.trim(); if (prefix.length > 6) { console.log(""); - const err = "\x1b[91mERROR: \x1b[92mThe prefix must have a maximum length of 6\x1b[0m"; - printText(err, 0); - setTimeout( - () => { - console.log(""); - askPrefix(); - }, - err.length * 100 + 1000, - ); + console.log("\x1b[91mERROR: \x1b[92mThe prefix must have a maximum length of 6\x1b[0m"); + setTimeout(() => { + console.log(""); + askPrefix(); + }); return; } resolve(prefix); @@ -44,9 +35,6 @@ function getLang() { }); const askLang = async () => { console.log(""); - const pref = "\x1b[93mTell me the language you want to use (English/Español)\x1b[0m"; - printText(pref, 0); - await wait(pref.length * 100 + 1000); rl.question( "\x1b[93mTell me the language you want to use (English/Español)\x1b[94m\n⤳\x1b[0m ", (input) => { @@ -79,15 +67,11 @@ function getLang() { rl.close(); } else { console.log(""); - const err = "\x1b[91mERROR: \x1b[92mThe language provided is not correct\x1b[0m"; - printText(err, 0); - setTimeout( - () => { - console.log(""); - askLang(); - }, - err.length * 100 + 1000, - ); + console.log("\x1b[91mERROR: \x1b[92mThe language provided is not correct\x1b[0m"); + setTimeout(() => { + console.log(""); + askLang(); + }); } }, ); diff --git a/src/db/migrations/index.js b/src/db/migrations/index.js index b798f31..f01dfd0 100644 --- a/src/db/migrations/index.js +++ b/src/db/migrations/index.js @@ -1,13 +1,8 @@ -const wait = require("../../util/wait"); -const printText = require("../../util/printText"); - module.exports = async (migrations, config) => { const m = require("./2024-05-09T00-20-59.327Z"); if (!migrations.select("version", { date: m.date })[0]) { console.log("\n"); - const migrationStart = `\x1b[97mCreating the migrations ${m.date}\x1b[0m`; - printText(migrationStart, 0); - await wait(migrationStart.length * 100 + 1000); + console.log(`\x1b[97mCreating the migrations ${m.date}\x1b[0m`); console.log(""); switch (m.type) { case "config": @@ -15,8 +10,6 @@ module.exports = async (migrations, config) => { break; } console.log(""); - const migrationDone = `\x1b[95mThe creation of the migrations ${m.date} has been completed\x1b[0m`; - printText(migrationDone, 0); - await wait(migrationDone.length * 100 + 1000); + console.log(`\x1b[95mThe creation of the migrations ${m.date} has been completed\x1b[0m`); } };