Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ifoche authored May 16, 2024
0 parents commit 9d292d1
Show file tree
Hide file tree
Showing 95 changed files with 16,138 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
> 0.5%
last 2 versions
Firefox ESR
ie 11
not dead
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BROWSER=false
VITE_PORT=8081

VITE_DHIS2_BASE_URL=https://dev.eyeseetea.com/play
VITE_DHIS2_AUTH='admin:district'
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GENERATE_SOURCEMAP=false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/**/*.d.ts
/src/locales
73 changes: 73 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"extends": [
"react-app",
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:testing-library/react"
],
"parser": "@typescript-eslint/parser",
"ignorePatterns": ["src/**/snapshots/*.ts"],
"rules": {
"no-console": ["warn", { "allow": ["debug", "warn", "error"] }],
"prefer-const": "warn",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": ["off"],
"@typescript-eslint/no-this-alias": ["off"],
"@typescript-eslint/no-unnecessary-type-constraint": ["off"],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-unused-expressions": ["warn"],
"react/prop-types": "off",
"react/display-name": "off",
"react/react-in-jsx-scope": "off",
"no-unused-expressions": "off",
"no-useless-concat": "off",
"no-useless-constructor": "off",
"no-unexpected-multiline": "off",
"default-case": "off",
"array-callback-return": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/no-misused-promises": "warn",
"no-use-before-define": "off",
"no-debugger": "warn",
"no-extra-semi": "off",
"no-mixed-spaces-and-tabs": "off",
"no-useless-rename": "off",
"react-hooks/rules-of-hooks": "warn",
"react-hooks/exhaustive-deps": "warn",
"testing-library/await-async-query": "error",
"testing-library/no-await-sync-query": "error",
"testing-library/prefer-screen-queries": "off",
"testing-library/no-debugging-utils": "off",
"testing-library/no-dom-import": "off"
},
"plugins": ["@typescript-eslint", "react-hooks", "unused-imports"],
"env": {},
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": {
"react": {
"pragma": "React",
"version": "16.6.0"
}
}
}
10 changes: 10 additions & 0 deletions .githooks/dep-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

function changed {
git diff --name-only HEAD@{1} HEAD | grep "^$1" > /dev/null 2>&1
}

if changed 'yarn.lock'; then
echo "Lockfile changes detected. Installing updates..."
yarn install
fi
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### :pushpin: References

- **Issue:** Closes #?

### :memo: Implementation

### :video_camera: Screenshots/Screen capture

### :fire: Notes to the tester
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Application testing
on:
push:
workflow_dispatch:
jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install apt libraries
run: sudo apt install gettext -y

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install yarn
run: npm install -g yarn

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn dependencies
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile --silent

- name: Install translations
run: yarn localize

- name: Run jest tests
run: yarn test

- name: Build typescript
run: npx tsc
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
manifest.webapp
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
*.sublime-project
*.sublime-workspace
*.code-workspace
*.zip

npm-debug.log*
yarn-debug.log*
yarn-error.log*

src/locales/
src/react-app.d.ts
src/react-app-env.d.ts
bak
.eslintcache

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

# IntelliJ
.idea/*

docs/
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

./.githooks/dep-check
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn prettify && yarn lint && yarn update-po && yarn test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.14.2
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
node_modules
*.min.js
*.min.css
18 changes: 18 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @format */

module.exports = {
printWidth: 100,
tabWidth: 4,
useTabs: false,
semi: true,
singleQuote: false,
trailingComma: "es5",
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: "avoid",
rangeStart: 0,
rangeEnd: Infinity,
proseWrap: "preserve",
requirePragma: false,
insertPragma: false,
};
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
language: node_js
node_js:
- 12.13.0
dist: bionic
cache:
directories:
- "$HOME/.cache"
before_install:
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
# Install python dependencies
- sudo apt-get update
- sudo apt-get install python3 python python3-setuptools docker.io docker-compose
# Install d2-docker
- git clone https://github.com/EyeSeeTea/d2-docker.git
- cd d2-docker/
- sudo python3 setup.py install
- d2-docker --help
# Hack to not be prompted in the terminal
- sudo apt-get remove golang-docker-credential-helpers
# Start docker service
- sudo systemctl unmask docker.service
- sudo systemctl unmask docker.socket
- sudo systemctl start docker.service
# Login to docker
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# Start docker service
- d2-docker start eyeseetea/dhis2-data:2.30-sierra-leone -d --port 8080
install:
- yarn install --frozen-lockfile
- yarn cy:verify
- yarn build
script:
- PORT=8081 REACT_APP_DHIS2_BASE_URL=http://localhost:8080 REACT_APP_CYPRESS=true yarn start &
- yarn wait-on http-get://localhost:8081
- yarn wait-on http-get://localhost:8080
- CYPRESS_EXTERNAL_API=http://localhost:8080 CYPRESS_ROOT_URL=http://localhost:8081 yarn cy:e2e:run --record --key $CYPRESS_KEY
- kill $(jobs -p) || true
addons:
apt:
packages:
- libgconf-2-4
Loading

0 comments on commit 9d292d1

Please sign in to comment.