(cmd: Command)
| 907 | |
| 908 | // Helper to configure create command options |
| 909 | function configureCreateCommand(cmd: Command) { |
| 910 | addHiddenAgentFlag(cmd) |
| 911 | cmd.argument('[project-name]', 'name of the project') |
| 912 | |
| 913 | if (!defaultFramework) { |
| 914 | cmd.option<string>( |
| 915 | '--framework <type>', |
| 916 | `project framework (${availableFrameworks.join(', ')})`, |
| 917 | (value) => { |
| 918 | if (value.toLowerCase() === 'react-cra') { |
| 919 | return 'react' |
| 920 | } |
| 921 | |
| 922 | if ( |
| 923 | !availableFrameworks.some( |
| 924 | (f) => f.toLowerCase() === value.toLowerCase(), |
| 925 | ) |
| 926 | ) { |
| 927 | throw new InvalidArgumentError( |
| 928 | `Invalid framework: ${value}. Only the following are allowed: ${availableFrameworks.join(', ')}`, |
| 929 | ) |
| 930 | } |
| 931 | return value |
| 932 | }, |
| 933 | ) |
| 934 | } |
| 935 | |
| 936 | cmd |
| 937 | .option( |
| 938 | '--starter [url-or-id]', |
| 939 | 'DEPRECATED: use --template. Initializes from a template URL or built-in id', |
| 940 | false, |
| 941 | ) |
| 942 | .option('--template-id <id>', 'initialize using a built-in template id') |
| 943 | .option( |
| 944 | '--template [url-or-id]', |
| 945 | 'initialize this project from a template URL or built-in template id', |
| 946 | ) |
| 947 | .option('--no-install', 'skip installing dependencies') |
| 948 | .option<PackageManager>( |
| 949 | `--package-manager <${SUPPORTED_PACKAGE_MANAGERS.join('|')}>`, |
| 950 | `Explicitly tell the CLI to use this package manager`, |
| 951 | (value) => { |
| 952 | if (!SUPPORTED_PACKAGE_MANAGERS.includes(value as PackageManager)) { |
| 953 | throw new InvalidArgumentError( |
| 954 | `Invalid package manager: ${value}. The following are allowed: ${SUPPORTED_PACKAGE_MANAGERS.join( |
| 955 | ', ', |
| 956 | )}`, |
| 957 | ) |
| 958 | } |
| 959 | return value as PackageManager |
| 960 | }, |
| 961 | ) |
| 962 | .option( |
| 963 | '--dev-watch <path>', |
| 964 | 'Watch a framework directory for changes and auto-rebuild', |
| 965 | ) |
| 966 | .option('--run-dev', 'Run the app dev server alongside dev-watch', false) |
no test coverage detected