Skip to content

Commit

Permalink
feat(plugin): ignore not ui dir when copy ui plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkinStars committed Oct 18, 2023
1 parent caf634b commit 929f674
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions internal/cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,26 @@ func copyUIFiles(b *buildingMaterial) (err error) {

// copy plugins dir
fmt.Printf("try to copy dir from %s to %s\n", pluginsDir, localUIPluginDir)
if err = copyDirEntries(os.DirFS(pluginsDir), ".", localUIPluginDir); err != nil {
return fmt.Errorf("failed to copy ui files: %w", err)
pluginsDirEntries, err := os.ReadDir(pluginsDir)
if err != nil {
return fmt.Errorf("failed to read plugins dir: %w", err)
}
for _, entry := range pluginsDirEntries {
if !entry.IsDir() {
continue
}
sourcePluginDir := filepath.Join(pluginsDir, entry.Name())
// check if plugin is a ui plugin
packageJsonPath := filepath.Join(sourcePluginDir, "package.json")
fmt.Printf("check if %s is a ui plugin\n", packageJsonPath)
if !dir.CheckFileExist(packageJsonPath) {
continue
}
localPluginDir := filepath.Join(localUIPluginDir, entry.Name())
fmt.Printf("try to copy dir from %s to %s\n", sourcePluginDir, localPluginDir)
if err = copyDirEntries(os.DirFS(sourcePluginDir), ".", localPluginDir); err != nil {
return fmt.Errorf("failed to copy ui files: %w", err)
}
}
formatUIPluginsDirName(localUIPluginDir)
return nil
Expand Down

0 comments on commit 929f674

Please sign in to comment.