forked from react-native-community/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Migrate doctor command to TypeScript (3) (react-native-communi…
…ty#719) * Migrate packageManagers and iosDeploy to TS * Migrate xcode to TS Ignore TS import in index.js * Migrate watchman to TS * Migrate runAutomaticFix, nodeJS and androidSDK * Fix typings for androidSDK and envinfo * Fix androidNDK typings with envinfo update
- Loading branch information
Showing
11 changed files
with
69 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
...rc/commands/doctor/healthchecks/nodeJS.js → ...rc/commands/doctor/healthchecks/nodeJS.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
// @flow | ||
import Ora from 'ora'; | ||
// $FlowFixMe - converted to TS | ||
import versionRanges from '../versionRanges'; | ||
// $FlowFixMe - converted to TS | ||
import {doesSoftwareNeedToBeFixed} from '../checkInstallation'; | ||
// $FlowFixMe - converted to TS | ||
import {logManualInstallation} from './common'; | ||
import type {EnvironmentInfo, HealthCheckInterface} from '../types'; | ||
import {HealthCheckInterface} from '../types'; | ||
|
||
export default ({ | ||
export default { | ||
label: 'Node.js', | ||
getDiagnostics: async ({Binaries}: EnvironmentInfo) => ({ | ||
getDiagnostics: async ({Binaries}) => ({ | ||
version: Binaries.Node.version, | ||
needsToBeFixed: doesSoftwareNeedToBeFixed({ | ||
version: Binaries.Node.version, | ||
versionRange: versionRanges.NODE_JS, | ||
}), | ||
}), | ||
runAutomaticFix: async ({loader}: {loader: typeof Ora}) => { | ||
runAutomaticFix: async ({loader}) => { | ||
loader.fail(); | ||
|
||
logManualInstallation({ | ||
healthcheck: 'Node.js', | ||
url: 'https://nodejs.org/en/download/', | ||
}); | ||
}, | ||
}: HealthCheckInterface); | ||
} as HealthCheckInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
.../commands/doctor/healthchecks/watchman.js → .../commands/doctor/healthchecks/watchman.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
// @flow | ||
import Ora from 'ora'; | ||
// $FlowFixMe - converted to TS | ||
import versionRanges from '../versionRanges'; | ||
// $FlowFixMe - converted to TS | ||
import {doesSoftwareNeedToBeFixed} from '../checkInstallation'; | ||
// $FlowFixMe - converted to TS | ||
import {install} from '../../../tools/install'; | ||
import type {EnvironmentInfo} from '../types'; | ||
import {HealthCheckInterface} from '../types'; | ||
|
||
const label = 'Watchman'; | ||
|
||
export default { | ||
label, | ||
getDiagnostics: ({Binaries}: EnvironmentInfo) => ({ | ||
getDiagnostics: async ({Binaries}) => ({ | ||
needsToBeFixed: doesSoftwareNeedToBeFixed({ | ||
version: Binaries.Watchman.version, | ||
versionRange: versionRanges.WATCHMAN, | ||
}), | ||
}), | ||
runAutomaticFix: async ({loader}: typeof Ora) => | ||
runAutomaticFix: async ({loader}) => | ||
await install({ | ||
pkg: 'watchman', | ||
label, | ||
source: 'https://facebook.github.io/watchman/docs/install.html', | ||
loader, | ||
}), | ||
}; | ||
} as HealthCheckInterface; |
15 changes: 5 additions & 10 deletions
15
...src/commands/doctor/healthchecks/xcode.js → ...src/commands/doctor/healthchecks/xcode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
// @flow | ||
import Ora from 'ora'; | ||
// $FlowFixMe - converted to TS | ||
import versionRanges from '../versionRanges'; | ||
// $FlowFixMe - converted to TS | ||
import {doesSoftwareNeedToBeFixed} from '../checkInstallation'; | ||
// $FlowFixMe - converted to TS | ||
import {logManualInstallation} from './common'; | ||
import type {EnvironmentInfo, HealthCheckInterface} from '../types'; | ||
import {HealthCheckInterface} from '../types'; | ||
|
||
export default ({ | ||
export default { | ||
label: 'Xcode', | ||
getDiagnostics: async ({IDEs}: EnvironmentInfo) => ({ | ||
getDiagnostics: async ({IDEs}) => ({ | ||
needsToBeFixed: doesSoftwareNeedToBeFixed({ | ||
version: IDEs.Xcode.version.split('/')[0], | ||
versionRange: versionRanges.XCODE, | ||
}), | ||
}), | ||
runAutomaticFix: async ({loader}: {loader: typeof Ora}) => { | ||
runAutomaticFix: async ({loader}) => { | ||
loader.info(); | ||
|
||
logManualInstallation({ | ||
healthcheck: 'Xcode', | ||
url: 'https://developer.apple.com/xcode/', | ||
}); | ||
}, | ||
}: HealthCheckInterface); | ||
} as HealthCheckInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters