refactor: move getPlatform to helpers

This commit is contained in:
Igor Randjelovic
2020-11-19 22:20:48 +01:00
parent 054d4e6f87
commit e23c8356af
4 changed files with 24 additions and 16 deletions

View File

@ -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?: {