Skip to content

Commit 08da3fe

Browse files
authored
Merge pull request #93 from thangved/feat/upgrade
Feat/upgrade
2 parents de5dd99 + a892e7f commit 08da3fe

Some content is hidden

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

43 files changed

+285
-194
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/actions/setup-node/action.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: Setup Node.js
22
description: Setup Node.js
33

44
runs:
5-
using: "composite"
6-
steps:
7-
- uses: actions/setup-node@v4
8-
name: Setup Node.js
9-
with:
10-
node-version-file: .nvmrc
11-
- name: Install dependencies
12-
run: npm i
13-
shell: bash
5+
using: "composite"
6+
steps:
7+
- uses: actions/setup-node@v4
8+
name: Setup Node.js
9+
with:
10+
node-version-file: .nvmrc
11+
- name: Install dependencies
12+
run: npm i
13+
shell: bash

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: [v*]
7+
pull_request:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
DOCKER_USER: ${{ github.actor }}
13+
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
14+
15+
jobs:
16+
publish:
17+
name: Publish
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
attestations: write
23+
id-token: write
24+
steps:
25+
- name: Install Cosign
26+
uses: sigstore/[email protected]
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
- name: Login to Container Registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ env.DOCKER_USER }}
36+
password: ${{ env.DOCKER_PASSWORD }}
37+
- name: Get metadata
38+
uses: docker/metadata-action@v4
39+
id: meta
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
tags: |
43+
type=ref,event=branch
44+
type=ref,event=pr
45+
type=semver,pattern={{version}}
46+
type=semver,pattern={{major}}.{{minor}}
47+
type=sha
48+
- name: Build and push
49+
uses: docker/build-push-action@v4
50+
id: build-and-push
51+
with:
52+
context: .
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57+
cache-to: type=inline
58+
- name: Sign the published Docker image
59+
if: ${{ github.event_name != 'pull_request' }}
60+
env:
61+
TAGS: ${{ steps.meta.outputs.tags }}
62+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
63+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
## [1.1.0](https://github.com/thangved/react-boilerplate/compare/v1.0.7...v1.1.0) (2024-12-17)
44

5-
65
### Features
76

