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

NM-2: core spa logic #4

Merged
merged 62 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
6f78eeb
add html base layout
daronenko Sep 28, 2024
18081d3
add .gitignore
daronenko Sep 28, 2024
934ca07
implement static server
daronenko Sep 28, 2024
af00c3d
add package lock
daronenko Sep 28, 2024
a86a4ae
add npmrc file
daronenko Sep 28, 2024
0da1ac1
add nvmrc file
daronenko Sep 28, 2024
ac0adda
add abstract view class
daronenko Sep 28, 2024
feee116
implement spa router
daronenko Sep 28, 2024
d78e8e3
add config for app
daronenko Sep 28, 2024
e96778d
add entry point for spa
daronenko Sep 28, 2024
23c0f93
implement ajax module
daronenko Sep 28, 2024
8381975
add main script
daronenko Sep 28, 2024
e01972e
implement module for user object
daronenko Sep 28, 2024
46f5c70
add error page
daronenko Sep 28, 2024
a6c7175
fix router error view
daronenko Sep 28, 2024
ac08739
add login page
daronenko Sep 28, 2024
eba0242
add signup page
daronenko Sep 28, 2024
83fa376
add header component
daronenko Sep 28, 2024
1e4acbf
add precompiled js to .gitignore
daronenko Sep 28, 2024
6333150
create main css file
daronenko Sep 28, 2024
9e863fe
fix method name
daronenko Sep 28, 2024
6bec388
update code style
daronenko Sep 28, 2024
e9f8504
add jsdoc to router
daronenko Sep 28, 2024
6e63b0e
main page core
damedelion Sep 28, 2024
625010a
Merge branch 'NM-3' into NM-2
damedelion Sep 28, 2024
bfec2dc
add linter
daronenko Sep 28, 2024
5e22577
setup ci workflow
daronenko Sep 28, 2024
8e2ac43
fix ci workflow
daronenko Sep 28, 2024
4b3a75c
yet another ci workflow fix
daronenko Sep 28, 2024
544c636
merge fixes and add validation
damedelion Sep 28, 2024
8d5f804
Merge branch 'NM-2' of github.com:frontend-park-mail-ru/2024_2_NovaCo…
damedelion Sep 28, 2024
d8094cb
fix ci workflow
daronenko Sep 29, 2024
c142c2d
remove some files
daronenko Sep 29, 2024
80d9389
update linter config
daronenko Sep 29, 2024
c09e2e8
remove some scripts from base html layout
daronenko Sep 29, 2024
93a9ef6
fix layout rendering
daronenko Sep 29, 2024
ea3860e
remove some unused files
daronenko Sep 29, 2024
4cb15e8
add function to remove current user from local storage
daronenko Sep 29, 2024
25b41d3
get main page info from backend
damedelion Sep 29, 2024
cf588d1
add jsdoc
damedelion Sep 29, 2024
4440994
main page backend integration
damedelion Sep 29, 2024
be418dd
some fixes and remove test files
damedelion Sep 29, 2024
8c261c9
ajax response json fix
damedelion Sep 29, 2024
f470b02
feed imports fix
damedelion Sep 29, 2024
0f8f957
update makefile
daronenko Sep 29, 2024
7d31703
add build in docker
daronenko Sep 29, 2024
618abf3
update app config
daronenko Sep 29, 2024
8d8e073
update docs in makefile
daronenko Sep 29, 2024
6ccde29
fix docker file name in make target
daronenko Sep 29, 2024
a19b83b
fix make target command
daronenko Sep 29, 2024
7edcd2a
refactor destructor exists check
daronenko Sep 29, 2024
4452fd5
yet another refactor method exists check
daronenko Sep 29, 2024
d2a6a1d
fix optional view in router
daronenko Sep 29, 2024
c03187d
serve images on static server
daronenko Sep 29, 2024
478e397
update app config
daronenko Sep 29, 2024
c14b7c9
load test images
daronenko Sep 29, 2024
e34c37b
switch to dev config
daronenko Sep 30, 2024
01059a0
fix backend queries
daronenko Sep 30, 2024
2431ad7
update feed
daronenko Sep 30, 2024
2ebb7aa
remove unused env variable
daronenko Sep 30, 2024
77d3bcc
move version variable to env
daronenko Sep 30, 2024
8e476c4
fix version variable
daronenko Sep 30, 2024
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
15 changes: 15 additions & 0 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import globals from "globals";
import pluginJs from "@eslint/js";


export default [
{
languageOptions: {
globals: {
...globals.browser,
Handlebars: "readonly"
}
}
},
pluginJs.configs.recommended,
];
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
pull_request:
push:
branches:
- main
- develop

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Check out code into directory
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Clean install
id: install
run: npm ci

- name: Run linter
id: super-linter
uses: super-linter/super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORE_GITIGNORED_FILES: true
DEFAULT_BRANCH: main
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_ALL_CODEBASE: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.idea/
.vscode/
.DS_Store

*.precompiled.js
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ENV_FILE = ./docker/.env
include $(ENV_FILE)

DOCKER_COMPOSE_PATH = ./docker/docker-compose.yaml

# use `gawk` on mac os
AWK := awk
ifeq ($(shell uname -s), Darwin)
AWK = gawk
ifeq (, $(shell which gawk 2> /dev/null))
$(error "gawk not found")
endif
endif

################################################################################
# Miscellaneous
################################################################################

.PHONY: help
## (default) Show help page.
help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|awk -F --- -v n=$$(tput cols) -v i=29 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n\n";}'

################################################################################
# Containers
################################################################################

.PHONY: docker-build
## Build docker container static server.
docker-build:
@docker compose -f $(DOCKER_COMPOSE_PATH) --env-file $(ENV_FILE) build

.PHONY: docker-start
## Start docker compose containers (all by default).
## Format: `docker-start [compose=<docker-compose-service>]`.
## Example: `docker-start`, `docker-stop compose=postgres`.
docker-start:
@docker compose -f $(DOCKER_COMPOSE_PATH) --env-file $(ENV_FILE) up -d $(compose)

.PHONY: docker-stop
## Stop docker compose containers (all by default).
## Format: `docker-stop [compose=<docker-compose-service>]`.
## Example: `docker-stop`, `docker-stop compose=postgres`.
docker-stop:
@docker compose -f $(DOCKER_COMPOSE_PATH) stop $(compose)

.PHONY: docker-ash
## Run `ash` in docker container of static server.
docker-ash:
@docker exec -it $(SERVICE_NAME) /bin/ash

.PHONY: docker-clean
## Remove containers, networks, volumes, and images created by `make docker-start`.
docker-clean:
@docker compose -f $(DOCKER_COMPOSE_PATH) down

.PHONY: build-image
## Build docker image of frontend static server with name.
build-image:
@docker build -f docker/Dockerfile --platform linux/amd64 -t daronenko/$(SERVICE_NAME)-frontend:$(VERSION) .

.PHONY: push-image
## Push docker image of frontend static server to the docker hub.
push-image:
@docker push daronenko/$(SERVICE_NAME)-frontend:$(VERSION)
3 changes: 3 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SERVICE_NAME=novamusic
VERSION=v0.3
PORT=3000
12 changes: 12 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:20-alpine

WORKDIR /service

COPY package.json ./
RUN npm install

COPY . .

EXPOSE 3000

CMD [ "npm", "run", "start" ]
11 changes: 11 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
novamusic-frontend:
image: daronenko/novamusic-frontend:${VERSION}
container_name: novamusic-frontend
build:
dockerfile: docker/Dockerfile
context: ..
env_file: .env
ports:
- 80:${PORT}
restart: on-failure
Loading