Added vue template
continuous-integration/drone/push Build is passing Details

main
Filip Borum Poulsen 3 years ago
parent e841a9e2fe
commit 8ba822814b

28
client/.gitignore vendored

@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}

@ -1,6 +1,13 @@
FROM node:lts-alpine AS builder
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
FROM nginx:1.23.4-alpine
WORKDIR /var/www/html
COPY ./index.html ./index.html
COPY --from=builder /app/dist .
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

@ -0,0 +1,40 @@
# merit-opgave-client
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Type Support for `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
1. Disable the built-in TypeScript Extension
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Type-Check, Compile and Minify for Production
```sh
npm run build
```

1
client/env.d.ts vendored

@ -0,0 +1 @@
/// <reference types="vite/client" />

@ -1 +1,13 @@
Hello, World!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fitness World</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

@ -3,6 +3,8 @@ server {
root /var/www/html;
try_files $uri $uri/ /index.html;
gzip on;
gzip_static on;
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,25 @@
{
"name": "merit-opgave-client",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"vue": "^3.2.47",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@types/node": "^18.14.2",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/tsconfig": "^0.1.3",
"npm-run-all": "^4.1.5",
"typescript": "~4.8.4",
"vite": "^4.1.4",
"vue-tsc": "^1.2.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

@ -0,0 +1,15 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import NavBar from './components/NavBar.vue'
</script>
<template>
<NavBar/>
<RouterView />
</template>
<style scoped>
</style>

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342.67 130.6"><defs><style>.cls-1{fill:#1b1c20;}</style></defs><title>Artboard 1</title><path class="cls-1" d="M17,26.17H42V39.92H17V58H1.14V2.78H45.2V16.45H17Z"/><path class="cls-1" d="M51.37,58V2.78H67.19V58Z"/><path class="cls-1" d="M106.71,16.37V58H90.82V16.37H73.52V2.78H124V16.37Z"/><path class="cls-1" d="M184.61,58H171.52L146.15,29.54V58H130.34V2.78h13l25.37,29.4V2.78h15.89Z"/><path class="cls-1" d="M237,58H193.09V2.78h43.57V16.12H208.9v8.15h25.53V36.38H208.9v8.23H237Z"/><path class="cls-1" d="M289.85,17.6l-15.49,3.13a8.13,8.13,0,0,0-8.31-6.92c-3.46,0-5.85,1.73-5.85,4.45,0,1.57.58,3,3.21,3.54l11.2,2.64c10.13,2.55,15.73,7.49,15.73,16.39,0,12.93-12,18.36-23.47,18.36-13.42,0-23.63-6.5-25.2-17l16.14-3c1.32,5.18,4.7,7.33,9.39,7.33,3.79,0,6.51-1.57,6.51-4.45,0-1.65-.75-3-3.79-3.71l-11.45-2.71c-9.22-2.15-15.15-6.84-15.15-16,0-11.61,9.8-18,22.73-18S287.87,7.31,289.85,17.6Z"/><path class="cls-1" d="M342.18,17.6,326.7,20.73a8.15,8.15,0,0,0-8.32-6.92c-3.46,0-5.85,1.73-5.85,4.45,0,1.57.58,3,3.21,3.54l11.2,2.64c10.13,2.55,15.73,7.49,15.73,16.39,0,12.93-12,18.36-23.47,18.36-13.42,0-23.63-6.5-25.2-17l16.14-3c1.32,5.18,4.7,7.33,9.39,7.33,3.79,0,6.51-1.57,6.51-4.45,0-1.65-.74-3-3.79-3.71L310.8,35.56c-9.22-2.15-15.15-6.84-15.15-16,0-11.61,9.8-18,22.73-18S340.2,7.31,342.18,17.6Z"/><path class="cls-1" d="M84.69,129.36h-17l-7.82-31-7.83,31H35L19.55,74.18H35.77l8.65,31.46,7.9-31.46h15l7.91,31.46,8.65-31.46h16.22Z"/><path class="cls-1" d="M158.92,101.77c0,16.14-13,28.83-29.73,28.83s-29.73-12.69-29.73-28.83S112.48,73,129.19,73,158.92,85.71,158.92,101.77Zm-16,0c0-8.23-5.77-14.58-13.76-14.58s-13.75,6.35-13.75,14.58,5.77,14.58,13.75,14.58S143,110.09,143,101.77Z"/><path class="cls-1" d="M197.3,129.36l-15.15-17.62H180v17.62H164.19V74.18H193.6c11.85,0,19.84,7.41,19.84,18.53,0,8.9-5.11,15.49-13.26,18l16.14,18.69Zm-6.67-30.14c4.45,0,7.25-2.47,7.25-6.1,0-3.46-2.8-5.84-7.25-5.84H180V99.22Z"/><path class="cls-1" d="M263.09,129.36H221.26V74.18h15.81v41.59h26Z"/><path class="cls-1" d="M292.34,74.18c18,0,30.06,11.2,30.06,27.59s-12,27.59-30.06,27.59H269V74.18ZM291.19,116c9.14,0,15.24-5.77,15.24-14.25s-6.1-14.25-15.24-14.25h-6.34V116Z"/><path class="cls-1" d="M328.57,122.25v-1.73h1.48c.68,0,1.11.33,1.11.83s-.43.9-1.11.9Zm4.17-.94c0-1.29-1-2.18-2.66-2.18h-3.15v6.53h1.64v-2h.9l1.66,2h1.93l-1.83-2.19a2.25,2.25,0,0,0,1.51-2.16m-3.16,7a5.71,5.71,0,1,1,5.64-5.67,5.6,5.6,0,0,1-5.64,5.67m0-12.88a7.2,7.2,0,1,0,7.18,7.21,7.07,7.07,0,0,0-7.18-7.21"/></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -0,0 +1,40 @@
<script setup lang="ts">
defineProps<{
msg: string
}>()
</script>
<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
Youve successfully created a project with
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>. What's next?
</h3>
</div>
</template>
<style scoped>
h1 {
font-weight: 500;
font-size: 2.6rem;
top: -10px;
}
h3 {
font-size: 1.2rem;
}
.greetings h1,
.greetings h3 {
text-align: center;
}
@media (min-width: 1024px) {
.greetings h1,
.greetings h3 {
text-align: left;
}
}
</style>

@ -0,0 +1,24 @@
<script setup lang="ts">
import { RouterLink } from 'vue-router'
</script>
<template>
<div class="NavBar">
<img alt="Fitness World Logo" class="logo" src="@/assets/logo.svg" width="125" />
<div class="links">
<RouterLink to="/about">test</RouterLink>
</div>
</div>
</template>
<style scoped>
.NavBar {
width: 100vw;
position: absolute;
top: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-between;
}
</style>

@ -0,0 +1,86 @@
<template>
<div class="item">
<i>
<slot name="icon"></slot>
</i>
<div class="details">
<h3>
<slot name="heading"></slot>
</h3>
<slot></slot>
</div>
</div>
</template>
<style scoped>
.item {
margin-top: 2rem;
display: flex;
}
.details {
flex: 1;
margin-left: 1rem;
}
i {
display: flex;
place-items: center;
place-content: center;
width: 32px;
height: 32px;
color: var(--color-text);
}
h3 {
font-size: 1.2rem;
font-weight: 500;
margin-bottom: 0.4rem;
color: var(--color-heading);
}
@media (min-width: 1024px) {
.item {
margin-top: 0;
padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
}
i {
top: calc(50% - 25px);
left: -26px;
position: absolute;
border: 1px solid var(--color-border);
background: var(--color-background);
border-radius: 8px;
width: 50px;
height: 50px;
}
.item:before {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
bottom: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:after {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
top: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:first-of-type:before {
display: none;
}
.item:last-of-type:after {
display: none;
}
}
</style>

@ -0,0 +1,9 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(router)
app.mount('#app')

@ -0,0 +1,23 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue')
}
]
})
export default router

@ -0,0 +1,15 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<style>
@media (min-width: 1024px) {
.about {
min-height: 100vh;
display: flex;
align-items: center;
}
}
</style>

@ -0,0 +1,9 @@
<script setup lang="ts">
// import TheWelcome from '../components/TheWelcome.vue'
</script>
<template>
<main>
<TheWelcome />
</main>
</template>

@ -0,0 +1,16 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

@ -0,0 +1,8 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
"compilerOptions": {
"composite": true,
"types": ["node"]
}
}

@ -0,0 +1,14 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})
Loading…
Cancel
Save