Skip to content

Commit

Permalink
build(web): move to apps/web, rename package, bump deps, adapt code
Browse files Browse the repository at this point in the history
Signed-off-by: --help <[email protected]>
  • Loading branch information
MrSquaare committed Dec 19, 2024
1 parent 771de15 commit f1ad8e6
Show file tree
Hide file tree
Showing 85 changed files with 3,106 additions and 4,504 deletions.
36 changes: 0 additions & 36 deletions .dockerignore

This file was deleted.

41 changes: 0 additions & 41 deletions .eslintrc.js

This file was deleted.

17 changes: 17 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Setup environment"
description: "Setup environment"

runs:
using: "composite"
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: "pnpm"

- name: Install dependencies
shell: bash
run: pnpm install
14 changes: 2 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm

- name: Install dependencies
run: pnpm install
- name: Setup environment
uses: ./.github/actions/setup-env

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/web-app-pull-request.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/web-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "@mrsquaare-fr/web Pull Request"

on:
pull_request:
branches:
- main
paths:
- ".github/workflows/web-pull-request.yml"
- "apps/web/**"

jobs:
setup:
runs-on: ubuntu-latest
name: Setup

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup environment
uses: ./.github/actions/setup-env

build:
needs: setup
runs-on: ubuntu-latest
name: Build

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup environment
uses: ./.github/actions/setup-env

- name: Build
run: pnpm build --filter @mrsquaare-fr/web

lint:
needs: setup
runs-on: ubuntu-latest
name: Analyze

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup environment
uses: ./.github/actions/setup-env

- name: Lint
run: pnpm lint --filter @mrsquaare-fr/web

docker:
runs-on: ubuntu-latest
name: Build Docker Image

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build
uses: docker/build-push-action@v5
with:
context: .
push: false
file: ./apps/web/Dockerfile
tags: image:latest
cache-from: type=gha
cache-to: type=gha,mode=max
18 changes: 4 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,17 @@
# Node
**/node_modules/

# Next.js
next-env.d.ts

# Turborepo
**/.turbo/

# Builds
**/.next/
**/.swc/
**/dist/
**/out/
**/*.tsbuildinfo

# Tests
**/coverage/

# Editors and IDEs
.idea/
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/*.code-snippets
!.vscode/*.code-snippets

# macOS
.DS_Store
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"jest.autoRun": {}
}
"i18n-ally.enabledFrameworks": ["react-i18next"],
"i18n-ally.localesPaths": ["apps/web/src/locales"]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This repository is a [monorepo](https://en.wikipedia.org/wiki/Monorepo), powered

It is only composed of one main project:

- the [Web App](web-app), powered by [Next.js](https://nextjs.org/)
- the [Web App](apps/web), powered by [Remix](https://remix.run/)

## Getting started

Expand Down
5 changes: 5 additions & 0 deletions apps/web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules

/.cache
/build
.env
File renamed without changes.
22 changes: 10 additions & 12 deletions web-app.Dockerfile → apps/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
FROM node:20-alpine AS base
FROM node:22-alpine AS base

ENV PNPM_HOME="/pnpm"
ENV APP_DIRECTORY="/usr/src/app"

ENV PATH="${PATH}:${PNPM_HOME}"

RUN corepack enable pnpm
ENV TURBO_TELEMETRY_DISABLED="1"

WORKDIR ${APP_DIRECTORY}

COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./
COPY ./web-app/package.json ./web-app/

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN corepack enable pnpm
COPY ./apps/web/package.json ./apps/web/


FROM base AS build

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

COPY ./turbo.json ./turbo.json
COPY ./web-app ./web-app
RUN pnpm build:web
COPY ./apps/web ./apps/web
RUN pnpm build


FROM base

COPY --from=build ${APP_DIRECTORY}/web-app/build/ ./web-app/build/

ENV NODE_ENV="production"
COPY --from=build ${APP_DIRECTORY}/apps/web/build/ ./apps/web/build/

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

Expand All @@ -36,4 +34,4 @@ EXPOSE 3000

ENTRYPOINT ["dumb-init", "--"]

CMD ["pnpm", "-F", "web-app", "start"]
CMD ["pnpm", "-F", "@mrsquaare-fr/web", "start"]
File renamed without changes.
41 changes: 41 additions & 0 deletions apps/web/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import jsxA11y from "eslint-plugin-jsx-a11y";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";

import rootConfig from "../../eslint.config.mjs";

export default [
{ ignores: ["build"] },
...rootConfig,
jsxA11y.flatConfigs.recommended,
{
...react.configs.flat.recommended,
...react.configs.flat["jsx-runtime"],
settings: {
react: {
version: "detect",
},
},
},
{
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
"react/jsx-curly-brace-presence": ["warn", { props: "always" }],
"react/jsx-sort-props": ["warn"],
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"error",
{ allowExportNames: ["meta", "links", "headers", "loader", "action"] },
],
},
},
];
Loading

0 comments on commit f1ad8e6

Please sign in to comment.