diff --git a/.gitignore b/.gitignore index 919d110e1bd216..b331cd3cd3ea91 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,8 @@ project.xcworkspace /packages/react-native/ReactAndroid/hermes-engine/.cxx/ /packages/react-native/template/android/app/build/ /packages/react-native/template/android/build/ +/packages/helloworld/android/app/build/ +/packages/helloworld/android/build/ /packages/react-native-popup-menu-android/android/build/ /packages/react-native-test-library/android/build/ @@ -108,6 +110,7 @@ package-lock.json # Ruby Gems (Bundler) /packages/react-native/vendor /packages/react-native/template/vendor +/packages/helloworld/vendor .ruby-version /**/.ruby-version vendor/ @@ -116,6 +119,9 @@ vendor/ /packages/react-native/template/ios/build/ /packages/react-native/template/ios/Pods/ /packages/react-native/template/ios/Podfile.lock +/packages/helloworld/ios/build/ +/packages/helloworld/ios/Pods/ +/packages/helloworld/ios/Podfile.lock /packages/rn-tester/Gemfile.lock /packages/**/RCTLegacyInteropComponents.mm diff --git a/flow-typed/npm/commander_v12.x.x.js b/flow-typed/npm/commander_v12.x.x.js new file mode 100644 index 00000000000000..05b63e620be2ed --- /dev/null +++ b/flow-typed/npm/commander_v12.x.x.js @@ -0,0 +1,1003 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + * @oncall react_native + * @generated + */ + +// Flowtype definitions for commander +// Generated by Flowgen from a Typescript Definition +// Flowgen v1.21.0 + +declare module 'commander' { + declare type LiteralUnion = + | LiteralType + | {...BaseType, ...{[key: empty]: empty, ...}}; + + declare export class CommanderError mixins Error { + code: string; + exitCode: number; + message: string; + nestedError?: string; + + /** + * Constructs the CommanderError class + * @param exitCode - suggested exit code which could be used with process.exit + * @param code - an id string representing the error + * @param message - human-readable description of the error + * @constructor + */ + constructor(exitCode: number, code: string, message: string): this; + } + declare export class InvalidArgumentError mixins CommanderError { + /** + * Constructs the InvalidArgumentError class + * @param message - explanation of why argument is invalid + * @constructor + */ + constructor(message: string): this; + } + + declare export {InvalidArgumentError as InvalidOptionArgumentError}; + + export interface ErrorOptions { + /** + * an id string representing the error + */ + code?: string; + + /** + * suggested exit code which could be used with process.exit + */ + exitCode?: number; + } + declare export class Argument { + description: string; + required: boolean; + variadic: boolean; + defaultValue?: any; + defaultValueDescription?: string; + argChoices?: string[]; + + /** + * Initialize a new command argument with the given name and description. + * The default is that the argument is required, and you can explicitly + * indicate this with <> around the name. Put [] around the name for an optional argument. + */ + constructor(arg: string, description?: string): this; + + /** + * Return argument name. + */ + name(): string; + + /** + * Set the default value, and optionally supply the description to be displayed in the help. + */ + default(value: mixed, description?: string): this; + + /** + * Set the custom handler for processing CLI command arguments into argument values. + */ + argParser(fn: (value: string, previous: T) => T): this; + + /** + * Only allow argument value to be one of choices. + */ + choices(values: $ReadOnlyArray): this; + + /** + * Make argument required. + */ + argRequired(): this; + + /** + * Make argument optional. + */ + argOptional(): this; + } + declare export class Option { + flags: string; + description: string; + required: boolean; + optional: boolean; + variadic: boolean; + mandatory: boolean; + short?: string; + long?: string; + negate: boolean; + defaultValue?: any; + defaultValueDescription?: string; + presetArg?: mixed; + envVar?: string; + parseArg?: (value: string, previous: T) => T; + hidden: boolean; + argChoices?: string[]; + constructor(flags: string, description?: string): this; + + /** + * Set the default value, and optionally supply the description to be displayed in the help. + */ + default(value: mixed, description?: string): this; + + /** + * Preset to use when option used without option-argument, especially optional but also boolean and negated. + * The custom processing (parseArg) is called. + * @example ```ts + * new Option('--color').default('GREYSCALE').preset('RGB'); + * new Option('--donate [amount]').preset('20').argParser(parseFloat); + * ``` + */ + preset(arg: mixed): this; + + /** + * Add option name(s) that conflict with this option. + * An error will be displayed if conflicting options are found during parsing. + * @example ```ts + * new Option('--rgb').conflicts('cmyk'); + * new Option('--js').conflicts(['ts', 'jsx']); + * ``` + */ + conflicts(names: string | string[]): this; + + /** + * Specify implied option values for when this option is set and the implied options are not. + * + * The custom processing (parseArg) is not called on the implied values. + * @example program + * .addOption(new Option('--log', 'write logging information to file')) + * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' })); + */ + implies(optionValues: OptionValues): this; + + /** + * Set environment variable to check for option value. + * + * An environment variables is only used if when processed the current option value is + * undefined, or the source of the current value is 'default' or 'config' or 'env'. + */ + env(name: string): this; + + /** + * Calculate the full description, including defaultValue etc. + */ + fullDescription(): string; + + /** + * Set the custom handler for processing CLI option arguments into option values. + */ + argParser(fn: (value: string, previous: T) => T): this; + + /** + * Whether the option is mandatory and must have a value after parsing. + */ + makeOptionMandatory(mandatory?: boolean): this; + + /** + * Hide option in help. + */ + hideHelp(hide?: boolean): this; + + /** + * Only allow option value to be one of choices. + */ + choices(values: $ReadOnlyArray): this; + + /** + * Return option name. + */ + name(): string; + + /** + * Return option name, in a camelcase format that can be used + * as a object attribute key. + */ + attributeName(): string; + + /** + * Return whether a boolean option. + * + * Options are one of boolean, negated, required argument, or optional argument. + */ + isBoolean(): boolean; + } + declare export class Help { + /** + * output helpWidth, long lines are wrapped to fit + */ + helpWidth?: number; + sortSubcommands: boolean; + sortOptions: boolean; + showGlobalOptions: boolean; + constructor(): this; + + /** + * Get the command term to show in the list of subcommands. + */ + subcommandTerm(cmd: Command): string; + + /** + * Get the command summary to show in the list of subcommands. + */ + subcommandDescription(cmd: Command): string; + + /** + * Get the option term to show in the list of options. + */ + optionTerm(option: Option): string; + + /** + * Get the option description to show in the list of options. + */ + optionDescription(option: Option): string; + + /** + * Get the argument term to show in the list of arguments. + */ + argumentTerm(argument: Argument): string; + + /** + * Get the argument description to show in the list of arguments. + */ + argumentDescription(argument: Argument): string; + + /** + * Get the command usage to be displayed at the top of the built-in help. + */ + commandUsage(cmd: Command): string; + + /** + * Get the description for the command. + */ + commandDescription(cmd: Command): string; + + /** + * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one. + */ + visibleCommands(cmd: Command): Command[]; + + /** + * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one. + */ + visibleOptions(cmd: Command): Option[]; + + /** + * Get an array of the visible global options. (Not including help.) + */ + visibleGlobalOptions(cmd: Command): Option[]; + + /** + * Get an array of the arguments which have descriptions. + */ + visibleArguments(cmd: Command): Argument[]; + + /** + * Get the longest command term length. + */ + longestSubcommandTermLength(cmd: Command, helper: Help): number; + + /** + * Get the longest option term length. + */ + longestOptionTermLength(cmd: Command, helper: Help): number; + + /** + * Get the longest global option term length. + */ + longestGlobalOptionTermLength(cmd: Command, helper: Help): number; + + /** + * Get the longest argument term length. + */ + longestArgumentTermLength(cmd: Command, helper: Help): number; + + /** + * Calculate the pad width from the maximum term length. + */ + padWidth(cmd: Command, helper: Help): number; + + /** + * Wrap the given string to width characters per line, with lines after the first indented. + * Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted. + */ + wrap( + str: string, + width: number, + indent: number, + minColumnWidth?: number, + ): string; + + /** + * Generate the built-in help text. + */ + formatHelp(cmd: Command, helper: Help): string; + } + export type HelpConfiguration = $Rest; + export interface ParseOptions { + from: 'node' | 'electron' | 'user'; + } + export interface HelpContext { + error: boolean; + } + export interface AddHelpTextContext { + error: boolean; + command: Command; + } + export interface OutputConfiguration { + writeOut?: (str: string) => void; + writeErr?: (str: string) => void; + getOutHelpWidth?: () => number; + getErrHelpWidth?: () => number; + outputError?: (str: string, write: (str: string) => void) => void; + } + export type AddHelpTextPosition = + | 'beforeAll' + | 'before' + | 'after' + | 'afterAll'; + export type HookEvent = 'preSubcommand' | 'preAction' | 'postAction'; + export type OptionValueSource = LiteralUnion< + 'default' | 'config' | 'env' | 'cli' | 'implied', + string, + > | void; + export type OptionValues = {[key: string]: any, ...}; + declare export class Command { + args: string[]; + processedArgs: any[]; + +commands: $ReadOnlyArray; + +options: $ReadOnlyArray