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

chore: upgrades 2023 #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ jobs:
build:

runs-on: ubuntu-latest

strategy:
max-parallel: 4
max-parallel: 1
matrix:
python-version: [3.7, 3.8]
python-version: [3.9]

defaults:
run:
working-directory: ./backend

steps:
- uses: actions/checkout@v2
Expand All @@ -30,5 +35,4 @@ jobs:
python manage.py test
- name: Run flake8
run: |
python manage.py test
flake8 backend/
flake8 .
11 changes: 8 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [18.x]

defaults:
run:
working-directory: ./frontend

steps:
- uses: actions/checkout@v2
Expand All @@ -26,5 +30,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run lint
# - run: npm run format:check
# TODO: add lint step
- run: npm test -- --watchAll=false
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
node_modules
.pnp
.pnp.js

# testing
Expand Down Expand Up @@ -139,4 +139,5 @@ venv.bak/
.mypy_cache/

# database sqlite
db.sqlite3
db.sqlite3
frontend/node_modules
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.github
build
coverage
.venv
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
2 changes: 0 additions & 2 deletions Procfile

This file was deleted.

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ I've learnt a lot from this project. Some concepts that I've grasped:

### Backend
- `git clone https://github.com/karlosos/react-todoist/`
- `cd react-todoist/backend`
- `virtualenv .venv`
- `.venv\Scripts\activate` or `source .venv/bin/activate`
- `pip install -r requirements.txt`
Expand All @@ -44,6 +45,7 @@ I've learnt a lot from this project. Some concepts that I've grasped:
- Open [http://127.0.0.1:8000/api/v1/](http://127.0.0.1:8000/api/v1/) or [http://127.0.0.1:8000/swagger/](http://127.0.0.1:8000/swagger/) to view documentation.

### Frontend
- `cd react-todoist/frontend`
- `npm run install`
- `npm start`
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
Expand Down Expand Up @@ -88,3 +90,28 @@ Push repository to **heroku**:
```
$ git push heroku master
```

### Changelog 🗒️

**v0.1 | 11.03.2020 | 30e7d5dfe070f13ba3b3d097a4addc63b6070189**

- created initial project with React + Firebase

**v0.2 | 14.07.2020 | c51909f7163ee16f1c52319b52abf21564291854**

- replaced Firebase with custom backend written with Django Rest Framework
- added Github CI

**v0.2 | 21.03.2023**

- upgraded frontend versions
- from React 16.12 to React 18.2.0
- support from Node v12 to Node v18
- cleanup `package.json` with proper 'devDependencies'

- [x] fix tests
- [x] update ci
- [x] move backend and frontend to separate directories
- [ ] msw mocks
- [ ] write down supported versions (update README)
- [ ] review tests. make them modern (without much mocking)
File renamed without changes.
4 changes: 2 additions & 2 deletions backend/asgi.py → backend/app/asgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASGI config for backend project.
ASGI config for app project.

It exposes the ASGI callable as a module-level variable named ``application``.

Expand All @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')

application = get_asgi_application()
8 changes: 4 additions & 4 deletions backend/settings.py → backend/app/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Django settings for backend project.
Django settings for app project.

Generated by 'django-admin startproject' using Django 3.0.7.

Expand Down Expand Up @@ -46,7 +46,7 @@
'drf_yasg',

# LOCAL
'backend.todo',
'app.todo',
]

MIDDLEWARE = [
Expand All @@ -61,7 +61,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'backend.urls'
ROOT_URLCONF = 'app.urls'

TEMPLATES = [
{
Expand All @@ -79,7 +79,7 @@
},
]

WSGI_APPLICATION = 'backend.wsgi.application'
WSGI_APPLICATION = 'app.wsgi.application'


# Database
Expand Down
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.
2 changes: 1 addition & 1 deletion backend/todo/views.py → backend/app/todo/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from backend.todo.serializers import UserSerializer, GroupSerializer
from app.todo.serializers import UserSerializer, GroupSerializer
from rest_framework.response import Response

from .models import Task, Project
Expand Down
2 changes: 1 addition & 1 deletion backend/urls.py → backend/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
path('', index, name='index'),
path('admin/', admin.site.urls),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
path('api/v1/', include('backend.todo.urls')),
path('api/v1/', include('app.todo.urls')),
url(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions backend/wsgi.py → backend/app/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
WSGI config for backend project.
WSGI config for app project.

It exposes the WSGI callable as a module-level variable named ``application``.

Expand All @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')

application = get_wsgi_application()
2 changes: 1 addition & 1 deletion manage.py → backend/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
File renamed without changes.
Loading