@l4yercak3/cli 1.2.18 → 1.2.20

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.
@@ -13,7 +13,7 @@ class ExpoDetector extends BaseDetector {
13
13
  }
14
14
 
15
15
  get priority() {
16
- return 95; // High priority - specific framework
16
+ return 95; // Slightly lower than Next.js (100), but high enough for framework detection
17
17
  }
18
18
 
19
19
  /**
@@ -106,11 +106,11 @@ class ExpoDetector extends BaseDetector {
106
106
  }
107
107
 
108
108
  // Determine confidence based on what we found
109
- let confidence = 0.7; // Base confidence for React Native
109
+ let confidence = 0.85; // Base confidence for React Native
110
110
  if (results.isExpo) {
111
- confidence = 0.9; // Higher for Expo
111
+ confidence = 0.9; // Higher confidence for Expo projects
112
112
  if (results.config) {
113
- confidence = 0.95; // Even higher with config file
113
+ confidence = 0.95; // Even higher with config file (app.json)
114
114
  }
115
115
  }
116
116
 
@@ -18,8 +18,12 @@ class EnvGenerator {
18
18
  organizationId,
19
19
  features,
20
20
  oauthProviders,
21
+ isMobile,
21
22
  } = options;
22
23
 
24
+ // Use EXPO_PUBLIC_ for Expo, NEXT_PUBLIC_ for Next.js
25
+ const publicPrefix = isMobile ? 'EXPO_PUBLIC_' : 'NEXT_PUBLIC_';
26
+
23
27
  const envPath = path.join(projectPath, '.env.local');
24
28
  const existingEnv = this.readExistingEnv(envPath);
25
29
 
@@ -31,9 +35,11 @@ class EnvGenerator {
31
35
  L4YERCAK3_API_KEY: apiKey || existingEnv.L4YERCAK3_API_KEY || 'your_api_key_here',
32
36
  L4YERCAK3_BACKEND_URL: backendUrl,
33
37
  L4YERCAK3_ORGANIZATION_ID: organizationId,
34
- NEXT_PUBLIC_L4YERCAK3_BACKEND_URL: backendUrl,
35
38
  };
36
39
 
40
+ // Add public backend URL with appropriate prefix
41
+ envVars[`${publicPrefix}L4YERCAK3_BACKEND_URL`] = backendUrl;
42
+
37
43
  // Add OAuth variables if OAuth is enabled
38
44
  if (features.includes('oauth') && oauthProviders) {
39
45
  if (oauthProviders.includes('google')) {
@@ -55,11 +61,15 @@ class EnvGenerator {
55
61
 
56
62
  // Add Stripe variables if Stripe is enabled
57
63
  if (features.includes('stripe')) {
58
- envVars.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY = existingEnv.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || 'your_stripe_publishable_key_here';
64
+ const stripePublicKey = `${publicPrefix}STRIPE_PUBLISHABLE_KEY`;
65
+ envVars[stripePublicKey] = existingEnv[stripePublicKey] || existingEnv.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || 'your_stripe_publishable_key_here';
59
66
  envVars.STRIPE_SECRET_KEY = existingEnv.STRIPE_SECRET_KEY || 'your_stripe_secret_key_here';
60
67
  envVars.STRIPE_WEBHOOK_SECRET = existingEnv.STRIPE_WEBHOOK_SECRET || 'your_stripe_webhook_secret_here';
61
68
  }
62
69
 
70
+ // Store isMobile for formatting
71
+ envVars._isMobile = isMobile;
72
+
63
73
  // Write env file
64
74
  const envContent = this.formatEnvFile(envVars);
65
75
  fs.writeFileSync(envPath, envContent, 'utf8');
@@ -103,19 +113,23 @@ class EnvGenerator {
103
113
  * Format environment variables as .env file
104
114
  */
105
115
  formatEnvFile(envVars) {
116
+ const isMobile = envVars._isMobile;
117
+ const publicPrefix = isMobile ? 'EXPO_PUBLIC_' : 'NEXT_PUBLIC_';
118
+ const platformName = isMobile ? 'Expo/React Native' : 'Next.js';
119
+ const deploymentPlatforms = isMobile ? 'EAS Build, Expo Go' : 'Vercel, Netlify, etc.';
120
+
106
121
  let content = `# L4YERCAK3 Configuration
107
122
  # Auto-generated by @l4yercak3/cli
108
123
  # DO NOT commit this file to git - it contains sensitive credentials
109
124
  #
110
- # This file is for LOCAL DEVELOPMENT. For production:
111
- # - Set these variables in your hosting platform (Vercel, Netlify, etc.)
112
- # - NEXTAUTH_URL should be your production domain
125
+ # This file is for LOCAL DEVELOPMENT (${platformName}).
126
+ # For production, set these variables in your deployment platform (${deploymentPlatforms}).
113
127
 
114
128
  # Core API Configuration
115
129
  L4YERCAK3_API_KEY=${envVars.L4YERCAK3_API_KEY}
116
130
  L4YERCAK3_BACKEND_URL=${envVars.L4YERCAK3_BACKEND_URL}
117
131
  L4YERCAK3_ORGANIZATION_ID=${envVars.L4YERCAK3_ORGANIZATION_ID}
118
- NEXT_PUBLIC_L4YERCAK3_BACKEND_URL=${envVars.NEXT_PUBLIC_L4YERCAK3_BACKEND_URL}
132
+ ${publicPrefix}L4YERCAK3_BACKEND_URL=${envVars[`${publicPrefix}L4YERCAK3_BACKEND_URL`]}
119
133
 
120
134
  `;
121
135
 
@@ -160,9 +174,10 @@ NEXTAUTH_SECRET=${envVars.NEXTAUTH_SECRET}
160
174
  }
161
175
 
162
176
  // Add Stripe section if present
163
- if (envVars.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY) {
177
+ const stripePublicKey = envVars[`${publicPrefix}STRIPE_PUBLISHABLE_KEY`];
178
+ if (stripePublicKey) {
164
179
  content += `# Stripe Configuration
165
- NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=${envVars.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}
180
+ ${publicPrefix}STRIPE_PUBLISHABLE_KEY=${stripePublicKey}
166
181
  STRIPE_SECRET_KEY=${envVars.STRIPE_SECRET_KEY}
167
182
  STRIPE_WEBHOOK_SECRET=${envVars.STRIPE_WEBHOOK_SECRET}
168
183