chore:update

This commit is contained in:
chaoszhu 2024-07-04 22:39:38 +08:00
parent 6a01a9e658
commit 0255ef6c0b
24 changed files with 6418 additions and 4460 deletions

View File

@ -1,93 +0,0 @@
// 规则参见https://cn.eslint.org/docs/rules/
module.exports = {
root: true, // 当前配置文件不能往父级查找
env: {
node: true,
es6: true
},
extends: [
'eslint:recommended' // 应用Eslint全部默认规则
],
'parserOptions': {
'ecmaVersion': 'latest',
'sourceType': 'module' // 目标类型 Node项目得添加这个
},
// 自定义规则,可以覆盖 extends 的配置【安装Eslint插件可以静态检查本地文件是否符合以下规则】
'ignorePatterns': ['*.html', 'node-os-utils'],
rules: {
// 0: 关闭规则(允许) 1/2: 警告warning/错误error(不允许)
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'template-curly-spacing': ['error', 'always'], // 模板字符串空格
'default-case': 0,
'object-curly-spacing': ['error', 'always'],
'no-multi-spaces': ['error'],
indent: ['error', 2, { 'SwitchCase': 1 }], // 缩进2
quotes: ['error', 'single'], // 引号single单引 double双引
semi: ['error', 'never'], // 结尾分号never禁止 always必须
'comma-dangle': ['error', 'never'], // 对象拖尾逗号
'no-redeclare': ['error', { builtinGlobals: true }], // 禁止重复对象声明
'no-multi-assign': 0,
'no-restricted-globals': 0,
'space-before-function-paren': 0, // 函数定义时括号前面空格
'one-var': 0, // 允许连续声明
// 'no-undef': 0, // 允许未定义的变量【会使env配置无效】
'linebreak-style': 0, // 检测CRLF/LF检测【默认LF】
'no-extra-boolean-cast': 0, // 允许意外的Boolean值转换
'no-constant-condition': 0, // if语句中禁止常量表达式
'no-prototype-builtins': 0, // 允许使用Object.prototypes内置对象(如xxx.hasOwnProperty)
'no-regex-spaces': 0, // 允许正则匹配多个空格
'no-unexpected-multiline': 0, // 允许多行表达式
'no-fallthrough': 0, // 允许switch穿透
'no-delete-var': 0, // 允许 delete 删除对象属性
'no-mixed-spaces-and-tabs': 0, // 允许空格tab混用
'no-class-assign': 0, // 允许修改class类型
'no-param-reassign': 0, // 允许对函数params赋值
'max-len': 0, // 允许长行
'func-names': 0, // 允许命名函数
'import/no-unresolved': 0, // 不检测模块not fund
'import/prefer-default-export': 0, // 允许单个导出
'no-const-assign': 1, // 警告修改const命名的变量
'no-unused-vars': 1, // 警告:已声明未使用
'no-unsafe-negation': 1, // 警告:使用 in / instanceof 关系运算符时,左边表达式请勿使用 ! 否定操作符
'use-isnan': 1, // 警告:使用 isNaN() 检查 NaN
'no-var': 2, // 禁止使用var声明
'no-empty-pattern': 2, // 空解构赋值
'eqeqeq': 2, // 必须使用 全等=== 或 非全等 !==
'no-cond-assign': 2, // if语句中禁止赋值
'no-dupe-args': 2, // 禁止function重复参数
'no-dupe-keys': 2, // 禁止object重复key
'no-duplicate-case': 2,
'no-empty': 2, // 禁止空语句块
'no-func-assign': 2, // 禁止重复声明函数
'no-inner-declarations': 2, // 禁止在嵌套的语句块中出现变量或 function 声明
'no-sparse-arrays': 2, // 禁止稀缺数组
'no-unreachable': 2, // 禁止非条件return、throw、continue 和 break 语句后出现代码
'no-unsafe-finally': 2, // 禁止finally出现控制流语句return、throw等因为这会导致try...catch捕获不到
'valid-typeof': 2, // 强制 typeof 表达式与有效的字符串进行比较
// auto format options
'prefer-const': 0, // 禁用声明自动化
'no-extra-parens': 0, // 允许函数周围出现不明括号
'no-extra-semi': 2, // 禁止不必要的分号
// curly: ['error', 'multi'], // if、else、for、while 语句单行代码时不使用大括号
'dot-notation': 0, // 允许使用点号或方括号来访问对象属性
'dot-location': ['error', 'property'], // 点操作符位置,要求跟随下一行
'no-else-return': 2, // 禁止if中有return后又else
'no-implicit-coercion': [2, { allow: ['!!', '~', '+'] }], // 禁止隐式转换allow字段内符号允许
'no-trailing-spaces': 1, //一行结束后面不要有空格
'no-multiple-empty-lines': [1, { 'max': 1 }], // 空行最多不能超过1行
'no-useless-return': 2,
'wrap-iife': 0, // 允许自调用函数
'yoda': 0, // 允许yoda语句
'strict': 0, // 允许strict
'no-undef-init': 0, // 允许将变量初始化为undefined
'prefer-promise-reject-errors': 0, // 允许使用非 Error 对象作为 Promise 拒绝的原因
'consistent-return': 0, // 允许函数不使用return
'no-new': 0, // 允许单独new
'no-restricted-syntax': 0, // 允许特定的语法
'no-plusplus': 0,
'import/extensions': 0, // 忽略扩展名
'global-require': 0,
'no-return-assign': 0
}
}

