Skip to content

Commit b3c52ff

Browse files
authored
Merge pull request #297 from IFRCGo/project/country-pages
Country Pages
2 parents 98155a2 + 7c339a9 commit b3c52ff

File tree

1,923 files changed

+116122
-99709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,923 files changed

+116122
-99709
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,83 +22,161 @@ env:
2222
GITHUB_WORKFLOW: true
2323

2424
jobs:
25+
ui:
26+
name: UI library
27+
environment: 'test'
28+
runs-on: ubuntu-latest
29+
defaults:
30+
run:
31+
working-directory: packages/ui
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-node@v3
35+
with:
36+
node-version: '18.x'
37+
cache: 'yarn'
38+
39+
- name: Install dependencies on UI library
40+
run: yarn install --frozen-lockfile
41+
42+
- name: Typecheck
43+
run: yarn typecheck
44+
45+
- name: Lint CSS
46+
run: yarn lint:css
47+
48+
- name: Lint JS
49+
run: yarn lint:js
50+
51+
- name: build UI library
52+
run: yarn build
53+
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: ui-build
57+
path: packages/ui/dist
58+
2559
test:
2660
name: Run tests
2761
environment: 'test'
2862
runs-on: ubuntu-latest
63+
needs: [ui]
2964
steps:
3065
- uses: actions/checkout@v3
3166
- uses: actions/setup-node@v3
3267
with:
3368
node-version: '18.x'
3469
cache: 'yarn'
3570

71+
- uses: actions/download-artifact@v4
72+
with:
73+
name: ui-build
74+
path: packages/ui/dist
75+
3676
- name: Install dependencies
37-
run: yarn install --prefer-offline --frozen-lockfile
77+
run: yarn install --frozen-lockfile
78+
working-directory: app
3879

3980
- name: Run test
40-
4181
run: yarn test
82+
working-directory: app
83+
4284
translation:
4385
name: Identify error with translation files
4486
runs-on: ubuntu-latest
87+
needs: [ui]
4588
steps:
4689
- uses: actions/checkout@v3
4790
- uses: actions/setup-node@v3
4891
with:
4992
node-version: '18.x'
5093
cache: 'yarn'
5194

95+
- uses: actions/download-artifact@v4
96+
with:
97+
name: ui-build
98+
path: packages/ui/dist
99+
52100
- name: Install dependencies
53-
run: yarn install --prefer-offline --frozen-lockfile
101+
run: yarn install --frozen-lockfile
102+
working-directory: app
54103

55104
- name: Identify error with translation files
56105
run: yarn lint:translation
106+
working-directory: app
107+
57108
unimported:
58109
name: Identify unused files
59110
runs-on: ubuntu-latest
111+
needs: [ui]
60112
steps:
61113
- uses: actions/checkout@v3
62114
- uses: actions/setup-node@v3
63115
with:
64116
node-version: '18.x'
65117
cache: 'yarn'
66118

119+
- uses: actions/download-artifact@v4
120+
with:
121+
name: ui-build
122+
path: packages/ui/dist
123+
67124
- name: Install dependencies
68-
run: yarn install --prefer-offline --frozen-lockfile
125+
run: yarn install --frozen-lockfile
126+
working-directory: app
69127

70128
- name: Identify unused files
71129
run: yarn lint:unused
130+
working-directory: app
131+
72132
lint:
73133
name: Lint JS
74134
runs-on: ubuntu-latest
135+
needs: [ui]
75136
steps:
76137
- uses: actions/checkout@v3
77138
- uses: actions/setup-node@v3
78139
with:
79140
node-version: '18.x'
80141
cache: 'yarn'
81142

143+
- uses: actions/download-artifact@v4
144+
with:
145+
name: ui-build
146+
path: packages/ui/dist
147+
82148
- name: Install dependencies
83-
run: yarn install --prefer-offline --frozen-lockfile
149+
run: yarn install --frozen-lockfile
150+
working-directory: app
84151

85152
- name: Lint JS
86153
run: yarn lint:js
154+
working-directory: app
155+
87156
lint-css:
88157
name: Lint CSS
89158
runs-on: ubuntu-latest
159+
needs: [ui]
90160
steps:
91161
- uses: actions/checkout@v3
92162
- uses: actions/setup-node@v3
93163
with:
94164
node-version: '18.x'
95165
cache: 'yarn'
96166

167+
- uses: actions/download-artifact@v4
168+
with:
169+
name: ui-build
170+
path: packages/ui/dist
171+
97172
- name: Install dependencies
98-
run: yarn install --prefer-offline --frozen-lockfile
173+
run: yarn install --frozen-lockfile
174+
working-directory: app
99175

100176
- name: Lint CSS
101177
run: yarn lint:css
178+
working-directory: app
179+
102180
# FIXME: Identify a way to generate schema before we run typecheck
103181
# typecheck:
104182
# name: Typecheck
@@ -111,14 +189,14 @@ jobs:
111189
# cache: 'yarn'
112190

113191
# - name: Install dependencies
114-
# run: yarn install --prefer-offline --frozen-lockfile
192+
# run: yarn install --frozen-lockfile
115193

116194
# - name: Typecheck
117195
# run: yarn typecheck
118196
build:
119197
name: Build
120198
environment: 'test'
121-
needs: [lint, lint-css, test]
199+
needs: [lint, lint-css, test, ui]
122200
runs-on: ubuntu-latest
123201
steps:
124202
- uses: actions/checkout@v3
@@ -127,8 +205,15 @@ jobs:
127205
node-version: '18.x'
128206
cache: 'yarn'
129207

