1 | # gooddata-create-gooddata-react-app
|
2 |
|
3 | (c) 2019-2021 GoodData Corporation
|
4 | This repository is under the BSD-3-clause license available in the LICENSE file and includes additional third party packages under separate open source licenses as specified in the NOTICES file.
|
5 |
|
6 | # GoodData Create React App
|
7 |
|
8 | This is a CLI tool that creates a new React project with a proxy set up to connect to your projects on the GoodData platform.
|
9 | The new app features some widgets and helpers that could come in handy.
|
10 | The app is built on top of Create React App. For more info see [Create React App documentation](https://facebook.github.io/create-react-app/).
|
11 |
|
12 | ## How to use
|
13 |
|
14 | To create a project called `my-app`, run this in your terminal:
|
15 |
|
16 | ```bash
|
17 | npx --ignore-existing @gooddata/create-gooddata-react-app my-app
|
18 | ```
|
19 |
|
20 | Then follow the instructions provided by the CLI.
|
21 |
|
22 | When navigating to your application using an IP address instead of localhost, you may run into `401` errors while trying to log in. This is due to proxying and cookie rewriting rules that the generated application uses to get around CORS. Use localhost instead of IP addresses to access the application because the development server rewrites GDC cookies to be for localhost.
|
23 |
|
24 | _NOTE:_ We use `yarn` dependency manager. To install it, follow its [documentation](https://yarnpkg.com/lang/en/docs/install). If you don't want to use `yarn`, provide the `--no-install` flag like `npx @gooddata/create-gooddata-react-app my-app --no-install` . This will skip calling `yarn install` and you will have to manually install the dependencies of the created app. Please note that we do not provide `package-lock.json` so the application may not work properly when dependencies are installed using `npm`.
|
25 |
|
26 | ## CLI usage
|
27 |
|
28 | `@gooddata/create-gooddata-react-app` supports several optional flags:
|
29 |
|
30 | - `--hostname <hostname>` URL of your GoodData host
|
31 | - `-c, --config <config>` path to configuration file (see below)
|
32 | - `--no-install` skip yarn installing the app dependencies
|
33 | - `--verbose` output additional logs, useful mainly for debugging and bug reports
|
34 | - `-h, --help` output usage information
|
35 | - `--backend <backend>` switch backend to a desired one (default: `bear`)
|
36 | - `--flavor <flavor>` desired flavor of the application: `js` for JavaScript, `ts` for TypeScript
|
37 |
|
38 | ### Configuration file
|
39 |
|
40 | The configuration file has the following structure:
|
41 |
|
42 | ```json
|
43 | {
|
44 | "hostname": "(Required) URL of the project hosted, e.g., https://developer.na.gooddata.com",
|
45 | "appName": "(Optional) name of the app to use",
|
46 | "flavor": "(Optional) flavor of the app, e.g., js for JavaScript, ts for TypeScript (default: js)"
|
47 | }
|
48 | ```
|
49 |
|
50 | ## Prerequisites
|
51 |
|
52 | Before running `@gooddata/create-gooddata-react-app`, please make sure that you have all compatible [technologies](https://sdk.gooddata.com/gooddata-ui/docs/about_gooddataui.html#supported-technologies) installed on your device.
|
53 |
|
54 | ## Troubleshooting
|
55 |
|
56 | In case there are errors while running `@gooddata/create-gooddata-react-app`, please try these steps.
|
57 |
|
58 | ### Remove older versions
|
59 |
|
60 | Sometimes having older versions of `@gooddata/create-gooddata-react-app` can cause errors. In that case please remove any previously installed versions by running
|
61 |
|
62 | ```bash
|
63 | npm uninstall -g @gooddata/create-gooddata-react-app
|
64 | yarn global remove @gooddata/create-gooddata-react-app
|
65 | ```
|
66 |
|
67 | ### Force npx to use the latest version
|
68 |
|
69 | You can force `npx` to use latest version of the tool by running
|
70 |
|
71 | ```bash
|
72 | npx --ignore-existing @gooddata/create-gooddata-react-app my-app
|
73 | ```
|
74 |
|
75 | ### Enable verbose output
|
76 |
|
77 | You can increase the logging level of `@gooddata/create-gooddata-react-app my-app` by providing the `--verbose` flag like
|
78 |
|
79 | ```bash
|
80 | npx @gooddata/create-gooddata-react-app my-app --verbose
|
81 | ```
|