mysqlsyncr 1.0.68 → 1.0.70

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/dist/index.cjs CHANGED
@@ -2288,13 +2288,13 @@ const y18n = (opts) => {
2288
2288
  const REQUIRE_ERROR = 'require is not supported by ESM';
2289
2289
  const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM';
2290
2290
 
2291
- let __dirname$2;
2291
+ let __dirname$3;
2292
2292
  try {
2293
- __dirname$2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
2293
+ __dirname$3 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
2294
2294
  } catch (e) {
2295
- __dirname$2 = process.cwd();
2295
+ __dirname$3 = process.cwd();
2296
2296
  }
2297
- const mainFilename = __dirname$2.substring(0, __dirname$2.lastIndexOf('node_modules'));
2297
+ const mainFilename = __dirname$3.substring(0, __dirname$3.lastIndexOf('node_modules'));
2298
2298
 
2299
2299
  ({
2300
2300
  assert: {
@@ -2340,7 +2340,7 @@ const mainFilename = __dirname$2.substring(0, __dirname$2.lastIndexOf('node_modu
2340
2340
  return [...str].length
2341
2341
  },
2342
2342
  y18n: y18n({
2343
- directory: path.resolve(__dirname$2, '../../../locales'),
2343
+ directory: path.resolve(__dirname$3, '../../../locales'),
2344
2344
  updateFiles: false
2345
2345
  })
2346
2346
  });
@@ -4232,6 +4232,8 @@ var compareAllDatabases = /*#__PURE__*/function () {
4232
4232
  };
4233
4233
  }();
4234
4234
 
4235
+ var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
4236
+ var __dirname$2 = path.dirname(__filename$1);
4235
4237
  var setConfig = function setConfig(config, argv) {
4236
4238
  if (!config.host && argv.host) {
4237
4239
  config.host = argv.host;
@@ -4263,9 +4265,8 @@ var startApiServer = function startApiServer(port, argv) {
4263
4265
  limit: '50mb',
4264
4266
  extended: true
4265
4267
  }));
4266
- var __dirname = process.platform === "win32" ? process.cwd().replace(/\\/g, '/') : process.cwd();
4267
- console.log("Serving UI from ".concat(path.join(__dirname, './ui/dist/spa')));
4268
- app.use(express["static"](path.join(__dirname, './ui/dist/spa')));
4268
+ console.log("Serving UI from ".concat(path.join(__dirname$2, '../ui/dist/spa')));
4269
+ app.use(express["static"](path.join(__dirname$2, '../ui/dist/spa')));
4269
4270
  app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
4270
4271
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
4271
4272
  var config, databases;
@@ -4492,9 +4493,9 @@ var startApiServer = function startApiServer(port, argv) {
4492
4493
  while (1) switch (_context8.prev = _context8.next) {
4493
4494
  case 0:
4494
4495
  _context8.prev = 0;
4495
- _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? process.cwd() : _req$body$currentPath;
4496
+ _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? __dirname$2 : _req$body$currentPath;
4496
4497
  console.log('Browsing folder:', currentPath);
4497
- resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? path.resolve(currentPath) : path.resolve(process.cwd(), currentPath);
4498
+ resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? path.resolve(currentPath) : path.resolve(currentPath);
4498
4499
  console.log('Resolved path:', resolvedPath);
4499
4500
  _context8.next = 7;
4500
4501
  return fs$1.readdir(resolvedPath, {
@@ -4556,7 +4557,7 @@ var startApiServer = function startApiServer(port, argv) {
4556
4557
  _context9.prev = 0;
4557
4558
  folderPath = req.body.folderPath;
4558
4559
  console.log('Creating folder:', folderPath);
4559
- resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? path.resolve(folderPath) : path.resolve(process.cwd(), folderPath);
4560
+ resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? path.resolve(folderPath) : path.resolve(__dirname$2, folderPath);
4560
4561
  _context9.next = 6;
4561
4562
  return fs$1.mkdir(resolvedPath, {
4562
4563
  recursive: true
package/dist/index.js CHANGED
@@ -2285,13 +2285,13 @@ const y18n = (opts) => {
2285
2285
  const REQUIRE_ERROR = 'require is not supported by ESM';
2286
2286
  const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM';
2287
2287
 
2288
- let __dirname$2;
2288
+ let __dirname$3;
2289
2289
  try {
2290
- __dirname$2 = fileURLToPath(import.meta.url);
2290
+ __dirname$3 = fileURLToPath(import.meta.url);
2291
2291
  } catch (e) {
2292
- __dirname$2 = process.cwd();
2292
+ __dirname$3 = process.cwd();
2293
2293
  }
2294
- const mainFilename = __dirname$2.substring(0, __dirname$2.lastIndexOf('node_modules'));
2294
+ const mainFilename = __dirname$3.substring(0, __dirname$3.lastIndexOf('node_modules'));
2295
2295
 
2296
2296
  ({
2297
2297
  assert: {
@@ -2337,7 +2337,7 @@ const mainFilename = __dirname$2.substring(0, __dirname$2.lastIndexOf('node_modu
2337
2337
  return [...str].length
2338
2338
  },
2339
2339
  y18n: y18n({
2340
- directory: resolve(__dirname$2, '../../../locales'),
2340
+ directory: resolve(__dirname$3, '../../../locales'),
2341
2341
  updateFiles: false
2342
2342
  })
2343
2343
  });
@@ -4229,6 +4229,8 @@ var compareAllDatabases = /*#__PURE__*/function () {
4229
4229
  };
4230
4230
  }();
4231
4231
 
4232
+ var __filename = fileURLToPath(import.meta.url);
4233
+ var __dirname$2 = dirname(__filename);
4232
4234
  var setConfig = function setConfig(config, argv) {
4233
4235
  if (!config.host && argv.host) {
4234
4236
  config.host = argv.host;
@@ -4260,9 +4262,8 @@ var startApiServer = function startApiServer(port, argv) {
4260
4262
  limit: '50mb',
4261
4263
  extended: true
4262
4264
  }));
4263
- var __dirname = process.platform === "win32" ? process.cwd().replace(/\\/g, '/') : process.cwd();
4264
- console.log("Serving UI from ".concat(join(__dirname, './ui/dist/spa')));
4265
- app.use(express["static"](join(__dirname, './ui/dist/spa')));
4265
+ console.log("Serving UI from ".concat(join(__dirname$2, '../ui/dist/spa')));
4266
+ app.use(express["static"](join(__dirname$2, '../ui/dist/spa')));
4266
4267
  app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
4267
4268
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
4268
4269
  var config, databases;
@@ -4489,9 +4490,9 @@ var startApiServer = function startApiServer(port, argv) {
4489
4490
  while (1) switch (_context8.prev = _context8.next) {
4490
4491
  case 0:
4491
4492
  _context8.prev = 0;
4492
- _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? process.cwd() : _req$body$currentPath;
4493
+ _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? __dirname$2 : _req$body$currentPath;
4493
4494
  console.log('Browsing folder:', currentPath);
4494
- resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? resolve(currentPath) : resolve(process.cwd(), currentPath);
4495
+ resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? resolve(currentPath) : resolve(currentPath);
4495
4496
  console.log('Resolved path:', resolvedPath);
4496
4497
  _context8.next = 7;
4497
4498
  return readdir(resolvedPath, {
@@ -4553,7 +4554,7 @@ var startApiServer = function startApiServer(port, argv) {
4553
4554
  _context9.prev = 0;
4554
4555
  folderPath = req.body.folderPath;
4555
4556
  console.log('Creating folder:', folderPath);
4556
- resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? resolve(folderPath) : resolve(process.cwd(), folderPath);
4557
+ resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? resolve(folderPath) : resolve(__dirname$2, folderPath);
4557
4558
  _context9.next = 6;
4558
4559
  return mkdir(resolvedPath, {
4559
4560
  recursive: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysqlsyncr",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -8,6 +8,11 @@ import cors from 'cors';
8
8
  import { join } from 'path';
9
9
  import { readdir, mkdir } from 'fs/promises';
10
10
  import { resolve } from 'path';
11
+ import { fileURLToPath } from 'url';
12
+ import { dirname } from 'path';
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
11
16
 
12
17
  const setConfig = (config, argv) => {
13
18
  if(!config.host && argv.host){
@@ -35,11 +40,8 @@ export const startApiServer = (port, argv) => {
35
40
  app.use(express.json({ limit: '50mb' }));
36
41
  app.use(express.urlencoded({ limit: '50mb', extended: true }));
37
42
 
38
- const __dirname = process.platform === "win32"
39
- ? process.cwd().replace(/\\/g, '/')
40
- : process.cwd();
41
- console.log(`Serving UI from ${join(__dirname, './ui/dist/spa')}`);
42
- app.use(express.static(join(__dirname, './ui/dist/spa')));
43
+ console.log(`Serving UI from ${join(__dirname, '../ui/dist/spa')}`);
44
+ app.use(express.static(join(__dirname, '../ui/dist/spa')));
43
45
 
44
46
  app.post('/api/getDatabasesFromExistingDumps', async (req, res) => {
45
47
  let { config } = req.body;
@@ -139,12 +141,12 @@ export const startApiServer = (port, argv) => {
139
141
 
140
142
  app.post('/api/browse-folders', async (req, res) => {
141
143
  try {
142
- const { currentPath = process.cwd() } = req.body;
144
+ const { currentPath = __dirname } = req.body;
143
145
  console.log('Browsing folder:', currentPath);
144
146
 
145
147
  const resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/)
146
148
  ? resolve(currentPath)
147
- : resolve(process.cwd(), currentPath);
149
+ : resolve(currentPath);
148
150
 
149
151
  console.log('Resolved path:', resolvedPath);
150
152
 
@@ -192,7 +194,7 @@ export const startApiServer = (port, argv) => {
192
194
 
193
195
  const resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/)
194
196
  ? resolve(folderPath)
195
- : resolve(process.cwd(), folderPath);
197
+ : resolve(__dirname, folderPath);
196
198
 
197
199
  await mkdir(resolvedPath, { recursive: true });
198
200