Skip to content

Commit

Permalink
Merge pull request #36 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ifoche authored Oct 1, 2021
2 parents 1622cce + 7bc3a14 commit e457432
Show file tree
Hide file tree
Showing 118 changed files with 10,378 additions and 8,957 deletions.
9 changes: 7 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
SKIP_PREFLIGHT_CHECK=true
PORT=8081
BROWSER=false
PORT=8081
SKIP_PREFLIGHT_CHECK=true
REACT_APP_DHIS2_BASE_URL=https://dev.eyeseetea.com/play

CYPRESS_DHIS2_AUTH='admin:district'
CYPRESS_EXTERNAL_API="https://dev.eyeseetea.com/play"
CYPRESS_ROOT_URL=http://localhost:8081
29 changes: 23 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,45 @@ module.exports = {
"react-app",
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:cypress/recommended",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
rules: {
"no-console": "off",
"no-console": ["warn", { allow: ["debug", "warn", "error"] }],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": ["off"],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"unused-imports/no-unused-imports": "warn",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
"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",
"@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/explicit-function-return-type": "off",
"no-use-before-define": "off",
"no-debugger": "warn",
"no-extra-semi": "off",
"no-mixed-spaces-and-tabs": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
plugins: ["cypress"],
plugins: ["cypress", "@typescript-eslint", "react-hooks", "unused-imports"],
env: { "cypress/globals": true },
settings: {
react: {
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/validate-gee-api/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: 'Validate GEE API'
description: 'Validate Google Earth Engine API response'
author: 'EyeSeeTea'
runs:
using: 'node12'
main: 'index.js'
24 changes: 24 additions & 0 deletions .github/actions/validate-gee-api/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as core from "@actions/core";
import { validateApi } from "../../../src/scripts/validate-gee-api";

async function run(): Promise<void> {
try {
core.debug("Checking Google Earth Engine API");

const errors = await validateApi();

if (errors.length > 0) {
errors.forEach(({ id, url, error }) =>
core.error([`Data Set: ${id}`, `Url: ${url}`, error, ""].join("\n"))
);

core.setFailed(`Found ${errors.length} errors`);
} else {
core.setOutput("time", new Date().toTimeString());
}
} catch (error: any) {
core.setFailed(error.message);
}
}

run();
22 changes: 22 additions & 0 deletions .github/actions/validate-gee-api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es2015",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"noUnusedParameters": false,
"noUnusedLocals": false,
"experimentalDecorators": true,
"lib": ["dom", "dom.iterable", "esnext"]
},
"include": ["."]
}
3 changes: 0 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@
### :fire: How to test it? (If there is any special consideration or the reviewer does not know how to test it)

### :bookmark_tabs: Others

- [ ] Any change in the [API repo](https://github.com/EyeSeeTea/d2-api)? If so, what branch/PR?
- [ ] Any change in the [GUI library](https://github.com/EyeSeeTea/d2-ui-components)? If so, what branch/PR?
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Validate GEE API
on:
# Manual action
workflow_dispatch:
# Every day at 8:00 AM
schedule:
- cron: '0 8 * * *'

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "12.x"

- 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: Installing Dependencies
run: yarn install --frozen-lockfile --silent

- name: Build action
run: yarn build-validate-gee-api-action

- name: Validate API
uses: ./.github/actions/validate-gee-api
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# production
manifest.webapp
/build
/dist

# misc
.DS_Store
Expand All @@ -19,6 +20,7 @@ manifest.webapp
*.sublime-project
*.sublime-workspace
*.code-workspace
*.zip

npm-debug.log*
yarn-debug.log*
Expand All @@ -27,15 +29,13 @@ 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/*

# Custom
bak

.vscode
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
node_modules
*.min.js
*.min.css
public/ee_api_js.js
10 changes: 5 additions & 5 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/** @format */

module.exports = {
printWidth: 100,
printWidth: 120,
tabWidth: 4,
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,
}
};
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ $ yarn install

## Development

Start development server:
Start development server with the admin interface:

```
$ PORT=8082 REACT_APP_DHIS2_BASE_URL="https://play.dhis2.org/dev" yarn start
```

Start development server with the importer interface:

```
$ PORT=8082 REACT_APP_DATA_IMPORTER=true REACT_APP_DHIS2_BASE_URL="https://play.dhis2.org/dev" yarn start
```


Linting:

```
Expand Down Expand Up @@ -119,4 +126,4 @@ const SomeComponent: React.FunctionComponent = () => {

### Google Earth Engine API unilateral changes warning

**Attention:** GEE API has been reported to change its answer without respecting backwards compatibility with previous versions of its answers. Current app version is not compatible with GEE catalog json description. We will generate a new version as soon as possible. EyeSeetea does not garantee how quick the app will follow GEE API backwards incompatible unilateral changes.
**Attention:** GEE API has been reported to change its answer without respecting backwards compatibility with previous versions of its answers. EyeSeetea does not garantee how quick the app will follow GEE API backwards incompatible unilateral changes.
6 changes: 3 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = process.env.CYPRESS_ENV ? {} : {
"presets": ["babel-preset-react-app"]
}
module.exports = {
presets: ["@babel/typescript", ["babel-preset-react-app", { runtime: "automatic" }]],
};
30 changes: 30 additions & 0 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Required for CRA 4, see https://github.com/welldone-software/why-did-you-render/issues/154#issuecomment-773905769 */

module.exports = {
babel: {
loaderOptions: babelLoaderOptions => {
const origBabelPresetCRAIndex = babelLoaderOptions.presets.findIndex(preset => {
return preset[0].includes("babel-preset-react-app");
});

const origBabelPresetCRA = babelLoaderOptions.presets[origBabelPresetCRAIndex];

babelLoaderOptions.presets[origBabelPresetCRAIndex] = function overridenPresetCRA(api, opts, env) {
const babelPresetCRAResult = require(origBabelPresetCRA[0])(api, origBabelPresetCRA[1], env);

babelPresetCRAResult.presets.forEach(preset => {
// detect @babel/preset-react with {development: true, runtime: 'automatic'}
const isReactPreset =
preset && preset[1] && preset[1].runtime === "automatic" && preset[1].development === true;
if (isReactPreset) {
preset[1].importSource = "@welldone-software/why-did-you-render";
}
});

return babelPresetCRAResult;
};

return babelLoaderOptions;
},
},
};
12 changes: 0 additions & 12 deletions foo-dhis2-gee-app-09be93975aeb.json

This file was deleted.

7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2020-06-24T17:30:02.417Z\n"
"PO-Revision-Date: 2020-06-24T17:30:02.417Z\n"
"POT-Creation-Date: 2021-09-22T09:56:12.389Z\n"
"PO-Revision-Date: 2021-09-22T09:56:12.389Z\n"

msgid "No effective import into DHIS2, file download"
msgstr ""
Expand Down Expand Up @@ -218,6 +218,9 @@ msgstr ""
msgid "Dataset"
msgstr ""

msgid "Transform expression: {{transformExpression}}"
msgstr ""

msgid "Help"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2020-06-24T17:30:02.417Z\n"
"POT-Creation-Date: 2021-09-22T09:56:12.389Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -218,6 +218,9 @@ msgstr ""
msgid "Dataset"
msgstr ""

msgid "Transform expression: {{transformExpression}}"
msgstr ""

msgid "Help"
msgstr ""

Expand Down
6 changes: 5 additions & 1 deletion i18n/pt.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2020-06-24T17:30:02.417Z\n"
"POT-Creation-Date: 2021-09-22T09:56:12.389Z\n"
"PO-Revision-Date: 2020-06-16T05:53:00.829Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -226,6 +226,10 @@ msgstr "Resumo e salve"
msgid "Dataset"
msgstr "Conjunto de dados"

#, fuzzy
msgid "Transform expression: {{transformExpression}}"
msgstr "Transformar expressão para o atributo {{attr}}"

msgid "Help"
msgstr "Ajuda"

Expand Down
Loading

0 comments on commit e457432

Please sign in to comment.