utils

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatPackageName

func FormatPackageName(name string) string

FormatPackageName to npm like spec

func SavePackage

func SavePackage(folderPath string, pkg *Package) (bool, error)

SavePackage takes a Package and saves it to the %folderPath%/package.json

func Unzip

func Unzip(src string, dest string) ([]string, error)

Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).

Types

type Package

type Package struct {

	// basics
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description,omitempty"`
	Module      bool   `json:"module,omitempty"`

	// script files
	Preload  string `json:"preload,omitempty"`
	Postload string `json:"postload,omitempty"`
	Prestart string `json:"prestart,omitempty"`
	Plugin   string `json:"plugin,omitempty"`

	// dependencies
	ModDep map[string]string `json:"ccmodDependencies,omitempty"`
	Dep    map[string]string `json:"dependencies,omitempty"`
}

Package represents a CrossCode Mod package.json file

func GetPackage

func GetPackage(filePath string) (*Package, error)

GetPackage takes a filePath and returns a Package or error

func InitPackage

func InitPackage() *Package

InitPackage creates an empty Package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL