flipper-doctor
Advanced tools
Comparing version 0.253.0 to 0.254.0
@@ -10,3 +10,3 @@ /** | ||
import { FlipperDoctor } from 'flipper-common'; | ||
export declare function validateSelectedXcodeVersion(_selectedPath: string): Promise<FlipperDoctor.HealthcheckRunResult>; | ||
export declare function validateSelectedXcodeVersion(_selectedPath: string, _availableXcode: string | null): Promise<FlipperDoctor.HealthcheckRunResult>; | ||
//# sourceMappingURL=validateSelectedXcodeVersion.d.ts.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
exports.validateSelectedXcodeVersion = void 0; | ||
async function validateSelectedXcodeVersion(_selectedPath) { | ||
async function validateSelectedXcodeVersion(_selectedPath, _availableXcode) { | ||
return { | ||
@@ -15,0 +15,0 @@ hasProblem: false, |
135
lib/index.js
@@ -180,2 +180,52 @@ "use strict"; | ||
{ | ||
key: 'ios.idb', | ||
label: 'IDB installed', | ||
isRequired: true, | ||
run: async (_, settings) => { | ||
if (!settings) { | ||
return { | ||
hasProblem: false, | ||
message: ['ios.idb--no_context'], | ||
}; | ||
} | ||
if (!settings.enablePhysicalIOS) { | ||
return { | ||
hasProblem: false, | ||
message: ['ios.idb--physical_device_disabled'], | ||
}; | ||
} | ||
const result = await tryExecuteCommand(`${settings?.idbPath} --help`); | ||
const hasIdbCompanion = await tryExecuteCommand(`idbCompanion --help`); | ||
if (result.fail) { | ||
const hasIdbInPath = await tryExecuteCommand(`which idb`); | ||
if (!hasIdbInPath.fail) { | ||
return { | ||
hasProblem: true, | ||
message: [ | ||
'ios.idb--not_installed_but_present', | ||
{ | ||
idbPath: settings.idbPath, | ||
idbInPath: hasIdbInPath.stdout.trim(), | ||
}, | ||
], | ||
}; | ||
} | ||
return { | ||
hasProblem: true, | ||
message: [ | ||
'ios.idb--not_installed', | ||
{ | ||
idbPath: settings.idbPath, | ||
hasIdbCompanion: !hasIdbCompanion.fail, | ||
}, | ||
], | ||
}; | ||
} | ||
return { | ||
hasProblem: false, | ||
message: ['ios.idb--installed'], | ||
}; | ||
}, | ||
}, | ||
{ | ||
key: 'ios.xcode', | ||
@@ -208,3 +258,14 @@ label: 'XCode Installed', | ||
run: async (_) => { | ||
// TODO check for an existing Xcode | ||
const allApps = await fs_extra.promises.readdir('/Applications'); | ||
// Xcode_14.2.0_xxxxxxx.app | ||
// Xcode_14.3.1_xxxxxxxxxx.app | ||
// Xcode_15.0.0_xxxxxxxxxx.app | ||
// Xcode.app | ||
const latestXCode = allApps | ||
.filter((a) => a.startsWith('Xcode')) | ||
.sort() | ||
.pop(); | ||
const availableXcode = latestXCode | ||
? path.join('/Applications', latestXCode) | ||
: null; | ||
const result = await tryExecuteCommand('xcode-select -p'); | ||
@@ -216,3 +277,3 @@ if (result.fail) { | ||
'ios.xcode-select--not_set', | ||
{ message: result.message }, | ||
{ message: result.message, availableXcode }, | ||
], | ||
@@ -225,3 +286,6 @@ }; | ||
hasProblem: true, | ||
message: ['ios.xcode-select--no_xcode_selected'], | ||
message: [ | ||
'ios.xcode-select--no_xcode_selected', | ||
{ availableXcode }, | ||
], | ||
}; | ||
@@ -234,7 +298,7 @@ } | ||
'ios.xcode-select--nonexisting_selected', | ||
{ selected: selectedXcode }, | ||
{ selected: selectedXcode, availableXcode }, | ||
], | ||
}; | ||
} | ||
const validatedXcodeVersion = await (0, validateSelectedXcodeVersion_1.validateSelectedXcodeVersion)(selectedXcode); | ||
const validatedXcodeVersion = await (0, validateSelectedXcodeVersion_1.validateSelectedXcodeVersion)(selectedXcode, availableXcode); | ||
if (validatedXcodeVersion.hasProblem) { | ||
@@ -289,4 +353,11 @@ return validatedXcodeVersion; | ||
.split('\n') | ||
.map((x) => JSON.parse(x)) | ||
.filter((x) => x.type === 'simulator'); | ||
.map((x) => { | ||
try { | ||
return JSON.parse(x); | ||
} | ||
catch (e) { | ||
return null; | ||
} | ||
}) | ||
.filter((x) => x != null && x.type === 'simulator'); | ||
if (devices.length === 0) { | ||
@@ -331,52 +402,2 @@ return { | ||
}, | ||
{ | ||
key: 'ios.idb', | ||
label: 'IDB installed', | ||
isRequired: false, | ||
run: async (_, settings) => { | ||
if (!settings) { | ||
return { | ||
hasProblem: false, | ||
message: ['ios.idb--no_context'], | ||
}; | ||
} | ||
if (!settings.enablePhysicalIOS) { | ||
return { | ||
hasProblem: false, | ||
message: ['ios.idb--physical_device_disabled'], | ||
}; | ||
} | ||
const result = await tryExecuteCommand(`${settings?.idbPath} --help`); | ||
const hasIdbCompanion = await tryExecuteCommand(`idbCompanion --help`); | ||
if (result.fail) { | ||
const hasIdbInPath = await tryExecuteCommand(`which idb`); | ||
if (!hasIdbInPath.fail) { | ||
return { | ||
hasProblem: true, | ||
message: [ | ||
'ios.idb--not_installed_but_present', | ||
{ | ||
idbPath: settings.idbPath, | ||
idbInPath: hasIdbInPath.stdout.trim(), | ||
}, | ||
], | ||
}; | ||
} | ||
return { | ||
hasProblem: true, | ||
message: [ | ||
'ios.idb--not_installed', | ||
{ | ||
idbPath: settings.idbPath, | ||
hasIdbCompanion: !hasIdbCompanion.fail, | ||
}, | ||
], | ||
}; | ||
} | ||
return { | ||
hasProblem: false, | ||
message: ['ios.idb--installed'], | ||
}; | ||
}, | ||
}, | ||
], | ||
@@ -383,0 +404,0 @@ } |
{ | ||
"name": "flipper-doctor", | ||
"version": "0.253.0", | ||
"version": "0.254.0", | ||
"description": "Utility for checking for issues with a flipper installation", | ||
@@ -30,5 +30,5 @@ "main": "lib/index.js", | ||
"fb-watchman": "^2.0.2", | ||
"flipper-common": "0.253.0", | ||
"flipper-common": "0.254.0", | ||
"fs-extra": "^11.1.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41307
586
Updatedflipper-common@0.254.0