Basic Vue setup.

This commit is contained in:
2023-07-17 23:09:58 +02:00
parent a30ac3f997
commit b5860b4f64
21 changed files with 4335 additions and 6 deletions

48
cmd/admin/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,48 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript'
],
parserOptions: {
ecmaVersion: 2021
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"vue/multi-word-component-names": "off",
"indent": "off",
"vue/html-indent": ["warn", 4, {
"alignAttributesVertically": false
}],
"vue/script-indent": ["warn", 4, {
"baseIndent": 1,
"switchCase": 1
}],
"vue/mustache-interpolation-spacing": ["error", "never"],
"vue/v-on-style": ["error", "longform"],
"vue/max-attributes-per-line": ["warn", {
singleline: {
max: 99
}
}],
"vue/singleline-html-element-content-newline": "off",
"vue/attributes-order": "off",
"vue/first-attribute-linebreak": "off",
"vue/attribute-hyphenation": "off",
"vue/html-closing-bracket-newline": "off",
"vue/v-slot-style": "off",
"vue/no-v-html": "off",
"vue/html-self-closing": "off",
"vue/require-default-prop": "off"
}
}

28
cmd/admin/.gitignore vendored Normal file
View File

@@ -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?

1
cmd/admin/env.d.ts vendored Normal file
View File

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

View File

@@ -1 +1,13 @@
<h1>Admin</h1>
<!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>Migo Admin</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

4012
cmd/admin/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

33
cmd/admin/package.json Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "migo",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite build --watch",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"pinia": "^2.1.3",
"sass": "^1.63.6",
"vue": "^3.3.4",
"vue-router": "^4.2.2"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
"@tsconfig/node18": "^2.0.1",
"@types/node": "^18.16.17",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.39.0",
"eslint-plugin-vue": "^9.11.0",
"npm-run-all": "^4.1.5",
"typescript": "~5.0.4",
"vite": "^4.3.9",
"vue-tsc": "^1.6.5"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

13
cmd/admin/src/App.vue Normal file
View File

@@ -0,0 +1,13 @@
<template>
<router-view />
</template>
<script lang="ts">
import {defineComponent} from "vue";
export default defineComponent({});
</script>
<style lang="scss">
@import "@/assets/main.scss";
</style>

View File

@@ -0,0 +1,4 @@
html, body {
padding: 0;
margin: 0;
}

9
cmd/admin/src/main.ts Normal file
View File

@@ -0,0 +1,9 @@
import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import router from "./router";
createApp(App)
.use(createPinia())
.use(router)
.mount("#app");

View File

@@ -0,0 +1,15 @@
import {createRouter, createWebHistory} from "vue-router";
import SignIn from "../views/SignIn.vue";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: "/login",
name: "login",
component: SignIn
}
]
});
export default router;

View File

@@ -0,0 +1,5 @@
import {defineStore} from "pinia";
export const useCounterStore = defineStore("counter", () => {
return {}
})

View File

@@ -0,0 +1,9 @@
<template>
<h1>Sign In</h1>
</template>
<script lang="ts">
import {defineComponent} from "vue";
export default defineComponent({});
</script>

View File

@@ -0,0 +1,12 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

11
cmd/admin/tsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}

View File

@@ -0,0 +1,15 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"types": ["node"]
}
}

20
cmd/admin/vite.config.ts Normal file
View File

@@ -0,0 +1,20 @@
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))
}
},
base: "/admin",
define: {
__VITE_PROD_DEVTOOLS__: false
}
})