chore: fix vue prettier rules (max-attributes-per-line), reformat all codes
This commit is contained in:
1 parent
f225b4e54a
commit
2fb64f03ec
17 files changed
+227
-90
No files matched your search
+3
-1
@@ -12,6 +12,8 @@
|
||||
"insertPragma": false,
|
||||
"requirePragma": false,
|
||||
"proseWrap": "never",
|
||||
"singleAttributePerLine": true,
|
||||
"htmlWhitespaceSensitivity": "strict",
|
||||
"endOfLine": "lf"
|
||||
"endOfLine": "lf",
|
||||
"printWidth": 80
|
||||
}
|
||||
@@ -5,7 +5,8 @@ import { withI18n } from 'vitepress-i18n'
|
||||
import type { VitePressSidebarOptions } from 'vitepress-sidebar/types'
|
||||
import type { VitePressI18nOptions } from 'vitepress-i18n/types'
|
||||
|
||||
const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1)
|
||||
const capitalizeFirst = (str: string): string =>
|
||||
str.charAt(0).toUpperCase() + str.slice(1)
|
||||
const supportLocales = ['en', 'ko', 'zhHans']
|
||||
const defaultLocale: string = supportLocales[0]
|
||||
|
||||
@@ -96,5 +97,8 @@ const vitePressConfigs: UserConfig = {
|
||||
}
|
||||
|
||||
export default defineConfig(
|
||||
withSidebar(withI18n(vitePressConfigs, vitePressI18nConfigs), vitePressSidebarConfigs)
|
||||
withSidebar(
|
||||
withI18n(vitePressConfigs, vitePressI18nConfigs),
|
||||
vitePressSidebarConfigs
|
||||
)
|
||||
)
|
||||
@@ -32,8 +32,8 @@ order: 3
|
||||
|
||||
Used only for contributing to project documentation. Must be run from the `docs` directory location.
|
||||
|
||||
| Script Name | Description |
|
||||
| ----------- | ------------------------------------------------------------------ |
|
||||
| `dev` | Start the local document server. (For development) |
|
||||
| `build` | Build a local document server. Used only for GitHub page builders. |
|
||||
| `serve` | Start the local document server. |
|
||||
| Script Name | Description |
|
||||
| --- | --- |
|
||||
| `dev` | Start the local document server. (For development) |
|
||||
| `build` | Build a local document server. Used only for GitHub page builders. |
|
||||
| `serve` | Start the local document server. |
|
||||
@@ -32,8 +32,8 @@ order: 3
|
||||
|
||||
프로젝트 문서에 기여하는 경우에만 사용됩니다. `docs` 디렉토리 위치에서 실행해야 합니다.
|
||||
|
||||
| Script Name | Description |
|
||||
| ----------- | ------------------------------------------------------------------ |
|
||||
| `dev` | Start the local document server. (For development) |
|
||||
| `build` | Build a local document server. Used only for GitHub page builders. |
|
||||
| `serve` | Start the local document server. |
|
||||
| Script Name | Description |
|
||||
| --- | --- |
|
||||
| `dev` | Start the local document server. (For development) |
|
||||
| `build` | Build a local document server. Used only for GitHub page builders. |
|
||||
| `serve` | Start the local document server. |
|
||||
@@ -9,24 +9,24 @@ order: 3
|
||||
|
||||
## 一般情况
|
||||
|
||||
| 脚本名称 | 说明 |
|
||||
| ----------------- | ---------------------------------------------------------- |
|
||||
| `dev` | 启动电子作为开发环境 |
|
||||
| `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) |
|
||||
| `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) |
|
||||
| `build:pre` | 通常在编译时运行的命令。此脚本无需单独运行。 |
|
||||
| `build` | 为当前操作系统打包。 |
|
||||
| `build:all` | 为整个操作系统构建指定软件包(需要跨平台构建配置) |
|
||||
| `build:dir` | `electron-builder`目录构建 |
|
||||
| `build:mac` | 为macOS构建预配置软件包 |
|
||||
| `build:linux` | 为Linux构建预配置软件包 |
|
||||
| `build:win` | 为Windows构建预配置软件包 |
|
||||
| `lint` | ESLint代码检查。它不会修改代码。 |
|
||||
| `lint:fix` | ESLint代码检查。使用自动修复功能修复代码。 |
|
||||
| `format` | 更漂亮的代码检查。它不会修改代码。 |
|
||||
| `format:fix` | 更漂亮的代码检查。使用自动修复功能修复代码。 |
|
||||
| `test` | 根据测试规范文件构建测试包并运行测试。 |
|
||||
| `test:linux` | 根据测试规范文件构建测试包并运行测试。(仅适用于linux ci) |
|
||||
| 脚本名称 | 说明 |
|
||||
| --- | --- |
|
||||
| `dev` | 启动电子作为开发环境 |
|
||||
| `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) |
|
||||
| `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) |
|
||||
| `build:pre` | 通常在编译时运行的命令。此脚本无需单独运行。 |
|
||||
| `build` | 为当前操作系统打包。 |
|
||||
| `build:all` | 为整个操作系统构建指定软件包(需要跨平台构建配置) |
|
||||
| `build:dir` | `electron-builder`目录构建 |
|
||||
| `build:mac` | 为macOS构建预配置软件包 |
|
||||
| `build:linux` | 为Linux构建预配置软件包 |
|
||||
| `build:win` | 为Windows构建预配置软件包 |
|
||||
| `lint` | ESLint代码检查。它不会修改代码。 |
|
||||
| `lint:fix` | ESLint代码检查。使用自动修复功能修复代码。 |
|
||||
| `format` | 更漂亮的代码检查。它不会修改代码。 |
|
||||
| `format:fix` | 更漂亮的代码检查。使用自动修复功能修复代码。 |
|
||||
| `test` | 根据测试规范文件构建测试包并运行测试。 |
|
||||
| `test:linux` | 根据测试规范文件构建测试包并运行测试。(仅适用于linux ci) |
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
@@ -60,6 +60,17 @@ export default pluginTypeScriptESLint.config(
|
||||
'vue/v-on-event-hyphenation': 'off',
|
||||
'vue/no-v-text-v-html-on-component': 'off',
|
||||
'vue/attribute-hyphenation': 'off',
|
||||
'vue/max-attributes-per-line': [
|
||||
'error',
|
||||
{
|
||||
singleline: {
|
||||
max: 1
|
||||
},
|
||||
multiline: {
|
||||
max: 1
|
||||
}
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off'
|
||||
}
|
||||
}
|
||||
|
||||
+21
-15
@@ -12,23 +12,29 @@ export default class IPCs {
|
||||
})
|
||||
|
||||
// Open url via web browser
|
||||
ipcMain.on('msgOpenExternalLink', async (event: IpcMainEvent, url: string) => {
|
||||
await shell.openExternal(url)
|
||||
})
|
||||
ipcMain.on(
|
||||
'msgOpenExternalLink',
|
||||
async (event: IpcMainEvent, url: string) => {
|
||||
await shell.openExternal(url)
|
||||
}
|
||||
)
|
||||
|
||||
// Open file
|
||||
ipcMain.handle('msgOpenFile', async (event: IpcMainEvent, filter: string) => {
|
||||
const filters = []
|
||||
if (filter === 'text') {
|
||||
filters.push({ name: 'Text', extensions: ['txt', 'json'] })
|
||||
} else if (filter === 'zip') {
|
||||
filters.push({ name: 'Zip', extensions: ['zip'] })
|
||||
ipcMain.handle(
|
||||
'msgOpenFile',
|
||||
async (event: IpcMainEvent, filter: string) => {
|
||||
const filters = []
|
||||
if (filter === 'text') {
|
||||
filters.push({ name: 'Text', extensions: ['txt', 'json'] })
|
||||
} else if (filter === 'zip') {
|
||||
filters.push({ name: 'Zip', extensions: ['zip'] })
|
||||
}
|
||||
const dialogResult = await dialog.showOpenDialog({
|
||||
properties: ['openFile'],
|
||||
filters
|
||||
})
|
||||
return dialogResult
|
||||
}
|
||||
const dialogResult = await dialog.showOpenDialog({
|
||||
properties: ['openFile'],
|
||||
filters
|
||||
})
|
||||
return dialogResult
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -38,7 +38,11 @@ app.on('window-all-closed', () => {
|
||||
|
||||
app.on(
|
||||
'render-process-gone',
|
||||
(event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => {
|
||||
(
|
||||
event: Event,
|
||||
webContents: WebContents,
|
||||
details: RenderProcessGoneDetails
|
||||
) => {
|
||||
errorWindow = createErrorWindow(errorWindow, mainWindow, details)
|
||||
}
|
||||
)
|
||||
|
||||
+3
-1
@@ -97,7 +97,9 @@ function calculateWindowPosition(b) {
|
||||
const screenBounds = screen.getPrimaryDisplay().size
|
||||
const trayBounds = tray.getBounds()
|
||||
const bottom = trayBounds.y > screenBounds.height / 2
|
||||
const x = Math.floor(trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2)
|
||||
const x = Math.floor(
|
||||
trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2
|
||||
)
|
||||
const y = bottom
|
||||
? Math.floor(trayBounds.y - b.height - margin.y + trayBounds.height / 2)
|
||||
: Math.floor(trayBounds.y + margin.y + trayBounds.height / 2)
|
||||
|
||||
+17
-4
@@ -1,7 +1,11 @@
|
||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// Whitelist of valid channels used for IPC communication (Send message from Renderer to Main)
|
||||
const mainAvailChannels: string[] = ['msgRequestGetVersion', 'msgOpenExternalLink', 'msgOpenFile']
|
||||
const mainAvailChannels: string[] = [
|
||||
'msgRequestGetVersion',
|
||||
'msgOpenExternalLink',
|
||||
'msgOpenFile'
|
||||
]
|
||||
const rendererAvailChannels: string[] = []
|
||||
|
||||
contextBridge.exposeInMainWorld('mainApi', {
|
||||
@@ -15,21 +19,30 @@ contextBridge.exposeInMainWorld('mainApi', {
|
||||
throw new Error(`Unknown ipc channel name: ${channel}`)
|
||||
}
|
||||
},
|
||||
on: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
|
||||
on: (
|
||||
channel: string,
|
||||
listener: (event: IpcRendererEvent, ...args: any[]) => void
|
||||
): void => {
|
||||
if (rendererAvailChannels.includes(channel)) {
|
||||
ipcRenderer.on(channel, listener)
|
||||
} else {
|
||||
throw new Error(`Unknown ipc channel name: ${channel}`)
|
||||
}
|
||||
},
|
||||
once: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
|
||||
once: (
|
||||
channel: string,
|
||||
listener: (event: IpcRendererEvent, ...args: any[]) => void
|
||||
): void => {
|
||||
if (rendererAvailChannels.includes(channel)) {
|
||||
ipcRenderer.once(channel, listener)
|
||||
} else {
|
||||
throw new Error(`Unknown ipc channel name: ${channel}`)
|
||||
}
|
||||
},
|
||||
off: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
|
||||
off: (
|
||||
channel: string,
|
||||
listener: (event: IpcRendererEvent, ...args: any[]) => void
|
||||
): void => {
|
||||
if (rendererAvailChannels.includes(channel)) {
|
||||
ipcRenderer.off(channel, listener)
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,10 @@ const isCurrentRoute = (path: string): boolean => {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-app-bar color="primary" density="compact">
|
||||
<v-app-bar
|
||||
color="primary"
|
||||
density="compact"
|
||||
>
|
||||
<v-app-bar-title>{{ t(titleKey) }}</v-app-bar-title>
|
||||
<template #append>
|
||||
<v-btn
|
||||
|
||||
@@ -6,5 +6,8 @@
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script type="module" src="./main"></script>
|
||||
<script
|
||||
type="module"
|
||||
src="./main"
|
||||
></script>
|
||||
</html>
|
||||
@@ -1,5 +1,17 @@
|
||||
import { createVuetify } from 'vuetify'
|
||||
import { ko, en, zhHans, zhHant, de, es, ja, fr, ru, pt, nl } from 'vuetify/locale'
|
||||
import {
|
||||
ko,
|
||||
en,
|
||||
zhHans,
|
||||
zhHant,
|
||||
de,
|
||||
es,
|
||||
ja,
|
||||
fr,
|
||||
ru,
|
||||
pt,
|
||||
nl
|
||||
} from 'vuetify/locale'
|
||||
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'
|
||||
import 'vuetify/styles'
|
||||
|
||||
|
||||
@@ -4,7 +4,13 @@ import { useTheme } from 'vuetify'
|
||||
import { openExternal, openFile } from '@/renderer/utils'
|
||||
import { useCounterStore } from '@/renderer/store/counter'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { mdiBrightness6, mdiFileDocument, mdiFolderOpen, mdiGithub, mdiPlusCircle } from '@mdi/js'
|
||||
import {
|
||||
mdiBrightness6,
|
||||
mdiFileDocument,
|
||||
mdiFolderOpen,
|
||||
mdiGithub,
|
||||
mdiPlusCircle
|
||||
} from '@mdi/js'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
const { t, locale, availableLocales } = useI18n()
|
||||
@@ -58,9 +64,15 @@ const handleOpenFile = async () => {
|
||||
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row no-gutters class="text-center align-center">
|
||||
<v-col cols="12" md="5">
|
||||
<img
|
||||
<v-row
|
||||
no-gutters
|
||||
class="text-center align-center"
|
||||
>
|
||||
<v-col
|
||||
cols="12"
|
||||
md="5"
|
||||
>
|
||||
<v-img
|
||||
data-testid="main-logo"
|
||||
alt="logo"
|
||||
draggable="false"
|
||||
@@ -68,56 +80,103 @@ const handleOpenFile = async () => {
|
||||
src="/images/vutron-logo.webp"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12" md="7">
|
||||
<h2 class="my-4">{{ t('desc.welcome-title') }}</h2>
|
||||
<v-col
|
||||
cols="12"
|
||||
md="7"
|
||||
>
|
||||
<h2 class="my-4">
|
||||
{{ t('desc.welcome-title') }}
|
||||
</h2>
|
||||
<p>{{ t('desc.welcome-desc') }}</p>
|
||||
<p class="my-4">
|
||||
App Version: <strong>{{ appVersion }}</strong>
|
||||
</p>
|
||||
<p v-if="selectedFile">{{
|
||||
t('desc.selected-file', {
|
||||
filePath: selectedFile
|
||||
})
|
||||
}}</p>
|
||||
<p v-if="selectedFile">
|
||||
{{
|
||||
t('desc.selected-file', {
|
||||
filePath: selectedFile
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<v-row class="my-4">
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleChangeTheme">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleChangeTheme"
|
||||
>
|
||||
<v-icon :icon="mdiBrightness6" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.change-theme') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-badge data-testid="counter-badge" color="blue" :content="count">
|
||||
<v-btn data-testid="btn-counter" icon color="primary" @click="handleCountIncrease">
|
||||
<v-badge
|
||||
data-testid="counter-badge"
|
||||
color="blue"
|
||||
:content="count"
|
||||
>
|
||||
<v-btn
|
||||
data-testid="btn-counter"
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleCountIncrease"
|
||||
>
|
||||
<v-icon :icon="mdiPlusCircle" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.increase-count') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-badge>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleOpenDocument">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleOpenDocument"
|
||||
>
|
||||
<v-icon :icon="mdiFileDocument" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.documentation') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleOpenGitHub">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleOpenGitHub"
|
||||
>
|
||||
<v-icon :icon="mdiGithub" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.github') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn icon color="primary" @click="handleOpenFile">
|
||||
<v-btn
|
||||
icon
|
||||
color="primary"
|
||||
@click="handleOpenFile"
|
||||
>
|
||||
<v-icon :icon="mdiFolderOpen" />
|
||||
<v-tooltip activator="parent" location="bottom">
|
||||
<v-tooltip
|
||||
activator="parent"
|
||||
location="bottom"
|
||||
>
|
||||
{{ t('menu.open-file') }}
|
||||
</v-tooltip>
|
||||
</v-btn>
|
||||
|
||||
@@ -7,11 +7,23 @@ const { t } = useI18n()
|
||||
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row no-gutters class="text-center">
|
||||
<v-row
|
||||
no-gutters
|
||||
class="text-center"
|
||||
>
|
||||
<v-col cols="12">
|
||||
<v-icon :icon="mdiEmoticonCoolOutline" size="250" color="#009f57" />
|
||||
<v-icon
|
||||
:icon="mdiEmoticonCoolOutline"
|
||||
size="250"
|
||||
color="#009f57"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
cols="12"
|
||||
class="my-4"
|
||||
>
|
||||
{{ t('desc.second-desc') }}
|
||||
</v-col>
|
||||
<v-col cols="12" class="my-4">{{ t('desc.second-desc') }}</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
+11
-9
@@ -39,18 +39,20 @@ export const beforeAll = async () => {
|
||||
page.on('console', console.log)
|
||||
page.on('pageerror', console.log)
|
||||
|
||||
const evaluateResult = await appElectron.evaluate(async ({ app, BrowserWindow }) => {
|
||||
const currentWindow = BrowserWindow.getFocusedWindow()
|
||||
const evaluateResult = await appElectron.evaluate(
|
||||
async ({ app, BrowserWindow }) => {
|
||||
const currentWindow = BrowserWindow.getFocusedWindow()
|
||||
|
||||
// Fix window position for testing
|
||||
currentWindow.setPosition(50, 50)
|
||||
currentWindow.setSize(1080, 560)
|
||||
// Fix window position for testing
|
||||
currentWindow.setPosition(50, 50)
|
||||
currentWindow.setSize(1080, 560)
|
||||
|
||||
return {
|
||||
packaged: app.isPackaged,
|
||||
dataPath: app.getPath('userData')
|
||||
return {
|
||||
packaged: app.isPackaged,
|
||||
dataPath: app.getPath('userData')
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
base.expect(evaluateResult.packaged, 'app is not packaged').toBe(false)
|
||||
}
|
||||
|
||||
+5
-1
@@ -29,7 +29,11 @@ export default defineConfig(({ mode }) => {
|
||||
{
|
||||
entry: 'src/main/index.ts',
|
||||
onstart({ startup }) {
|
||||
const debugArgs = ['.', '--inspect=9228', '--remote-debugging-port=9229']
|
||||
const debugArgs = [
|
||||
'.',
|
||||
'--inspect=9228',
|
||||
'--remote-debugging-port=9229'
|
||||
]
|
||||
startup(debugArgs)
|
||||
},
|
||||
vite: {
|
||||
|
||||
Reference in new issue
Block a user