Skip to content

Commit 7a4ec0c

Browse files
LuisValgoiMarcusNotheis
authored andcommitted
Merge pull request #56 from LuisValgoi/issue-44
[ISSUE-44] Refactor .envs for Scripts
1 parent f8fb393 commit 7a4ec0c

File tree

7 files changed

+25
-20
lines changed

7 files changed

+25
-20
lines changed

packages/ui5-webcomponents-react-seed/.env

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REACT_APP_BASE_URL_STATE=http://localhost:3001/
2+
REACT_APP_BASE_URL_PATH=api
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REACT_APP_BASE_URL_STATE=/
2+
REACT_APP_BASE_URL_PATH=api

packages/ui5-webcomponents-react-seed/README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,41 @@
2929
- `npx create-react-app PROJECT_NAME --template ui5-webcomponents-react-seed`;
3030
- cd into `PROJECT_NAME`;
3131
- (no need to run `yarn install` since it already installs it for you);
32-
- run the available scripts;
32+
- run the available scripts.
3333

3434
PS.: It is important to add the `--template ui5-webcomponents-react-seed` at the end to get our template.
3535

3636
# Configuration Included
3737

38-
- JEST Up & Runnning.
38+
- JEST Up & Runnning;
3939

40-
- ESLint & EditorConfig Up & Running.
40+
- ESLint & EditorConfig Up & Running;
4141

42-
- CommitLint Up & Running.
42+
- CommitLint Up & Running;
4343

44-
- Enviroment Variables Up & Running.
44+
- Enviroment Variables Up & Running;
4545

46-
- Internalization Up & Running.
46+
- Internalization Up & Running;
4747

48-
- PR Template.
48+
- PR Template;
4949

50-
- IE Support.
50+
- IE Support;
5151

5252
- Multiple Scripts.
5353

5454
# Engine Included
5555

56-
- Fallback Engine (`<ErrorBoundary />`, `<NotFound />` and `<Error />`).
56+
- Fallback Engine (`<ErrorBoundary />`, `<NotFound />` and `<Error />`);
5757

58-
- MockServer Engine (w/ `json-server`).
58+
- MockServer Engine (w/ `json-server`);
5959

60-
- HTTP Request Engine (w/ `Request` and `URLProvider`).
60+
- HTTP Request Engine (w/ `Request` and `URLProvider`);
6161

62-
- Permission Engine (w/ `RouteValidator` and `ComponentValidator`)
62+
- Permission Engine (w/ `RouteValidator` and `ComponentValidator`).
6363

6464
# Hooks Included
6565

66-
- `useRequest`: Which includes `get`, `post`, `patch`, `delete`, `put` HTTP helpers.
66+
- `useRequest`: Which includes `get`, `post`, `patch`, `delete`, `put` HTTP helpers;
6767

6868
- `useAuthority`: Which includes `hasAccess` helpers.
6969

@@ -75,7 +75,9 @@ In the project directory, you can run:
7575

7676
### `yarn start`
7777

78-
Runs the app in the development mode @ [http://localhost:3000](http://localhost:3000) (⚠️ currently not supported).
78+
Runs the app in the development mode @ [http://localhost:3000](http://localhost:3000).
79+
80+
⚠️ It requires an AppRouter or a BackEnd up & running @ `<domain>:<port>/api`.
7981

8082
### `yarn mock`
8183

packages/ui5-webcomponents-react-seed/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
},
7171
"scripts": {
7272
"build": "react-scripts build",
73-
"mock": "env-cmd -f .env npm-run-all --parallel start:mock start:react",
74-
"start": "env-cmd -f .env npm-run-all --parallel start:react",
73+
"mock": "env-cmd -f .env.development npm-run-all --parallel start:mock start:react",
74+
"start": "env-cmd -f .env.production npm-run-all --parallel start:react",
7575
"start:react": "react-scripts start",
7676
"start:mock": "nodemon --watch server/data --exec npx json-server --p 3001 server/mockserver.js --routes server/routes.json",
7777
"test": "react-scripts test --silent --env=jest-environment-jsdom-sixteen",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
const Request = axios.create({
4-
baseURL: process.env.REACT_APP_API_URL,
4+
baseURL: process.env.REACT_APP_BASE_URL_STATE + process.env.REACT_APP_BASE_URL_PATH,
55
});
66

77
export default Request;

packages/ui5-webcomponents-react-seed/template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
},
3737
"scripts": {
3838
"build": "react-scripts build",
39-
"mock": "env-cmd -f .env npm-run-all --parallel start:mock start:react",
40-
"start": "env-cmd -f .env npm-run-all --parallel start:react",
39+
"mock": "env-cmd -f .env.development npm-run-all --parallel start:mock start:react",
40+
"start": "env-cmd -f .env.production npm-run-all --parallel start:react",
4141
"start:react": "react-scripts start",
4242
"start:mock": "nodemon --watch server/data --exec npx json-server --p 3001 server/mockserver.js --routes server/routes.json",
4343
"test": "react-scripts test --silent --env=jest-environment-jsdom-sixteen",

0 commit comments

Comments
 (0)