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

Fix create react admin fakerest #10502

Merged
merged 6 commits into from
Feb 11, 2025
Merged

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Feb 7, 2025

Problem

Fixes #10493

  • create-react-admin ignore custom resources when using ra-data-fakerest
  • The generated App.tsx file is incorrectly formatted:
import { Admin, Resource, ListGuesser, EditGuesser, ShowGuesser } from 'react-admin';
import { Layout } from './Layout';
import { dataProvider } from './dataProvider';


export const App = () => (
    <Admin
        layout={Layout}
        dataProvider={dataProvider}
        >
        <Resource name="books" list={ListGuesser} edit={EditGuesser} show={ShowGuesser} />
                <Resource name="authors" list={ListGuesser} edit={EditGuesser} show={ShowGuesser} />
    </Admin>
);

    

Solution

  • Allow to override resources by specifying them using the CLI resource option
  • Fix formatting

How To Test

  1. make build-create-react-admin install

  2. ./node_modules/.bin/create-react-admin myadmin --data-provider ra-data-fakerest --auth-provider local-auth-provider --resource books --resource authors --install skip

  • Check the generated App.tsx file contains only the books and authors resources.
  • Check the generated app does not contain an App.spec.tsx file
  • Check the generated App.tsx file is correctly formatted
  1. delete the generated app and run ./node_modules/.bin/create-react-admin myadmin --data-provider ra-data-fakerest --auth-provider none --resource books --resource authors --install skip (no auth)
  • Check all the points in 2
  1. delete the generated app and run ./node_modules/.bin/create-react-admin myadmin --data-provider ra-data-fakerest --auth-provider none --install skip (no auth)
  • Check the generated App.tsx file contains only the posts and comments resources.
  • Check the generated app contains an App.spec.tsx file
  • Check the generated App.tsx file is correctly formatted

Additional Checks

  • The PR targets master for a bugfix, or next for a feature

@djhi djhi added the RFR Ready For Review label Feb 7, 2025
@djhi djhi requested a review from slax57 February 11, 2025 09:07
@slax57 slax57 added this to the 5.5.4 milestone Feb 11, 2025
@slax57 slax57 merged commit 42f98f3 into master Feb 11, 2025
16 checks passed
@slax57 slax57 deleted the fix-create-react-admin-fakerest branch February 11, 2025 14:49
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.

create-react-admin ignores resource option when using ra-data-fakerest
3 participants