21
app.vue
View File

@ -1,6 +1,19 @@
<template>
<div>
<NuxtRouteAnnouncer />
<NuxtWelcome />
</div>
<naive-config>
<NuxtPage />
</naive-config>
<!-- <Body
class="antialiased duration-300 transition-colors text-gray-800 dark:text-gray-200 bg-white dark:bg-gray-950"
>
<NuxtLayout>
<NuxtLoadingIndicator />
<NuxtPage />
</NuxtLayout>
</Body> -->
</template>
<script setup>
</script>

BIN
assets/images/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
assets/images/preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

@ -0,0 +1,5 @@
// variables
:root {
// layouts > page > content
--layout-page-content-min-height: calc(100vh - 42px);
}

View File

@ -0,0 +1,25 @@
// page transition
.page-enter-active {
transition: all 0.1s ease-out;
}
.page-leave-active {
transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.page-enter-from,
.page-leave-to {
transform: translateY(20px);
opacity: 0;
}
// layout transition
.layout-enter-active {
transition: all 0.1s ease-out;
}
.layout-leave-active {
transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.layout-enter-from,
.layout-leave-to {
transform: translateY(-20px);
opacity: 0;
}

41
assets/scss/app.scss Normal file
View File

@ -0,0 +1,41 @@
@import url("https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap");
// vars
@import 'variables';
// components
// component::scrollbar
// components
::-webkit-scrollbar {
width: 16px;
}
::-webkit-scrollbar-track {
background: theme('colors.gray.100');
border-left: 1px solid theme('colors.gray.200');
}
::-webkit-scrollbar-thumb {
border: 4px solid theme('colors.gray.100');
background-clip: padding-box;
border-radius: 9999px;
background-color: theme('colors.slate.300');
}
::-webkit-scrollbar-thumb:hover {
background-color: theme('colors.slate.400');
}
html.dark {
::-webkit-scrollbar-track {
background: theme('colors.slate.800');
border-left: 1px solid theme('colors.slate.700');
}
::-webkit-scrollbar-thumb {
border-color: theme('colors.slate.800');
background-color: theme('colors.slate.500');
}
::-webkit-scrollbar-thumb:hover {
background-color: theme('colors.slate.400');
}
}
// components
@import 'animations/transitions';

View File

@ -0,0 +1,11 @@
export const useSyncProps = (props, key, emit) => {
return computed({
get() {
return props[key]
},
set(value) {
emit(`update:${key}`, value)
}
})
}

85
eslint.config.mjs Normal file
View File

@ -0,0 +1,85 @@
import withNuxt from './.nuxt/eslint.config.mjs'
import pluginVue from 'eslint-plugin-vue'
export default
{
...pluginVue.configs['flat/recommended'],
files: ['**/*.js', '**/*.jsx'],
rules: {
// 0: 关闭规则(允许) 1/2: 警告warning/错误error(不允许)
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'template-curly-spacing': ['error', 'always'], // 模板字符串空格
'default-case': 0,
'object-curly-spacing': ['error', 'always'],
'no-multi-spaces': ['error'],
'indent': ['error', 2, { 'SwitchCase': 1 }], // 缩进2
'quotes': ['error', 'single'], // 引号single单引 double双引
'semi': ['error', 'never'], // 结尾分号never禁止 always必须
'comma-dangle': ['error', 'never'], // 对象拖尾逗号
'no-redeclare': ['error', { builtinGlobals: true }], // 禁止重复对象声明
'no-multi-assign': 0,
'no-restricted-globals': 0,
'space-before-function-paren': 0, // 函数定义时括号前面空格
'one-var': 0, // 允许连续声明
// 'no-undef': 0, // 允许未定义的变量【会使env配置无效】
'linebreak-style': 0, // 检测CRLF/LF检测【默认LF】
'no-extra-boolean-cast': 0, // 允许意外的Boolean值转换
'no-constant-condition': 0, // if语句中禁止常量表达式
'no-prototype-builtins': 0, // 允许使用Object.prototypes内置对象(如xxx.hasOwnProperty)
'no-regex-spaces': 0, // 允许正则匹配多个空格
'no-unexpected-multiline': 0, // 允许多行表达式
'no-fallthrough': 0, // 允许switch穿透
'no-delete-var': 0, // 允许 delete 删除对象属性
'no-mixed-spaces-and-tabs': 0, // 允许空格tab混用
'no-class-assign': 0, // 允许修改class类型
'no-param-reassign': 0, // 允许对函数params赋值
'max-len': 0, // 允许长行
'func-names': 0, // 允许命名函数
'import/no-unresolved': 0, // 不检测模块not fund
'import/prefer-default-export': 0, // 允许单个导出
'no-const-assign': 1, // 警告修改const命名的变量
'no-unused-vars': 1, // 警告:已声明未使用
'no-unsafe-negation': 1, // 警告:使用 in / instanceof 关系运算符时,左边表达式请勿使用 ! 否定操作符
'use-isnan': 1, // 警告:使用 isNaN() 检查 NaN
'no-var': 2, // 禁止使用var声明
'no-empty-pattern': 2, // 空解构赋值
'eqeqeq': 2, // 必须使用 全等=== 或 非全等 !==
'no-cond-assign': 2, // if语句中禁止赋值
'no-dupe-args': 2, // 禁止function重复参数
'no-dupe-keys': 2, // 禁止object重复key
'no-duplicate-case': 2,
'no-empty': 2, // 禁止空语句块
'no-func-assign': 2, // 禁止重复声明函数
'no-inner-declarations': 2, // 禁止在嵌套的语句块中出现变量或 function 声明
'no-sparse-arrays': 2, // 禁止稀缺数组
'no-unreachable': 2, // 禁止非条件return、throw、continue 和 break 语句后出现代码
'no-unsafe-finally': 2, // 禁止finally出现控制流语句return、throw等因为这会导致try...catch捕获不到
'valid-typeof': 2, // 强制 typeof 表达式与有效的字符串进行比较
// auto format options
'prefer-const': 0, // 禁用声明自动化
'no-extra-parens': 0, // 允许函数周围出现不明括号
'no-extra-semi': 2, // 禁止不必要的分号
// curly: ['error', 'multi'], // if、else、for、while 语句单行代码时不使用大括号
'dot-notation': 0, // 允许使用点号或方括号来访问对象属性
'dot-location': ['error', 'property'], // 点操作符位置,要求跟随下一行
'no-else-return': 2, // 禁止if中有return后又else
'no-implicit-coercion': [2, { allow: ['!!', '~', '+'] }], // 禁止隐式转换allow字段内符号允许
'no-trailing-spaces': 1, //一行结束后面不要有空格
'no-multiple-empty-lines': [1, { 'max': 1 }], // 空行最多不能超过1行
'no-useless-return': 2,
'wrap-iife': 0, // 允许自调用函数
'yoda': 0, // 允许yoda语句
'strict': 0, // 允许strict
'no-undef-init': 0, // 允许将变量初始化为undefined
'prefer-promise-reject-errors': 0, // 允许使用非 Error 对象作为 Promise 拒绝的原因
'consistent-return': 0, // 允许函数不使用return
'no-new': 0, // 允许单独new
'no-restricted-syntax': 0, // 允许特定的语法
'no-plusplus': 0,
'import/extensions': 0, // 忽略扩展名
'global-require': 0,
'no-return-assign': 0
}
}
)

5
layouts/header.vue Normal file
View File

@ -0,0 +1,5 @@
<template>
<div class="overflow-x-hidden">
default header
</div>
</template>

24
modules/auth-db.js Normal file
View File

@ -0,0 +1,24 @@
import { existsSync, statSync } from 'fs'
import {
useNuxt,
defineNuxtModule,
createResolver,
addImportsDir,
} from '@nuxt/kit'
// 尝试借助这个模块创建一个空的db文件
export default defineNuxtModule({
meta: {
name: 'auto db',
},
async setup(_options, nuxt) {
// const resolver = createResolver(import.meta.url)
// if (existsSync(storesPath) && statSync(storesPath).isFile()) {
// // get config
// const configPath = resolver.resolve(storesPath)
// const config = await import(configPath)
// tsConfigs = Object.assign(tsConfigs, config.default)
// }
}
})

34
nuxt.config.js Normal file
View File

@ -0,0 +1,34 @@
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
compatibilityDate: "2024-07-03",
modules: [
"@nuxt/eslint",
"@pinia/nuxt",
"@nuxtjs/tailwindcss",
"nuxtjs-naive-ui"
],
vite: {
plugins: [
AutoImport({
imports: [
{
'naive-ui': [
'useDialog',
'useMessage',
'useNotification',
'useLoadingBar'
]
}
]
}),
Components({
resolvers: [NaiveUiResolver()]
})
]
}
})

