Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ BROWSER=false
PORT=8081
SKIP_PREFLIGHT_CHECK=true
REACT_APP_DHIS2_BASE_URL=http://localhost:8080
VITE_DHIS2_BASE_URL=http://localhost:8080
VITE_DHIS2_AUTH=
VITE_PORT=8081

CYPRESS_DHIS2_AUTH='admin:district'
CYPRESS_EXTERNAL_API="https://dev.eyeseetea.com/play"
Expand Down
4 changes: 1 addition & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
"react-app",
"eslint:recommended",
"plugin:react/recommended",
"plugin:cypress/recommended",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
Expand Down Expand Up @@ -45,8 +44,7 @@ module.exports = {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
plugins: ["cypress", "@typescript-eslint", "react-hooks", "unused-imports"],
env: { "cypress/globals": true },
plugins: ["@typescript-eslint", "react-hooks", "unused-imports"],
settings: {
react: {
pragma: "React",
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ on:
jobs:
master-workflow:
uses: EyeSeeTea/github-workflows/.github/workflows/master.yml@master
dependency-track-yarn4:
if: github.event_name == 'pull_request'
uses: EyeSeeTea/github-workflows/.github/workflows/dependency-track-yarn4.yml@feature/test_bom_actions
secrets: inherit
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ src/react-app-env.d.ts
bak
.eslintcache

# cypress
cypress/screenshots/
cypress/videos/
cypress/fixtures/

# IntelliJ
.idea/*

# Yarn 4
.yarn/cache
.yarn/install-state.gz
.yarn/unplugged
.yarn/build-state.yml
.pnp.*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.14.0
v22.22.0
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ $ yarn install
Start the development server:

```
$ PORT=8081 REACT_APP_DHIS2_BASE_URL="http://localhost:8080" yarn start
$ PORT=8081 VITE_DHIS2_BASE_URL="http://localhost:8080" VITE_DHIS2_AUTH="" yarn start
```

Now in your browser, go to `http://localhost:8081`.

Notes:

- Requests to DHIS2 will be transparently proxied (see `src/setupProxy.js`) from `http://localhost:8081/dhis2/path` to `http://localhost:8080/path` to avoid CORS and cross-domain problems.
- Requests to DHIS2 will be transparently proxied from `http://localhost:8081/dhis2/path` to `http://localhost:8080/path` (see `vite.config.ts`) to avoid CORS and cross-domain problems.

- The optional environment variable `REACT_APP_DHIS2_AUTH=USERNAME:PASSWORD` forces some credentials to be used by the proxy. This variable is usually not set, so the app has the same user logged in at `REACT_APP_DHIS2_BASE_URL`.
- The optional environment variable `VITE_DHIS2_AUTH=USERNAME:PASSWORD` forces some credentials to be used by the proxy. This variable is usually not set, so the app has the same user logged in at `VITE_DHIS2_BASE_URL`.

- The optional environment variable `REACT_APP_PROXY_LOG_LEVEL` can be helpful to debug the proxyfied requests (accepts: "warn" | "debug" | "info" | "error" | "silent")
- The optional environment variable `VITE_PROXY_LOG_LEVEL` can be helpful to debug the proxied requests (accepts: "warn" | "debug" | "info" | "error" | "silent")

- Create a file `.env.local` (copy it from `.env`) to customize environment variables so you can simply run `yarn start`.

- [why-did-you-render](https://github.com/welldone-software/why-did-you-render) is installed, but it does not work when using standard react scripts (`yarn start`). Instead, use `yarn craco-start` to debug re-renders with WDYR. Note that hot reloading does not work out-of-the-box with [craco](https://github.com/gsoft-inc/craco).
- [why-did-you-render](https://github.com/welldone-software/why-did-you-render) is loaded in development to help debug re-renders.

## Tests

Expand All @@ -43,21 +43,6 @@ Notes:
$ yarn test
```

### Integration tests (Cypress)

Create the required users for testing (`cypress/support/App.ts`) in your instance and run:

```
$ export CYPRESS_EXTERNAL_API="http://localhost:8080"
$ export CYPRESS_ROOT_URL=http://localhost:8081

# non-interactive
$ yarn cy:e2e:run

# interactive UI
$ yarn cy:e2e:open
```

## Build app ZIP

```
Expand Down
30 changes: 0 additions & 30 deletions craco.config.js

This file was deleted.

12 changes: 0 additions & 12 deletions cypress/integration/landing-page.spec.js

This file was deleted.

11 changes: 0 additions & 11 deletions cypress/plugins/index.js

This file was deleted.

28 changes: 0 additions & 28 deletions cypress/support/commands.ts

This file was deleted.

2 changes: 0 additions & 2 deletions cypress/support/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions cypress/tsconfig.json

This file was deleted.

30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico?v=1" />

<link
type="text/css"
rel="stylesheet"
href="/includes/material-design-icons/material-icons.css"
/>
<link type="text/css" rel="stylesheet" href="/includes/roboto-font.css" />
<link
href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"
rel="stylesheet"
/>

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#000000" />
<title>Bulk Load | DHIS2</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
collectCoverageFrom: ["src/**/*.js"],
testPathIgnorePatterns: ["/node_modules/", "/cypress"],
testPathIgnorePatterns: ["/node_modules/"],
transformIgnorePatterns: ["/node_modules/(?!@eyeseetea/(d2-ui-components|d2-api)|axios)"],
modulePaths: ["src"],
moduleDirectories: ["node_modules"],
Expand Down
Loading
Loading