Skip to content

Commit

Permalink
chore: updated base
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzo committed Feb 21, 2024
1 parent 9a4d04c commit 4df63b7
Show file tree
Hide file tree
Showing 30 changed files with 4,259 additions and 4,248 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy using SSH

on:
push:
branches:
- develop
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: "${{ github.repository }}"

jobs:

build:
environment: ${{ github.ref_name == 'master' && 'production' || 'staging'}}

runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Metadata Extraction for Main Image
id: meta_main
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and Push Main Image
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}"
push: true
file: Dockerfile
tags: "${{ steps.meta_main.outputs.tags }}"
labels: ${{ steps.meta_main.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
secrets: |
"env_variables=${{ secrets.ENV_VARIABLES}}"
deploy:
environment: ${{ github.ref_name == 'master' && 'production' || 'staging'}}
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Deploy to Staging
uses: appleboy/[email protected]
env:
PROJECT_PATH: ${{ vars.PROJECT_PATH }}
COMPOSE_FILE: ${{ vars.COMPOSE_FILE }}

with:
host: ${{ vars.REMOTE_HOST }}
username: ${{ vars.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script_stop: true
envs: PROJECT_PATH,COMPOSE_FILE
script: |
export COMPOSE_INTERACTIVE_NO_CLI=1
cd $PROJECT_PATH
set -euxo pipefail
git pull
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker compose -f ${{ vars.COMPOSE_FILE }} pull COMPOSE_NAME
docker compose -f ${{ vars.COMPOSE_FILE }} up -d COMPOSE_NAME
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build
coverage
yarn.lock
yarn.lock
*.yml
*.json
10 changes: 10 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
afterInstall: yarn husky

compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.6.0/bundles/@yarnpkg/plugin-after-install.js"
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:20 AS builder

WORKDIR /app

RUN corepack enable

COPY ./yarn.lock ./package.json ./.yarnrc.yml ./

COPY patches/ ./patches

RUN yarn install

COPY . .

RUN --mount=type=secret,id=env_variables \
cat /run/secrets/env_variables > .env

RUN yarn ioc-generate

RUN yarn graphql

RUN yarn build --base=/clientes/payments/

FROM nginx

# delete default nginx static files
RUN rm -rf /usr/share/nginx/html/*

# copy build files from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
19 changes: 0 additions & 19 deletions Dockerfile.prod

This file was deleted.

1 change: 0 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ corepack-enable:
# Installs project package.json dependencies
install-deps:
./nvm_exec.sh yarn
./nvm_exec.sh yarn husky install

# Starts React development server
dev:
Expand Down
71 changes: 36 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,81 +16,82 @@
"e2e:open": "cypress open",
"ioc-generate": "inversify-generator",
"prettier-fix": "prettier ./src --write --ignore-unknown",
"prettier-check": "prettier ./src --check --ignore-unknown"
"prettier-check": "prettier ./src --check --ignore-unknown",
"prepare": "husky"
},
"dependencies": {
"@apollo/client": "~3.8.8",
"@apollo/client": "~3.9.5",
"@front_web_mrmilu/hooks": "~2.1.0",
"@front_web_mrmilu/network": "~2.1.0",
"@front_web_mrmilu/services": "~2.1.0",
"@front_web_mrmilu/utils": "~2.1.0",
"@hookform/resolvers": "~3.3.4",
"@react-spring/web": "~9.7.3",
"@sentry/react": "~7.92.0",
"@sentry/tracing": "~7.92.0",
"@vanilla-extract/css": "~1.14.0",
"@sentry/react": "~7.102.0",
"@sentry/tracing": "~7.102.0",
"@vanilla-extract/css": "~1.14.1",
"@vanilla-extract/recipes": "~0.5.1",
"axios": "~1.6.5",
"axios": "~1.6.7",
"class-transformer": "~0.5.1",
"graphql": "~16.8.1",
"i18next": "~23.7.16",
"i18next-http-backend": "~2.4.2",
"i18next": "~23.9.0",
"i18next-http-backend": "~2.4.3",
"i18next-resources-to-backend": "~1.2.0",
"immer": "~10.0.3",
"inversify": "~6.0.2",
"inversify-generator": "~0.1.5",
"lodash": "~4.17.21",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"react-hook-form": "~7.49.2",
"react-i18next": "~14.0.0",
"react-router-dom": "~6.21.1",
"react-hook-form": "~7.50.1",
"react-i18next": "~14.0.5",
"react-router-dom": "~6.22.1",
"reflect-metadata": "~0.2.1",
"web-vitals": "~3.5.1",
"web-vitals": "~3.5.2",
"yup": "~1.3.3",
"zustand": "~4.4.7"
"zustand": "~4.5.1"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-decorators": "~7.23.7",
"@commitlint/cli": "~18.4.4",
"@commitlint/config-conventional": "~18.4.4",
"@commitlint/prompt-cli": "~18.4.4",
"@graphql-codegen/cli": "~5.0.0",
"@graphql-codegen/fragment-matcher": "~5.0.0",
"@graphql-codegen/introspection": "~4.0.0",
"@babel/plugin-proposal-decorators": "~7.23.9",
"@commitlint/cli": "~18.6.1",
"@commitlint/config-conventional": "~18.6.2",
"@commitlint/prompt-cli": "~18.6.1",
"@graphql-codegen/cli": "~5.0.2",
"@graphql-codegen/fragment-matcher": "~5.0.2",
"@graphql-codegen/introspection": "~4.0.2",
"@graphql-codegen/near-operation-file-preset": "~3.0.0",
"@graphql-codegen/typescript": "~4.0.1",
"@graphql-codegen/typescript": "~4.0.4",
"@graphql-codegen/typescript-graphql-files-modules": "~3.0.0",
"@graphql-codegen/typescript-operations": "~4.0.1",
"@graphql-codegen/typescript-operations": "~4.1.2",
"@rollup/plugin-graphql": "~2.0.4",
"@types/lodash": "~4.14.202",
"@types/node": "~20.10.7",
"@types/react": "~18.2.47",
"@types/react-dom": "~18.2.18",
"@typescript-eslint/eslint-plugin": "~6.18.0",
"@typescript-eslint/parser": "~6.18.0",
"@vanilla-extract/vite-plugin": "~3.9.3",
"@types/node": "~20.11.19",
"@types/react": "~18.2.57",
"@types/react-dom": "~18.2.19",
"@typescript-eslint/eslint-plugin": "~7.0.2",
"@typescript-eslint/parser": "~7.0.2",
"@vanilla-extract/vite-plugin": "~4.0.4",
"@vitejs/plugin-react": "~4.2.1",
"babel-plugin-import-graphql": "2.8.1",
"babel-plugin-inline-react-svg": "2.0.2",
"babel-plugin-transform-typescript-metadata": "0.3.2",
"cypress": "~13.6.2",
"cypress": "~13.6.4",
"esbuild-plugin-tsc": "0.4.0",
"eslint": "~8.56.0",
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-jsx-a11y": "~6.8.0",
"eslint-plugin-react": "~7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-unused-imports": "~3.0.0",
"eslint-plugin-unused-imports": "~3.1.0",
"http-proxy-middleware": "2.0.6",
"husky": "8.0.3",
"lint-staged": "~15.2.0",
"prettier": "~3.1.1",
"husky": "~9.0.11",
"lint-staged": "~15.2.2",
"prettier": "~3.2.5",
"react-app-alias": "2.2.2",
"typescript": "~5.3.3",
"vite": "~5.0.11",
"vite": "~5.1.3",
"vite-plugin-svgr": "~4.2.0"
},
"packageManager": "yarn@3.2.1"
"packageManager": "yarn@4.1.0"
}
15 changes: 2 additions & 13 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { StrictMode } from "react";
import reportWebVitals from "./reportWebVitals";
import { createRoot } from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { RouterProvider } from "react-router-dom";
import "@/src/ui/i18n/index";
import * as Sentry from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";
import { locator } from "@/src/core/app/ioc";
import type { IEnvVars } from "@/src/core/app/domain/interfaces/env_vars";
import { TYPES } from "@/src/core/app/ioc/types";
import App from "@/src/ui/app";
import "@/src/common/utils/yup_extensions";
import { router } from "@/src/ui/router/routes";

if (locator.get<IEnvVars>(TYPES.IEnvVars).sentryEnabled) {
Sentry.init({
Expand All @@ -23,11 +23,6 @@ if (locator.get<IEnvVars>(TYPES.IEnvVars).sentryEnabled) {

const container = document.getElementById("root");
const root = createRoot(container as HTMLElement);
// TODO migrate to new DataRouter API
const router = createBrowserRouter([
// match everything with "*"
{ path: "*", element: <App /> }
]);
root.render(
// Un comment strict mode when libraries like redux and react spring support react 18v in a stable way
<StrictMode>
Expand All @@ -39,9 +34,3 @@ root.render(
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

declare global {
interface Window {
Cypress: boolean;
}
}
22 changes: 0 additions & 22 deletions src/ui/app.tsx

This file was deleted.

44 changes: 0 additions & 44 deletions src/ui/components/base_layout/base_layout.tsx

This file was deleted.

Loading

0 comments on commit 4df63b7

Please sign in to comment.