Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlite dev #1462

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions server/service/system/sys_auto_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,11 @@ func (autoCodeService *AutoCodeService) PubPlug(plugName string) (zipPath string
// 创建一个新的zip文件

// 判断目录是否存在
_, err = os.Stat(webPath)
webInfo, err := os.Stat(webPath)
if err != nil {
return "", errors.New("web路径不存在")
}
_, err = os.Stat(serverPath)
serverInfo, err := os.Stat(serverPath)
if err != nil {
return "", errors.New("server路径不存在")
}
Expand All @@ -817,14 +817,33 @@ func (autoCodeService *AutoCodeService) PubPlug(plugName string) (zipPath string
zipWriter := zip.NewWriter(zipFile)
defer zipWriter.Close()

// 创建一个新的文件头
webHeader, err := zip.FileInfoHeader(webInfo)
if err != nil {
return
}

// 创建一个新的文件头
serverHeader, err := zip.FileInfoHeader(serverInfo)
if err != nil {
return
}

webHeader.Name = filepath.Join(plugName, "web", "plugin")
serverHeader.Name = filepath.Join(plugName, "server", "plugin")

// 将文件添加到zip归档中
_, err = zipWriter.CreateHeader(serverHeader)
_, err = zipWriter.CreateHeader(webHeader)

// 遍历webPath目录并将所有非隐藏文件添加到zip归档中
err = filepath.Walk(webPath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}

// 跳过隐藏文件和目录
if strings.HasPrefix(info.Name(), ".") || info.IsDir() {
// 跳过隐藏文件
if strings.HasPrefix(info.Name(), ".") {
return nil
}

Expand All @@ -844,6 +863,10 @@ func (autoCodeService *AutoCodeService) PubPlug(plugName string) (zipPath string
return err
}

if info.IsDir() {
return nil
}

// 打开文件并将其内容复制到zip归档中
file, err := os.Open(path)
if err != nil {
Expand All @@ -867,7 +890,7 @@ func (autoCodeService *AutoCodeService) PubPlug(plugName string) (zipPath string
}

// 跳过隐藏文件和目录
if strings.HasPrefix(info.Name(), ".") || info.IsDir() {
if strings.HasPrefix(info.Name(), ".") {
return nil
}

Expand All @@ -886,6 +909,10 @@ func (autoCodeService *AutoCodeService) PubPlug(plugName string) (zipPath string
return err
}

if info.IsDir() {
return nil
}

// 打开文件并将其内容复制到zip归档中
file, err := os.Open(path)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions web/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
}
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*"]
}