Skip to content

Commit

Permalink
Refactor project - V2 (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
raulfdm authored Apr 25, 2023
1 parent 93d665e commit d5c3a4f
Show file tree
Hide file tree
Showing 103 changed files with 7,522 additions and 227,694 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
old
.cache
.temp
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// eslint-disable-next-line no-undef
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'simple-import-sort',
'eslint-plugin-prettier',
],
root: true,
rules: {
'prettier/prettier': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
};
14 changes: 0 additions & 14 deletions .eslintrc.js

This file was deleted.

44 changes: 29 additions & 15 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,42 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Checkout to repository
uses: actions/checkout@v3

- name: Use Node
uses: actions/setup-node@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14'
node-version: 18

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
with:
useRollingCache: true
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile

# Necessary because it's being used in the code
- name: Linting
run: npm run lint

- name: Testing
run: npm run test
run: pnpm run lint

- name: Build API Doc
run: npm run api:doc
# - name: Testing
# run: npm run test

- name: Build Web docs
run: npm run docs:build
run: pnpm run docs:build
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpx lint-staged
5 changes: 0 additions & 5 deletions .prettierrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"prisma.prisma"
]
}
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
FROM node:14
FROM node:18

WORKDIR /app

ENV NODE_ENV=production

COPY package.json .

RUN npm install --production
RUN corepack enable
RUN corepack prepare pnpm@latest-8 --activate

RUN pnpm i --prod --ignore-scripts

COPY . .

RUN ls

RUN pnpm prisma generate

EXPOSE 4000

CMD [ "npm", "start" ]
CMD [ "pnpm", "start" ]
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018 Raul de Melo
Copyright 2022 Raul de Melo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# TACO API
# Taco GraphQL API

> Brazilian Table of Food Composition
<p align="center">
<p>
<a href="https://github.com/raulfdm/taco-api/actions/workflows/app.yml">
<img src="https://github.com/raulfdm/taco-api/actions/workflows/app.yml/badge.svg"
alt="build status">
Expand All @@ -13,7 +13,7 @@
</a>
</p>

## Documentation
## Docs

For more details about this API, check the official docs:

Expand Down
10 changes: 0 additions & 10 deletions apidoc.json

This file was deleted.

6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: '3.9'

services:
taco_api:
build: ./
environment:
PORT: 4000

ports:
- '4000:4000'
- 4000:4000
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module.exports = {
themeConfig: {
logo: false,
import { defaultTheme, defineUserConfig } from 'vuepress';

export default defineUserConfig({
theme: defaultTheme({
repo: 'raulfdm/taco-api',
locales: {
'/': {
selectLanguageName: 'Português',
toggleDarkMode: 'Alternar modo escuro',
toggleColorMode: 'Alternar modo escuro',
openInNewWindow: 'Abrir em nova aba',
backToHome: 'Voltar para página inicial',
tip: 'Dica',
Expand All @@ -20,10 +21,8 @@ module.exports = {
selectLanguageName: 'English',
},
},
},
}),
locales: {
// The key is the path for the locale to be nested under.
// As a special case, the default locale can use '/' as its path.
'/': {
lang: 'pt-BR',
title: 'TACO API',
Expand All @@ -35,4 +34,4 @@ module.exports = {
description: 'Brazilian Table of Food Composition',
},
},
};
});
Loading

0 comments on commit d5c3a4f

Please sign in to comment.