Skip to content

Commit dcaaf97

Browse files
committed
fix(cordova): recognize more browsers
fixes #2826
1 parent 19a3390 commit dcaaf97

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

packages/@ionic/cli-utils/src/definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ export interface ResourcesConfig {
686686
[propName: string]: ResourcesPlatform;
687687
}
688688

689-
export type KnownPlatform = 'ios' | 'android' | 'wp8';
689+
export type KnownPlatform = 'ios' | 'android' | 'wp8' | 'windows' | 'browser';
690690
export type KnownResourceType = 'icon' | 'splash';
691691

692692
export interface StarterTemplate {

packages/@ionic/cli-utils/src/lib/cordova/__tests__/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('@ionic/cli-utils', () => {
88
describe('getPlatforms', () => {
99

1010
it('should filter out platforms.json and empty string', async () => {
11-
spyOn(fsSpy, 'readDir').and.callFake(async () => ['android', 'ios', 'platforms.json', '']);
11+
spyOn(fsSpy, 'readDir').and.callFake(async () => ['.DS_Store', 'android', 'ios', 'platforms.json', '']);
1212
const platforms = await project.getPlatforms('/path/to/proj');
1313
expect(platforms).toEqual(['android', 'ios']);
1414
});

packages/@ionic/cli-utils/src/lib/cordova/project.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@ import * as path from 'path';
22

33
import chalk from 'chalk';
44

5-
import { IonicEnvironment, KnownPlatform } from '../../definitions';
5+
import { IonicEnvironment } from '../../definitions';
66

77
import { FatalException } from '../errors';
88
import { readDir } from '@ionic/cli-framework/utils/fs';
99

10-
function isKnownPlatform(platform: string): platform is KnownPlatform {
11-
return ['android', 'ios'].includes(platform);
12-
}
13-
1410
export async function getPlatforms(projectDir: string): Promise<string[]> {
1511
const platformsDir = path.resolve(projectDir, 'platforms');
1612
const dirContents = await readDir(platformsDir);
17-
return dirContents.filter(f => f && isKnownPlatform(f));
13+
return dirContents.filter(f => f && f !== 'platforms.json' && !f.startsWith('.'));
1814
}
1915

2016
export async function installPlatform(env: IonicEnvironment, platform: string): Promise<void> {

0 commit comments

Comments
 (0)