Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create-react-admin #8833

Merged
merged 25 commits into from Apr 28, 2023
Merged

Add create-react-admin #8833

merged 25 commits into from Apr 28, 2023

Conversation

djhi
Copy link
Contributor

@djhi djhi commented Apr 13, 2023

Problem

It can be long and confusing to start a new react-admin project.

Solution

A CLI that bootstrap a project after asking what dataProvider, authProvider and resources should be added.

This PR introduces a first basic version of this tool.

Tasks

  • Initialize a new TS project using Vite
  • Supports a few data providers
  • Supports local auth provider
  • Generate resources using guessers
  • Build README from templates
create-admin-app-fakerest.webm
create-admin-app-json.webm

@djhi djhi added the RFR Ready For Review label Apr 13, 2023
@fzaninotto
Copy link
Member

Could you add a screencast of the current UI? Also, tests fail.

@smeng9
Copy link
Contributor

smeng9 commented Apr 14, 2023

With the new create-react-admin we can also consider deprecate the create-react-app in the documentation, because even facebook is no longer promoting using this to bootstrap a new project on the new react.dev website .

@djhi
Copy link
Contributor Author

djhi commented Apr 14, 2023

With the new create-react-admin we can also consider deprecate the create-react-app in the documentation, because even facebook is no longer promoting using this to bootstrap a new project on the new react.dev website .

Indeed, even though that's not related at all.

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

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

Code seems good, and I learned some tricks with it so thanks! 🙂

Could you add a Readme though, and a makefile target to build it?

return {};
};

const initializeProjectDirectory = (projectName: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

you should support projectName being an absolute path.

E.g. I tried with projectName='~/workspaces/my-test-admin' and it failed with

Error: ENOENT: no such file or directory, mkdir '/home/user/workspaces/react-admin/packages/create-react-admin/home/user/workspaces/my-test-admin'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice to have. V2 imo

@slax57
Copy link
Contributor

slax57 commented Apr 24, 2023

I have a warning in the console after completing the wizard:

Warning: Each child in a list should have a unique "key" prop.

It seems to be located in the (cli) App component.

@slax57
Copy link
Contributor

slax57 commented Apr 24, 2023

Another thing I saw is that we are using the full path as the package's name in the generated package.json.
We should only use the folder's name instead.
(my-test-admin in this example)

2023-04-24_14-20

@slax57 slax57 requested a review from fzaninotto April 24, 2023 14:24
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

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

Love it! This really streamlines the developer onboarding.

packages/create-react-admin/src/app.tsx Show resolved Hide resolved
packages/create-react-admin/src/app.tsx Outdated Show resolved Hide resolved
packages/create-react-admin/src/app.tsx Outdated Show resolved Hide resolved
packages/create-react-admin/src/cli.tsx Show resolved Hide resolved
packages/create-react-admin/templates/common/index.html Outdated Show resolved Hide resolved
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

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

💯

Kudos, that's a great feature!

@fzaninotto fzaninotto merged commit 1298e69 into next Apr 28, 2023
7 of 9 checks passed
@fzaninotto fzaninotto deleted the create-admin-app branch April 28, 2023 13:09
@fzaninotto fzaninotto added this to the 4.10.0 milestone Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants