Skip to content
Closed
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
8 changes: 4 additions & 4 deletions packages/cli-hermes/src/profileHermes/index.ts
Original file line number Diff line number Diff line change
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,9 @@ export default {
description: 'Generates the JS bundle and source map',
},
{
name: '--port [number]',
name: '--port <number>',
default: process.env.RCT_METRO_PORT || 8081,
parse: (val: number) => String(val),
parse: Number,
},
],
examples: [
Expand Down
6 changes: 3 additions & 3 deletions packages/cli-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export type CommandFunction<Args = Object> = (
args: Args,
) => Promise<void> | void;

export type OptionValue = string | boolean | number;
export type OptionValue = string | boolean | number | OptionValue[];

export type CommandOption<T = (ctx: Config) => OptionValue> = {
name: string;
description?: string;
parse?: (val: string) => any;
description: string;
parse?: (val: string) => OptionValue;
default?: OptionValue | T;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@react-native-community/cli-types": "^5.0.1-alpha.0",
"chalk": "^3.0.0",
"command-exists": "^1.2.8",
"commander": "^2.19.0",
"commander": "^6.2.0",
"cosmiconfig": "^5.1.0",
"deepmerge": "^3.2.0",
"envinfo": "^7.7.2",
Expand Down
20 changes: 10 additions & 10 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),
parse: Number,
},
{
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
6 changes: 2 additions & 4 deletions packages/cli/src/commands/link/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,12 @@ export default {
name: 'link [packageName]',
options: [
{
name: '--platforms [list]',
name: '--platforms <list...>',
description: 'Scope linking to specified platforms',
parse: (val: string) => val.toLowerCase().split(','),
Comment thread
grabbou marked this conversation as resolved.
Resolved
},
{
name: '--all [boolean]',
name: '--all',
description: 'Link all native modules and assets',
parse: (val: string) => val.toLowerCase().split(','),
},
],
};
33 changes: 15 additions & 18 deletions packages/cli/src/commands/start/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,55 +15,52 @@ export default {
description: 'starts the webserver',
options: [
{
name: '--port [number]',
parse: (val: string) => Number(val),
name: '--port <number>',
default: process.env.RCT_METRO_PORT || 8081,
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),
parse: Number,
},
{
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 +73,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
Loading