diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1b5dacbf..80b7c627 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,6 +8,8 @@ on:
env:
APP_TITLE: ${{ vars.APP_TITLE }}
+ APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }}
+ APP_GRAPHQL_ENDPOINT: ${{ vars.APP_GRAPHQL_ENDPOINT }}
GITHUB_WORKFLOW: true
jobs:
@@ -37,6 +39,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- uses: pnpm/action-setup@v4
name: Install pnpm
@@ -51,13 +55,15 @@ jobs:
run: pnpm install
- name: Run knip
- run: pnpm lint:unused
+ run: pnpm generate:type && pnpm lint:unused
lint-js:
name: Lint JS
environment: 'test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- uses: pnpm/action-setup@v4
name: Install pnpm
@@ -100,6 +106,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- uses: pnpm/action-setup@v4
name: Install pnpm
@@ -122,6 +130,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- uses: pnpm/action-setup@v4
name: Install pnpm
diff --git a/.gitignore b/.gitignore
index 4f1c24c5..a62060a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,10 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
+
node_modules
+generated
+.pnpm-store
dist
dist-ssr
build
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..18cf160f
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "backend"]
+ path = backend
+ url = git@github.com:toggle-corp/ai-chatbot-backend.git
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 00000000..6c59086d
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+enable-pre-post-scripts=true
diff --git a/Dockerfile b/Dockerfile
index 0b92c8be..5b63b5cb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,10 +2,10 @@ FROM node:18-bullseye
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
- git bash g++ make \
+ git bash g++ make iproute2 \
&& rm -rf /var/lib/apt/lists/*
-RUN npm install pnpm
+RUN npm install -g pnpm
WORKDIR /code
diff --git a/backend b/backend
new file mode 160000
index 00000000..259e9200
--- /dev/null
+++ b/backend
@@ -0,0 +1 @@
+Subproject commit 259e9200dada89c09dace4b45e6f1ee161fe2f83
diff --git a/codegen.ts b/codegen.ts
new file mode 100644
index 00000000..e2013d24
--- /dev/null
+++ b/codegen.ts
@@ -0,0 +1,20 @@
+import { CodegenConfig } from '@graphql-codegen/cli';
+
+const config: CodegenConfig = {
+ schema: process.env.APP_GRAPHQL_CODEGEN_ENDPOINT,
+ documents: [
+ 'src/**/*.tsx',
+ 'src/**/*.ts',
+ ],
+ ignoreNoDocuments: true, // for better experience with the watcher
+ generates: {
+ './generated/types/': {
+ preset: 'client',
+ },
+ },
+ config: {
+ enumsAsTypes: true,
+ },
+};
+
+export default config;
diff --git a/docker-compose-with-backend.yml b/docker-compose-with-backend.yml
new file mode 100644
index 00000000..492af476
--- /dev/null
+++ b/docker-compose-with-backend.yml
@@ -0,0 +1,16 @@
+name: chatbot
+
+services:
+ react:
+ build: ../
+ command: sh -c 'pnpm install && pnpm start --host'
+ environment:
+ APP_TITLE: ${APP_TITLE:-CMS}
+ APP_GRAPHQL_ENDPOINT: ${APP_GRAPHQL_ENDPOINT:-http://localhost:8001/graphql/}
+ APP_GRAPHQL_CODEGEN_ENDPOINT: ${APP_GRAPHQL_CODEGEN_ENDPOINT:-http://web:8001/graphql/}
+ volumes:
+ - ../:/code
+ ports:
+ - '3000:3000'
+ depends_on:
+ - web
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index 3f19cad0..00000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-version: '3.8'
-services:
- react:
- build: .
- command: sh -c 'yarn install && yarn dev --host'
- environment:
- APP_TITLE: ${APP_TITLE:-React Base App}
- volumes:
- - .:/code
- ports:
- - '3000:3000'
diff --git a/env.ts b/env.ts
index d925fa5a..3a233f53 100644
--- a/env.ts
+++ b/env.ts
@@ -4,6 +4,6 @@ import {
} from '@julr/vite-plugin-validate-env';
export default defineConfig({
+ COMPOSE_FILE: Schema.string.optional(),
APP_TITLE: Schema.string.optional(),
- GRAPHQL_ENDPOINT: Schema.string.optional(),
});
diff --git a/index.html b/index.html
index e0322f2c..5d8267dd 100644
--- a/index.html
+++ b/index.html
@@ -21,7 +21,27 @@
%APP_TITLE%
-
+
+
+