Add a --basic flag to the create-react-admin package to skip interactive steps#10481
Merged
Add a --basic flag to the create-react-admin package to skip interactive steps#10481
--basic flag to the create-react-admin package to skip interactive steps#10481Conversation
djhi
suggested changes
Jan 30, 2025
Comment on lines
+57
to
+66
| } else if (cli.flags.basic) { | ||
| render( | ||
| <App | ||
| name={cli.input.length > 0 ? cli.input[0] : undefined} | ||
| dataProvider="none" | ||
| authProvider="none" | ||
| resources={[]} | ||
| install="skip" | ||
| /> | ||
| ); |
Contributor
There was a problem hiding this comment.
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
djhi
reviewed
Jan 31, 2025
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
djhi
suggested changes
Jan 31, 2025
Contributor
djhi
left a comment
There was a problem hiding this comment.
After testing, I notice that the generated App.tsx file still contains the guessers imports but they are not used anymore. You should modify generateAppFile.ts accordingly.
Member
I don't think that's a regression caused by this PR, plus it may be useful for beginners (and for the tutorial). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
To get a non-interactive `create-react-admin`, one must pass all options:
This is super verbose, especially in documentation.
Solution
Add a
--basicoption that replaces all the othersHow To Test
On the
xxbranch, build the cli:Create a new project with npx:
Create another one with the local version of the cli:
Compare folders:
Additional Checks
masterfor a bugfix, ornextfor a feature[ ] The PR includes unit tests (if not possible, describe why)[ ] The PR includes one or several stories (if not possible, describe why)helpflag)[ ] The documentation is up to date