Skip to content
Merged
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
27 changes: 17 additions & 10 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 @@ -50,19 +55,21 @@ const cli = meow(
if (cli.flags.h) {
cli.showHelp();
} else {
const dataProvider = cli.flags.basic ? 'none' : cli.flags.dataProvider;
const authProvider = cli.flags.basic ? 'none' : cli.flags.authProvider;
const install = cli.flags.basic ? 'skip' : cli.flags.install;
const resources =
cli.flags.basic || cli.flags.resource.includes('skip')
? []
: cli.flags.resource;

render(
<App
name={cli.input.length > 0 ? cli.input[0] : undefined}
dataProvider={cli.flags.dataProvider}
authProvider={cli.flags.authProvider}
resources={
cli.flags.resource.includes('skip')
? []
: cli.flags.resource.length > 0
? cli.flags.resource
: undefined
}
install={cli.flags.install}
dataProvider={dataProvider}
authProvider={authProvider}
resources={resources}
install={install}
/>
);
}
Loading