Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add skeleton structure #464

Merged
merged 5 commits into from
Oct 1, 2024
Merged
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
33 changes: 0 additions & 33 deletions .babelrc

This file was deleted.

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
16 changes: 0 additions & 16 deletions .eslintrc.js

This file was deleted.

77 changes: 77 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"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",
"no-relative-import-paths/no-relative-import-paths": [
"error",
{ "allowSameFolder": true, "rootDir": "src", "prefix": "$" }
]
},
"plugins": ["@typescript-eslint", "react-hooks", "no-relative-import-paths", "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
67 changes: 39 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
.DS_STORE
node_modules
*~
*.pyc
static
.grunt
_SpecRunner.html
__benchmarks__
build/
coverage/
.module-cache
*.gem
docs/.bundle
docs/code
docs/_site
docs/.sass-cache
docs/js/*
docs/downloads
docs/vendor/bundle
examples/shared/*.js
examples/**/bundle.js
test/the-files-to-test.generated.js
*.log*
chrome-user-data
# 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
.idea
*.iml
.vscode
*.code-workspace
manifest.webapp
*.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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.17.0
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
8 changes: 4 additions & 4 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ module.exports = {
useTabs: false,
semi: true,
singleQuote: false,
trailingComma: 'es5',
trailingComma: "es5",
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: 'avoid',
arrowParens: "avoid",
rangeStart: 0,
rangeEnd: Infinity,
proseWrap: 'preserve',
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.preferences.importModuleSpecifier": "non-relative"
}
Loading
Loading