mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
refactor: clean up custom flavor detection
This commit is contained in:
@ -3,26 +3,15 @@ import { getAllDependencies } from './dependencies';
|
|||||||
import { error } from './log';
|
import { error } from './log';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to determine the project flavor based on installed dependencies
|
* Utility to determine if the project uses an external flavor/framework
|
||||||
* (vue, angular, react, svelete, typescript, javascript...)
|
|
||||||
*/
|
*/
|
||||||
export function projectUsesCustomFlavor(): boolean {
|
export function projectUsesCustomFlavor(): boolean {
|
||||||
const dependencies = getAllDependencies();
|
const projectFlavor = determineProjectFlavor();
|
||||||
return [
|
|
||||||
'vue',
|
|
||||||
'angular',
|
|
||||||
'react',
|
|
||||||
'svelte'
|
|
||||||
].includes(determineProjectFlavor())
|
|
||||||
if (dependencies.includes('nativescript-vue') ||
|
|
||||||
dependencies.includes('@nativescript/angular') ||
|
|
||||||
dependencies.includes('react-nativescript') ||
|
|
||||||
dependencies.includes('svelte-native')
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return (
|
||||||
|
projectFlavor &&
|
||||||
|
['vue', 'angular', 'react', 'svelte'].includes(projectFlavor)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Utility to determine the project flavor based on installed dependencies
|
* Utility to determine the project flavor based on installed dependencies
|
||||||
|
Reference in New Issue
Block a user