mysql-migration 1.2.6 → 1.4.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.
@@ -1,78 +1,95 @@
1
1
  "use strict";
2
- //---------------------------------------
2
+
3
3
  const fs = require("fs");
4
4
  const dayjs = require("dayjs");
5
5
  const path = require("path");
6
- //---------------------------------------
6
+
7
7
  const currentPath = process.cwd();
8
- const config = require(`${currentPath}/migrations/mysql-migration.config.json`);
9
- //---------------------------------------
8
+ const configPath = path.join(currentPath, "migrations", "mysql-migration.config.json");
9
+
10
+ const { loadConfig, getDatabaseNames, isValidDatabase } = require("../utils/config");
11
+
12
+ /**
13
+ * Scaffold a new migration file for the selected database.
14
+ * @param {string} migrationName - Slug for the migration file (no spaces recommended).
15
+ * @param {string} dbName - Target database identifier.
16
+ * @returns {void}
17
+ */
10
18
  function create_migration(migrationName, dbName) {
11
19
  if (!migrationName) {
12
- console.error("\x1b[31m%s\x1b[0m", `Error: Migration name is empty !`);
20
+ console.error("\x1b[31m%s\x1b[0m", `Error: Migration name is required.`);
13
21
  process.exit(1);
14
22
  }
15
- //---------------------------------------
16
- const databases = Object.keys(config.databases);
17
- //---------------------------------------
18
- if (!databases.includes(dbName)) {
19
- console.error("\x1b[31m%s\x1b[0m", `Error: Invalid database name "${dbName}" can be: ${databases.join(", ")}.`);
23
+
24
+ const config = loadConfig(configPath);
25
+ const databases = getDatabaseNames(config);
26
+
27
+ if (!isValidDatabase(dbName, config)) {
28
+ console.error("\x1b[31m%s\x1b[0m", `Error: Invalid database name "${dbName}". Available databases: ${databases.join(", ")}.`);
20
29
  process.exit(1);
21
30
  }
22
- //---------------------------------------
23
- if (!fs.existsSync(`${currentPath}/migrations/${dbName}_db`))
24
- fs.mkdirSync(`${currentPath}/migrations/${dbName}_db`);
25
- //---------------------------------------
31
+
32
+ const migrationsDir = path.join(currentPath, "migrations", `${dbName}_db`);
33
+ if (!fs.existsSync(migrationsDir)) {
34
+ fs.mkdirSync(migrationsDir, { recursive: true });
35
+ }
36
+
26
37
  const currentDate = dayjs().format("YYYY_MM_DD_HHmmss");
27
38
  const fileName = `${currentDate}_${migrationName}.js`;
28
- const filePath = `${currentPath}/migrations/${dbName}_db/${fileName}`;
29
- //---------------------------------------
30
- if (fs.existsSync(filePath))
31
- console.warn("\x1b[33m%s\x1b[0m", `Warning: File "${fileName}" already exists in the "migrations" directory.`);
32
- else {
33
- let isEsm = false;
34
- try {
35
- const packageJsonPath = path.join(currentPath, "package.json");
36
- if (fs.existsSync(packageJsonPath)) {
37
- const packageJson = require(packageJsonPath);
38
- if (packageJson.type === "module") {
39
- isEsm = true;
40
- }
39
+ const filePath = path.join(migrationsDir, fileName);
40
+
41
+ if (fs.existsSync(filePath)) {
42
+ console.warn("\x1b[33m%s\x1b[0m", `Warning: File "${fileName}" already exists in the migrations directory.`);
43
+ return;
44
+ }
45
+
46
+ let isEsm = false;
47
+ try {
48
+ const packageJsonPath = path.join(currentPath, "package.json");
49
+ if (fs.existsSync(packageJsonPath)) {
50
+ const packageJson = require(packageJsonPath);
51
+ if (packageJson.type === "module") {
52
+ isEsm = true;
41
53
  }
42
- } catch (e) {
43
- // Ignore error, default to CJS
44
54
  }
55
+ } catch (e) {
56
+ // Ignore error, default to CJS
57
+ }
45
58
 
46
- const exportPrefix = isEsm ? "export default" : "module.exports =";
59
+ const exportPrefix = isEsm ? "export default" : "module.exports =";
47
60
 
48
- const dataText = `${exportPrefix} {
49
- up: (connection) => {
61
+ const dataText = `${exportPrefix} {
62
+ /**
63
+ * Run the migration
64
+ * @param {import('mysql2').Connection} connection
65
+ */
66
+ up: async (connection) => {
50
67
  const query = "";
51
68
 
52
- return new Promise((resolve, reject) => {
53
- if (!query) reject('Migration query is empty !');
54
- connection.query(query, (err) => {
55
- if (err) reject(err);
56
- resolve();
57
- });
58
- });
69
+ if (!query) {
70
+ throw new Error('Migration query is empty.');
71
+ }
72
+
73
+ await connection.promise().query(query);
59
74
  },
60
75
 
61
- down: (connection) => {
76
+ /**
77
+ * Rollback the migration
78
+ * @param {import('mysql2').Connection} connection
79
+ */
80
+ down: async (connection) => {
62
81
  const query = "";
63
82
 
64
- return new Promise((resolve, reject) => {
65
- if (!query) reject('Migration query is empty !');
66
- connection.query(query, (err) => {
67
- if (err) reject(err);
68
- resolve();
69
- });
70
- });
83
+ if (!query) {
84
+ throw new Error('Migration query is empty.');
85
+ }
86
+
87
+ await connection.promise().query(query);
71
88
  }
72
89
  };`;
73
- fs.writeFileSync(filePath, dataText);
74
- console.log("\x1b[32m%s\x1b[0m", `Created migration file: "${fileName}".`);
75
- }
90
+
91
+ fs.writeFileSync(filePath, dataText);
92
+ console.log("\x1b[32m%s\x1b[0m", `Created migration file: "${fileName}".`);
76
93
  }
77
- //---------------------------------------
94
+
78
95
  module.exports = create_migration;
@@ -1,29 +1,36 @@
1
1
  "use strict";
2
- //---------------------------------------
2
+
3
3
  const fs = require("fs");
4
- //---------------------------------------
4
+ const path = require("path");
5
+
5
6
  const currentPath = process.cwd();
6
- //---------------------------------------
7
- if (!fs.existsSync(`${currentPath}/migrations`)) fs.mkdirSync(`${currentPath}/migrations`);
8
- if (!fs.existsSync(`${currentPath}/migrations/mysql-migration.config.json`))
9
- fs.writeFileSync(
10
- `${currentPath}/migrations/mysql-migration.config.json`,
11
- JSON.stringify(
12
- {
13
- databases: {
14
- db_name: {
15
- host: "db_host",
16
- user: "db_user",
17
- password: "db_password",
18
- database: "db_name",
19
- },
20
- },
7
+
8
+ const migrationsDir = path.join(currentPath, "migrations");
9
+ const configPath = path.join(migrationsDir, "mysql-migration.config.json");
10
+
11
+ if (!fs.existsSync(migrationsDir)) {
12
+ fs.mkdirSync(migrationsDir, { recursive: true });
13
+ }
14
+
15
+ if (!fs.existsSync(configPath)) {
16
+ const defaultConfig = {
17
+ databases: {
18
+ db_name: {
19
+ host: "db_host",
20
+ user: "db_user",
21
+ password: "db_password",
22
+ database: "db_name",
21
23
  },
22
- null,
23
- 3
24
- )
24
+ },
25
+ };
26
+
27
+ fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 3));
28
+ console.log(
29
+ "\x1b[32m%s\x1b[0m",
30
+ `Created migration config file: "mysql-migration.config.json" in the "migrations" directory.`
25
31
  );
26
- console.log(
27
- "\x1b[32m%s\x1b[0m",
28
- `Created migration config file: "mysql-migration.config.json" in the "migrations" directory.`
29
- );
32
+ console.log("\x1b[36m%s\x1b[0m", "\nTip: You can use environment variables to override config values:");
33
+ console.log(" - DB_NAME_HOST, DB_NAME_USER, DB_NAME_PASSWORD, DB_NAME_DATABASE, DB_NAME_PORT");
34
+ } else {
35
+ console.warn("\x1b[33m%s\x1b[0m", 'Config file "mysql-migration.config.json" already exists.');
36
+ }
@@ -1,131 +1,203 @@
1
- "use strict";
2
- //==============================================================================
3
- const fs = require("fs");
4
- const mysql = require("mysql2");
5
- const path = require("path");
6
- //---------------------------------------
7
- const currentPath = process.cwd();
8
- const configPath = path.join(currentPath, "migrations", "mysql-migration.config.json");
9
- if (!fs.existsSync(configPath)) {
10
- console.error(
11
- "\x1b[31m%s\x1b[0m",
12
- 'Error: Config file "mysql-migration.config.json" not found. Run "mysql-migration init" first.'
13
- );
14
- process.exit(1);
15
- }
16
- const config = require(configPath);
17
- const {
18
- checkTableMigrations,
19
- createTableMigrations,
20
- getAllMigrations,
21
- getCurrentBatch,
22
- insertMigration,
23
- } = require("../utils/functions");
24
- const { loadModule } = require("../utils/moduleLoader");
25
- //==============================================================================
26
- async function run_migration(dbName) {
27
- const connection = {},
28
- migrations = [];
29
- const databases = config.databases;
30
- //---------------------------------------
31
- if (dbName) {
32
- if (!databases[dbName]) {
33
- console.error("\x1b[31m%s\x1b[0m", `Error: Invalid database name "${dbName}".`);
34
- process.exit(1);
35
- }
36
- //---------------------------------------
37
- connection[dbName] = mysql.createConnection(databases[dbName]);
38
- try {
39
- await connection[dbName].promise().connect();
40
- } catch (err) {
41
- console.error("\x1b[31m%s\x1b[0m", `Error: Unable to connect to database "${dbName}".\n${err}`);
42
- process.exit(1);
43
- }
44
- //---------------------------------------
45
- const tableMigrations = await checkTableMigrations(connection[dbName]);
46
- if (!tableMigrations) await createTableMigrations(connection[dbName]);
47
- //---------------------------------------
48
- const batch = (await getCurrentBatch(connection[dbName])) + 1;
49
- const allMigrations = await getAllMigrations(connection[dbName]);
50
- const migrationsDir = `${currentPath}/migrations/${dbName}_db`;
51
- if (!fs.existsSync(migrationsDir)) {
52
- console.log("\x1b[32m%s\x1b[0m", "Nothing to migrate.\n");
53
- await connection[dbName].promise().end();
54
- process.exit(0);
55
- }
56
- const migrationFiles = fs.readdirSync(migrationsDir);
57
- //---------------------------------------
58
- const pendingMigrations = migrationFiles.filter(
59
- (val) => !allMigrations.some((val2) => val.includes(val2.migration))
60
- );
61
- //---------------------------------------
62
- if (pendingMigrations.length === 0) {
63
- console.log("\x1b[32m%s\x1b[0m", "Nothing to migrate.\n");
64
- await connection[dbName].promise().end();
65
- process.exit(0);
66
- }
67
- //---------------------------------------
68
- for (let file of pendingMigrations) {
69
- const migrationPath = `${currentPath}/migrations/${dbName}_db/${file}`;
70
- const migration = await loadModule(migrationPath);
71
- try {
72
- await migration.up(connection[dbName]);
73
- await insertMigration(connection[dbName], file.replace(".js", ""), batch);
74
- console.log("\x1b[36m%s\x1b[0m", `Migrated: "${file}" successfully.`);
75
- } catch (err) {
76
- console.warn("\x1b[33m%s\x1b[0m", `Warning: "${err}" in migration "${file}".`);
77
- }
78
- }
79
- console.log("\x1b[32m%s\x1b[0m", "All migrations have been completed successfully.\n");
80
- await connection[dbName].promise().end();
81
- } else {
82
- for (let key in databases) {
83
- connection[key] = mysql.createConnection(databases[key]);
84
- try {
85
- await connection[key].promise().connect();
86
- } catch (err) {
87
- console.error("\x1b[31m%s\x1b[0m", `Error: Unable to connect to database "${key}".`);
88
- process.exit(1);
89
- }
90
- //---------------------------------------
91
- const tableMigrations = await checkTableMigrations(connection[key]);
92
- if (!tableMigrations) await createTableMigrations(connection[key]);
93
- //---------------------------------------
94
- const batch = (await getCurrentBatch(connection[key])) + 1;
95
-
96
- const allMigrations = await getAllMigrations(connection[key]);
97
- //---------------------------------------
98
- if (!fs.existsSync(`${currentPath}/migrations/${key}_db`)) continue;
99
- const migration = fs.readdirSync(`${currentPath}/migrations/${key}_db`);
100
- //---------------------------------------
101
- const diffMigrations = migration.filter(
102
- (val) => !allMigrations.some((val2) => val.includes(val2.migration))
103
- );
104
- //---------------------------------------
105
- for (let m of diffMigrations) migrations.push([m, key, batch]);
106
- }
107
-
108
- //---------------------------------------
109
- if (migrations.length === 0) {
110
- console.log("\x1b[32m%s\x1b[0m", "Nothing to migrate.\n");
111
- for (let key in connection) await connection[key].promise().end();
112
- process.exit(0);
113
- }
114
- //---------------------------------------
115
- for (let [file, key, batch] of migrations) {
116
- const migrationPath = `${currentPath}/migrations/${key}_db/${file}`;
117
- const migration = await loadModule(migrationPath);
118
- try {
119
- await migration.up(connection[key]);
120
- await insertMigration(connection[key], file.replace(".js", ""), batch);
121
- console.log("\x1b[36m%s\x1b[0m", `Migrated: "${file}" in database "${key}" successfully.`);
122
- } catch (err) {
123
- console.warn("\x1b[33m%s\x1b[0m", `Warning: "${err}" in migration "${file}" in database "${key}".`);
124
- }
125
- }
126
- console.log("\x1b[32m%s\x1b[0m", "All migrations have been completed successfully.\n");
127
- for (let key in connection) await connection[key].promise().end();
128
- }
129
- }
130
- //==============================================================================
131
- module.exports = run_migration;
1
+ "use strict";
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const currentPath = process.cwd();
7
+ const configPath = path.join(currentPath, "migrations", "mysql-migration.config.json");
8
+
9
+ if (!fs.existsSync(configPath)) {
10
+ console.error(
11
+ "\x1b[31m%s\x1b[0m",
12
+ 'Error: Config file "mysql-migration.config.json" not found. Run "mysql-migration init" first.'
13
+ );
14
+ process.exit(1);
15
+ }
16
+
17
+ const ConnectionManager = require("../utils/connectionManager");
18
+ const { loadConfig, getDatabaseConfig, isValidDatabase } = require("../utils/config");
19
+ const {
20
+ checkTableMigrations,
21
+ createTableMigrations,
22
+ getAllMigrations,
23
+ getCurrentBatch,
24
+ insertMigration,
25
+ withTransaction,
26
+ } = require("../utils/functions");
27
+ const { loadModule } = require("../utils/moduleLoader");
28
+
29
+ /**
30
+ * Run migration with optional dry-run mode.
31
+ * @param {string|null} dbName - Target database name or null to process all databases.
32
+ * @param {boolean} dryRun - When true, preview migrations without executing them.
33
+ * @param {boolean} useTransaction - When true, wrap migrations in a transaction per database.
34
+ * @returns {Promise<void>}
35
+ */
36
+ async function run_migration(dbName, dryRun = false, useTransaction = false) {
37
+ const config = loadConfig(configPath);
38
+ const connectionManager = new ConnectionManager();
39
+
40
+ try {
41
+ if (dbName) {
42
+ if (!isValidDatabase(dbName, config)) {
43
+ console.error("\x1b[31m%s\x1b[0m", `Error: Invalid database name "${dbName}".`);
44
+ process.exit(1);
45
+ }
46
+ await runForDatabase(dbName, config, connectionManager, dryRun, useTransaction);
47
+ } else {
48
+ await runForAllDatabases(config, connectionManager, dryRun, useTransaction);
49
+ }
50
+ } finally {
51
+ await connectionManager.closeAll();
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Run migrations for a single database.
57
+ * @param {string} dbName - Database identifier.
58
+ * @param {{databases: Record<string, any>}} config - Loaded migration configuration.
59
+ * @param {ConnectionManager} connectionManager - Shared connection manager instance.
60
+ * @param {boolean} dryRun - Whether to preview migrations only.
61
+ * @param {boolean} useTransaction - Whether to wrap execution in a transaction.
62
+ * @returns {Promise<void>}
63
+ */
64
+ async function runForDatabase(dbName, config, connectionManager, dryRun, useTransaction) {
65
+ const dbConfig = getDatabaseConfig(dbName, config);
66
+ const migrationsDir = path.join(currentPath, "migrations", `${dbName}_db`);
67
+
68
+ await connectionManager.withConnection(dbName, dbConfig, async (connection) => {
69
+ const tableMigrations = await checkTableMigrations(connection);
70
+ if (!tableMigrations) await createTableMigrations(connection);
71
+
72
+ const batch = (await getCurrentBatch(connection)) + 1;
73
+ const allMigrations = await getAllMigrations(connection);
74
+
75
+ if (!fs.existsSync(migrationsDir)) {
76
+ console.log("\x1b[32m%s\x1b[0m", "Nothing to migrate.\n");
77
+ return;
78
+ }
79
+
80
+ const migrationFiles = fs.readdirSync(migrationsDir);
81
+ const pendingMigrations = migrationFiles.filter(
82
+ (val) => !allMigrations.some((val2) => val.includes(val2.migration))
83
+ );
84
+
85
+ if (pendingMigrations.length === 0) {
86
+ console.log("\x1b[32m%s\x1b[0m", "Nothing to migrate.\n");
87
+ return;
88
+ }
89
+
90
+ if (dryRun) {
91
+ console.log("\x1b[33m%s\x1b[0m", `Dry-run mode: Previewing migrations for database "${dbName}":\n`);
92
+ for (let file of pendingMigrations) {
93
+ console.log(` Would migrate: "${file}"`);
94
+ }
95
+ console.log(`\nBatch: ${batch}`);
96
+ return;
97
+ }
98
+
99
+ const executeMigration = async (connection) => {
100
+ for (let file of pendingMigrations) {
101
+ const migrationPath = path.join(migrationsDir, file);
102
+ const migration = await loadModule(migrationPath);
103
+ try {
104
+ await migration.up(connection);
105
+ await insertMigration(connection, file.replace(".js", ""), batch);
106
+ console.log("\x1b[36m%s\x1b[0m", `Migrated: "${file}" successfully.`);
107
+ } catch (err) {
108
+ console.warn("\x1b[33m%s\x1b[0m", `Warning: "${err}" in migration "${file}".`);
109
+ throw err;
110
+ }
111
+ }
112
+ };
113
+
114
+ if (useTransaction) {
115
+ await withTransaction(connection, executeMigration);
116
+ } else {
117
+ await executeMigration(connection);
118
+ }
119
+
120
+ console.log("\x1b[32m%s\x1b[0m", "All migrations have been completed successfully.\n");
121
+ });
122
+ }
123
+
124
+ /**
125
+ * Run migrations for all configured databases.
126
+ * @param {{databases: Record<string, any>}} config - Loaded migration configuration.
127
+ * @param {ConnectionManager} connectionManager - Shared connection manager instance.
128
+ * @param {boolean} dryRun - Whether to preview migrations only.
129
+ * @param {boolean} useTransaction - Whether to wrap execution in transactions.
130
+ * @returns {Promise<void>}
131
+ */
132
+ async function runForAllDatabases(config, connectionManager, dryRun, useTransaction) {
133
+ const databases = config.databases;
134
+ const migrations = [];
135
+
136
+ for (let key in databases) {
137
+ const dbConfig = getDatabaseConfig(key, config);
138
+ const migrationsDir = path.join(currentPath, "migrations", `${key}_db`);
139
+
140
+ try {
141
+ await connectionManager.createConnection(key, dbConfig);
142
+ const connection = connectionManager.getConnection(key);
143
+
144
+ const tableMigrations = await checkTableMigrations(connection);
145
+ if (!tableMigrations) await createTableMigrations(connection);
146
+
147
+ const batch = (await getCurrentBatch(connection)) + 1;
148
+ const allMigrations = await getAllMigrations(connection);
149
+
150
+ if (!fs.existsSync(migrationsDir)) continue;
151
+
152
+ const migrationFiles = fs.readdirSync(migrationsDir);
153
+ const diffMigrations = migrationFiles.filter(
154
+ (val) => !allMigrations.some((val2) => val.includes(val2.migration))
155
+ );
156
+
157
+ for (let m of diffMigrations) migrations.push([m, key, batch]);
158
+ } catch (err) {
159
+ console.error("\x1b[31m%s\x1b[0m", `Error: Unable to connect to database "${key}".`);
160
+ process.exit(1);
161
+ }
162
+ }
163
+
164
+ if (migrations.length === 0) {
165
+ console.log("\x1b[32m%s\x1b[0m", "Nothing to migrate.\n");
166
+ return;
167
+ }
168
+
169
+ if (dryRun) {
170
+ console.log("\x1b[33m%s\x1b[0m", "Dry-run mode: Previewing migrations:\n");
171
+ for (let [file, key, batch] of migrations) {
172
+ console.log(` Would migrate: "${file}" in database "${key}" [Batch ${batch}]`);
173
+ }
174
+ return;
175
+ }
176
+
177
+ for (let [file, key, batch] of migrations) {
178
+ const connection = connectionManager.getConnection(key);
179
+ const migrationPath = path.join(currentPath, "migrations", `${key}_db`, file);
180
+ const migration = await loadModule(migrationPath);
181
+
182
+ const executeMigration = async (conn) => {
183
+ try {
184
+ await migration.up(conn);
185
+ await insertMigration(conn, file.replace(".js", ""), batch);
186
+ console.log("\x1b[36m%s\x1b[0m", `Migrated: "${file}" in database "${key}" successfully.`);
187
+ } catch (err) {
188
+ console.warn("\x1b[33m%s\x1b[0m", `Warning: "${err}" in migration "${file}" in database "${key}".`);
189
+ throw err;
190
+ }
191
+ };
192
+
193
+ if (useTransaction) {
194
+ await withTransaction(connection, executeMigration);
195
+ } else {
196
+ await executeMigration(connection);
197
+ }
198
+ }
199
+
200
+ console.log("\x1b[32m%s\x1b[0m", "All migrations have been completed successfully.\n");
201
+ }
202
+
203
+ module.exports = run_migration;
@@ -1,26 +1,33 @@
1
1
  "use strict";
2
- //---------------------------------------
2
+
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
- //---------------------------------------
5
+
6
6
  const currentPath = process.cwd();
7
- const config = require(`${currentPath}/migrations/mysql-migration.config.json`);
8
- //---------------------------------------
7
+ const configPath = path.join(currentPath, "migrations", "mysql-migration.config.json");
8
+
9
+ const { loadConfig, getDatabaseNames, isValidDatabase } = require("../utils/config");
10
+
11
+ /**
12
+ * Convert migration files within a database directory from ESM to CommonJS format.
13
+ * @param {string} dbName - Target database identifier.
14
+ * @returns {void}
15
+ */
9
16
  function convert_to_cjs(dbName) {
10
- //---------------------------------------
11
- const databases = Object.keys(config.databases);
12
- //---------------------------------------
13
- if (!databases.includes(dbName)) {
14
- console.error("\x1b[31m%s\x1b[0m", `Error: Invalid database name "${dbName}" can be: ${databases.join(", ")}.`);
17
+ const config = loadConfig(configPath);
18
+ const databases = getDatabaseNames(config);
19
+
20
+ if (!isValidDatabase(dbName, config)) {
21
+ console.error("\x1b[31m%s\x1b[0m", `Error: Invalid database name "${dbName}". Available databases: ${databases.join(", ")}.`);
15
22
  process.exit(1);
16
23
  }
17
- //---------------------------------------
18
- const migrationsDir = `${currentPath}/migrations/${dbName}_db`;
24
+
25
+ const migrationsDir = path.join(currentPath, "migrations", `${dbName}_db`);
19
26
  if (!fs.existsSync(migrationsDir)) {
20
27
  console.error("\x1b[31m%s\x1b[0m", `Error: Migrations directory for "${dbName}" not found.`);
21
28
  process.exit(1);
22
29
  }
23
- //---------------------------------------
30
+
24
31
  const files = fs.readdirSync(migrationsDir);
25
32
  let convertedCount = 0;
26
33
 
@@ -45,5 +52,5 @@ function convert_to_cjs(dbName) {
45
52
  console.log("\x1b[32m%s\x1b[0m", `\nSuccessfully converted ${convertedCount} files to CJS.`);
46
53
  }
47
54
  }
48
- //---------------------------------------
55
+
49
56
  module.exports = convert_to_cjs;