Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn into monorepo #53

Merged
merged 17 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/app.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: App
name: CI

on: [push]

Expand All @@ -19,10 +19,7 @@ jobs:

# Necessary because it's being used in the code
- name: Linting/Formating
run: bunx @biomejs/biome ci src
run: bun run lint:ci

- name: Build
run: bun run build

- name: Build Web docs
run: bun run docs:build
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ typings/
# Serverless directories
.serverless

# Others
docs/

## macOS
.DS_Store

## Misc
.temp
.cache
documentation/.vuepress/dist
dist/
dist/
.turbo
18 changes: 12 additions & 6 deletions Dockerfile → apps/taco/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ FROM base as installer
# install with devDependencies to be used later
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
COPY /apps/taco/package.json /temp/dev/apps/taco/package.json
COPY /apps/website/package.json /temp/dev/apps/website/package.json
RUN cd /temp/dev && bun install --frozen-lockfile --ignore-scripts

# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
COPY /apps/taco/package.json /temp/prod/apps/taco/package.json
# We need to include the website package.json because otherwise it will throw
# an error due to a difference between lockfiles
COPY /apps/website/package.json /temp/prod/apps/website/package.json
RUN cd /temp/prod && bun install --frozen-lockfile --production --ignore-scripts

# ------------------------------ #
Expand All @@ -28,8 +34,8 @@ ENV NODE_ENV=production
COPY --from=installer /temp/dev/node_modules node_modules
COPY . .

RUN bun run build
RUN bunx prisma generate
RUN bun run build --filter=taco-api
RUN cd ./apps/taco && bunx prisma generate

# ------------------------------ #
FROM base AS release
Expand All @@ -39,10 +45,10 @@ COPY --from=installer /temp/prod/node_modules /app/node_modules
# Includes the prisma client generated
COPY --from=prerelease /app/node_modules/.prisma /app/node_modules/.prisma
# Includes the database and schema
COPY --from=prerelease /app/src/infrastructure/prisma /app/src/infrastructure/prisma
COPY --from=prerelease /app/dist/app.js .
COPY --from=prerelease /app/package.json .
COPY --from=prerelease /app/apps/taco/src/infrastructure/prisma /app/src/infrastructure/prisma
COPY --from=prerelease /app/apps/taco/dist/app.js .
COPY --from=prerelease /app/apps/taco/package.json .

# run the app
EXPOSE 4000/tcp
EXPOSE 4000
ENTRYPOINT [ "bun", "run", "app.js" ]
4 changes: 4 additions & 0 deletions apps/taco/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"extends": ["../../biome.json"]
}
File renamed without changes.
48 changes: 48 additions & 0 deletions apps/taco/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "taco-api",
"description": "Brazilian Table of Food Composition (TACO) - GraphQL API",
"version": "2.3.0",
"type": "module",
"homepage": "https://github.com/raulfdm/taco-api",
"bugs": {
"url": "https://github.com/raulfdm/taco-api/issues"
},
"scripts": {
"start": "NODE_ENV=production bun run src/app.ts",
"dev": "NODE_ENV=development bun --watch src/app.ts",
"studio": "prisma studio",
"build": "bun run scripts/build.ts",
"lint": "biome lint src",
"lint:ci": "biome ci src",
"db:migrate": "NODE_ENV=development prisma migrate dev",
"db:generate": "NODE_ENV=development prisma generate",
"db:seed": "NODE_ENV=development prisma db seed",
"db:reset": "NODE_ENV=development prisma migrate reset",
"prepare": "bun run db:generate"
},
"dependencies": {
"@prisma/client": "5.7.0",
"cors": "2.8.5",
"express": "4.18.2",
"graphql": "16.8.1",
"graphql-http": "1.22.0",
"graphql-modules": "2.3.0",
"zod": "3.22.4"
},
"devDependencies": {
"@types/cors": "2.8.17",
"@types/express": "4.17.21",
"bun-types": "1.0.15",
"csvtojson": "2.0.10",
"prisma": "5.7.0",
"typescript": "5.3.2"
},
"packageManager": "bun@1.0.15",
"engines": {
"bun": "1.0.15"
},
"prisma": {
"seed": "bun run ./src/infrastructure/seed/index.ts",
"schema": "./src/infrastructure/prisma/schema.prisma"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions apps/taco/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"compilerOptions": {
"lib": [
"ESNext"
],
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"downlevelIteration": true,
"skipLibCheck": true,
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
},
"types": [
"bun-types" // add Bun global
]
}
}
11 changes: 11 additions & 0 deletions apps/website/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"extends": ["../../biome.json"],
"files": {
"ignore": [
"./docs/.vuepress/dist/**/*",
"./docs/.vuepress/.temp/**/*",
"./docs/.vuepress/.cache/**/*"
]
}
}
67 changes: 67 additions & 0 deletions apps/website/docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { defaultTheme, defineUserConfig } from "vuepress";

export default defineUserConfig({
theme: defaultTheme({
repo: "raulfdm/taco-api",
locales: {
"/": {
navbar: [
{
text: "Versão",
children: [
{
text: "Changelog",
link: "https://github.com/raulfdm/taco-api/blob/main/CHANGELOG.md",
},
{
text: "v1.0.0",
link: "https://6447d8ec2c2ccb00085151ca--taco-api.netlify.app/",
},
],
},
],
selectLanguageName: "Português",
toggleColorMode: "Alternar modo escuro",
openInNewWindow: "Abrir em nova aba",
backToHome: "Voltar para página inicial",
tip: "Dica",
warning: "Atenção",
danger: "Perigo",
contributorsText: "Contribuidores",
lastUpdatedText: "Atualizado pela última vez em",
editLinkText: "Edite esta página",
selectLanguageText: "Idiomas",
},
"/en/": {
navbar: [
{
text: "Version",
children: [
{
text: "Changelog",
link: "https://github.com/raulfdm/taco-api/blob/main/CHANGELOG.md",
},
{
text: "v1.0.0",
link: "https://6447d8ec2c2ccb00085151ca--taco-api.netlify.app/",
},
],
},
],
selectLanguageName: "English",
},
},
}),
locales: {
"/": {
lang: "pt-BR",
title: "TACO API",
description: "Tabela Brasileira de Composição de Alimentos",
},
"/en/": {
lang: "en-US",
title: "TACO API",
description: "Brazilian Table of Food Composition",
},
},
});
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions apps/website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "website",
"private": true,
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs",
"lint": "biome lint docs",
"lint:ci": "biome ci docs"
},
"devDependencies": {
"@vuepress/client": "2.0.0-rc.0",
"vue": "3.3.11",
"vuepress": "2.0.0-rc.0"
}
}
Binary file modified bun.lockb
Binary file not shown.
File renamed without changes.
67 changes: 0 additions & 67 deletions documentation/.vuepress/config.ts

This file was deleted.

Loading
Loading