package.go 614 B

1234567891011121314151617181920212223242526272829303132
  1. package bundle
  2. import (
  3. "os"
  4. "github.com/langgenius/dify-plugin-daemon/internal/utils/log"
  5. )
  6. func PackageBundle(bundlePath string, outputPath string) {
  7. packager, err := loadBundlePackager(bundlePath)
  8. if err != nil {
  9. log.Error("Failed to load bundle packager: %v", err)
  10. os.Exit(1)
  11. return
  12. }
  13. zipFile, err := packager.Export()
  14. if err != nil {
  15. log.Error("Failed to export bundle: %v", err)
  16. os.Exit(1)
  17. return
  18. }
  19. if err := os.WriteFile(outputPath, zipFile, 0644); err != nil {
  20. log.Error("Failed to write zip file: %v", err)
  21. os.Exit(1)
  22. return
  23. }
  24. log.Info("Successfully packaged bundle")
  25. }