devicely 2.1.9 → 2.2.1

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.
Files changed (40) hide show
  1. package/lib/frontend/asset-manifest.json +3 -3
  2. package/lib/frontend/index.html +1 -1
  3. package/lib/frontend/static/js/{main.96600727.js → main.5495c762.js} +3 -3
  4. package/lib/logger.js +15 -3
  5. package/lib/server.js +20 -15
  6. package/lib/server.js.bak +3524 -0
  7. package/package.json +1 -1
  8. package/lib/frontend/static/css/main.23bd35c0.css.map +0 -1
  9. package/lib/frontend/static/js/main.96600727.js.map +0 -1
  10. package/scripts/shell/android_device_control +0 -0
  11. package/scripts/shell/connect_android_usb +0 -0
  12. package/scripts/shell/connect_android_usb_multi_final +0 -0
  13. package/scripts/shell/connect_android_wireless +0 -0
  14. package/scripts/shell/connect_android_wireless_multi_final +0 -0
  15. package/scripts/shell/connect_ios_usb +0 -0
  16. package/scripts/shell/connect_ios_usb_multi_final +0 -0
  17. package/scripts/shell/connect_ios_wireless_multi_final +0 -0
  18. package/scripts/shell/create_production_scripts +0 -0
  19. package/scripts/shell/diagnose_wireless_ios +0 -0
  20. package/scripts/shell/find_element_coordinates +0 -0
  21. package/scripts/shell/find_wda +0 -0
  22. package/scripts/shell/install_uiautomator2 +0 -0
  23. package/scripts/shell/ios_device_control +0 -0
  24. package/scripts/shell/organize_project +0 -0
  25. package/scripts/shell/pre-publish-check +0 -0
  26. package/scripts/shell/publish +0 -0
  27. package/scripts/shell/publish-to-npm +0 -0
  28. package/scripts/shell/setup +0 -0
  29. package/scripts/shell/setup_android +0 -0
  30. package/scripts/shell/start +0 -0
  31. package/scripts/shell/sync-to-npm-package-final +0 -0
  32. package/scripts/shell/test_android_locators +0 -0
  33. package/scripts/shell/test_connect +0 -0
  34. package/scripts/shell/test_device_detection +0 -0
  35. package/scripts/shell/test_fixes +0 -0
  36. package/scripts/shell/test_getlocators_fix +0 -0
  37. package/scripts/shell/test_recording_feature +0 -0
  38. package/scripts/shell/verify-shell-protection +0 -0
  39. package/scripts/shell/verify_distribution +0 -0
  40. /package/lib/frontend/static/js/{main.96600727.js.LICENSE.txt → main.5495c762.js.LICENSE.txt} +0 -0
package/lib/logger.js CHANGED
@@ -1,7 +1,9 @@
1
1
  // Centralized Logger for Production
2
- // Use environment variable to control debug output
2
+ // Use environment variable or --debug flag to control debug output
3
3
 
4
- const DEBUG_MODE = process.env.DEBUG === 'true' || process.env.NODE_ENV === 'development';
4
+ const DEBUG_MODE = process.argv.includes('--debug') ||
5
+ process.env.DEBUG === 'true' ||
6
+ process.env.NODE_ENV === 'development';
5
7
 
