-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9841796
Showing
28 changed files
with
8,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false | ||
|
||
[*.js] | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VITE_BASE_URL=/ | ||
VITE_BASE_URL_FULL=http://localhost:3000/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VITE_BASE_URL=/riichi/wait-trainer/ | ||
VITE_BASE_URL_FULL=https://tools.phil.moe/riichi/wait-trainer/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
'vue/setup-compiler-macros': true | ||
}, | ||
extends: [ | ||
'plugin:vue/vue3-essential', | ||
'standard' | ||
], | ||
ignorePatterns: ['tests/*'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Continous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Install Yarn | ||
run: | | ||
npm i -g yarn | ||
- name: Install dependencies | ||
run: | | ||
yarn --frozen-lockfile --production=false | ||
- name: Run linter | ||
run: | | ||
yarn lint | ||
#- name: Run unit tests | ||
# run: | | ||
# yarn test:unit | ||
|
||
- name: Test application build | ||
run: | | ||
yarn build | ||
- name: Test Docker build | ||
run: | | ||
docker build -t ci:local . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Install Yarn | ||
run: | | ||
npm i -g yarn | ||
- name: Install dependencies | ||
run: | | ||
yarn --frozen-lockfile --production=false | ||
- name: Build application | ||
run: | | ||
yarn build | ||
- name: Build docker image | ||
run: | | ||
docker build -t emeraldcoder/riichi-wait-trainer-web:${{ github.event.release.tag_name }} . | ||
- name: Publish docker image | ||
run: | | ||
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | ||
docker push emeraldcoder/riichi-wait-trainer-web:${{ github.event.release.tag_name }} | ||
- name: Update K8S cluster | ||
run: | | ||
cat <<< "${{ secrets.DO_K8S_CONFIG }}" > $GITHUB_WORKSPACE/.kubeconfig | ||
IMAGE_TAG=${{ github.event.release.tag_name }} envsubst < $GITHUB_WORKSPACE/deploy/web.yml > $GITHUB_WORKSPACE/deploy/web.processed.yml | ||
kubectl --kubeconfig=$GITHUB_WORKSPACE/.kubeconfig apply -f $GITHUB_WORKSPACE/deploy/namespace.yml | ||
kubectl --kubeconfig=$GITHUB_WORKSPACE/.kubeconfig apply -f $GITHUB_WORKSPACE/deploy/web.processed.yml | ||
kubectl --kubeconfig=$GITHUB_WORKSPACE/.kubeconfig apply -f $GITHUB_WORKSPACE/deploy/ingress.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM nginx:alpine | ||
ADD ./dist /usr/share/nginx/html | ||
ADD ./nginx /etc/nginx/conf.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 EmeraldCoder | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# riichi-pointer-trainer | ||
|
||
## Project setup | ||
``` | ||
yarn install | ||
``` | ||
|
||
### Compiles and hot-reloads for development | ||
``` | ||
yarn serve | ||
``` | ||
|
||
### Compiles and minifies for production | ||
``` | ||
yarn build | ||
``` | ||
|
||
### Run your unit tests | ||
``` | ||
yarn test:unit | ||
``` | ||
|
||
### Lints and fixes files | ||
``` | ||
yarn lint | ||
``` | ||
|
||
### Customize configuration | ||
See [Configuration Reference](https://cli.vuejs.org/config/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: riichi-wait-trainer | ||
namespace: riichi-wait-trainer | ||
annotations: | ||
kubernetes.io/ingress.class: "nginx" | ||
nginx.ingress.kubernetes.io/rewrite-target: /$1 | ||
nginx.ingress.kubernetes.io/service-upstream: "true" | ||
spec: | ||
rules: | ||
- host: tools.phil.moe | ||
http: | ||
paths: | ||
- path: /riichi/wait-trainer/?(.*) | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: riichi-wait-trainer-web | ||
port: | ||
number: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Namespace | ||
apiVersion: v1 | ||
metadata: | ||
name: riichi-wait-trainer | ||
labels: | ||
name: riichi-wait-trainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: riichi-wait-trainer-web | ||
namespace: riichi-wait-trainer | ||
labels: | ||
app: riichi-wait-trainer-web | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: riichi-wait-trainer-web | ||
template: | ||
metadata: | ||
labels: | ||
app: riichi-wait-trainer-web | ||
spec: | ||
containers: | ||
- name: riichi-wait-trainer-web | ||
image: emeraldcoder/riichi-wait-trainer-web:${IMAGE_TAG} | ||
ports: | ||
- containerPort: 80 | ||
imagePullSecrets: | ||
- name: regcred | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: riichi-wait-trainer-web | ||
namespace: riichi-wait-trainer | ||
spec: | ||
selector: | ||
app: riichi-wait-trainer-web | ||
ports: | ||
- name: tcp | ||
port: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Riichi Mahjong Wait Trainer (beta version)</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="description" content="Web application to train yourself at identifying waits of a tenpai hand at Riichi Mahjong (Japanese Mahjong)."> | ||
|
||
<!-- <meta name="twitter:card" content="summary_large_image" /> --> | ||
<meta property="og:title" content="Riichi Mahjong Wait Trainer"> | ||
<meta property="og:description" content="Web application to train yourself at identifying waits of a tenpai hand at Riichi Mahjong (Japanese Mahjong)."> | ||
<meta property="og:type" content="website"> | ||
<meta property="og:url" content="<%- VITE_BASE_URL_FULL %>"> | ||
<!-- <meta property="og:image" content="<%= VITE_BASE_URL_FULL %>og-image.png"> --> | ||
|
||
<link rel="manifest" href="/site.webmanifest"> | ||
<meta name="theme-color" content="#1b5e20"> | ||
</head> | ||
|
||
<body> | ||
<div id="App"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
# Default caching strategy based on the etag feature (for stuff like index.html and site.webmanifest that don't have a content hash in the name) | ||
etag on; | ||
add_header Cache-Control "no-cache"; | ||
|
||
# Caching strategy for static assets (Vue build those assets with a content hash in the name, so etag is not usefull and the cache will be busted automatically if the content of the file change) | ||
location /assets { | ||
etag off; | ||
add_header Cache-Control "public,max-age=31536000,immutable"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "riichi-wait-trainer", | ||
"version": "0.0.0", | ||
"private": true, | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "vite --host", | ||
"build": "vite build", | ||
"preview": "vite preview --port 5050", | ||
"test:unit": "vitest run", | ||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --ignore-path .gitignore", | ||
"watch:test:unit": "vitest" | ||
}, | ||
"dependencies": { | ||
"@emeraldcoder/riichi-ui-vue": "0.0.0-beta.5", | ||
"@fortawesome/fontawesome-svg-core": "^6.0.0", | ||
"@fortawesome/free-solid-svg-icons": "^6.0.0", | ||
"@fortawesome/vue-fontawesome": "^3.0.0", | ||
"@vueuse/core": "^10.0.0", | ||
"dot-prop": "^8.0.0", | ||
"vue": "^3.2.31" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"eslint": "^7.12.1", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-promise": "^5.0.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-vue": "^8.2.0", | ||
"vite": "^4.0.0", | ||
"vitest": "^0.34.0", | ||
"vite-plugin-html": "^3.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "Riichi Mahjong Wait Trainer", | ||
"short_name": "Riichi Mahjong Wait Trainer", | ||
"background_color": "#43a047", | ||
"theme_color": "#1b5e20" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<header> | ||
<div class="container"> | ||
<h1>Trainer</h1> | ||
</div> | ||
</header> | ||
|
||
<main style="overflow: hidden;"> | ||
<wait-trainer /> | ||
</main> | ||
</template> | ||
|
||
<script setup> | ||
import WaitTrainer from './components/WaitTrainer.vue' | ||
</script> |
Oops, something went wrong.