Skip to content
Merged
Changes from 2 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
15 changes: 15 additions & 0 deletions packages/create-react-admin/src/cli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@ const cli = meow(
--auth-provider Set the auth provider to use ("local-auth-provider" or "none")
--resource Add a resource that will be initialized with guessers (can be used multiple times). Set to "skip" to bypass the interactive resource step.
--install Set the package manager to use for installing dependencies ("yarn", "npm" or "skip" to bypass the interactive install step)
--basic Skip all the interactive steps and create a basic app with no data provider, no auth provider, no resources and no install step

Examples
$ create-admin-app my-admin
$ create-admin-app my-admin --data-provider ra-data-json-server --auth-provider local-auth-provider --resource posts --resource comments --install npm
$ create-admin-app my-admin --basic
`,
{
flags: {
help: {
type: 'boolean',
alias: 'h',
},
basic: {
type: 'boolean',
},
dataProvider: {
type: 'string',
choices: SupportedDataProviders.map(choice => choice.value),
Expand All @@ -49,6 +54,16 @@ const cli = meow(

if (cli.flags.h) {
cli.showHelp();
} else if (cli.flags.basic) {
render(
<App
name={cli.input.length > 0 ? cli.input[0] : undefined}
dataProvider="none"
authProvider="none"
resources={[]}
install="skip"
/>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can avoid an else if by declaring local dataProvider, authProvider, resource and skip variables, initialize them depending on the cli.flags and then render the App

} else {
render(
<App
Expand Down
Loading