8-
* add i18next ([05f925b](https://github.com/thangved/react-boilerplate/commit/05f925be508b94f7f1ab300b09c690c70d1dea7d))
9-
7+
- add i18next ([05f925b](https://github.com/thangved/react-boilerplate/commit/05f925be508b94f7f1ab300b09c690c70d1dea7d))
108

119
### Bug Fixes
1210

13-
* **deps:** update react monorepo to v19 ([95fe746](https://github.com/thangved/react-boilerplate/commit/95fe7469d5116af762419e35fd97cce8e08b7d5d))
11+
- **deps:** update react monorepo to v19 ([95fe746](https://github.com/thangved/react-boilerplate/commit/95fe7469d5116af762419e35fd97cce8e08b7d5d))
1412

1513
## [1.0.7](https://github.com/thangved/react-boilerplate/compare/v1.0.6...v1.0.7) (2024-12-06)
1614

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM node:22 AS base
2+
3+
FROM base AS builder
4+
5+
WORKDIR /app
6+
7+
ADD ./package.json ./
8+
9+
RUN npm i --ignore-scripts
10+
11+
ADD ./locales ./locales
12+
ADD ./public ./public
13+
ADD ./src ./src
14+
ADD ./index.html\
15+
./tsconfig.json\
16+
./tsconfig.node.json\
17+
./vite.config.ts\
18+
./
19+
20+
RUN npm run build
21+
22+
FROM nginx:alpine AS runner
23+
24+
COPY --from=builder /app/dist /usr/share/nginx/html
25+
ADD ./nginx.conf /etc/nginx/conf.d/default.conf
26+
27+
EXPOSE 80
28+
29+
CMD ["nginx", "-g", "daemon off;"]

compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
web:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
image: ghrc.io/thangved/react-boilerplate
7+
ports:
8+
- 8888:80
9+
api:
10+
image: ghrc.io/thangved/express0

eslint.config.mjs

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
11
import { fixupConfigRules } from "@eslint/compat";
2+
import { FlatCompat } from "@eslint/eslintrc";
3+
import js from "@eslint/js";
4+
import tsParser from "@typescript-eslint/parser";
25
import reactRefresh from "eslint-plugin-react-refresh";
36
import globals from "globals";
4-
import tsParser from "@typescript-eslint/parser";
57
import path from "node:path";
68
import { fileURLToPath } from "node:url";
7-
import js from "@eslint/js";
8-
import { FlatCompat } from "@eslint/eslintrc";
99

1010
const __filename = fileURLToPath(import.meta.url);
1111
const __dirname = path.dirname(__filename);
1212
const compat = new FlatCompat({
13-
baseDirectory: __dirname,
14-
recommendedConfig: js.configs.recommended,
15-
allConfig: js.configs.all
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
1616
});
1717

18-
export default [{
19-
ignores: ["**/dist", "**/.eslintrc.cjs"],
20-
}, ...fixupConfigRules(compat.extends(
21-
"eslint:recommended",
22-
"plugin:@typescript-eslint/recommended",
23-
"plugin:react-hooks/recommended",
24-
)), {
25-
plugins: {
26-
"react-refresh": reactRefresh,
27-
},
18+
export default [
19+
{
20+
ignores: ["**/dist", "**/.eslintrc.cjs"],
21+
},
22+
...fixupConfigRules(
23+
compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"),
24+
),
25+
{
26+
plugins: {
27+
"react-refresh": reactRefresh,
28+
},
2829

29-
languageOptions: {
30-
globals: {
31-
...globals.browser,
32-
},
30+
languageOptions: {
31+
globals: {
32+
...globals.browser,
33+
},
3334

34-
parser: tsParser,
35-
},
35+
parser: tsParser,
36+
},
3637

37-
rules: {
38-
"react-refresh/only-export-components": ["warn", {
39-
allowConstantExport: true,
40-
}],
41-
},
42-
}];
38+
rules: {
39+
"react-refresh/only-export-components": [
40+
"warn",
41+
{
42+
allowConstantExport: true,
43+
},
44+
],
45+
},
46+
},
47+
];

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
.app-logo {
6060
width: 150px;
6161
height: 150px;
62-
background: url(@/assets/logo.svg) no-repeat center center / contain;
62+
background: url(/logo.svg) no-repeat center center / contain;
6363
animation: blingbling 0.5s infinite;
6464
position: relative;
6565
z-index: 10;

nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
listen 80;
3+
4+
location /api {
5+
proxy_pass http://api:3000;
6+
proxy_set_header Host $host;
7+
proxy_set_header X-Real-IP $remote_addr;
8+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
9+
proxy_set_header X-Forwarded-Proto $scheme;
10+
}
11+
12+
location / {
13+
root /usr/share/nginx/html;
14+
index index.html;
15+
try_files $uri $uri/ /index.html;
16+
}
17+
}

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "react-boilerplate",
33
"version": "1.1.0",
44
"private": true,
5+
"license": "MIT",
56
"type": "module",
67
"scripts": {
78
"build": "tsc && vite build",
@@ -22,19 +23,14 @@
2223
"clsx": "^2.1.1",
2324
"i18next": "^24.1.1",
2425
"i18next-browser-languagedetector": "^8.0.2",
25-
"i18next-chained-backend": "^4.6.2",
26-
"i18next-http-backend": "^3.0.1",
2726
"i18next-localstorage-backend": "^4.2.0",
2827
"react": "^19.0.0",
2928
"react-dom": "^19.0.0",
3029
"react-i18next": "^15.2.0",
3130
"react-redux": "^9.2.0",
3231
"react-router-dom": "^7.0.2",
3332
"sharp": "^0.33.5",
34-
"svgo": "^3.3.2",
35-
"translation-check": "^1.1.0",
36-
"vite-plugin-bundle-prefetch": "^0.0.4",
37-
"vite-plugin-image-optimizer": "^1.1.8"
33+
"svgo": "^3.3.2"
3834
},
3935
"devDependencies": {
4036
"@commitlint/cli": "^19.6.1",

0 commit comments

Comments
 (0)