208+
- uses: actions/download-artifact@v4
209+
with:
210+
name: ui-build
211+
path: packages/ui/dist
212+
130213
- name: Install dependencies
131-
run: yarn install --prefer-offline --frozen-lockfile
214+
run: yarn install --frozen-lockfile
215+
working-directory: app
132216

133217
- name: Build
134218
run: yarn build
219+
working-directory: app
File renamed without changes.
File renamed without changes.

.unimportedrc.json renamed to app/.unimportedrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"#assets/content/operational_timeline_title.svg?react",
77
"#assets/content/operational_timeline_body.svg?react"
88
],
9-
"ignoreUnused": ["@tinymce/tinymce-react"],
9+
"ignoreUnused": ["@tinymce/tinymce-react", "@mapbox/mapbox-gl-draw"],
1010
"extensions": [".ts", ".js", ".tsx", ".jsx"],
1111
"aliases": {
1212
"#generated/*": ["./generated/*"],
File renamed without changes.
File renamed without changes.

env.ts renamed to app/env.ts

File renamed without changes.

app/eslint.config.js

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
import { FlatCompat } from '@eslint/eslintrc';
2+
import js from '@eslint/js';
3+
import process from 'process';
4+
5+
const dirname = process.cwd();
6+
7+
const compat = new FlatCompat({
8+
baseDirectory: dirname,
9+
resolvePluginsRelativeTo: dirname,
10+
});
11+
12+
const appConfigs = compat.config({
13+
env: {
14+
node: true,
15+
browser: true,
16+
es2020: true,
17+
},
18+
root: true,
19+
extends: [
20+
'airbnb',
21+
'airbnb/hooks',
22+
'plugin:@typescript-eslint/recommended',
23+
'plugin:react-hooks/recommended',
24+
],
25+
parser: '@typescript-eslint/parser',
26+
parserOptions: {
27+
ecmaVersion: 'latest',
28+
sourceType: 'module',
29+
},
30+
plugins: [
31+
'@typescript-eslint',
32+
'react-refresh',
33+
'simple-import-sort',
34+
'import-newlines'
35+
],
36+
settings: {
37+
'import/parsers': {
38+
'@typescript-eslint/parser': ['.ts', '.tsx']
39+
},
40+
'import/resolver': {
41+
typescript: {
42+
project: [
43+
'./tsconfig.json',
44+
],
45+
},
46+
},
47+
},
48+
rules: {
49+
'react-refresh/only-export-components': 'warn',
50+
51+
'no-unused-vars': 0,
52+
'@typescript-eslint/no-unused-vars': 1,
53+
54+
'no-use-before-define': 0,
55+
'@typescript-eslint/no-use-before-define': 1,
56+
57+
'no-shadow': 0,
58+
'@typescript-eslint/no-shadow': ['error'],
59+
60+
'import/no-extraneous-dependencies': [
61+
'error',
62+
{
63+
devDependencies: [
64+
'**/*.test.{ts,tsx}',
65+
'eslint.config.js',
66+
'postcss.config.cjs',
67+
'stylelint.config.cjs',
68+
'vite.config.ts',
69+
],
70+
optionalDependencies: false,
71+
},
72+
],
73+
74+
indent: ['error', 4, { SwitchCase: 1 }],
75+
76+
'import/no-cycle': ['error', { allowUnsafeDynamicCyclicDependency: true }],
77+
78+
'react/react-in-jsx-scope': 'off',
79+
'camelcase': 'off',
80+
81+
'react/jsx-indent': ['error', 4],
82+
'react/jsx-indent-props': ['error', 4],
83+
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
84+
85+
'import/extensions': ['off', 'never'],
86+
87+
'react-hooks/rules-of-hooks': 'error',
88+
'react-hooks/exhaustive-deps': 'warn',
89+
90+
'react/require-default-props': ['warn', { ignoreFunctionalComponents: true }],
91+
'simple-import-sort/imports': 'warn',
92+
'simple-import-sort/exports': 'warn',
93+
'import-newlines/enforce': ['warn', 1]
94+
},
95+
overrides: [
96+
{
97+
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
98+
rules: {
99+
'simple-import-sort/imports': [
100+
'error',
101+
{
102+
'groups': [
103+
// side effect imports
104+
['^\\u0000'],
105+
// packages `react` related packages come first
106+
['^react', '^@?\\w'],
107+
// internal packages
108+
['^#.+$'],
109+
// parent imports. Put `..` last
110+
// other relative imports. Put same-folder imports and `.` last
111+
['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
112+
// style imports
113+
['^.+\\.json$', '^.+\\.module.css$'],
114+
]
115+
}
116+
]
117+
}
118+
}
119+
]
120+
}).map((conf) => ({
121+
...conf,
122+
files: ['src/**/*.tsx', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.js'],
123+
ignores: ['src/generated/types.ts'],
124+
}));
125+
126+
const otherConfig = {
127+
files: ['*.js', '*.ts', '*.cjs'],
128+
...js.configs.recommended,
129+
};
130+
131+
export default [
132+
...appConfigs,
133+
otherConfig,
134+
];
File renamed without changes.

0 commit comments

Comments
 (0)