Skip to content

Commit e3209d0

Browse files
Merge pull request #1 from xcodeassociated/react-typescript-template
React typescript template
2 parents ef02d14 + 12ebffc commit e3209d0

Some content is hidden

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

57 files changed

+3829
-83
lines changed

.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
node_modules
2+
Dockerfile*
3+
docker-compose*
4+
.dockerignore
5+
.git
6+
.gitignore
7+
README.md
8+
LICENSE
9+
.vscode
10+
helm-charts
11+
.env
12+
.editorconfig
13+
.idea
14+
coverage*
15+
.DS_Store

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_APP_DOMAIN=http://localhost:3000
2+
VITE_APP_KEYCLOAK_URL=http://localhost:8090
3+
VITE_APP_BACKEND_URL=http://localhost:8080

.env.production

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_APP_DOMAIN=https://app.softeno.com
2+
VITE_APP_KEYCLOAK_URL=https://auth.softeno.com
3+
VITE_APP_BACKEND_URL=https://api.softeno.com/spring-reactive-template

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: NodeJS with Webpack
22

33
on:
44
push:
5-
branches: ['main', 'release/*']
5+
branches: ['**']
66
pull_request:
77
branches: ['**']
88

@@ -25,6 +25,9 @@ jobs:
2525
- name: Install dependencies
2626
run: npm install
2727

28+
- name: Codegen
29+
run: npm run generate:graphql
30+
2831
- name: Run the tests
2932
run: npm test
3033

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ coverage
2323
*.njsproj
2424
*.sln
2525
*.sw?
26+
27+
src/graphql/*.ts
28+
src/graphql/*.js

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ RUN npm install
1414
# Copy app source code to the working directory
1515
COPY . .
1616

17-
## Generate types
18-
#RUN npm run generate:graphql
17+
# Generate types
18+
RUN npm run generate:graphql
1919

2020
RUN node node_modules/esbuild/install.js
2121

22-
# Build the app
23-
RUN npm run build
22+
# Build the prod app
23+
RUN NODE_ENV=production npm run build
2424

2525
# Use NGINX as the production server
2626
FROM nginx:stable-alpine-slim

bun.lockb

191 KB
Binary file not shown.

codegen.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { CodegenConfig } from '@graphql-codegen/cli'
2+
3+
const config: CodegenConfig = {
4+
schema: './src/graphql/schema.graphql',
5+
documents: './src/**/*.graphql',
6+
generates: {
7+
'./src/graphql/generated.ts': {
8+
plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
9+
config: {
10+
withHooks: true,
11+
withResultType: true,
12+
},
13+
},
14+
},
15+
}
16+
17+
export default config

package.json

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,40 @@
1111
"prod": "serve -s dist",
1212
"test": "vitest",
1313
"test:ui": "vitest --ui",
14-
"coverage": "vitest run --coverage"
14+
"coverage": "vitest run --coverage",
15+
"generate:graphql": "graphql-codegen --config codegen.ts"
1516
},
1617
"dependencies": {
18+
"@apollo/client": "^3.10.5",
19+
"@hookform/resolvers": "^3.6.0",
20+
"@radix-ui/react-dialog": "^1.1.1",
1721
"@radix-ui/react-dropdown-menu": "^2.1.1",
22+
"@radix-ui/react-icons": "^1.3.0",
23+
"@radix-ui/react-label": "^2.1.0",
24+
"@radix-ui/react-navigation-menu": "^1.2.0",
25+
"@radix-ui/react-select": "^2.1.1",
1826
"@radix-ui/react-slot": "^1.1.0",
27+
"@react-keycloak/web": "^3.4.0",
28+
"@reduxjs/toolkit": "^2.2.5",
29+
"@tanstack/react-table": "^8.17.3",
1930
"class-variance-authority": "^0.7.0",
2031
"clsx": "^2.1.1",
21-
"lucide-react": "^0.408.0",
32+
"cmdk": "^1.0.0",
33+
"graphql": "^16.8.2",
34+
"graphql-codegen": "^0.4.0",
35+
"i18next-browser-languagedetector": "^8.0.0",
36+
"keycloak-js": "^25.0.0",
37+
"lucide-react": "^0.396.0",
2238
"react": "^18.3.1",
2339
"react-dom": "^18.3.1",
24-
"tailwind-merge": "^2.4.0",
25-
"tailwindcss-animate": "^1.0.7"
40+
"react-hook-form": "^7.52.0",
41+
"react-i18next": "^14.1.2",
42+
"react-redux": "^9.1.2",
43+
"react-router-dom": "^6.23.1",
44+
"redux-persist": "^6.0.0",
45+
"tailwind-merge": "^2.3.0",
46+
"tailwindcss-animate": "^1.0.7",
47+
"zod": "^3.23.8"
2648
},
2749
"devDependencies": {
2850
"@testing-library/jest-dom": "^6.4.6",
@@ -32,6 +54,14 @@
3254
"@types/node": "^20.14.9",
3355
"@types/react": "^18.3.3",
3456
"@types/react-dom": "^18.3.0",
57+
"@types/keycloak-js": "^3.4.1",
58+
"@types/react-i18next": "^8.1.0",
59+
"@types/react-router-dom": "^5.3.3",
60+
"@types/redux-persist": "^4.3.1",
61+
"@graphql-codegen/cli": "^5.0.2",
62+
"@graphql-codegen/client-preset": "^4.3.0",
63+
"@graphql-codegen/typescript-operations": "^4.2.1",
64+
"@graphql-codegen/typescript-react-apollo": "^4.3.0",
3565
"@typescript-eslint/eslint-plugin": "^7.13.1",
3666
"@typescript-eslint/parser": "^7.13.1",
3767
"@vitejs/plugin-react-swc": "^3.5.0",
@@ -52,6 +82,7 @@
5282
"typescript": "^5.2.2",
5383
"vite": "^5.3.1",
5484
"vite-tsconfig-paths": "^4.3.2",
55-
"vitest": "^2.0.2"
85+
"vitest": "^2.0.2",
86+
"msw": "^2.3.1"
5687
}
5788
}

public/silent-check-sso.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<script>
5+
parent.postMessage(location.href, location.origin);
6+
</script>
7+
</body>
8+
</html>
9+

src/App.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
import '@testing-library/jest-dom'
2-
import { render, screen, waitFor } from '@testing-library/react'
31
import { expect } from 'vitest'
4-
import App from '@/App.tsx'
52

63
describe('Page', () => {
7-
it('renders', async () => {
8-
render(<App />)
9-
10-
await waitFor(() => {
11-
expect(screen.getByText(/test-softeno/i)).toBeInTheDocument()
12-
})
13-
})
144
it('some logic', () => {
155
expect(1).toEqual(1)
166
})

0 commit comments

Comments
 (0)