feat: 更新发布工作流,优化 Git 配置,添加文件和文件夹选择功能,调整模板列表标题

This commit is contained in:
zhanggy committed 2025-10-29 18:58:58 +08:00
1 parent c59dc5c159
commit 56acfb275b
9 files changed
+76 -78

No files matched your search

+1 -1
View File
@@ -81,7 +81,7 @@ jobs:
git push origin v${{ env.VERSION }} git push origin v${{ env.VERSION }}
- name: Build for all platforms - name: Build for all platforms
run: pnpm build:all run: pnpm build:win
env: env:
# 在 macOS 上禁用代码签名 # 在 macOS 上禁用代码签名
CSC_IDENTITY_AUTO_DISCOVERY: false CSC_IDENTITY_AUTO_DISCOVERY: false
+12 -12
View File
@@ -56,18 +56,18 @@ const baseConfig = {
win: { win: {
icon: 'buildAssets/icons/icon.ico', icon: 'buildAssets/icons/icon.ico',
target: [ target: [
{ // {
target: 'appx', // target: 'appx',
arch: 'x64' // arch: 'x64'
}, // },
{ // {
target: 'zip', // target: 'zip',
arch: 'x64' // arch: 'x64'
}, // },
{ // {
target: 'portable', // target: 'portable',
arch: 'x64' // arch: 'x64'
}, // },
{ {
target: 'nsis', target: 'nsis',
arch: 'x64' arch: 'x64'
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "vutron", "name": "gdt-tool",
"appId": "com.vutron.vutron", "appId": "com.tool.gdt",
"version": "0.0.2", "version": "0.0.2",
"description": "Quick Start Templates for Vite + Vue 3 + Electron", "description": "Quick Start Templates for Vite + Vue 3 + Electron",
"homepage": "https://vutron.cdget.com", "homepage": "https://vutron.cdget.com",
+25 -1
View File
@@ -57,13 +57,37 @@ export default class IPCs {
if (!dialogResult.canceled && dialogResult.filePaths.length > 0) { if (!dialogResult.canceled && dialogResult.filePaths.length > 0) {
return { return {
canceled: false, canceled: false,
filePath: dialogResult.filePaths[0] filePath: dialogResult.filePaths[0],
isDirectory: true
} }
} }
return { canceled: true } return { canceled: true }
}) })
// Select file or directory
ipcMain.handle('msgSelectFileOrFolder', async () => {
const dialogResult = await dialog.showOpenDialog({
properties: ['openFile', 'openDirectory']
})
if (!dialogResult.canceled && dialogResult.filePaths.length > 0) {
const filePath = dialogResult.filePaths[0];
const fs = require('fs');
const isDirectory = fs.statSync(filePath).isDirectory();
return {
canceled: false,
filePath: filePath,
isDirectory: isDirectory
}
}
return { canceled: true }
})
// Find all files in a folder recursively // Find all files in a folder recursively
ipcMain.handle( ipcMain.handle(
'msgFindFilesInFolder', 'msgFindFilesInFolder',
+1
View File
@@ -11,6 +11,7 @@ const mainAvailChannels: string[] = [
'msgOpenExternalLink', 'msgOpenExternalLink',
'msgOpenFile', 'msgOpenFile',
'msgSelectDirectory', 'msgSelectDirectory',
'msgSelectFileOrFolder',
'msgLoadData', 'msgLoadData',
'msgSaveData', 'msgSaveData',
'msgExecuteTemplate', 'msgExecuteTemplate',
@@ -36,7 +36,9 @@ const headerMenus: {
</script> </script>
<template> <template>
<v-app-bar color="primary" density="compact"> <v-app-bar color="primary" density="compact">
<v-app-bar-title @click="handleRoute('/')">{{ t(titleKey) }}</v-app-bar-title> <v-app-bar-title @click="handleRoute('/')">
GDT Tool
</v-app-bar-title>
<!-- <template #append> <!-- <template #append>
<v-btn <v-btn
v-for="menu in headerMenus" v-for="menu in headerMenus"
+30 -59
View File
@@ -6,8 +6,7 @@
<v-row class="fill-height"> <v-row class="fill-height">
<!-- Left Panel - Template Info --> <!-- Left Panel - Template Info -->
<v-col <v-col
cols="12" cols="4"
md="4"
class="pa-4 border-e" class="pa-4 border-e"
> >
<div class="d-flex align-center mb-4"> <div class="d-flex align-center mb-4">
@@ -38,7 +37,7 @@
v-model="templateName" v-model="templateName"
label="模板名称 *" label="模板名称 *"
placeholder="输入模板名称" placeholder="输入模板名称"
:rules="[requiredRule]" :rules="[requiredRule('模板名称')]"
required required
clearable clearable
density="comfortable" density="comfortable"
@@ -73,8 +72,7 @@
<!-- Right Panel - Tree Structure --> <!-- Right Panel - Tree Structure -->
<v-col <v-col
cols="12" cols="8"
md="8"
class="pa-4" class="pa-4"
> >
<div class="d-flex align-center mb-4"> <div class="d-flex align-center mb-4">
@@ -164,9 +162,9 @@
<v-form v-model="directoryFormValid"> <v-form v-model="directoryFormValid">
<v-text-field <v-text-field
v-model="newDirectoryPath" v-model="newDirectoryPath"
:label="currentEditingItem ? '新目录路径 *' : '目录路径 *'" :label="'目录名称'"
:placeholder="currentEditingItem ? '例如: src/new-components' : '例如: src/components'" :placeholder="'请输入目录名称'"
:rules="[requiredRule]" :rules="[requiredRule('目录名称')]"
required required
density="comfortable" density="comfortable"
ref="directoryInputRef" ref="directoryInputRef"
@@ -203,34 +201,39 @@
<v-form v-model="fileFormValid"> <v-form v-model="fileFormValid">
<v-text-field <v-text-field
v-model="newFilePath" v-model="newFilePath"
:label="currentEditingItem ? '新文件路径 *' : '目标文件路径 *'" :label="'文件名'"
:placeholder="currentEditingItem ? '例如: src/new-index.js' : '例如: src/index.js'" :placeholder="'文件名需要带上后缀,如:style skech.doc'"
:rules="[requiredRule]" :rules="[requiredRule('文件名')]"
required required
density="comfortable" density="comfortable"
ref="fileInputRef" ref="fileInputRef"
@keydown.enter="selectAndAddFile" @keydown.enter="selectAndAddFile"
/> />
<v-file-input webkitdirectory directory label="选择文件或文件夹" density="comfortable"></v-file-input>
<div class="d-flex align-center my-4"> <div class="d-flex align-center my-4">
<v-btn <v-btn
@click="selectSourceFile" @click="selectSourceFileOrFolder"
variant="outlined" variant="outlined"
class="mr-2" class="mr-2"
:disabled="!!currentEditingItem" :disabled="!!currentEditingItem"
> >
选择文件 选择文件或文件夹
</v-btn>
<v-btn
@click="selectSourceFolder"
variant="outlined"
class="mr-2"
:disabled="!!currentEditingItem"
>
选择文件夹
</v-btn> </v-btn>
</div> </div>
<!-- 选择提示 -->
<v-alert
type="info"
variant="tonal"
class="mt-2"
>
<div class="d-flex align-start flex-column">
<span>选择文件会直接复制到目标位置</span>
<span>选择文件夹则会自动匹配该文件夹下的文件进行复制并且重命名</span>
</div>
</v-alert>
<!-- Display selected source --> <!-- Display selected source -->
<div v-if="selectedSourcePath" class="d-flex align-center"> <div v-if="selectedSourcePath" class="d-flex align-center">
<v-icon :color="isAutoFindMode ? 'warning' : 'info'" class="mr-2"> <v-icon :color="isAutoFindMode ? 'warning' : 'info'" class="mr-2">
@@ -238,32 +241,6 @@
</v-icon> </v-icon>
<span class="text-truncate">{{ selectedSourcePath }}</span> <span class="text-truncate">{{ selectedSourcePath }}</span>
</div> </div>
<!-- Auto-find indicator -->
<v-alert
v-if="isAutoFindMode"
type="info"
variant="tonal"
class="mt-2"
>
<div class="d-flex align-center">
<v-icon class="mr-2">mdi-auto-fix</v-icon>
<span>自动寻找文件夹内的文件</span>
</div>
</v-alert>
<!-- Note when editing -->
<v-alert
v-if="currentEditingItem"
type="warning"
variant="tonal"
class="mt-2"
>
<div class="d-flex align-center">
<v-icon class="mr-2">mdi-information</v-icon>
<span>正在编辑现有文件路径,文件源不会改变</span>
</div>
</v-alert>
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
@@ -430,7 +407,7 @@ const convertToTreeItem = (node: TreeNode): TreeItem => {
} }
// Validation rules // Validation rules
const requiredRule = (v: string | null | undefined) => !!v || '此字段为必填项' const requiredRule = (fieldName: string) => (v: string | null | undefined) => !!v || `${fieldName}为必填项`
// Watch for changes to detect unsaved changes // Watch for changes to detect unsaved changes
watch( watch(
@@ -1062,19 +1039,13 @@ const showSnackbar = (message: string, color: string = 'error') => {
} }
// Methods for file/folder selection // Methods for file/folder selection
const selectSourceFile = async () => { const selectSourceFileOrFolder = async () => {
const result = await window.mainApi.invoke('msgOpenFile', 'any') // 使用现有的主进程API来选择文件或文件夹
if (!result.canceled && result.filePaths && result.filePaths.length > 0) { const result = await window.mainApi.invoke('msgSelectFileOrFolder')
selectedSourcePath.value = result.filePaths[0]
isAutoFindMode.value = false // Not in auto-find mode when selecting a specific file
}
}
const selectSourceFolder = async () => { if (result && result.filePath) {
const result = await window.mainApi.invoke('msgSelectDirectory')
if (!result.canceled && result.filePath) {
selectedSourcePath.value = result.filePath selectedSourcePath.value = result.filePath
isAutoFindMode.value = true // In auto-find mode when selecting a folder isAutoFindMode.value = result.isDirectory // 如果是目录,则启用自动查找模式
} }
} }
+1 -1
View File
@@ -81,7 +81,7 @@ const navigateToCreateTemplate = () => {
<v-row class="text-center mb-6"> <v-row class="text-center mb-6">
<v-col cols="12"> <v-col cols="12">
<h1 class="text-h4 font-weight-bold mb-4"> <h1 class="text-h4 font-weight-bold mb-4">
{{ t('title.main') }} GDT Tool
</h1> </h1>
<p class="text-h6 mb-6"> <p class="text-h6 mb-6">
{{ t('desc.welcome-desc') }} {{ t('desc.welcome-desc') }}
+1 -1
View File
@@ -3,7 +3,7 @@
<v-row> <v-row>
<v-col cols="12"> <v-col cols="12">
<div class="d-flex align-center mb-4 justify-space-between flex-wrap"> <div class="d-flex align-center mb-4 justify-space-between flex-wrap">
<h2 class="mr-2 mb-2"> 模板列表 </h2> <h2 class="mr-2 mb-2"> 文件创建 </h2>
<v-btn @click="navigateToCreateTemplate" color="primary" prepend-icon="mdi-plus" class="mb-2"> <v-btn @click="navigateToCreateTemplate" color="primary" prepend-icon="mdi-plus" class="mb-2">
创建模板 创建模板
</v-btn> </v-btn>