Skip to content

Commit 4f77061

Browse files
Merge pull request #20 from meyerbaptiste/update_doc
Update the documentation
2 parents 1019a23 + d7d2329 commit 4f77061

File tree

4 files changed

+126
-112
lines changed

4 files changed

+126
-112
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
| Q | A
2+
| ------------- | ---
3+
| Bug fix? | yes/no
4+
| New feature? | yes/no
5+
| BC breaks? | no
6+
| Deprecations? | no
7+
| Tests pass? | yes
8+
| Fixed tickets | #1234, #5678
9+
| License | MIT
10+
| Doc PR | api-platform/doc#1234
11+
12+
*Please update this template with something that matches your PR*

CONTRIBUTING.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Contributing to API Platform
2+
3+
First of all, thank you for contributing, you're awesome!
4+
5+
To have your code integrated in the API Platform project, there is some rules to follow, but don't panic, it's easy!
6+
7+
## Reporting bugs
8+
9+
If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:
10+
11+
* Check the [project documentation available online](https://api-platform.com/docs/)
12+
13+
Then, if it appears that it's a real bug, you may report it using Github by following these 3 points:
14+
15+
* Check if the bug is not already reported!
16+
* A clear title to resume the issue
17+
* A description of the workflow needed to reproduce the bug,
18+
19+
> _NOTE:_ Don’t hesitate giving as much information as you can
20+
21+
## Pull requests
22+
23+
### Writing a Pull Request
24+
25+
First of all, you must decide on what branch your changes will be based. If the changes your are going to make are
26+
fully backward-compatible, you should base your changes on the latest stable branch.
27+
Otherwise, you should base your changes on the `master` branch.
28+
29+
### Testing your changes
30+
31+
Before sending a Pull Request, make sure the tests pass correctly:
32+
33+
```bash
34+
yarn test
35+
```
36+
37+
### Matching coding standards
38+
39+
The API Platform CRUD Generator project is inspired by the [Airbnb JavaScript style guide](https://github.com/airbnb/javascript).
40+
But don't worry, you can fix CS issues automatically using [ESLint](https://eslint.org/) tool:
41+
42+
```bash
43+
yarn fix
44+
```
45+
46+
And then, add fixed file to your commit before push.
47+
Be sure to add only **your modified files**. If another files are fixed by cs tools, just revert it before commit.
48+
49+
### Sending a Pull Request
50+
51+
When you send a PR, just make sure that:
52+
53+
* You add valid test cases (Behat and PHPUnit).
54+
* Tests are green.
55+
* You make a PR on the related documentation in the [api-platform/doc](https://github.com/api-platform/doc) repository.
56+
* You make the PR on the same branch you based your changes on. If you see commits
57+
that you did not make in your PR, you're doing it wrong.
58+
* Also don't forget to add a comment when you update a PR with a ping to [the maintainer](https://github.com/orgs/api-platform/people), so he/she will get a notification.
59+
* Squash your commits into one commit. (see the next chapter)
60+
61+
All Pull Requests must include the following header:
62+
63+
```markdown
64+
| Q | A
65+
| ------------- | ---
66+
| Bug fix? | yes/no
67+
| New feature? | yes/no
68+
| BC breaks? | no
69+
| Deprecations? | no
70+
| Tests pass? | yes
71+
| Fixed tickets | #1234, #5678
72+
| License | MIT
73+
| Doc PR | api-platform/doc#1234
74+
```
75+
76+
## Squash your commits
77+
78+
If you have 3 commits. So start with:
79+
80+
```bash
81+
git rebase -i HEAD~3
82+
```
83+
84+
An editor will be opened with your 3 commits, all prefixed by `pick`.
85+
86+
Replace all `pick` prefixes by `fixup` (or `f`) **except the first commit** of the list.
87+
88+
Save and quit the editor.
89+
90+
After that, all your commits where squashed into the first one and the commit message of the first commit.
91+
92+
If you would like to rename your commit message type:
93+
94+
```bash
95+
git commit --amend
96+
```
97+
98+
Now force push to update your PR:
99+
100+
```bash
101+
git push --force
102+
```
103+
104+
# License and copyright attribution
105+
106+
When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](LICENSE)
107+
and to transfer the copyright on the submitted code to Kévin Dunglas.
108+
109+
Be sure to you have the right to do that (if you are a professional, ask your company)!
110+
111+
If you include code from another project, please mention it in the Pull Request description and credit the original author.

README.md

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -24,88 +24,11 @@ Works especially well with APIs built with the [API Platform](https://api-platfo
2424
* The generated HTML code is accessible to people with disabilities ([ARIA](https://www.w3.org/WAI/intro/aria) support)
2525
* The Redux and the React Router configuration is also generated
2626

27-
## Installation and Usage
27+
## Documentation
2828

29-
Create a React application using [Facebook's Create React App](https://github.com/facebookincubator/create-react-app):
30-
31-
$ create-react-app my-app
32-
$ cd my-app
33-
34-
Install React Router, Redux, React Redux, React Router Redux, Redux Form and Redux Thunk (to handle AJAX requests):
35-
36-
$ yarn add redux react-redux redux-thunk redux-form react-router-dom react-router-redux prop-types
37-
38-
Install the generator globally:
39-
40-
$ yarn global add api-platform-generate-crud
41-
42-
Reference the Bootstrap CSS stylesheet in `public/index.html` (optional):
43-
44-
```html
45-
<!-- ... -->
46-
<title>React App</title>
47-
48-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
49-
</head>
50-
<!-- ... -->
51-
```
52-
53-
In the app directory, generate the files for the resource you want:
54-
55-
$ api-platform-generate-crud https://demo.api-platform.com src/ --resource foo
56-
# Replace the URL by the entrypoint of your Hydra-enabled API
57-
# Omit the resource flag to generate files for all resource types exposed by the API
58-
59-
The code is ready to be executed! Register the generated reducers and components in the `index.js` file, here is an example:
60-
61-
```javascript
62-
import React from 'react';
63-
import ReactDom from 'react-dom';
64-
import { createStore, combineReducers, applyMiddleware } from 'redux';
65-
import { Provider } from 'react-redux';
66-
import thunk from 'redux-thunk';
67-
import { reducer as form } from 'redux-form';
68-
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
69-
import createBrowserHistory from 'history/createBrowserHistory';
70-
import { syncHistoryWithStore, routerReducer as routing } from 'react-router-redux'
71-
72-
// Replace "foo" by the name of the resource type
73-
import foo from './reducers/foo/';
74-
import fooRoutes from './routes/foo';
75-
76-
const store = createStore(
77-
combineReducers({routing, form, foo}), // Don't forget to register the reducers here
78-
applyMiddleware(thunk),
79-
);
80-
81-
const history = syncHistoryWithStore(createBrowserHistory(), store);
82-
83-
ReactDom.render(
84-
<Provider store={store}>
85-
<Router history={history}>
86-
<Switch>
87-
{fooRoutes}
88-
<Route render={() => <h1>Not Found</h1>}/>
89-
</Switch>
90-
</Router>
91-
</Provider>,
92-
document.getElementById('root')
93-
);
94-
```
95-
96-
## [Troubleshooting](Troubleshooting.md)
97-
98-
## TODO
99-
100-
* Automatically normalize numbers
101-
* Generate E2E tests
102-
* Add a React Native generator
103-
104-
## Run tests
105-
106-
$ yarn test
107-
$ yarn lint
29+
The documentation of API Platform CRUD Generator can be browsed [on the official website](https://api-platform.com/docs/).
10830

10931
## Credits
11032

11133
Created by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).
34+
Commercial support available upon request.

Troubleshooting.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)