Skip to content

Commit

Permalink
feat: create monorepo for go web app using yarn workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
samshara committed Jan 2, 2024
1 parent 77454de commit f9bc670
Show file tree
Hide file tree
Showing 1,365 changed files with 2,459 additions and 1,333 deletions.
90 changes: 89 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ env:
GITHUB_WORKFLOW: true

jobs:
ui:
name: UI library
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: Identify unused files
run: yarn lint:unused
working-directory: packages/ui

- name: Lint CSS
run: yarn lint:css
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

test:
name: Run tests
environment: 'test'
Expand All @@ -33,12 +60,21 @@ jobs:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
working-directory: app

- name: Run test

run: yarn test
working-directory: app
translation:
name: Identify error with translation files
runs-on: ubuntu-latest
Expand All @@ -49,11 +85,21 @@ jobs:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
working-directory: app

- name: Identify error with translation files
run: yarn lint:translation
working-directory: app
unimported:
name: Identify unused files
runs-on: ubuntu-latest
Expand All @@ -64,11 +110,21 @@ jobs:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
working-directory: app

- name: Identify unused files
run: yarn lint:unused
working-directory: app
lint:
name: Lint JS
runs-on: ubuntu-latest
Expand All @@ -79,11 +135,21 @@ jobs:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
working-directory: app

- name: Lint JS
run: yarn lint:js
working-directory: app
lint-css:
name: Lint CSS
runs-on: ubuntu-latest
Expand All @@ -94,11 +160,22 @@ jobs:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
working-directory: app

- name: Lint CSS
run: yarn lint:css
working-directory: app

# FIXME: Identify a way to generate schema before we run typecheck
# typecheck:
# name: Typecheck
Expand Down Expand Up @@ -127,8 +204,19 @@ jobs:
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies on UI library
run: yarn install --prefer-offline --frozen-lockfile
working-directory: packages/ui

- name: build UI library
run: yarn build
working-directory: packages/ui

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile
working-directory: app


- name: Build
run: yarn build
working-directory: app
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
107 changes: 107 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"name": "go-web-app",
"version": "7.0.17",
"type": "module",
"private": true,
"scripts": {
"initialize:type": "mkdir -p generated/ && yarn initialize:type:go-api && yarn initialize:type:risk-api",
"initialize:type:go-api": "test -f ./generated/types.ts && true || cp types.stub.ts ./generated/types.ts",
"initialize:type:risk-api": "test -f ./generated/riskTypes.ts && true || cp types.stub.ts ./generated/riskTypes.ts",
"prestart": "yarn initialize:type",
"pretypecheck": "yarn initialize:type",
"prelint:js": "yarn initialize:type",
"prelint:unused": "yarn initialize:type",
"prebuild": "yarn initialize:type",
"start": "vite",
"build": "vite build",
"generate:type": "yarn generate:type:go-api && yarn generate:type:risk-api",
"generate:type:go-api": "dotenv -- cross-var openapi-typescript \"%APP_API_ENDPOINT%api-docs/\" -o ./generated/types.ts --alphabetize",
"generate:type:risk-api": "dotenv -- cross-var openapi-typescript \"%APP_RISK_API_ENDPOINT%api-docs/\" -o ./generated/riskTypes.ts --alphabetize",
"typecheck": "tsc",
"lint:js": "eslint src",
"lint:css": "stylelint \"./src/**/*.css\"",
"lint:unused": "unimported",
"lint:translation": "node ./scripts/translator.js",
"lint": "yarn lint:js && yarn lint:css && yarn lint:unused && yarn lint:translation",
"test": "vitest",
"test:coverage": "vitest run --coverage",
"surge:deploy": "branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); branch=$(echo $branch | tr ./ -); cp build/index.html build/200.html; surge -p build/ -d https://ifrc-go-$branch.surge.sh",
"surge:teardown": "branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); branch=$(echo $branch | tr ./ -); surge teardown https://ifrc-go-$branch.surge.sh",
"postinstall": "patch-package"
},
"dependencies": {
"@ifrc-go/icons": "^1.2.0",
"@ifrc-go/ui": "^0.0.1",
"@mapbox/mapbox-gl-draw": "^1.2.0",
"@sentry/react": "^7.81.1",
"@tinymce/tinymce-react": "^4.3.0",
"@togglecorp/fujs": "^2.0.0",
"@togglecorp/re-map": "^0.2.0-beta-6",
"@togglecorp/toggle-form": "2.0.3",
"@togglecorp/toggle-request": "^1.0.0-beta.2",
"@turf/bbox": "^6.5.0",
"@turf/buffer": "^6.5.0",
"exceljs": "^4.3.0",
"file-saver": "^2.0.5",
"html-to-image": "^1.11.11",
"mapbox-gl": "^1.13.0",
"papaparse": "^5.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-focus-on": "^3.8.1",
"react-router-dom": "^6.18.0",
"sanitize-html": "^2.10.0"
},
"devDependencies": {
"@eslint/eslintrc": "^2.0.3",
"@julr/vite-plugin-validate-env": "^1.0.1",
"@types/file-saver": "^2.0.5",
"@types/html2canvas": "^1.0.0",
"@types/mapbox-gl": "^1.13.0",
"@types/node": "^20.1.3",
"@types/papaparse": "^5.3.8",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/sanitize-html": "^2.9.0",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.14",
"cross-var": "^1.1.0",
"dotenv-cli": "^7.2.1",
"eslint": "^8.40.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"fast-glob": "^3.3.0",
"happy-dom": "^9.18.3",
"openapi-typescript": "6.5.5",
"patch-package": "^7.0.0",
"postcss": "^8.3.0",
"postcss-nested": "^6.0.1",
"postcss-normalize": "^10.0.1",
"postcss-preset-env": "^8.3.2",
"postinstall-postinstall": "^2.1.0",
"rollup-plugin-visualizer": "^5.9.0",
"stylelint": "^15.6.1",
"stylelint-config-concentric": "^2.0.2",
"stylelint-config-recommended": "^12.0.0",
"stylelint-no-unused-selectors": "git+https://github.com/toggle-corp/stylelint-no-unused-selectors#e0831e1",
"stylelint-value-no-unknown-custom-properties": "^4.0.0",
"surge": "^0.23.1",
"typescript": "^5.0.4",
"unimported": "^1.28.0",
"vite": "^5.0.10",
"vite-plugin-checker": "^0.6.2",
"vite-plugin-compression2": "^0.11.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"
}
}
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { _cs } from '@togglecorp/fujs';

import AlertContext from '#contexts/alert';
import Alert from '#components/Alert';
import Portal from '#components/Portal';
import { Portal } from '@ifrc-go/ui';
import { DURATION_DEFAULT_ALERT_DISMISS } from '#utils/constants';

import styles from './styles.module.css';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f9bc670

Please sign in to comment.