()
| 7 | * (vue, angular, react, svelete, typescript, javascript...) |
| 8 | */ |
| 9 | export function determineProjectFlavor(): keyof typeof defaultConfigs | false { |
| 10 | const dependencies = getAllDependencies(); |
| 11 | |
| 12 | if (dependencies.includes('nativescript-vue')) { |
| 13 | return 'vue'; |
| 14 | } |
| 15 | |
| 16 | if (dependencies.includes('@nativescript/angular')) { |
| 17 | return 'angular'; |
| 18 | } |
| 19 | |
| 20 | if (dependencies.includes('react-nativescript')) { |
| 21 | return 'react'; |
| 22 | } |
| 23 | |
| 24 | if ( |
| 25 | dependencies.includes('svelte-native') || |
| 26 | dependencies.includes('@nativescript-community/svelte-native') |
| 27 | ) { |
| 28 | return 'svelte'; |
| 29 | } |
| 30 | |
| 31 | // the order is important - angular, react, and svelte also include these deps |
| 32 | // but should return prior to this condition! |
| 33 | if ( |
| 34 | dependencies.includes('@nativescript/core') && |
| 35 | dependencies.includes('typescript') |
| 36 | ) { |
| 37 | return 'typescript'; |
| 38 | } |
| 39 | |
| 40 | if (dependencies.includes('@nativescript/core')) { |
| 41 | return 'javascript'; |
| 42 | } |
| 43 | |
| 44 | error(` |
| 45 | Could not determine project flavor. |
| 46 | Please use webpack.useConfig('<flavor>') to explicitly set the base config. |
| 47 | `); |
| 48 | |
| 49 | return false; |
| 50 | } |
no test coverage detected