-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: convert command options and dependencyConfig into getters
- Loading branch information
1 parent
6eb9595
commit dd15e98
Showing
10 changed files
with
178 additions
and
136 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
4 changes: 3 additions & 1 deletion
4
packages/cli-platform-apple/src/commands/logCommand/logOptions.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
97 changes: 51 additions & 46 deletions
97
packages/cli-platform-apple/src/commands/runCommand/runOptions.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,48 +1,53 @@ | ||
import {getDefaultUserTerminal} from '@react-native-community/cli-tools'; | ||
import {buildOptions} from '../buildCommand/buildOptions'; | ||
import {BuilderCommand} from '../../types'; | ||
import {getPlatformInfo} from './getPlatformInfo'; | ||
import {getBuildOptions} from '../buildCommand/buildOptions'; | ||
|
||
export const runOptions = [ | ||
{ | ||
name: '--no-packager', | ||
description: 'Do not launch packager while running the app', | ||
}, | ||
{ | ||
name: '--port <number>', | ||
default: process.env.RCT_METRO_PORT || 8081, | ||
parse: Number, | ||
}, | ||
{ | ||
name: '--terminal <string>', | ||
description: | ||
'Launches the Metro Bundler in a new window using the specified terminal path.', | ||
default: getDefaultUserTerminal(), | ||
}, | ||
{ | ||
name: '--binary-path <string>', | ||
description: | ||
'Path relative to project root where pre-built .app binary lives.', | ||
}, | ||
{ | ||
name: '--list-devices', | ||
description: | ||
'List all available iOS devices and simulators and let you choose one to run the app. ', | ||
}, | ||
{ | ||
name: '--simulator <string>', | ||
description: | ||
'Explicitly set the simulator to use. Optionally set the iOS version ' + | ||
'between parentheses at the end to match an exact version: ' + | ||
'"iPhone 15 (17.0)"', | ||
}, | ||
{ | ||
name: '--device <string>', | ||
description: | ||
'Explicitly set the device to use by name. The value is not required ' + | ||
'if you have a single device connected.', | ||
}, | ||
{ | ||
name: '--udid <string>', | ||
description: 'Explicitly set the device to use by UDID', | ||
}, | ||
...buildOptions, | ||
]; | ||
export const getRunOptions = ({platformName}: BuilderCommand) => { | ||
const {readableName} = getPlatformInfo(platformName); | ||
const isMac = platformName === 'macos'; | ||
return [ | ||
{ | ||
name: '--no-packager', | ||
description: 'Do not launch packager while running the app', | ||
}, | ||
{ | ||
name: '--port <number>', | ||
default: process.env.RCT_METRO_PORT || 8081, | ||
parse: Number, | ||
}, | ||
{ | ||
name: '--terminal <string>', | ||
description: | ||
'Launches the Metro Bundler in a new window using the specified terminal path.', | ||
default: getDefaultUserTerminal(), | ||
}, | ||
{ | ||
name: '--binary-path <string>', | ||
description: | ||
'Path relative to project root where pre-built .app binary lives.', | ||
}, | ||
{ | ||
name: '--list-devices', | ||
description: `List all available ${readableName} devices and simulators and let you choose one to run the app. `, | ||
}, | ||
{ | ||
name: '--udid <string>', | ||
description: 'Explicitly set the device to use by UDID', | ||
}, | ||
!isMac && { | ||
name: '--simulator <string>', | ||
description: | ||
`Explicitly set the simulator to use. Optionally set the ${readableName} version ` + | ||
'between parentheses at the end to match an exact version: ' + | ||
'"iPhone 15 (17.0)"', | ||
}, | ||
!isMac && { | ||
name: '--device <string>', | ||
description: | ||
'Explicitly set the device to use by name. The value is not required ' + | ||
'if you have a single device connected.', | ||
}, | ||
...getBuildOptions({platformName}), | ||
]; | ||
}; |
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
Oops, something went wrong.