also looking at this
fix(cli): validate scaffold templates before creating projects
#298
4 files
+53
-7
| @@ -729,9 +729,15 @@ cli | ||
| 729 | 729 | .example('craft init MyApp --template dashboard') |
| 730 | 730 | .example('craft init MyApp --template all') |
| 731 | 731 | .action(async (name: string, options?: any) => { |
| 732 | const template = options?.template || 'blank' | |
| 733 | const templates = ['blank', 'tabs', 'drawer', 'dashboard', 'desktop', 'ios', 'android', 'all'] | |
| 734 | if (!templates.includes(template)) { | |
| 735 | console.error(`Error: Unknown template "${template}"`) | |
| 736 | console.error(`Available templates: ${templates.join(', ')}`) | |
| 737 | process.exit(1) | |
| 738 | } | |
| 732 | 739 | console.log(`\n⚡ Creating new Craft project: ${name}\n`) |
| 733 | 740 | |
| 734 | const template = options?.template || 'blank' | |
| 735 | 741 | const bundleId = options?.bundleId || `com.example.${name.toLowerCase().replace(/[^a-z0-9]/g, '')}` |
| 736 | 742 | const appNameSlug = name.toLowerCase().replace(/[^a-z0-9]/g, '-') |
| 737 | 743 | |