MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / determineProjectFlavor

Function determineProjectFlavor

packages/vite/helpers/flavor.ts:21–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 * (vue, angular, react, svelete, typescript, javascript...)
20 */
21export function determineProjectFlavor(): string | false {
22 const dependencies = getAllDependencies();
23
24 if (dependencies.includes('nativescript-vue')) {
25 return 'vue';
26 }
27
28 if (dependencies.includes('@nativescript/angular')) {
29 return 'angular';
30 }
31
32 if (dependencies.includes('react-nativescript')) {
33 return 'react';
34 }
35
36 if (dependencies.includes('@nativescript-community/solid-js') || dependencies.includes('solid-js')) {
37 return 'solid';
38 }
39
40 if (dependencies.includes('svelte-native') || dependencies.includes('@nativescript-community/svelte-native')) {
41 return 'svelte';
42 }
43
44 // the order is important - angular, react, and svelte also include these deps
45 // but should return prior to this condition!
46 if (dependencies.includes('@nativescript/core') && dependencies.includes('typescript')) {
47 return 'typescript';
48 }
49
50 if (dependencies.includes('@nativescript/core')) {
51 return 'javascript';
52 }
53
54 console.info(`
55 Could not determine project flavor.
56 Please use webpack.useConfig('<flavor>') to explicitly set the base config.
57 `);
58
59 return false;
60}

Callers 2

resolveFlavorFunction · 0.70
getProjectFlavorFunction · 0.70

Calls 3

includesMethod · 0.80
infoMethod · 0.80
getAllDependenciesFunction · 0.70

Tested by

no test coverage detected