View File

@ -1,4 +0,0 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true }
})

View File

@ -1,7 +1,7 @@
{
"name": "easynode",
"version": "1.0.0",
"description": "easy to manage the server",
"description": "connect to your server via the easynode",
"private": false,
"repository": {
"type": "git",
@ -16,11 +16,20 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxt/eslint": "^0.3.13",
"@nuxtjs/eslint-module": "^4.1.0",
"@nuxtjs/tailwindcss": "^6.12.0",
"@pinia/nuxt": "^0.5.1",
"naive-ui": "^2.38.2",
"nuxt": "^3.12.3",
"nuxtjs-naive-ui": "^1.0.2",
"vue": "latest"
},
"packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a",
"devDependencies": {
"@nuxt/devtools": "^1.3.9"
"@nuxt/devtools": "^1.3.9",
"eslint-plugin-vue": "^9.27.0",
"unplugin-auto-import": "^0.17.6",
"unplugin-vue-components": "^0.27.2"
}
}

62
pages/index.vue Normal file
View File

@ -0,0 +1,62 @@
<template>
<div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
<div class="sm:mx-auto sm:w-full sm:max-w-sm mt-32">
<img class="mx-auto h-10 w-auto" src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600">
<!-- <h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">Sign in to your account</h2> -->
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">EasyNode</h2>
</div>
<div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
<form class="space-y-6" action="#" method="POST">
<div>
<label for="email" class="block text-sm font-medium leading-6 text-gray-900">用户名</label>
<div class="mt-2">
<n-input-group>
<n-input v-model="username" />
</n-input-group>
</div>
</div>
<div>
<div class="flex items-center justify-between">
<label for="password" class="block text-sm font-medium leading-6 text-gray-900">密码</label>
<!-- <div class="text-sm">
<a href="#" class="font-semibold text-indigo-600 hover:text-indigo-500">忘记密码?</a>
</div> -->
</div>
<div class="mt-2">
<n-input-group>
<n-input type="password" v-model="password" show-password-on="mousedown" :maxlength="18" />
</n-input-group>
</div>
</div>
<n-button type="primary" class="w-full">
登录
</n-button>
</form>
<!-- <p class="mt-10 text-center text-sm text-gray-500">
Not a member?
<a href="#" class="font-semibold leading-6 text-indigo-600 hover:text-indigo-500">Start a 14 day free trial</a>
</p> -->
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
const username = ref('');
const password = ref('');
const onLogin = () => {
//
console.log('Username:', username.value);
console.log('Password:', password.value);
//
};
</script>
<style>
/* 可以在这里添加额外的CSS样式 */
</style>

