@l4yercak3/cli 1.2.18 → 1.2.19

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,17 +13,35 @@ class HooksGenerator {
13
13
  * @param {Object} options - Generation options
14
14
  * @returns {Promise<Object>} - Generated file paths
15
15
  */
16
+ /**
17
+ * Check if framework is Expo/React Native
18
+ */
19
+ isMobileFramework(frameworkType) {
20
+ return ['expo', 'react-native'].includes(frameworkType);
21
+ }
22
+
16
23
  async generate(options) {
17
- const { projectPath, features = [] } = options;
24
+ const { projectPath, features = [], frameworkType } = options;
25
+ const isMobile = this.isMobileFramework(frameworkType);
18
26
 
19
27
  const results = {};
20
28
 
21
- // Determine output directory
29
+ // Determine output directory based on framework
22
30
  let outputDir;
23
- if (fs.existsSync(path.join(projectPath, 'src'))) {
24
- outputDir = path.join(projectPath, 'src', 'lib', 'l4yercak3', 'hooks');
31
+ if (isMobile) {
32
+ // Expo typically uses src/lib or just lib
33
+ if (fs.existsSync(path.join(projectPath, 'src'))) {
34
+ outputDir = path.join(projectPath, 'src', 'lib', 'l4yercak3', 'hooks');
35
+ } else {
36
+ outputDir = path.join(projectPath, 'lib', 'l4yercak3', 'hooks');
37
+ }
25
38
  } else {
26
- outputDir = path.join(projectPath, 'lib', 'l4yercak3', 'hooks');
39
+ // Next.js uses src/lib
40
+ if (fs.existsSync(path.join(projectPath, 'src'))) {
41
+ outputDir = path.join(projectPath, 'src', 'lib', 'l4yercak3', 'hooks');
42
+ } else {
43
+ outputDir = path.join(projectPath, 'lib', 'l4yercak3', 'hooks');
44
+ }
27
45
  }
28
46
 
29
47
  ensureDir(outputDir);
@@ -6,10 +6,13 @@
6
6
  const databaseGenerator = require('./database');
7
7
  const hooksGenerator = require('./hooks');
8
8
  const componentGenerator = require('./components');
9
+ const mobileComponentGenerator = require('./components-mobile');
9
10
  const pageGenerator = require('./pages');
11
+ const screensGenerator = require('./screens');
10
12
  const apiOnlyGenerator = require('../api-only');
11
13
  const envGenerator = require('../env-generator');
12
14
  const nextauthGenerator = require('../nextauth-generator');
15
+ const expoAuthGenerator = require('../expo-auth-generator');
13
16
  const oauthGuideGenerator = require('../oauth-guide-generator');
14
17
  const gitignoreGenerator = require('../gitignore-generator');
15
18
 
@@ -53,9 +56,13 @@ class QuickStartGenerator {
53
56
  // Pages (Next.js only)
54
57
  pages: null,
55
58
 
59
+ // Screens (Expo only)
60
+ screens: null,
61
+
56
62
  // Common files
57
63
  envFile: null,
58
64
  nextauth: null,
65
+ expoAuth: null,
59
66
  oauthGuide: null,
60
67
  gitignore: null,
61
68
  };
@@ -81,23 +88,35 @@ class QuickStartGenerator {
81
88
  results.hooks = await hooksGenerator.generate(options);
82
89
  }
83
90
 
84
- // 4. Generate React components
91
+ // 4. Generate React components (mobile or web)
85
92
  if (options.features && options.features.length > 0) {
86
- results.components = await componentGenerator.generate(options);
93
+ if (isMobile) {
94
+ results.components = await mobileComponentGenerator.generate(options);
95
+ } else {
96
+ results.components = await componentGenerator.generate(options);
97
+ }
87
98
  }
88
99
 
89
- // 5. Generate pages (Next.js only)
90
- if (isNextJs && options.features && options.features.length > 0) {
91
- results.pages = await pageGenerator.generate(options);
100
+ // 5. Generate pages (Next.js) or screens (Expo)
101
+ if (options.features && options.features.length > 0) {
102
+ if (isNextJs) {
103
+ results.pages = await pageGenerator.generate(options);
104
+ } else if (isMobile) {
105
+ results.screens = await screensGenerator.generate(options);
106
+ }
92
107
  }
93
108
 
94
109
  // 6. Generate environment file
95
110
  results.envFile = envGenerator.generate(this.enhanceEnvOptions(options));
96
111
 
97
- // 7. Generate NextAuth.js config if OAuth is enabled (Next.js only)
112
+ // 7. Generate auth config if OAuth is enabled
98
113
  if (options.features && options.features.includes('oauth') && options.oauthProviders) {
99
114
  if (isNextJs) {
115
+ // NextAuth.js for Next.js
100
116
  results.nextauth = await nextauthGenerator.generate(options);
117
+ } else if (isMobile) {
118
+ // expo-auth-session for Expo/React Native
119
+ results.expoAuth = await expoAuthGenerator.generate(options);
101
120
  }
102
121
  }
103
122
 
@@ -123,15 +142,19 @@ class QuickStartGenerator {
123
142
  const enhanced = { ...options };
124
143
  enhanced.additionalEnvVars = enhanced.additionalEnvVars || [];
125
144
 
145
+ const isMobile = this.isMobileFramework(options.frameworkType);
146
+ // Use EXPO_PUBLIC_ for Expo, NEXT_PUBLIC_ for Next.js
147
+ const publicPrefix = isMobile ? 'EXPO_PUBLIC_' : 'NEXT_PUBLIC_';
148
+
126
149
  if (options.selectedDatabase === 'convex') {
127
150
  enhanced.additionalEnvVars.push(
128
151
  { key: 'CONVEX_DEPLOYMENT', value: '', comment: 'Convex deployment URL (from npx convex dev)' },
129
- { key: 'NEXT_PUBLIC_CONVEX_URL', value: '', comment: 'Convex public URL' }
152
+ { key: `${publicPrefix}CONVEX_URL`, value: '', comment: 'Convex public URL' }
130
153
  );
131
154
  } else if (options.selectedDatabase === 'supabase') {
132
155
  enhanced.additionalEnvVars.push(
133
- { key: 'NEXT_PUBLIC_SUPABASE_URL', value: '', comment: 'Supabase project URL' },
134
- { key: 'NEXT_PUBLIC_SUPABASE_ANON_KEY', value: '', comment: 'Supabase anonymous key' },
156
+ { key: `${publicPrefix}SUPABASE_URL`, value: '', comment: 'Supabase project URL' },
157
+ { key: `${publicPrefix}SUPABASE_ANON_KEY`, value: '', comment: 'Supabase anonymous key' },
135
158
  { key: 'SUPABASE_SERVICE_ROLE_KEY', value: '', comment: 'Supabase service role key (server only)' }
136
159
  );
137
160
  }
@@ -140,10 +163,13 @@ class QuickStartGenerator {
140
163
  enhanced.additionalEnvVars.push(
141
164
  { key: 'STRIPE_SECRET_KEY', value: '', comment: 'Stripe secret key' },
142
165
  { key: 'STRIPE_WEBHOOK_SECRET', value: '', comment: 'Stripe webhook signing secret' },
143
- { key: 'NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY', value: '', comment: 'Stripe publishable key' }
166
+ { key: `${publicPrefix}STRIPE_PUBLISHABLE_KEY`, value: '', comment: 'Stripe publishable key' }
144
167
  );
145
168
  }
146
169
 
170
+ // Pass mobile flag to env generator
171
+ enhanced.isMobile = isMobile;
172
+
147
173
  return enhanced;
148
174
  }
149
175
  }