mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
refactor: move getPlatform to helpers
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { env } from '../index';
|
||||
import { env, Platform } from '../index';
|
||||
import { resolve, basename } from 'path';
|
||||
|
||||
export function getProjectRootPath(): string {
|
||||
@ -33,6 +33,19 @@ export function getDistPath() {
|
||||
// 3rd party platforms would be treated the same
|
||||
}
|
||||
|
||||
export function getPlatform(): Platform {
|
||||
if (env?.android) {
|
||||
return 'android';
|
||||
}
|
||||
|
||||
if (env?.ios) {
|
||||
return 'ios';
|
||||
}
|
||||
|
||||
// todo: maybe no throw?
|
||||
throw new Error('You need to provide a target platform!');
|
||||
}
|
||||
|
||||
interface IPackageJson {
|
||||
main?: string;
|
||||
dependencies?: {
|
||||
|
Reference in New Issue
Block a user