@realtimex/email-automator 2.1.1 → 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 (48) hide show
  1. package/api/server.ts +0 -6
  2. package/api/src/config/index.ts +3 -0
  3. package/bin/email-automator-setup.js +2 -3
  4. package/bin/email-automator.js +23 -7
  5. package/package.json +1 -2
  6. package/src/App.tsx +0 -622
  7. package/src/components/AccountSettings.tsx +0 -310
  8. package/src/components/AccountSettingsPage.tsx +0 -390
  9. package/src/components/Configuration.tsx +0 -1345
  10. package/src/components/Dashboard.tsx +0 -940
  11. package/src/components/ErrorBoundary.tsx +0 -71
  12. package/src/components/LiveTerminal.tsx +0 -308
  13. package/src/components/LoadingSpinner.tsx +0 -39
  14. package/src/components/Login.tsx +0 -371
  15. package/src/components/Logo.tsx +0 -57
  16. package/src/components/SetupWizard.tsx +0 -388
  17. package/src/components/Toast.tsx +0 -109
  18. package/src/components/migration/MigrationBanner.tsx +0 -97
  19. package/src/components/migration/MigrationModal.tsx +0 -458
  20. package/src/components/migration/MigrationPulseIndicator.tsx +0 -38
  21. package/src/components/mode-toggle.tsx +0 -24
  22. package/src/components/theme-provider.tsx +0 -72
  23. package/src/components/ui/alert.tsx +0 -66
  24. package/src/components/ui/button.tsx +0 -57
  25. package/src/components/ui/card.tsx +0 -75
  26. package/src/components/ui/dialog.tsx +0 -133
  27. package/src/components/ui/input.tsx +0 -22
  28. package/src/components/ui/label.tsx +0 -24
  29. package/src/components/ui/otp-input.tsx +0 -184
  30. package/src/context/AppContext.tsx +0 -422
  31. package/src/context/MigrationContext.tsx +0 -53
  32. package/src/context/TerminalContext.tsx +0 -31
  33. package/src/core/actions.ts +0 -76
  34. package/src/core/auth.ts +0 -108
  35. package/src/core/intelligence.ts +0 -76
  36. package/src/core/processor.ts +0 -112
  37. package/src/hooks/useRealtimeEmails.ts +0 -111
  38. package/src/index.css +0 -140
  39. package/src/lib/api-config.ts +0 -42
  40. package/src/lib/api-old.ts +0 -228
  41. package/src/lib/api.ts +0 -421
  42. package/src/lib/migration-check.ts +0 -264
  43. package/src/lib/sounds.ts +0 -120
  44. package/src/lib/supabase-config.ts +0 -117
  45. package/src/lib/supabase.ts +0 -28
  46. package/src/lib/types.ts +0 -166
  47. package/src/lib/utils.ts +0 -6
  48. package/src/main.tsx +0 -10
package/api/server.ts CHANGED
@@ -109,12 +109,6 @@ const server = app.listen(config.port, () => {
109
109
  if (getServerSupabase()) {
110
110
  startScheduler();
111
111
  }
112
-
113
- // Automatically open browser unless -n flag is provided
114
- if (!config.noUi) {
115
- const startCommand = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
116
- spawn(startCommand, [url], { detached: true }).unref();
117
- }
118
112
  });
119
113
 
120
114
  // Handle server errors
@@ -2,6 +2,9 @@ import dotenv from 'dotenv';
2
2
  import { fileURLToPath } from 'url';
3
3
  import { dirname, join } from 'path';
4
4
 
5
+ // 1. Try to load from current working directory (e.g. where npx is run)
6
+ dotenv.config({ path: join(process.cwd(), '.env') });
7
+ // 2. Fallback to package root
5
8
  dotenv.config();
6
9
 
7
10
  const __filename = fileURLToPath(import.meta.url);
@@ -30,9 +30,8 @@ async function setup() {
30
30
  console.log('========================');
31
31
  console.log('');
32
32
 
33
- const envPath = join(__dirname, '..', '.env');
34
- const envExamplePath = join(__dirname, '..', '.env.example');
35
-
33
+ const envPath = join(process.cwd(), '.env');
34
+
36
35
  // Check if .env already exists
37
36
  if (existsSync(envPath)) {
38
37
  const overwrite = await question('⚠️ .env file already exists. Overwrite? (y/N): ');
@@ -5,9 +5,10 @@
5
5
  * Main command to run the Email Automator API server
6
6
  */
7
7
 
8
- import { spawn } from 'child_process';
8
+ import { spawn, execSync } from 'child_process';
9
9
  import { fileURLToPath } from 'url';
10
10
  import { dirname, join } from 'path';
11
+ import { existsSync } from 'fs';
11
12
 
12
13
  const __filename = fileURLToPath(import.meta.url);
13
14
  const __dirname = dirname(__filename);
@@ -24,7 +25,7 @@ if (portIndex !== -1 && args[portIndex + 1]) {
24
25
 
25
26
  const noUi = args.includes('--no-ui');
26
27
 
27
- console.log('🚀 Starting Email Automator...');
28
+ console.log('🚀 Email Automator starting...');
28
29
  console.log(`📡 Port: ${port}`);
29
30
  if (noUi) console.log('🖥️ Mode: No-UI');
30
31
  console.log('');
@@ -32,12 +33,27 @@ console.log('');
32
33
  // Path to server
33
34
  const serverPath = join(__dirname, '..', 'api', 'server.ts');
34
35
 
35
- // Resolve tsx binary path
36
- // In npx/installed mode, it will be in ../node_modules/.bin/tsx
37
- // In dev mode, it will be in ../node_modules/.bin/tsx
38
- const tsxPath = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
36
+ // Robust tsx resolution
37
+ function getTsxPath() {
38
+ // 1. Try local node_modules
39
+ const localTsx = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
40
+ if (existsSync(localTsx)) return localTsx;
39
41
 
40
- // Start server with resolved tsx
42
+ // 2. Try to find in PATH
43
+ try {
44
+ const pathTsx = execSync(process.platform === 'win32' ? 'where tsx' : 'which tsx').toString().trim().split('\n')[0];
45
+ if (pathTsx) return pathTsx;
46
+ } catch (e) {
47
+ // which failed
48
+ }
49
+
50
+ // 3. Fallback to just 'tsx' and hope for the best
51
+ return 'tsx';
52
+ }
53
+
54
+ const tsxPath = getTsxPath();
55
+
56
+ // Start server
41
57
  const server = spawn(tsxPath, [serverPath, ...args], {
42
58
  stdio: 'inherit',
43
59
  env: { ...process.env, PORT: port },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/email-automator",
3
- "version": "2.1.1",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "main": "api/server.ts",
6
6
  "bin": {
@@ -11,7 +11,6 @@
11
11
  "files": [
12
12
  "bin",
13
13
  "api",
14
- "src",
15
14
  "dist",
16
15
  "supabase",
17
16
  "scripts",