refactor: update import paths to use internal package

This commit is contained in:
Antoine Aflalo
2025-02-13 19:39:06 -05:00
parent 5428134d15
commit dd7b6a332c
25 changed files with 54 additions and 54 deletions

View File

@@ -24,7 +24,7 @@ changelog:
order: 2
builds:
- id: cbzoptimizer
main: main.go
main: cmd/cbzoptimizer/main.go
goos:
- linux
goarch:

View File

@@ -1,10 +1,10 @@
package cmd
package commands
import (
"fmt"
"github.com/belphemur/CBZOptimizer/v2/converter"
"github.com/belphemur/CBZOptimizer/v2/converter/constant"
"github.com/belphemur/CBZOptimizer/v2/utils"
utils2 "github.com/belphemur/CBZOptimizer/v2/internal/utils"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
"github.com/spf13/cobra"
"github.com/thediveo/enumflag/v2"
"os"
@@ -45,7 +45,7 @@ func ConvertCbzCommand(cmd *cobra.Command, args []string) error {
return fmt.Errorf("path is required")
}
if !utils.IsValidFolder(path) {
if !utils2.IsValidFolder(path) {
return fmt.Errorf("the path needs to be a folder")
}
@@ -92,7 +92,7 @@ func ConvertCbzCommand(cmd *cobra.Command, args []string) error {
go func() {
defer wg.Done()
for path := range fileChan {
err := utils.Optimize(&utils.OptimizeOptions{
err := utils2.Optimize(&utils2.OptimizeOptions{
ChapterConverter: chapterConverter,
Path: path,
Quality: quality,

View File

@@ -1,11 +1,11 @@
package cmd
package commands
import (
"github.com/belphemur/CBZOptimizer/v2/cbz"
"github.com/belphemur/CBZOptimizer/v2/converter"
"github.com/belphemur/CBZOptimizer/v2/converter/constant"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/internal/cbz"
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
"github.com/belphemur/CBZOptimizer/v2/internal/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
"github.com/spf13/cobra"
"log"
"os"

View File

@@ -1,4 +1,4 @@
package cmd
package commands
import (
"fmt"

View File

@@ -1,10 +1,10 @@
package cmd
package commands
import (
"fmt"
"github.com/belphemur/CBZOptimizer/v2/converter"
"github.com/belphemur/CBZOptimizer/v2/converter/constant"
"github.com/belphemur/CBZOptimizer/v2/utils"
utils2 "github.com/belphemur/CBZOptimizer/v2/internal/utils"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
"github.com/pablodz/inotifywaitgo/inotifywaitgo"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@@ -53,7 +53,7 @@ func WatchCommand(_ *cobra.Command, args []string) error {
return fmt.Errorf("path is required")
}
if !utils.IsValidFolder(path) {
if !utils2.IsValidFolder(path) {
return fmt.Errorf("the path needs to be a folder")
}
@@ -114,7 +114,7 @@ func WatchCommand(_ *cobra.Command, args []string) error {
for _, e := range event.Events {
switch e {
case inotifywaitgo.CLOSE_WRITE, inotifywaitgo.MOVE:
err := utils.Optimize(&utils.OptimizeOptions{
err := utils2.Optimize(&utils2.OptimizeOptions{
ChapterConverter: chapterConverter,
Path: event.Filename,
Quality: quality,

16
cmd/cbzoptimizer/main.go Normal file
View File

@@ -0,0 +1,16 @@
package main
import (
"github.com/belphemur/CBZOptimizer/v2/cmd/cbzoptimizer/commands"
)
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
commands.SetVersionInfo(version, commit, date)
commands.Execute()
}

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/belphemur/CBZOptimizer/v2
go 1.23.1
go 1.24
toolchain go1.24.0

View File

@@ -3,8 +3,8 @@ package cbz
import (
"archive/zip"
"fmt"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
"github.com/belphemur/CBZOptimizer/v2/internal/utils/errs"
"os"
"time"
)

View File

@@ -4,8 +4,8 @@ import (
"archive/zip"
"bytes"
"fmt"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
"github.com/belphemur/CBZOptimizer/v2/internal/utils/errs"
"os"
"testing"
"time"

View File

@@ -6,8 +6,8 @@ import (
"bytes"
"fmt"
"github.com/araddon/dateparse"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
"github.com/belphemur/CBZOptimizer/v2/internal/utils/errs"
"io"
"path/filepath"
"strings"

View File

@@ -3,9 +3,9 @@ package utils
import (
"errors"
"fmt"
"github.com/belphemur/CBZOptimizer/v2/cbz"
"github.com/belphemur/CBZOptimizer/v2/converter"
errors2 "github.com/belphemur/CBZOptimizer/v2/converter/errors"
"github.com/belphemur/CBZOptimizer/v2/internal/cbz"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter"
errors2 "github.com/belphemur/CBZOptimizer/v2/pkg/converter/errors"
"log"
"strings"
)

16
main.go
View File

@@ -1,16 +0,0 @@
package main
import (
"github.com/belphemur/CBZOptimizer/v2/cmd"
)
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
cmd.SetVersionInfo(version, commit, date)
cmd.Execute()
}

View File

@@ -2,9 +2,9 @@ package converter
import (
"fmt"
"github.com/belphemur/CBZOptimizer/v2/converter/constant"
"github.com/belphemur/CBZOptimizer/v2/converter/webp"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/webp"
"github.com/samber/lo"
"strings"
)

View File

@@ -2,9 +2,9 @@ package converter
import (
"bytes"
"github.com/belphemur/CBZOptimizer/v2/converter/constant"
"github.com/belphemur/CBZOptimizer/v2/internal/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/utils/errs"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
"golang.org/x/exp/slices"
"image"
"image/jpeg"

View File

@@ -4,9 +4,9 @@ import (
"bytes"
"errors"
"fmt"
"github.com/belphemur/CBZOptimizer/v2/converter/constant"
converterrors "github.com/belphemur/CBZOptimizer/v2/converter/errors"
"github.com/belphemur/CBZOptimizer/v2/manga"
"github.com/belphemur/CBZOptimizer/v2/internal/manga"
"github.com/belphemur/CBZOptimizer/v2/pkg/converter/constant"
converterrors "github.com/belphemur/CBZOptimizer/v2/pkg/converter/errors"
"github.com/oliamb/cutter"
"golang.org/x/exp/slices"
_ "golang.org/x/image/webp"