create-solostack 1.3.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-solostack",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "The complete SaaS boilerplate for indie hackers - Next.js 15 with auth, payments, database, and email",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -16,13 +16,7 @@ import { generateEmails } from './generators/emails.js';
16
16
  import { generateSetup } from './generators/setup.js';
17
17
  import { generateUI } from './generators/ui.js';
18
18
  import { validateLicense, isLicenseKeyFormat } from './utils/license.js';
19
- // Pro generators
20
- import { generateOAuth } from './generators/pro/oauth.js';
21
- import { generateFullDatabase } from './generators/pro/database-full.js';
22
- import { generateAdvancedStripe } from './generators/pro/stripe-advanced.js';
23
- import { generateAdvancedEmails } from './generators/pro/emails.js';
24
- import { generateAdmin } from './generators/pro/admin.js';
25
- import { generateApiKeys } from './generators/pro/api-keys.js';
19
+ import { generateProFromServer } from './utils/pro-api.js';
26
20
  import {
27
21
  AUTH_PROVIDERS,
28
22
  DATABASES,
@@ -159,6 +153,7 @@ export async function main() {
159
153
 
160
154
  if (licenseData.valid) {
161
155
  hasProLicense = true;
156
+ licenseData.licenseKey = licenseAnswer.licenseKey; // Store key for server-side generation
162
157
  spinner.succeed(chalk.green(`Pro license validated! Welcome ${licenseData.email} šŸ’Ž`));
163
158
  } else {
164
159
  spinner.fail(chalk.red('Invalid license key'));
@@ -226,38 +221,27 @@ export async function main() {
226
221
  await generateSetup(projectPath, config);
227
222
  spinner.succeed('Added diagnostics page (/setup)');
228
223
 
229
- // Pro Features Generation
224
+ // Pro Features Generation (Server-Side)
230
225
  if (hasProLicense) {
231
- console.log(chalk.cyan('\nšŸ’Ž Adding Pro features...\n'));
232
-
233
- spinner = ora('Adding OAuth providers (Google, GitHub)').start();
234
- await generateOAuth(projectPath);
235
- spinner.succeed('OAuth providers configured');
236
-
237
- spinner = ora('Upgrading database schema').start();
238
- await generateFullDatabase(projectPath);
239
- spinner.succeed('Full database schema created');
240
-
241
- spinner = ora('Setting up advanced Stripe integration').start();
242
- await generateAdvancedStripe(projectPath);
243
- spinner.succeed('Stripe subscriptions and webhooks configured');
244
-
245
- spinner = ora('Adding email templates').start();
246
- await generateAdvancedEmails(projectPath);
247
- spinner.succeed('Email templates created');
248
-
249
- spinner = ora('Creating admin panel').start();
250
- await generateAdmin(projectPath);
251
- spinner.succeed('Admin panel created');
252
-
253
- spinner = ora('Setting up API key system').start();
254
- await generateApiKeys(projectPath);
255
- spinner.succeed('API key system configured');
226
+ console.log(chalk.cyan('\nšŸ’Ž Fetching Pro features from server...\n'));
227
+
228
+ spinner = ora('Downloading Pro features (OAuth, Admin, API Keys, Billing...)').start();
229
+ try {
230
+ const fileCount = await generateProFromServer(projectPath, licenseData.licenseKey, config);
231
+ spinner.succeed(`Pro features downloaded (${fileCount} files)`);
232
+ } catch (error) {
233
+ spinner.fail('Failed to download Pro features');
234
+ console.log(chalk.yellow('\nāš ļø Error: ' + error.message));
235
+ console.log(chalk.yellow(' Continuing with free version...\n'));
236
+ hasProLicense = false;
237
+ }
256
238
 
257
- // Install Pro-specific packages
258
- spinner = ora('Installing Pro packages...').start();
259
- await installProPackages(projectPath);
260
- spinner.succeed('Pro packages installed');
239
+ if (hasProLicense) {
240
+ // Install Pro-specific packages
241
+ spinner = ora('Installing Pro packages...').start();
242
+ await installProPackages(projectPath);
243
+ spinner.succeed('Pro packages installed');
244
+ }
261
245
  }
262
246
 
263
247
  // Install dependencies
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Pro API Client
3
+ * Fetches Pro files from the server-side generation API
4
+ */
5
+
6
+ import path from 'path';
7
+ import { writeFile, ensureDir } from './files.js';
8
+
9
+ // Pro generation API endpoint
10
+ const PRO_API = 'https://solostack-license-api.solo-stack.workers.dev/generate-pro';
11
+
12
+ /**
13
+ * Fetch Pro files from the server
14
+ * @param {string} licenseKey - Valid Pro license key
15
+ * @param {object} config - Project configuration
16
+ * @returns {Promise<object>} - Object with file paths and contents
17
+ */
18
+ export async function fetchProFiles(licenseKey, config = {}) {
19
+ const response = await fetch(PRO_API, {
20
+ method: 'POST',
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ },
24
+ body: JSON.stringify({
25
+ license: licenseKey,
26
+ config: config,
27
+ }),
28
+ });
29
+
30
+ if (!response.ok) {
31
+ const error = await response.json().catch(() => ({ error: 'Server error' }));
32
+ throw new Error(error.error || 'Failed to generate Pro files');
33
+ }
34
+
35
+ const data = await response.json();
36
+
37
+ if (!data.success) {
38
+ throw new Error(data.error || 'Pro generation failed');
39
+ }
40
+
41
+ return data.files;
42
+ }
43
+
44
+ /**
45
+ * Write Pro files to the project directory
46
+ * @param {string} projectPath - Path to the project
47
+ * @param {object} files - Object with { "path/to/file": "content" }
48
+ */
49
+ export async function writeProFiles(projectPath, files) {
50
+ for (const [filePath, content] of Object.entries(files)) {
51
+ const fullPath = path.join(projectPath, filePath);
52
+
53
+ // Ensure directory exists
54
+ await ensureDir(path.dirname(fullPath));
55
+
56
+ // Write file
57
+ await writeFile(fullPath, content);
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Generate Pro features for a project
63
+ * @param {string} projectPath - Path to the project
64
+ * @param {string} licenseKey - Valid Pro license key
65
+ * @param {object} config - Project configuration
66
+ */
67
+ export async function generateProFromServer(projectPath, licenseKey, config = {}) {
68
+ const files = await fetchProFiles(licenseKey, config);
69
+ await writeProFiles(projectPath, files);
70
+ return Object.keys(files).length;
71
+ }