Skip to content

Commit 98487ec

Browse files
previRoberto Previtera
and
Roberto Previtera
authored
Vite (#93)
* wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * wip #92 * #wip 92 * wip #92 * wip #92 Co-authored-by: Roberto Previtera <[email protected]>
1 parent 0cfb4eb commit 98487ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7263
-28558
lines changed

.env.development

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_CB_ENDPOINT=http://coderbot.local

.env.production

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_CB_ENDPOINT=''

.eslintrc.cjs

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* eslint-env node */
2+
/*
3+
module.exports = {
4+
"root": true,
5+
"extends": [
6+
"plugin:vue/vue3-essential",
7+
"eslint:recommended"
8+
],
9+
"parserOptions": {
10+
"ecmaVersion": "latest"
11+
}
12+
}
13+
*/
14+
15+
// https://eslint.org/docs/user-guide/configuring
16+
module.exports = {
17+
root: true,
18+
19+
env: {
20+
node: true
21+
},
22+
23+
ignorePatterns: ['src/assets/js/**/*.js'],
24+
25+
extends: [
26+
'plugin:vue/base',
27+
'plugin:vue/vue3-essential',
28+
'eslint:recommended',
29+
'airbnb-base',
30+
31+
],
32+
33+
parserOptions: {
34+
ecmaVersion: 'latest'
35+
},
36+
37+
rules: {
38+
'comma-dangle': 'off',
39+
'no-tabs': 'off',
40+
'no-console': 'off',
41+
'max-len': 'off',
42+
'import/no-unresolved': 'off',
43+
eqeqeq: 'off',
44+
'import/extensions': 'off',
45+
camelcase: 'off',
46+
'no-mixed-spaces-and-tabs': 'off',
47+
'no-multi-str': 'off',
48+
'prefer-destructuring': 'off',
49+
'vue/valid-v-for': 'off',
50+
'no-plusplus': 'off',
51+
'global-require': 'off',
52+
'import/no-dynamic-require': 'off',
53+
'vue/no-v-for-template-key': 'off',
54+
'vue/multi-word-component-names': ['error', {
55+
ignores: ['Activity', 'Control', 'Gallery', 'Landing', 'Settings', 'Sidebar']
56+
}]
57+
},
58+
59+
plugins: [
60+
'vue'
61+
],
62+
63+
overrides: [
64+
{
65+
files: [
66+
'**/__tests__/*.{j,t}s?(x)',
67+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
68+
],
69+
env: {
70+
jest: true
71+
}
72+
},
73+
{
74+
files: [
75+
'**/__tests__/*.{j,t}s?(x)',
76+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
77+
],
78+
env: {
79+
jest: true
80+
}
81+
}
82+
]
83+
};

.eslintrc.js

-120
This file was deleted.

.github/workflows/build_frontend.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: build CoderBot frontend
5+
6+
on: push
7+
8+
jobs:
9+
build-frontend:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [16.x]
15+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
- run: npm ci
25+
- run: npm run build --if-present
26+
- name: Archive dist
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: dist
30+
path: dist
31+
32+
release-frontend:
33+
runs-on: ubuntu-latest
34+
needs: build-frontend
35+
steps:
36+
- uses: actions/checkout@v3 # Checking out the repo
37+
- name: Docker meta
38+
id: meta
39+
uses: docker/metadata-action@v4
40+
with:
41+
# list of Docker images to use as base name for tags
42+
images: ghcr.io/coderbotorg/frontend
43+
# generate Docker tags based on the following events/attributes
44+
tags: |
45+
# always latest
46+
type=raw,value=latest
47+
# branch event
48+
type=ref,event=branch
49+
# tag event
50+
type=ref,event=tag
51+
# pull request event
52+
type=ref,event=pr
53+
# push event
54+
type=sha,enable=true,prefix=git-,format=short
55+
- name: Download dist artifact
56+
uses: actions/download-artifact@v3
57+
with:
58+
name: dist
59+
path: dist
60+
- run: wget https://github.com/CoderBotOrg/docs/releases/download/v0.1/docs.tgz
61+
- run: mkdir -p cb_docs
62+
- run: tar xzf docs.tgz -C cb_docs
63+
- run: rm docs.tgz
64+
- name: Set up QEMU
65+
uses: docker/setup-qemu-action@v2
66+
- name: Set up Docker Buildx
67+
id: buildx
68+
uses: docker/setup-buildx-action@v2
69+
- name: Login to DockerHub
70+
uses: docker/login-action@v2
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
- name: Build and push
76+
uses: docker/build-push-action@v3
77+
with:
78+
push: true
79+
platforms: linux/arm/v7
80+
tags: ${{ steps.meta.outputs.tags }}
81+
context: .
82+
file: docker/Dockerfile
83+
cache-from: type=registry,ref=ghcr.io/coderbotorg/frontend:latest
84+
cache-to: type=inline

.postcssrc.js

-10
This file was deleted.

babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module.exports = {
22
presets: [
33
'@vue/cli-plugin-babel/preset'
44
]
5-
}
5+
};

docker/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM nginx:1.23.1-alpine
2+
3+
ADD dist /usr/share/nginx/html
4+
ADD cb_docs /usr/share/nginx/html/docs
5+
ADD docker/nginx.conf /etc/nginx/nginx.conf
6+
ADD docker/default.conf /etc/nginx/conf.d/default.conf

docker/default.conf

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
#access_log /var/log/nginx/host.access.log main;
5+
6+
location / {
7+
root /usr/share/nginx/html;
8+
index index.html index.htm;
9+
}
10+
11+
#error_page 404 /404.html;
12+
13+
# redirect server error pages to the static page /50x.html
14+
#
15+
error_page 500 502 503 504 /50x.html;
16+
location = /50x.html {
17+
root /usr/share/nginx/html;
18+
}
19+
20+
location /api {
21+
proxy_pass http://127.0.0.1:5000;
22+
}
23+
location /wifi {
24+
rewrite /wifi/(.*) /$1 break;
25+
proxy_pass http://127.0.0.1:9090;
26+
}
27+
}

docker/nginx.conf

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
user nginx;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log notice;
5+
pid /var/run/nginx.pid;
6+
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
13+
http {
14+
include /etc/nginx/mime.types;
15+
default_type application/octet-stream;
16+
17+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18+
'$status $body_bytes_sent "$http_referer" '
19+
'"$http_user_agent" "$http_x_forwarded_for"';
20+
21+
access_log /var/log/nginx/access.log main;
22+
23+
sendfile on;
24+
#tcp_nopush on;
25+
26+
keepalive_timeout 65;
27+
28+
#gzip on;
29+
30+
include /etc/nginx/conf.d/*.conf;
31+
}

index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>CoderBot</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)