mysqlsyncr 1.0.70 → 1.0.72

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
@@ -3457,7 +3457,7 @@ var findDifferences = function findDifferences(expected, current) {
3457
3457
 
3458
3458
  // Compare stored procedures
3459
3459
  if (!expected.procedures) {
3460
- console.log('No procedures found in expected for database', current.database);
3460
+ console.log('No procedures found in expected');
3461
3461
  } else {
3462
3462
  var _loop6 = function _loop6() {
3463
3463
  var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2);
@@ -4252,6 +4252,22 @@ var setConfig = function setConfig(config, argv) {
4252
4252
  }
4253
4253
  return config;
4254
4254
  };
4255
+
4256
+ // Create a function to get the package root directory that works in both ESM and CJS
4257
+ var getPackageRoot = function getPackageRoot() {
4258
+ if (typeof __dirname$2 !== 'undefined') {
4259
+ // CommonJS
4260
+ return path.join(__dirname$2, '..');
4261
+ } else {
4262
+ // ESM
4263
+ var _filename = 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)));
4264
+ var _dirname = path.dirname(_filename);
4265
+ return path.join(_dirname, '..');
4266
+ }
4267
+ };
4268
+
4269
+ // Use the function to get the root path
4270
+ var packageRoot = getPackageRoot();
4255
4271
  var startApiServer = function startApiServer(port, argv) {
4256
4272
  var app = express();
4257
4273
  app.use(cors({
@@ -4265,8 +4281,8 @@ var startApiServer = function startApiServer(port, argv) {
4265
4281
  limit: '50mb',
4266
4282
  extended: true
4267
4283
  }));
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')));
4284
+ console.log("Serving UI from ".concat(path.join(packageRoot, 'ui/dist/spa')));
4285
+ app.use(express["static"](path.join(packageRoot, 'ui/dist/spa')));
4270
4286
  app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
4271
4287
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
4272
4288
  var config, databases;
@@ -4493,7 +4509,7 @@ var startApiServer = function startApiServer(port, argv) {
4493
4509
  while (1) switch (_context8.prev = _context8.next) {
4494
4510
  case 0:
4495
4511
  _context8.prev = 0;
4496
- _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? __dirname$2 : _req$body$currentPath;
4512
+ _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? packageRoot : _req$body$currentPath;
4497
4513
  console.log('Browsing folder:', currentPath);
4498
4514
  resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? path.resolve(currentPath) : path.resolve(currentPath);
4499
4515
  console.log('Resolved path:', resolvedPath);
@@ -4557,7 +4573,7 @@ var startApiServer = function startApiServer(port, argv) {
4557
4573
  _context9.prev = 0;
4558
4574
  folderPath = req.body.folderPath;
4559
4575
  console.log('Creating folder:', folderPath);
4560
- resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? path.resolve(folderPath) : path.resolve(__dirname$2, folderPath);
4576
+ resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? path.resolve(folderPath) : path.resolve(packageRoot, folderPath);
4561
4577
  _context9.next = 6;
4562
4578
  return fs$1.mkdir(resolvedPath, {
4563
4579
  recursive: true
package/dist/index.js CHANGED
@@ -3454,7 +3454,7 @@ var findDifferences = function findDifferences(expected, current) {
3454
3454
 
3455
3455
  // Compare stored procedures
3456
3456
  if (!expected.procedures) {
3457
- console.log('No procedures found in expected for database', current.database);
3457
+ console.log('No procedures found in expected');
3458
3458
  } else {
3459
3459
  var _loop6 = function _loop6() {
3460
3460
  var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2);
@@ -4249,6 +4249,22 @@ var setConfig = function setConfig(config, argv) {
4249
4249
  }
4250
4250
  return config;
4251
4251
  };
4252
+
4253
+ // Create a function to get the package root directory that works in both ESM and CJS
4254
+ var getPackageRoot = function getPackageRoot() {
4255
+ if (typeof __dirname$2 !== 'undefined') {
4256
+ // CommonJS
4257
+ return join(__dirname$2, '..');
4258
+ } else {
4259
+ // ESM
4260
+ var _filename = fileURLToPath(import.meta.url);
4261
+ var _dirname = dirname(_filename);
4262
+ return join(_dirname, '..');
4263
+ }
4264
+ };
4265
+
4266
+ // Use the function to get the root path
4267
+ var packageRoot = getPackageRoot();
4252
4268
  var startApiServer = function startApiServer(port, argv) {
4253
4269
  var app = express();
4254
4270
  app.use(cors({
@@ -4262,8 +4278,8 @@ var startApiServer = function startApiServer(port, argv) {
4262
4278
  limit: '50mb',
4263
4279
  extended: true
4264
4280
  }));
4265
- console.log("Serving UI from ".concat(join(__dirname$2, '../ui/dist/spa')));
4266
- app.use(express["static"](join(__dirname$2, '../ui/dist/spa')));
4281
+ console.log("Serving UI from ".concat(join(packageRoot, 'ui/dist/spa')));
4282
+ app.use(express["static"](join(packageRoot, 'ui/dist/spa')));
4267
4283
  app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
4268
4284
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
4269
4285
  var config, databases;
@@ -4490,7 +4506,7 @@ var startApiServer = function startApiServer(port, argv) {
4490
4506
  while (1) switch (_context8.prev = _context8.next) {
4491
4507
  case 0:
4492
4508
  _context8.prev = 0;
4493
- _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? __dirname$2 : _req$body$currentPath;
4509
+ _req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? packageRoot : _req$body$currentPath;
4494
4510
  console.log('Browsing folder:', currentPath);
4495
4511
  resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? resolve(currentPath) : resolve(currentPath);
4496
4512
  console.log('Resolved path:', resolvedPath);
@@ -4554,7 +4570,7 @@ var startApiServer = function startApiServer(port, argv) {
4554
4570
  _context9.prev = 0;
4555
4571
  folderPath = req.body.folderPath;
4556
4572
  console.log('Creating folder:', folderPath);
4557
- resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? resolve(folderPath) : resolve(__dirname$2, folderPath);
4573
+ resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? resolve(folderPath) : resolve(packageRoot, folderPath);
4558
4574
  _context9.next = 6;
4559
4575
  return mkdir(resolvedPath, {
4560
4576
  recursive: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysqlsyncr",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -135,7 +135,7 @@ export const findDifferences = (expected, current) => {
135
135
 
136
136
  // Compare stored procedures
137
137
  if (!expected.procedures) {
138
- console.log('No procedures found in expected for database', current.database);
138
+ console.log('No procedures found in expected');
139
139
  } else {
140
140
  for (const [position, contents] of Object.entries(expected.procedures)) {
141
141
  let procName = contents.Name;
@@ -33,6 +33,22 @@ const setConfig = (config, argv) => {
33
33
  return config;
34
34
  }
35
35
 
36
+ // Create a function to get the package root directory that works in both ESM and CJS
37
+ const getPackageRoot = () => {
38
+ if (typeof __dirname !== 'undefined') {
39
+ // CommonJS
40
+ return join(__dirname, '..');
41
+ } else {
42
+ // ESM
43
+ const __filename = fileURLToPath(import.meta.url);
44
+ const __dirname = dirname(__filename);
45
+ return join(__dirname, '..');
46
+ }
47
+ };
48
+
49
+ // Use the function to get the root path
50
+ const packageRoot = getPackageRoot();
51
+
36
52
  export const startApiServer = (port, argv) => {
37
53
  const app = express();
38
54
  app.use(cors({ origin: '*' }));
@@ -40,8 +56,8 @@ export const startApiServer = (port, argv) => {
40
56
  app.use(express.json({ limit: '50mb' }));
41
57
  app.use(express.urlencoded({ limit: '50mb', extended: true }));
42
58
 
43
- console.log(`Serving UI from ${join(__dirname, '../ui/dist/spa')}`);
44
- app.use(express.static(join(__dirname, '../ui/dist/spa')));
59
+ console.log(`Serving UI from ${join(packageRoot, 'ui/dist/spa')}`);
60
+ app.use(express.static(join(packageRoot, 'ui/dist/spa')));
45
61
 
46
62
  app.post('/api/getDatabasesFromExistingDumps', async (req, res) => {
47
63
  let { config } = req.body;
@@ -141,7 +157,7 @@ export const startApiServer = (port, argv) => {
141
157
 
142
158
  app.post('/api/browse-folders', async (req, res) => {
143
159
  try {
144
- const { currentPath = __dirname } = req.body;
160
+ const { currentPath = packageRoot } = req.body;
145
161
  console.log('Browsing folder:', currentPath);
146
162
 
147
163
  const resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/)
@@ -194,7 +210,7 @@ export const startApiServer = (port, argv) => {
194
210
 
195
211
  const resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/)
196
212
  ? resolve(folderPath)
197
- : resolve(__dirname, folderPath);
213
+ : resolve(packageRoot, folderPath);
198
214
 
199
215
  await mkdir(resolvedPath, { recursive: true });
200
216