6
8
  class Logger {
7
9
  constructor(module) {
@@ -28,8 +30,18 @@ class Logger {
28
30
 
29
31
  // Keep critical startup/connection messages
30
32
  startup(...args) {
31
- console.log(`[STARTUP][${this.module}]`, ...args);
33
+ console.log(`✅ [${this.module}]`, ...args);
32
34
  }
35
+
36
+ // Show execution results (always visible)
37
+ result(...args) {
38
+ console.log(`📝 [${this.module}]`, ...args);
39
+ }
40
+ }
41
+
42
+ // Show debug mode status on startup
43
+ if (DEBUG_MODE) {
44
+ console.log('🔧 DEBUG MODE ENABLED - Use devicely without --debug flag for quiet mode\n');
33
45
  }
34
46
 
35
47
  module.exports = Logger;
package/lib/server.js CHANGED
@@ -9,6 +9,10 @@ const { spawn } = require('child_process');
9
9
  const WebSocket = require('ws');
10
10
  const fs = require('fs').promises;
11
11
  const AIProviderManager = require('./aiProviders');
12
+ const Logger = require('./logger');
13
+
14
+ // Initialize logger
15
+ const logger = new Logger('Server');
12
16
 
13
17
  // Import scriptLoader for encrypted scripts
14
18
  let scriptLoader;
@@ -643,12 +647,11 @@ function executeCommand(deviceNames, command, wsClient) {
643
647
 
644
648
  function executeWithScript(scriptPath, deviceNames, command, wsClient) {
645
649
  return new Promise((resolve, reject) => {
646
- console.log(`\n${'='.repeat(60)}`);
647
- console.log(`Script: ${path.basename(scriptPath)}`);
648
- console.log(`Devices: [${deviceNames.join(', ')}]`);
649
- console.log(`Command: "${command}"`);
650
-
651
- console.log(`${'='.repeat(60)}\n`);
650
+ logger.debug(`\n${'='.repeat(60)}`);
651
+ logger.debug(`Script: ${path.basename(scriptPath)}`);
652
+ logger.debug(`Devices: [${deviceNames.join(', ')}]`);
653
+ logger.debug(`Command: "${command}"`);
654
+ logger.debug(`${'='.repeat(60)}\n`);
652
655
 
653
656
  // Execute command on each device in parallel
654
657
  const devicePromises = deviceNames.map((deviceName, index) => {
@@ -657,6 +660,8 @@ function executeWithScript(scriptPath, deviceNames, command, wsClient) {
657
660
  // Use -d flag for each device
658
661
  const args = ['-d', deviceName, command];
659
662
 
663
+ logger.debug(`[${index + 1}/${deviceNames.length}] Executing on: ${deviceName}`);
664
+
660
665
 
661
666
  const child = spawn(scriptPath, args, {
662
667
  cwd: path.dirname(scriptPath)
@@ -669,7 +674,7 @@ function executeWithScript(scriptPath, deviceNames, command, wsClient) {
669
674
  child.stdout.on('data', (data) => {
670
675
  const text = data.toString();
671
676
  output += text;
672
- console.log(`[${deviceName}] STDOUT: ${text.trim()}`);
677
+ logger.debug(`[${deviceName}] STDOUT: ${text.trim()}`);
673
678
  if (wsClient) {
674
679
  wsClient.send(JSON.stringify({
675
680
  type: 'command_output',
@@ -728,15 +733,15 @@ function executeWithScript(scriptPath, deviceNames, command, wsClient) {
728
733
  // Execute Android commands (uses device UDID instead of name)
729
734
  function executeAndroidDevices(scriptPath, devices, command, wsClient) {
730
735
  return new Promise((resolve, reject) => {
731
- console.log(`\n${'='.repeat(60)}`);
732
- console.log(`Script: ${path.basename(scriptPath)}`);
733
- console.log(`Devices: [${devices.map(d => d.name).join(', ')}]`);
734
- console.log(`Command: "${command}"`);
735
- console.log(`${'='.repeat(60)}\n`);
736
+ logger.debug(`\n${'='.repeat(60)}`);
737
+ logger.debug(`Script: ${path.basename(scriptPath)}`);
738
+ logger.debug(`Devices: [${devices.map(d => d.name).join(', ')}]`);
739
+ logger.debug(`Command: "${command}"`);
740
+ logger.debug(`${'='.repeat(60)}\n`);
736
741
 
737
742
  // Execute command on each device in parallel
738
743
  const devicePromises = devices.map((device, index) => {
739
- console.log(`[${index + 1}/${devices.length}] Creating execution promise for: ${device.name} (${device.udid})`);
744
+ logger.debug(`[${index + 1}/${devices.length}] Creating execution promise for: ${device.name} (${device.udid}`);
740
745
 
741
746
  return new Promise((resolveDevice, rejectDevice) => {
742
747
  // Android script expects: <device_serial> <command> [args...]
@@ -754,7 +759,7 @@ function executeAndroidDevices(scriptPath, devices, command, wsClient) {
754
759
  child.stdout.on('data', (data) => {
755
760
  const text = data.toString();
756
761
  output += text;
757
- console.log(`[${device.name}] STDOUT: ${text.trim()}`);
762
+ logger.debug(`[${device.name}] STDOUT: ${text.trim()}`);
758
763
  if (wsClient) {
759
764
  wsClient.send(JSON.stringify({
760
765
  type: 'output',
@@ -767,7 +772,7 @@ function executeAndroidDevices(scriptPath, devices, command, wsClient) {
767
772
  child.stderr.on('data', (data) => {
768
773
  const text = data.toString();
769
774
  error += text;
770
- console.log(`[${device.name}] STDERR: ${text.trim()}`);
775
+ logger.debug(`[${device.name}] STDERR: ${text.trim()}`);
771
776
  });
772
777
 
773
778
  child.on('close', (code) => {