Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/cli-hermes/src/profileHermes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Options = {
raw?: boolean;
sourcemapPath?: string;
generateSourcemap?: boolean;
port?: string;
port: string;
};

async function profileHermes(
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
func: profileHermes,
options: [
{
name: '--filename [string]',
name: '--filename <string>',
description:
'File name of the profile to be downloaded, eg. sampling-profiler-trace8593107139682635366.cpuprofile',
},
Expand All @@ -53,7 +53,7 @@ export default {
'Pulls the original Hermes tracing profile without any transformation',
},
{
name: '--sourcemap-path [string]',
name: '--sourcemap-path <string>',
description:
'The local path to your source map file, eg. /tmp/sourcemap.json',
},
Expand All @@ -62,9 +62,8 @@ export default {
description: 'Generates the JS bundle and source map',
},
{
name: '--port [number]',
default: process.env.RCT_METRO_PORT || 8081,
parse: (val: number) => String(val),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. Values to be parsed are always string.

name: '--port <number>',
default: `${process.env.RCT_METRO_PORT || 8081}`,
},
],
examples: [
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/src/commands/bundle/bundleCommandLineArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export default [
'Path to the root JS file, either absolute or relative to JS root',
},
{
name: '--platform [string]',
name: '--platform <string>',
description: 'Either "ios" or "android"',
default: 'ios',
},
{
name: '--transformer [string]',
name: '--transformer <string>',
description: 'Specify a custom transformer to be used',
},
{
Expand All @@ -63,26 +63,26 @@ export default [
'File name where to store the resulting bundle, ex. /tmp/groups.bundle',
},
{
name: '--bundle-encoding [string]',
name: '--bundle-encoding <string>',
description:
'Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).',
default: 'utf8',
},
{
name: '--max-workers [number]',
name: '--max-workers <number>',
description:
'Specifies the maximum number of workers the worker-pool ' +
'will spawn for transforming files. This defaults to the number of the ' +
'cores available on your machine.',
parse: (workers: string) => Number(workers),
},
{
name: '--sourcemap-output [string]',
name: '--sourcemap-output <string>',
description:
'File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map',
},
{
name: '--sourcemap-sources-root [string]',
name: '--sourcemap-sources-root <string>',
description:
"Path to make sourcemap's sources entries relative to, ex. /root/dir",
},
Expand All @@ -92,12 +92,12 @@ export default [
default: false,
},
{
name: '--assets-dest [string]',
name: '--assets-dest <string>',
description:
'Directory name where to store assets referenced in the bundle',
},
{
name: '--unstable-transform-profile [string]',
name: '--unstable-transform-profile <string>',
description:
'Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default',
},
Expand All @@ -113,7 +113,7 @@ export default [
default: false,
},
{
name: '--config [string]',
name: '--config <string>',
description: 'Path to the CLI configuration file',
parse: (val: string) => path.resolve(val),
},
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export default {
'Initialize a new React Native project named <projectName> in a directory of the same name.',
options: [
{
name: '--version [string]',
name: '--version <string>',
description: 'Shortcut for `--template react-native@version`',
},
{
name: '--template [string]',
name: '--template <string>',
description:
'Uses a custom template. Valid arguments are the ones supported by `yarn add [package]` or `npm install [package]`, if you are using `--npm` option',
},
Expand All @@ -21,11 +21,11 @@ export default {
description: 'Forces using npm for initialization',
},
{
name: '--directory [string]',
name: '--directory <string>',
description: 'Uses a custom directory instead of `<projectName>`.',
},
{
name: '--title [string]',
name: '--title <string>',
description: 'Uses a custom app title name for application',
},
{
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/link/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ export default {
parse: (val: string) => val.toLowerCase().split(','),
},
{
name: '--all [boolean]',
name: '--all',
description: 'Link all native modules and assets',
parse: (val: string) => val.toLowerCase().split(','),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one, we don't support comma separated values, nor --all true, so just sticking to --all.

},
],
};
26 changes: 13 additions & 13 deletions packages/cli/src/commands/start/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,55 @@ export default {
description: 'starts the webserver',
options: [
{
name: '--port [number]',
parse: (val: string) => Number(val),
name: '--port <number>',
parse: Number,
},
{
name: '--host [string]',
name: '--host <string>',
default: '',
},
{
name: '--projectRoot [path]',
name: '--projectRoot <path>',
description: 'Path to a custom project root',
parse: (val: string) => path.resolve(val),
},
{
name: '--watchFolders [list]',
name: '--watchFolders <list>',
description:
'Specify any additional folders to be added to the watch list',
parse: (val: string) =>
val.split(',').map<string>((folder: string) => path.resolve(folder)),
},
{
name: '--assetPlugins [list]',
name: '--assetPlugins <list>',
description:
'Specify any additional asset plugins to be used by the packager by full filepath',
parse: (val: string) => val.split(','),
},
{
name: '--sourceExts [list]',
name: '--sourceExts <list>',
description:
'Specify any additional source extensions to be used by the packager',
parse: (val: string) => val.split(','),
},
{
name: '--max-workers [number]',
name: '--max-workers <number>',
description:
'Specifies the maximum number of workers the worker-pool ' +
'will spawn for transforming files. This defaults to the number of the ' +
'cores available on your machine.',
parse: (workers: string) => Number(workers),
},
{
name: '--transformer [string]',
name: '--transformer <string>',
description: 'Specify a custom transformer to be used',
},
{
name: '--reset-cache, --resetCache',
description: 'Removes cached files',
},
{
name: '--custom-log-reporter-path, --customLogReporterPath [string]',
name: '--custom-log-reporter-path, --customLogReporterPath <string>',
description:
'Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter',
},
Expand All @@ -76,15 +76,15 @@ export default {
description: 'Enables https connections to the server',
},
{
name: '--key [path]',
name: '--key <path>',
description: 'Path to custom SSL key',
},
{
name: '--cert [path]',
name: '--cert <path>',
description: 'Path to custom SSL cert',
},
{
name: '--config [string]',
name: '--config <string>',
description: 'Path to the CLI configuration file',
parse: (val: string) => path.resolve(val),
},
Expand Down
3 changes: 0 additions & 3 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {logger, CLIError} from '@react-native-community/cli-tools';

import {detachedCommands, projectCommands} from './commands';
import init from './commands/init/initCompat';
import assertRequiredOptions from './tools/assertRequiredOptions';
import loadConfig from './tools/config';

const pkgJson = require('../package.json');
Expand Down Expand Up @@ -130,7 +129,6 @@ function attachCommand<IsDetached extends boolean>(
command: Command<IsDetached>,
...rest: IsDetached extends false ? [Config] : []
): void {
const options = command.options || [];
const cmd = commander
.command(command.name)
.action(async function handleAction(
Expand All @@ -141,7 +139,6 @@ function attachCommand<IsDetached extends boolean>(
const argv = Array.from(args).slice(0, -1);

try {
assertRequiredOptions(options, passedOptions);
if (isDetachedCommand(command)) {
await command.func(argv, passedOptions);
} else {
Expand Down
38 changes: 0 additions & 38 deletions packages/cli/src/tools/assertRequiredOptions.ts

This file was deleted.

23 changes: 11 additions & 12 deletions packages/platform-android/src/commands/runAndroid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,39 +318,39 @@ export default {
func: runAndroid,
options: [
{
name: '--root [string]',
name: '--root <string>',
description:
'[DEPRECATED - root is discovered automatically] Override the root directory for the android build (which contains the android directory)',
default: '',
},
{
name: '--variant [string]',
name: '--variant <string>',
description: "Specify your app's build variant",
default: 'debug',
},
{
name: '--appFolder [string]',
name: '--appFolder <string>',
description:
'[DEPRECATED – use "project.android.appName" in react-native.config.js] Specify a different application folder name for the android source. If not, we assume is "app"',
},
{
name: '--appId [string]',
name: '--appId <string>',
description:
'Specify an applicationId to launch after build. If not specified, `package` from AndroidManifest.xml will be used.',
default: '',
},
{
name: '--appIdSuffix [string]',
name: '--appIdSuffix <string>',
description: 'Specify an applicationIdSuffix to launch after build.',
default: '',
},
{
name: '--main-activity [string]',
name: '--main-activity <string>',
description: 'Name of the activity to start',
default: 'MainActivity',
},
{
name: '--deviceId [string]',
name: '--deviceId <string>',
description:
'builds your app and starts it on a specific device/simulator with the ' +
'given device id (listed by running "adb devices" on the command line).',
Expand All @@ -360,26 +360,25 @@ export default {
description: 'Do not launch packager while building',
},
{
name: '--port [number]',
name: '--port <number>',
default: process.env.RCT_METRO_PORT || 8081,
parse: (val: string) => Number(val),
parse: Number,
},
{
name: '--terminal [string]',
name: '--terminal <string>',
description:
'Launches the Metro Bundler in a new window using the specified terminal path.',
default: getDefaultUserTerminal(),
},
{
name: '--tasks [list]',
name: '--tasks <list>',
description: 'Run custom Gradle tasks. By default it\'s "installDebug"',
parse: (val: string) => val.split(','),
},
{
name: '--no-jetifier',
description:
'Do not run "jetifier" – the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don\'t support AndroidX yet. See more at: https://www.npmjs.com/package/jetifier.',
default: false,
},
],
};
Loading