diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index d7674ba3..87db778c 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -24,7 +24,7 @@ runs: shell: bash run: | corepack enable - yarn set version 4.2.1 + yarn set version 4.2.2 - name: Install projects dependencies shell: bash diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index f047614f..45cf25af 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -46,7 +46,9 @@ jobs: run: sudo systemctl start mysql.service - name: Run tests - run: yarn test + run: | + yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma + yarn test version: runs-on: ubuntu-latest diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbffa449..02daf328 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: MYSQL_DATABASE: test MYSQL_PORT: 3306 DATABASE_URL: mysql://root:root@127.0.0.1:3306/test - ADMIN_PASSWORD: admin_password + TEST_DATABASE_URL: mysql://root:root@127.0.0.1:3306/test CONVERTKIT_API_KEY: api_key CONVERTKIT_FORM_ID: form_id outputs: @@ -43,7 +43,9 @@ jobs: run: sudo systemctl start mysql.service - name: Run tests - run: yarn test + run: | + yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma + yarn test preview-frontend: runs-on: ubuntu-latest @@ -56,7 +58,7 @@ jobs: - name: Install Yarn 4 run: | corepack enable - yarn set version 4.2.1 + yarn set version 4.2.2 - name: Install Vercel CLI run: npm install --global vercel@latest diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml index 204a3d93..63093618 100644 --- a/.github/workflows/deploy-frontend.yml +++ b/.github/workflows/deploy-frontend.yml @@ -22,7 +22,7 @@ jobs: - name: Install Yarn 4 run: | corepack enable - yarn set version 4.2.1 + yarn set version 4.2.2 - name: Install Vercel CLI run: npm install --global vercel@latest diff --git a/apps/core/README.md b/apps/core/README.md index 89ea66f3..55de104b 100644 --- a/apps/core/README.md +++ b/apps/core/README.md @@ -1,12 +1,12 @@ # Snipcode Core -This is the core backend of Snipcode. All the business logic behind this application is implemented here. +This is the backend of Snipcode, containing the business logics related to . ## Tech Stack * Node.js -* Typescript +* TypeScript * GraphQL -* MySQL 8 through PlanetScale +* MySQL * Prisma ## Prerequisites @@ -15,13 +15,13 @@ Make sure you have this tools installed before running the project * NPM or Yarn * Docker * AWS CLI v2 +* MySQL 8 on PlanetScale ## Packages dependencies We use Yarn workspace to create packages we can share with other applications. These packages are located in the folder `packages`, so you might need to change the code of one or many packages to implement a feature. Here are the packages used in this project: -* [@snipcode/database](../../packages/database) * [@snipcode/domain](../../packages/domain) * [@snipcode/logger](../../packages/logger) * [@snipcode/utils](../../packages/utils) diff --git a/apps/core/tsconfig.json b/apps/core/tsconfig.json index 192dafc8..9d32a654 100644 --- a/apps/core/tsconfig.json +++ b/apps/core/tsconfig.json @@ -23,8 +23,5 @@ { "path": "../../packages/domain" }, - { - "path": "../../packages/database" - } ] } diff --git a/apps/functions/code-embed/scripts/setup-layer.sh b/apps/functions/code-embed/scripts/setup-layer.sh index db1e129f..25f1b45d 100755 --- a/apps/functions/code-embed/scripts/setup-layer.sh +++ b/apps/functions/code-embed/scripts/setup-layer.sh @@ -8,7 +8,7 @@ mkdir -p layers/shiki-layer/nodejs/node_modules cd ../../.. -yarn workspace @snipcode/database db:generate +yarn workspace @snipcode/domain db:generate cp -r node_modules/.prisma apps/functions/code-embed/layers/prisma-layer/nodejs/node_modules diff --git a/package.json b/package.json index a69b4110..96bfab82 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,10 @@ "scripts": { "build": "turbo run build", "build:prod": "turbo run build:prod", - "build:backend": "turbo run build --filter=!@snipcode/web", "dev": "turbo run dev --no-cache --parallel --continue", "lint": "turbo run lint", "test": "turbo run test", - "clean": "turbo run clean && rm -rf .turbo", + "clean": "turbo run clean --force && rm -rf .turbo", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "cache:login": "turbo login", "cache:link": "turbo link", diff --git a/packages/embed/README.md b/packages/embed/README.md index 4e42ea45..46a2a61a 100644 --- a/packages/embed/README.md +++ b/packages/embed/README.md @@ -33,7 +33,7 @@ nano .env Start the database locally ```shell -yarn workspace @snipcode/database db:dev +yarn workspace @snipcode/domain db:dev ``` ## Start the watcher for the CSS and JS diff --git a/packages/embed/package.json b/packages/embed/package.json index 4858abc2..3d4b350f 100644 --- a/packages/embed/package.json +++ b/packages/embed/package.json @@ -21,6 +21,7 @@ "test": "jest" }, "devDependencies": { + "@snipcode/domain": "workspace:*", "@types/express": "4.17.21", "express": "4.19.1", "nodemon": "2.0.22", diff --git a/packages/embed/tsconfig.json b/packages/embed/tsconfig.json index e68cd4e8..6836d362 100644 --- a/packages/embed/tsconfig.json +++ b/packages/embed/tsconfig.json @@ -14,5 +14,10 @@ "include": ["src", "__tests__", "index.ts"], "exclude": [ "node_modules" + ], + "references": [ + { + "path": "../../packages/domain" + } ] } diff --git a/turbo.json b/turbo.json index 5f94c6ab..aa568ee4 100644 --- a/turbo.json +++ b/turbo.json @@ -38,7 +38,7 @@ "DATABASE_URL" ] }, - "@snipcode/database#build": { + "@snipcode/domain#build": { "dependsOn": [ "^build", "prebuild" diff --git a/yarn.lock b/yarn.lock index f0344c31..26749a1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5459,6 +5459,7 @@ __metadata: version: 0.0.0-use.local resolution: "@snipcode/embed@workspace:packages/embed" dependencies: + "@snipcode/domain": "workspace:*" "@types/express": "npm:4.17.21" express: "npm:4.19.1" nodemon: "npm:2.0.22"