Skip to content

Commit 41937aa

Browse files
dunglasalanpoulain
andauthored
docs(create-client): rename Client Generator in Create Client (api-platform#1603)
* docs(create-client): rename Client Generator in Create Client * Update create-client/vuetify.md Co-authored-by: Alan Poulain <[email protected]> Co-authored-by: Alan Poulain <[email protected]>
1 parent 5ab0df4 commit 41937aa

34 files changed

+194
-181
lines changed

admin/getting-started.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@
44

55
If you use the [API Platform Distribution](../distribution/), API Platform Admin is already installed, you can skip this installation guide.
66

7-
Otherwise, all you need to install API Platform Admin is a JavaScript package manager. We recommend [Yarn](https://yarnpkg.com/) ([npm](https://www.npmjs.com/) is also supported).
7+
Otherwise, follow this guide.
88

99
If you don't have an existing React Application, create one using [Create React App](https://create-react-app.dev/):
1010

1111
```console
12-
yarn create react-app my-admin
13-
```
14-
15-
Go to the directory of your project:
16-
17-
```console
12+
npm init react-app my-admin
1813
cd my-admin
1914
```
2015

21-
Finally, install the `@api-platform/admin` library:
16+
Then, install the `@api-platform/admin` library:
2217

2318
```console
24-
yarn add @api-platform/admin
19+
npm install @api-platform/admin
2520
```
2621

2722
## Creating the Admin
@@ -69,6 +64,6 @@ docker compose exec php \
6964
bin/console cache:clear --env=prod
7065
```
7166

72-
Your new administration interface is ready! Type `yarn start` to try it!
67+
Your new administration interface is ready! Type `npm start` to try it!
7368

7469
Note: if you don't want to hardcode the API URL, you can [use an environment variable](https://create-react-app.dev/docs/adding-custom-environment-variables).

client-generator/nextjs.md

-64
This file was deleted.

core/angularjs-integration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AngularJS Integration
22

3-
Warning: for a new project, you should consider using [the API Platform's Progressive Web App generator](../client-generator/index.md)
3+
Warning: for a new project, you should consider using [the API Platform's Progressive Web App generator](../create-client/index.md)
44
(that supports React and Vue.js) instead of this Angular v1 integration.
55

66
## Restangular

core/deprecations.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class Parchment
3636
As you can see, to deprecate a resource, we just have to explain what the client should do to upgrade in the dedicated attribute.
3737

3838
The deprecation will automatically be taken into account by clients supporting the previously mentioned format, including
39-
[API Platform Admin](../admin/index.md), [API Platform Client Generator](../client-generator/index.md) and the lower level
40-
[api-doc-parser library](https://github.com/api-platform/api-doc-parser).
39+
[Admin](../admin/index.md), clients created with [Create Client](../create-client/index.md) and the lower level
40+
[api-doc-parser](https://github.com/api-platform/api-doc-parser) library.
4141

4242
Here is how it renders for OpenAPI in the built-in Swagger UI shipped with the framework:
4343

core/mercure.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ This header allows smart clients to automatically discover the Mercure hub.
4646

4747
![Mercure subscriptions](images/mercure-discovery.png)
4848

49-
Clients generated using [the API Platform Client Generator](../client-generator/index.md) will use this capability to automatically subscribe to Mercure updates when available:
49+
Clients generated using [Create Client](../create-client/index.md) will use this capability to automatically subscribe to Mercure updates when available:
5050

51-
![Screencast](../client-generator/images/client-generator-demo.gif)
51+
![Screencast](../create-client/images/create-client-demo.gif)
5252

5353
[Learn how to use the discovery capabilities of Mercure in your own clients](https://mercure.rocks/docs/ecosystem/awesome).
5454

client-generator/custom.md renamed to create-client/custom.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
# Custom Generator
22

3-
Client Generator provides support for many of the popular JS frameworks, but you may be using another framework or language and may need a solution adapted to your specific needs. For this cenario, you can write your own generator and pass it to the CLI using a path as the `-g` argument.
3+
Create Client provides support for many of the popular JS frameworks, but you may be using another framework or language and may need a solution adapted to your specific needs. For this cenario, you can write your own generator and pass it to the CLI using a path as the `-g` argument.
44

5-
You will probably want to extend or, at least, take a look at [BaseGenerator.js](https://github.com/api-platform/client-generator/blob/main/src/generators/BaseGenerator.js), since the library expects some methods to be available, as well as one of the [included generators](https://github.com/api-platform/client-generator/blob/main/src/generators/BaseGenerator.j) to make your own.
5+
You will probably want to extend or, at least, take a look at [BaseGenerator.js](https://github.com/api-platform/create-client/blob/main/src/generators/BaseGenerator.js), since the library expects some methods to be available, as well as one of the [included generators](https://github.com/api-platform/create-client/blob/main/src/generators/BaseGenerator.j) to make your own.
66

77
## Usage
88

99
```shell
10-
generate-api-platform-client -g "$(pwd)/path/to/custom/generator.js" -t "$(pwd)/path/to/templates"
10+
npm init @api-platform/client -g "$(pwd)/path/to/custom/generator.js" -t "$(pwd)/path/to/templates"
1111
```
1212

1313
The `-g` argument can point to any resolvable node module which means it can be a package dependency of the current project as well as any js file.
1414

1515
## Example
1616

17-
Client Generator makes use of the [Handlebars](https://handlebarsjs.com/) template engine. You can use any programming language or file type. Your generator can also pass data to your templates in any shape you want.
17+
Create Client makes use of the [Handlebars](https://handlebarsjs.com/) template engine. You can use any programming language or file type. Your generator can also pass data to your templates in any shape you want.
1818

1919
In this example, we'll create a simple [Rust](https://www.rust-lang.org) file defining a new `struct` and creating some instances of this `struct`.
2020

2121
### Generator
2222

2323
```js
2424
// ./Generator.js
25-
import BaseGenerator from "@api-platform/client-generator/lib/generators/BaseGenerator";
25+
import BaseGenerator from "@api-platform/create-client/lib/generators/BaseGenerator";
2626

2727
export default class extends BaseGenerator {
2828
constructor(params) {
@@ -94,7 +94,7 @@ fn main() {
9494
Then we can use our generator:
9595

9696
```shell
97-
generate-api-platform-client https://demo.api-platform.com out/ -g "$(pwd)/Generator.js" -t "$(pwd)/template"
97+
npm init @api-platform/client https://demo.api-platform.com out/ -g "$(pwd)/Generator.js" -t "$(pwd)/template"
9898
```
9999

100100
which will produces:

client-generator/index.md renamed to create-client/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# The API Platform Client Generator
1+
# API Platform Create Client
22

3-
Client Generator is the fastest way to scaffold fully featured webapps
3+
Create Client is the fastest way to scaffold fully featured webapps
44
and native mobile apps from APIs supporting the [Hydra](http://www.hydra-cg.com/) or [OpenAPI](https://www.openapis.org/) format.
55

6-
![Screencast](images/client-generator-demo.gif)
6+
![Screencast](images/create-client-demo.gif)
77

88
## Generated React and React Native Apps, Updated in Real Time
99

@@ -18,7 +18,7 @@ It is able to generate apps using the following frontend stacks:
1818
- [Vue.js](vuejs.md)
1919
- [Or bring your custom generator](custom.md)
2020

21-
Client Generator works especially well with APIs built with the [API Platform](https://api-platform.com) framework.
21+
Create Client works especially well with APIs built with the [API Platform](https://api-platform.com) framework.
2222

2323
## Features
2424

create-client/nextjs.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Next.js Generator
2+
3+
![List screenshot](images/nextjs/create-client-nextjs-list.png)
4+
5+
The Next.js generator scaffolds components for Server Side Rendered applications using [Next.js](https://nextjs.org/).
6+
7+
## Install
8+
9+
The easiest way to get started is to install [the API Platform distribution](../distribution/index.md).
10+
It contains a Next.js skeleton generated with Create Next App,
11+
a development Docker container to serve the webapp, and all the API Platform components you may need, including an API server
12+
supporting Hydra and OpenAPI.
13+
14+
If you use API Platform, jump to the next section!
15+
16+
Alternatively, create a Next.js application by executing:
17+
18+
```console
19+
# using pnpm (recommended)
20+
pnpm create next-app --typescript
21+
# or using npm
22+
npm init next-app --typescript
23+
# or using yarn
24+
yarn create next-app --typescript
25+
```
26+
27+
Install the required dependencies:
28+
29+
```console
30+
# using pnpm
31+
pnpm install isomorphic-unfetch formik react-query
32+
# or using npm
33+
npm install isomorphic-unfetch formik react-query
34+
# or using yarn
35+
yarn add isomorphic-unfetch formik react-query
36+
```
37+
38+
## Generating Routes
39+
40+
If you use the API Platform distribution, generating all the code you need for a given resource is as simple as running the following command:
41+
42+
```console
43+
docker compose exec pwa \
44+
pnpm create @api-platform/client --resource book -g next
45+
```
46+
47+
Omit the resource flag to generate files for all resource types exposed by the API.
48+
49+
If you don't use the standalone installation, run the following command instead:
50+
51+
```console
52+
# using pnpm
53+
pnpm create @api-platform/client https://demo.api-platform.com . --generator next --resource book
54+
# or using npm
55+
npm init @api-platform/client https://demo.api-platform.com . --generator next --resource book
56+
# or using yarn
57+
yarn create @api-platform/client https://demo.api-platform.com . --generator next --resource book
58+
```
59+
60+
Replace the URL by the entrypoint of your Hydra-enabled API.
61+
You can also use an OpenAPI documentation with `-f openapi3`.
62+
63+
The code has been generated, and is ready to be executed!
64+
65+
## Starting the Project
66+
67+
You can launch the server with
68+
69+
```console
70+
# using pnpm
71+
pnpm dev
72+
# or using npm
73+
npm run dev
74+
# or using yarn
75+
yarn dev
76+
```
77+
78+
Go to `http://localhost:3000/books/` to start using your app.
79+
80+
## Screenshots
81+
82+
![List](images/nextjs/create-client-nextjs-list.png)
83+
![Show](images/nextjs/create-client-nextjs-show.png)

client-generator/nuxtjs.md renamed to create-client/nuxtjs.md

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
# Nuxt.js Generator
22

3-
The Nuxt.js Client Generator generates components for Server Side Rendered applications using [Nuxt.js](https://nuxtjs.org/) and [Vuetify](https://vuetifyjs.com/).
3+
The Nuxt.js generator scaffolds components for Server Side Rendered applications using [Nuxt.js](https://nuxtjs.org/) and [Vuetify](https://vuetifyjs.com/).
44

55
## Install
66

77
### Nuxt
88

99
Create a [Nuxt.js application](https://nuxtjs.org/guides/get-started/installation#using-create-nuxt-app).
10-
The easiest way is to execute:
1110

1211
```console
13-
npx create-nuxt-app your-app-name
14-
```
15-
16-
or:
17-
18-
```console
19-
yarn create nuxt-app your-app-name
12+
npm init nuxt-app your-app-name
2013
```
2114

2215
It will ask you some questions, you can use these answers:
2316

2417
```console
2518
Project name: your-app-name
2619
Programming language: JavaScript
27-
Package manager: Yarn
20+
Package manager: NPM
2821
UI framework: Vuetify.js
2922
Nuxt.js modules: None
3023
Linting tools: Prettier, Lint staged files
@@ -38,8 +31,8 @@ Deployment target: Static (Static/JAMStack hosting)
3831
Install required dependencies:
3932

4033
```console
41-
yarn add moment lodash vue-i18n vuelidate vuex-map-fields nuxt-i18n
42-
yarn add --dev @nuxtjs/vuetify @nuxtjs/fontawesome
34+
npm install moment lodash vue-i18n vuelidate vuex-map-fields nuxt-i18n
35+
npm install --dev @nuxtjs/vuetify @nuxtjs/fontawesome
4336
```
4437

4538
## Updating Nuxt Config
@@ -61,11 +54,11 @@ Update your `nuxt.config.js` with following:
6154
## Generating Routes
6255

6356
```console
64-
npx @api-platform/client-generator https://demo.api-platform.com . --generator nuxt
65-
# You can also use an OpenAPI documentation with `-f openapi3`.
57+
npm init @api-platform/client https://demo.api-platform.com . --generator nuxt
6658
```
6759

6860
Replace the URL by the entrypoint of your Hydra-enabled API.
61+
You can also use an OpenAPI documentation with `-f openapi3`.
6962

7063
**Note:** Omit the resource flag to generate files for all resource types exposed by the API.
7164

@@ -148,12 +141,12 @@ export default {
148141
You can launch the server with:
149142

150143
```console
151-
yarn dev
144+
npm run dev
152145
````
153146

154147
Go to `https://localhost:3000/books/` to start using your app.
155148

156149
## Screenshots
157150

158-
![List](images/nuxtjs/client-generator-nuxtjs-list.png)
159-
![Edit](images/nuxtjs/client-generator-nuxtjs-edit.png)
151+
![List](images/nuxtjs/create-client-nuxtjs-list.png)
152+
![Edit](images/nuxtjs/create-client-nuxtjs-edit.png)

client-generator/quasar.md renamed to create-client/quasar.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ cd my-app
1111
In the app directory, generate the files for the resource you want:
1212

1313
```console
14-
npx @api-platform/client-generator https://demo.api-platform.com src/ --generator quasar --resource foo
15-
# You can also use an OpenAPI documentation with `-f openapi3`.
14+
npm init @api-platform/client https://demo.api-platform.com src/ --generator quasar --resource foo
1615
```
1716

1817
Replace the URL by the entrypoint of your Hydra-enabled API.
18+
You can also use an OpenAPI documentation with `-f openapi3`.
19+
1920
Omit the resource flag to generate files for all resource types exposed by the API.
2021

2122
The code is ready to be executed! Register the generated routes:

0 commit comments

Comments
 (0)