3
plugins/awesome.js Normal file
View File

@ -0,0 +1,3 @@
export default defineNuxtPlugin((nuxt) => {
// console.log('plugin')
})

10361
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
export default defineEventHandler(async (event) => {
return 'get-user-info'
})

View File

@ -0,0 +1,3 @@
export default defineEventHandler((event) => {
console.log('New request: ' + getRequestURL(event))
})

4
server/routes/test.js Normal file
View File

@ -0,0 +1,4 @@
// no api prefix
export default defineEventHandler(async (event) => {
return 'test'
})

80
tailwind.config.js Normal file
View File

@ -0,0 +1,80 @@
import defaultTheme from 'tailwindcss/defaultTheme'
import colors from 'tailwindcss/colors'
const MyTheme = {
colors: {
green: {
DEFAULT: '#3BA676',
'50': '#B4E4CF',
'100': '#A5DFC5',
'200': '#87D4B2',
'300': '#69CA9E',
'400': '#4BBF8B',
'500': '#3BA676',
'600': '#2C7D59',
'700': '#1E533B',
'800': '#0F2A1E',
'900': '#000000',
},
blue: {
DEFAULT: '#0096FF',
'50': '#B8E2FF',
'100': '#A3D9FF',
'200': '#7AC8FF',
'300': '#52B8FF',
'400': '#29A7FF',
'500': '#0096FF',
'600': '#0075C7',
'700': '#00548F',
'800': '#003357',
'900': '#00121F',
},
red: {
DEFAULT: '#FF6464',
'50': '#FFFFFF',
'100': '#FFFFFF',
'200': '#FFDEDE',
'300': '#FFB6B6',
'400': '#FF8D8D',
'500': '#FF6464',
'600': '#FF2C2C',
'700': '#F30000',
'800': '#BB0000',
'900': '#830000',
},
},
}
export default {
darkMode: 'class',
content: [
'./components/**/*.{vue,js,ts}',
'./layouts/**/*.vue',
'./pages/**/*.vue',
'./composables/**/*.{js,ts}',
'./plugins/**/*.{js,ts}',
'./App.{js,ts,vue}',
'./app.{js,ts,vue}',
'./Error.{js,ts,vue}',
'./error.{js,ts,vue}',
],
theme: {
extend: {
maxWidth: {
'8xl': '90rem',
},
colors: {
primary: MyTheme.colors.green,
// if want to change primary color to blue
// primary: MyTheme.colors.blue,
green: MyTheme.colors.green,
blue: MyTheme.colors.blue,
red: MyTheme.colors.red,
slate: colors.slate,
},
fontFamily: {
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
},
},
},
}

View File

@ -1,4 +1,3 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}