Skip to content

Commit

Permalink
First pass at setting resolutions in package.json (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemadden authored Jun 20, 2023
1 parent 4426355 commit e62f1a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
38 changes: 20 additions & 18 deletions launcher/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@ type ConfigCli struct {

// Config server config structure
type Config struct {
SteamKey string `yaml:"steamKey" json:"steamKey"`
SteamKeyFile string `yaml:"steamKeyFile" json:"steamKeyFile"`
Cli *ConfigCli `yaml:"cli" json:"cli"`
Env *ConfigEnv `yaml:"env" json:"env"`
Processors int `yaml:"processors" json:"processors"`
RunnerThreads int `yaml:"runnerThreads" json:"runnerThreads"`
Version string `yaml:"version" json:"version"`
NodeVersion string `yaml:"nodeVersion" json:"nodeVersion"`
Mods []string `yaml:"mods" json:"mods"`
Bots map[string]string `yaml:"bots" json:"bots"`
ExtraPackages map[string]string `yaml:"extraPackages" json:"extraPackages"`
LocalMods string `yaml:"localMods" json:"localMods"`
Backup *ConfigBackup `yaml:"backup" json:"backup"`
Modules map[string]bool `yaml:"modules" json:"modules"`
SteamKey string `yaml:"steamKey" json:"steamKey"`
SteamKeyFile string `yaml:"steamKeyFile" json:"steamKeyFile"`
Cli *ConfigCli `yaml:"cli" json:"cli"`
Env *ConfigEnv `yaml:"env" json:"env"`
Processors int `yaml:"processors" json:"processors"`
RunnerThreads int `yaml:"runnerThreads" json:"runnerThreads"`
Version string `yaml:"version" json:"version"`
NodeVersion string `yaml:"nodeVersion" json:"nodeVersion"`
Mods []string `yaml:"mods" json:"mods"`
Bots map[string]string `yaml:"bots" json:"bots"`
ExtraPackages map[string]string `yaml:"extraPackages" json:"extraPackages"`
PinnedPackages map[string]string `yaml:"pinnedPackages" json:"pinnedPackages"`
LocalMods string `yaml:"localMods" json:"localMods"`
Backup *ConfigBackup `yaml:"backup" json:"backup"`
Modules map[string]bool `yaml:"modules" json:"modules"`
}

// NewConfig Create a new Config
Expand Down Expand Up @@ -89,10 +90,11 @@ func NewConfig() *Config {
"DB_PATH": "db.json",
},
},
LocalMods: "mods",
Mods: make([]string, 0),
Bots: make(map[string]string),
ExtraPackages: make(map[string]string),
LocalMods: "mods",
Mods: make([]string, 0),
Bots: make(map[string]string),
ExtraPackages: make(map[string]string),
PinnedPackages: make(map[string]string),
Backup: &ConfigBackup{
Dirs: make([]string, 0),
Files: make([]string, 0),
Expand Down
2 changes: 2 additions & 0 deletions launcher/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type PackageJSON struct {
Name string `json:"name"`
Main string `json:"main"`
Dependencies map[string]string `json:"dependencies"`
Resolutions map[string]string `json:"resolutions"`
Private bool `json:"private"`
}

Expand Down Expand Up @@ -40,6 +41,7 @@ func writePackage(c *Config) error {
}
var pack PackageJSON
pack.Dependencies = deps
pack.Resolutions = c.PinnedPackages
pack.Private = true
pack.Name = "screeps-private-server"
bytes, err := json.MarshalIndent(pack, "", " ")
Expand Down

0 comments on commit e62f1a4

Please sign in to comment.