vibefast-cli 0.7.7 → 0.7.10

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.
@@ -40,6 +40,45 @@ export const initCommand = new Command('init')
40
40
  process.exit(1);
41
41
  }
42
42
 
43
+ // Step 0: Check License Key (REQUIRED)
44
+ let licenseKey = options.license;
45
+
46
+ // Check if user already has a license key saved
47
+ if (!licenseKey) {
48
+ const { getToken } = await import('../core/auth.js');
49
+ const existingToken = await getToken();
50
+
51
+ if (existingToken) {
52
+ log.info('✓ Using existing license key');
53
+ licenseKey = existingToken;
54
+ }
55
+ }
56
+
57
+ if (!licenseKey) {
58
+ log.plain('');
59
+ log.info('🔑 VibeFast License Key Required');
60
+ log.plain('');
61
+ log.info('To use VibeFast, you need a valid license key.');
62
+ log.info('Get one at: https://vibefast.pro');
63
+ log.plain('');
64
+
65
+ if (options.yes) {
66
+ log.error('License key is required. Use --license <key> or run "vf login" first');
67
+ process.exit(1);
68
+ }
69
+
70
+ licenseKey = await promptUser('Enter your license key: ');
71
+
72
+ if (!licenseKey || licenseKey.trim() === '') {
73
+ log.error('License key cannot be empty');
74
+ process.exit(1);
75
+ }
76
+
77
+ // Save globally for future use
78
+ const { saveToken } = await import('../core/auth.js');
79
+ await saveToken(licenseKey);
80
+ }
81
+
43
82
  // Step 1: Choose starter type
44
83
  let starterType: 'clean' | 'custom' = 'clean';
45
84
  let selectedFeatures: string[] = [];
@@ -364,15 +403,34 @@ export const initCommand = new Command('init')
364
403
  ];
365
404
 
366
405
  let envFilesCreated = 0;
367
- for (const { example, target } of envFiles) {
368
- const examplePath = join(projectPath, 'apps/native', example);
369
- const targetPath = join(projectPath, 'apps/native', target);
370
-
371
- if (existsSync(examplePath) && !existsSync(targetPath)) {
372
- const { copyFileSync } = await import('fs');
373
- copyFileSync(examplePath, targetPath);
374
- log.info(`✓ Created ${target}`);
375
- envFilesCreated++;
406
+
407
+ // Setup Native Env Files
408
+ if (platforms.includes('native')) {
409
+ for (const { example, target } of envFiles) {
410
+ const examplePath = join(projectPath, 'apps/native', example);
411
+ const targetPath = join(projectPath, 'apps/native', target);
412
+
413
+ if (existsSync(examplePath) && !existsSync(targetPath)) {
414
+ const { copyFileSync } = await import('fs');
415
+ copyFileSync(examplePath, targetPath);
416
+ log.info(`✓ Created apps/native/${target}`);
417
+ envFilesCreated++;
418
+ }
419
+ }
420
+ }
421
+
422
+ // Setup Web Env Files
423
+ if (platforms.includes('web')) {
424
+ for (const { example, target } of envFiles) {
425
+ const examplePath = join(projectPath, 'apps/web', example);
426
+ const targetPath = join(projectPath, 'apps/web', target);
427
+
428
+ if (existsSync(examplePath) && !existsSync(targetPath)) {
429
+ const { copyFileSync } = await import('fs');
430
+ copyFileSync(examplePath, targetPath);
431
+ log.info(`✓ Created apps/web/${target}`);
432
+ envFilesCreated++;
433
+ }
376
434
  }
377
435
  }
378
436
 
@@ -389,7 +447,7 @@ export const initCommand = new Command('init')
389
447
  // Step 6: Run starter setup script (optional)
390
448
  const setupScriptPath = join(projectPath, 'apps/native/scripts/starter-setup.mjs');
391
449
 
392
- if (existsSync(setupScriptPath)) {
450
+ if (platforms.includes('native') && existsSync(setupScriptPath)) {
393
451
  log.info('📋 Starter Setup Available');
394
452
  log.plain('');
395
453
  log.info('The starter includes a setup script that will:');
@@ -436,6 +494,11 @@ export const initCommand = new Command('init')
436
494
  log.plain(' node scripts/starter-setup.mjs');
437
495
  }
438
496
 
497
+ log.plain('');
498
+ } else if (platforms.includes('native')) {
499
+ // Native platform selected but script missing
500
+ log.warn('⚠ Setup script not found at apps/native/scripts/starter-setup.mjs');
501
+ log.info('Skipping automated setup.');
439
502
  log.plain('');
440
503
  }
441
504
 
@@ -476,6 +539,13 @@ export const initCommand = new Command('init')
476
539
  const config = await validateSignature(paths.signatureFile);
477
540
 
478
541
  // Fetch recipe
542
+ // Determine target based on platform selection
543
+ // If native is not selected, we shouldn't be installing native features
544
+ if (!platforms.includes('native')) {
545
+ log.warn(`⚠ Skipping ${featureName} (requires native platform)`);
546
+ continue;
547
+ }
548
+
479
549
  const response = await fetchRecipe({
480
550
  token: token!,
481
551
  device,
@@ -613,40 +683,8 @@ export const initCommand = new Command('init')
613
683
  log.plain('');
614
684
  }
615
685
 
616
- // Step 7: Login with license key (REQUIRED)
617
- let licenseKey = options.license;
618
-
619
- // Check if user already has a license key saved
620
- if (!licenseKey) {
621
- const { getToken } = await import('../core/auth.js');
622
- const existingToken = await getToken();
623
-
624
- if (existingToken) {
625
- log.info('✓ Using existing license key');
626
- licenseKey = existingToken;
627
- }
628
- }
629
-
630
- if (!licenseKey) {
631
- log.plain('');
632
- log.info('🔑 VibeFast License Key Required');
633
- log.plain('');
634
- log.info('To use VibeFast, you need a valid license key.');
635
- log.info('Get one at: https://vibefast.pro');
636
- log.plain('');
637
-
638
- if (options.yes) {
639
- log.error('License key is required. Use --license <key> or run "vf login" first');
640
- process.exit(1);
641
- }
642
-
643
- licenseKey = await promptUser('Enter your license key: ');
644
-
645
- if (!licenseKey || licenseKey.trim() === '') {
646
- log.error('License key cannot be empty');
647
- process.exit(1);
648
- }
649
- }
686
+ // Step 7: Save license key to project
687
+ // Note: License key was already validated in Step 0
650
688
 
651
689
  log.plain('');
652
690
  await withSpinner(