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 app for testing #1

Merged
merged 3 commits into from
Dec 13, 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
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
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
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
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
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"
}
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ["@babel/typescript", ["babel-preset-react-app", { runtime: "automatic" }]],
};
3 changes: 3 additions & 0 deletions config/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Turns file imports into dummy objects

module.exports = "test-file-stub";
3 changes: 3 additions & 0 deletions config/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Turns style imports into empty objects

module.exports = {};
8 changes: 8 additions & 0 deletions config/testHelpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function getD2Stub() {
return {
system: {
systemInfo: {},
},
currentUser: {},
};
}
13 changes: 13 additions & 0 deletions config/testSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { TextDecoder, TextEncoder } from "util";

global.console = {
error: console.error,
info: console.info,
log: jest.fn(),
warn: jest.fn(),
debug: jest.fn(),
};

// Polyfill for encoding which isn't present globally in jsdom
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
30 changes: 30 additions & 0 deletions i18n/en.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-06-26T10:58:19.149Z\n"
"PO-Revision-Date: 2024-06-26T10:58:19.149Z\n"

msgid "Add"
msgstr ""

msgid "List"
msgstr ""

msgid "Back"
msgstr ""

msgid "Help"
msgstr ""

msgid "Hello {{name}}"
msgstr ""

msgid "Detail page"
msgstr ""

msgid "Section"
msgstr ""
30 changes: 30 additions & 0 deletions i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-06-26T10:58:19.149Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

msgid "Add"
msgstr "Añadir"

msgid "List"
msgstr "Listar"

msgid "Back"
msgstr "Volver"

msgid "Help"
msgstr "Ayuda"

msgid "Hello {{name}}"
msgstr "Hola {{name}}"

msgid "Detail page"
msgstr ""

msgid "Section"
msgstr "Sección"
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />

<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" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/webapp/main.tsx"></script>
</body>
</html>
Loading