diff --git a/cmd/crx/build.go b/cmd/crx/build.go deleted file mode 100644 index 61e2455..0000000 --- a/cmd/crx/build.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - "os/exec" - - "github.com/customrealms/cli/lib" -) - -const DEFAULT_MC_VERSION = "1.17.1" - -func crxBuild() { - - var projectDir string - var mcVersion string - var outputFile string - - flag.StringVar(&projectDir, "p", ".", "plugin project directory") - flag.StringVar(&mcVersion, "mc", DEFAULT_MC_VERSION, "Minecraft version number target") - flag.StringVar(&outputFile, "o", "", "output JAR file path") - - flag.CommandLine.Parse(os.Args[2:]) - - if len(outputFile) == 0 { - fmt.Println("Output JAR file is required: -o option") - os.Exit(1) - } - - // Build the local directory - cmd := exec.Command("npm", "run", "build") - cmd.Dir = projectDir - if err := cmd.Run(); err != nil { - panic(err) - } - - // Define the specification for the JAR template - jarTemplate := lib.JarTemplate{ - MCVersion: mcVersion, - } - - if err := lib.BundleJar( - projectDir, - &jarTemplate, - mcVersion, - outputFile, - ); err != nil { - panic(err) - } - -} diff --git a/cmd/crx/main.go b/cmd/crx/main.go index d535e53..c179362 100644 --- a/cmd/crx/main.go +++ b/cmd/crx/main.go @@ -1,11 +1,16 @@ package main import ( + "flag" "fmt" "os" + "os/exec" + + "github.com/customrealms/cli/lib" ) const VERSION = "0.1.0" +const DEFAULT_MC_VERSION = "1.17.1" func main() { @@ -27,3 +32,43 @@ func main() { } } + +func crxBuild() { + + var projectDir string + var mcVersion string + var outputFile string + + flag.StringVar(&projectDir, "p", ".", "plugin project directory") + flag.StringVar(&mcVersion, "mc", DEFAULT_MC_VERSION, "Minecraft version number target") + flag.StringVar(&outputFile, "o", "", "output JAR file path") + + flag.CommandLine.Parse(os.Args[2:]) + + if len(outputFile) == 0 { + fmt.Println("Output JAR file is required: -o option") + os.Exit(1) + } + + // Build the local directory + cmd := exec.Command("npm", "run", "build") + cmd.Dir = projectDir + if err := cmd.Run(); err != nil { + panic(err) + } + + // Define the specification for the JAR template + jarTemplate := lib.JarTemplate{ + MCVersion: mcVersion, + } + + if err := lib.BundleJar( + projectDir, + &jarTemplate, + mcVersion, + outputFile, + ); err != nil { + panic(err) + } + +}