Skip to content

Commit

Permalink
Merge pull request #21 from IFRCGo/feature/table
Browse files Browse the repository at this point in the history
Add  Alert Table columns
  • Loading branch information
samshara authored Apr 11, 2024
2 parents 0903ceb + 3030678 commit 4a3e294
Show file tree
Hide file tree
Showing 30 changed files with 2,158 additions and 515 deletions.
80 changes: 41 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint, Build and Test
name: Lint & Build

on:
pull_request:
Expand All @@ -7,57 +7,53 @@ on:
- 'develop'

env:
APP_TITLE: ${{ vars.APP_TITLE }}
APP_MAPBOX_ACCESS_TOKEN: ${{ vars.APP_MAPBOX_ACCESS_TOKEN }}
APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }}
APP_GRAPHQL_API_ENDPOINT: ${{ vars.APP_GRAPHQL_API_ENDPOINT }}
GITHUB_WORKFLOW: true

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
# unimported:
# name: Find unimported files
# environment: 'test'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: 'yarn'

- name: Install dependencies
run: yarn install
# - name: Install dependencies
# run: yarn install --frozen-lockfile

- name: Run test
run: yarn test
unimported:
name: Find unimported files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Run unimported
run: yarn unimported
lint:
# - name: Run unimported
# run: yarn unimported
# fix use better tool, this is deprecated
lint-js:
name: Lint JS
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- name: Install dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint
- name: Lint Javascript
run: yarn generate && yarn lint:js
css-lint:
name: Lint CSS
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -67,38 +63,44 @@ jobs:
cache: 'yarn'

- name: Install dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Css Lint
run: yarn lint:css
typecheck:
name: Typecheck
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- name: Install dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Typecheck
run: yarn typecheck
run: yarn generate && yarn typecheck
build:
name: Build
needs: [lint, css-lint, typecheck, test]
environment: 'test'
needs: [lint-js, css-lint, typecheck]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- name: Install dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Build
run: yarn build
run: yarn generate && yarn build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
generated
node_modules
dist
dist-ssr
build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "backend"]
path = backend
url = [email protected]:IFRCGo/alert-hub-backend.git
8 changes: 6 additions & 2 deletions .unimportedrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
{
"entry": ["./src/index.tsx"],
"ignorePatterns": ["**/node_modules/**", "build/**"],
"ignoreUnimported": ["**/*.d.ts", "**/*.test.*"],
"ignoreUnimported": ["**/*.d.ts", "**/*.test.*", "**/generated/**"],
"ignoreUnused": [
"@apollo/client",
"@graphql-codegen/introspection",
"@graphql-codegen/typescript-operations",
"@togglecorp/re-map",
"@sentry/react"
],
"ignoreUnresolved": ["@graphql-typed-document-node/core"],
"extensions": [".ts", ".js", ".tsx", ".jsx"],
"aliases": {
"#utils/*": ["./src/utils/*"],
"#views/*": ["./src/views/*"]
"#views/*": ["./src/views/*"],
"#generated/*": ["./generated/*"],
"#components/*": ["./src/components/*"],
"#hooks/*": ["./src/hooks/*"]
}
}
1 change: 1 addition & 0 deletions backend
Submodule backend added at 8f8391
17 changes: 17 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
schema: process.env.APP_GRAPHQL_CODEGEN_ENDPOINT,
documents: [
'src/**/*.tsx',
'src/**/*.ts'
],
ignoreNoDocuments: true, // for better experience with the watcher
generates: {
'./generated/types/': {
preset: 'client'
}
}
}

export default config;
17 changes: 0 additions & 17 deletions codegen.yml

This file was deleted.

7 changes: 5 additions & 2 deletions env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { defineConfig, Schema } from '@julr/vite-plugin-validate-env';

// TODO: Integrate .env for CI and remove optional() call on required fields
export default defineConfig({
APP_TITLE: Schema.string.optional(),
APP_MAPBOX_ACCESS_TOKEN: Schema.string.optional(),
APP_ENVIRONMENT: Schema.string.optional(),
APP_GRAPHQL_API_ENDPOINT: Schema.string(),
APP_MAPBOX_ACCESS_TOKEN: Schema.string(),
APP_TITLE: Schema.string(),
APP_GRAPHQL_CODEGEN_ENDPOINT: Schema.string.optional(),
})
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ const appConfigs = compat.config({
]
}).map((conf) => ({
...conf,
files: ['src/**/*.tsx', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.js'],
files: ['src/**/*.tsx', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.js', 'generated/**/*.ts'],
}));

const otherConfig = {
files: ['*.js', '*.ts', '*.cjs'],
files: ['*.js', '*.cjs'],
...js.configs.recommended,
};

Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "ifrc-alert-hub",
"version": "0.0.0",
"version": "0.0.1",
"type": "module",
"private": true,
"scripts": {
"start": "vite",
"build": "vite build",
"preview": "vite preview",
"generate": "graphql-codegen --config codegen.yml && eslint --fix src/generated/types.ts",
"codegen:watch": "graphql-codegen --require dotenv/config --config codegen.ts --watch",
"generate": "graphql-codegen --require dotenv/config --config codegen.ts && eslint --fix generated/",
"lint:js": "eslint src",
"lint:css": "stylelint \"./src/**/*.css\"",
"lint:unused": "unimported",
"lint": "yarn lint:js && yarn lint:css && yarn lint:unused",
"lint:fix": "yarn lint:js --fix && yarn lint:css --fix",
"test": "vitest",
"test:coverage": "vitest run --coverage",
"typecheck": "tsc"
Expand All @@ -25,7 +26,7 @@
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@sentry/react": "^7.81.1",
"@togglecorp/fujs": "^2.1.1",
"@togglecorp/re-map": "^0.1.4",
"@togglecorp/re-map": "^0.2.0-beta-6",
"graphql": "^16.8.1",
"mapbox-gl": "^1.13.0",
"react": "^18.2.0",
Expand All @@ -34,7 +35,10 @@
},
"devDependencies": {
"@eslint/eslintrc": "^3.0.2",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.2.5",
"@julr/vite-plugin-validate-env": "^1.0.1",
"@parcel/watcher": "^2.4.1",
"@types/mapbox-gl": "^1.13.0",
"@types/node": "^20.1.3",
"@types/react": "^18.0.28",
Expand Down Expand Up @@ -71,14 +75,16 @@
"stylelint-no-unused-selectors": "git+https://github.com/toggle-corp/stylelint-no-unused-selectors#e0831e1",
"stylelint-value-no-unknown-custom-properties": "^5.0.0",
"surge": "^0.23.1",
"typescript": "^5.4.3",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"unimported": "1.31.1",
"vite": "^5.2.6",
"vite-plugin-checker": "^0.6.2",
"vite-plugin-compression2": "^1.0.0",
"vite-plugin-radar": "^0.9.2",
"vite-plugin-svgr": "^4.2.0",
"vite-plugin-webfont-dl": "^3.9.1",
"vite-tsconfig-paths": "^4.2.2",
"vitest": "^1.1.0"
}
}
}
Loading

0 comments on commit 4a3e294

Please sign in to comment.