[create-content-sdk-app] Add help flag output#494
Conversation
|
📦 Package Size and Test Coverage Report
|
illiakovalenko
left a comment
There was a problem hiding this comment.
Looks good 👍
A couple of minor suggestions below
Also, please, add a changeset, can be a "patch" version
| Templates: | ||
| nextjs | ||
| nextjs-app-router |
There was a problem hiding this comment.
We have a getAllTemplates() function, and it's used in main(), it returns the dynamic list of templates. Currently, when a new template is added, printHelp will silently fall out of sync.
Could you, please, accept here a list of templates and show them?
| console.log(`Usage: | ||
| create-content-sdk-app [template] [options] | ||
|
|
||
| Templates: | ||
| nextjs | ||
| nextjs-app-router | ||
|
|
||
| Options: | ||
| --template <name> Template to scaffold | ||
| --destination <path> Destination folder | ||
| --yes Use defaults and skip prompts where possible | ||
| --force Continue if destination is not empty | ||
| --noInstall Skip package install and lint fix | ||
| --silent Suppress normal output | ||
| --help, -h Show help`); | ||
| }; |
There was a problem hiding this comment.
A minor suggestion to add some styling
| console.log(`Usage: | |
| create-content-sdk-app [template] [options] | |
| Templates: | |
| nextjs | |
| nextjs-app-router | |
| Options: | |
| --template <name> Template to scaffold | |
| --destination <path> Destination folder | |
| --yes Use defaults and skip prompts where possible | |
| --force Continue if destination is not empty | |
| --noInstall Skip package install and lint fix | |
| --silent Suppress normal output | |
| --help, -h Show help`); | |
| }; | |
| console.log(`${chalk.bold('Usage:')} create-content-sdk-app ${chalk.cyan('[template]')} ${chalk.yellow('[options]')} | |
| ${chalk.bold('Arguments:')} | |
| ${chalk.cyan('template')} Template to scaffold (e.g. nextjs, nextjs-app-router) | |
| Templates: <--TODO - Show a dynamic list of templates --> | |
| nextjs | |
| nextjs-app-router | |
| ${chalk.bold('Options:')} | |
| ${chalk.yellow('--template')} ${chalk.dim('<name>')} Template to scaffold | |
| ${chalk.yellow('--destination')} ${chalk.dim('<path>')} Destination folder | |
| ${chalk.yellow('--yes')} Use defaults and skip prompts where possible | |
| ${chalk.yellow('--force')} Continue if destination is not empty | |
| ${chalk.yellow('--noInstall')} Skip package install and lint fix | |
| ${chalk.yellow('--silent')} Suppress normal output | |
| ${chalk.yellow('-h, --help')} Show help`); | |
| }; |
Description / Motivation
Fixes JSS-9643.
The create-content-sdk-app initializer now handles --help and -h before entering template selection or interactive prompts, displaying usage information and exiting the command flow.
Testing Details
Ran:
Note: lint completed with one existing warning in src/common/processes/transform.ts.
Types of changes