Skip to content

Commit

Permalink
Cleanup of entrypoint to make it a single file
Browse files Browse the repository at this point in the history
  • Loading branch information
connerdouglass committed Nov 11, 2021
1 parent 4c82459 commit 68f60a7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 52 deletions.
52 changes: 0 additions & 52 deletions cmd/crx/build.go

This file was deleted.

45 changes: 45 additions & 0 deletions cmd/crx/main.go
Original file line number Diff line number Diff line change
@@ -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() {

Expand All @@ -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)
}

}

0 comments on commit 68f60a7

Please sign in to comment.