Skip to content

Commit

Permalink
restructure json5 input format
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed Jan 31, 2021
1 parent 902747e commit 4a952c8
Show file tree
Hide file tree
Showing 18 changed files with 807 additions and 539 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ data class CommonComponent(
override var validMcVersions: Set<String> = setOf(),
override var invalidMcVersions: Set<String> = setOf(),
override var enabled: Boolean = true
) : CommonMutable
) : CommonMutable {
companion object {
val DEFAULT = CommonComponent()
}
}

@Serializable
data class CurseComponent(
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/kotlin/voodoo/data/components/Parts.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package voodoo.data.components

import kotlinx.serialization.Transient
import voodoo.data.DependencyType
import voodoo.data.OptionalData
import voodoo.data.Side
import voodoo.data.curse.FileID
import voodoo.data.curse.FileType
import voodoo.data.curse.PackageType
import voodoo.data.curse.ProjectID
import voodoo.data.nested.NestedEntry
import voodoo.data.provider.UpdateChannel

interface Common {
Expand Down Expand Up @@ -51,14 +49,16 @@ interface CommonMutable : CommonImmutable {
override var invalidMcVersions: Set<String>
override var enabled: Boolean

/*
/**
* utility function to configure optionalData
*/
fun optional(configureOptional: OptionalData.() -> Unit) {
val optionalData = optionalData?.copy() ?: OptionalData()
optionalData.configureOptional()
this.optionalData = optionalData
fun optional(transform: (optionalData: OptionalData) -> OptionalData): OptionalData {
return transform(
optionalData?.copy() ?: OptionalData()
)
}
*/
}

interface CurseImmutable {
Expand Down
104 changes: 45 additions & 59 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,71 +35,52 @@ run the `generateSchema` command once to make it generate a `config.json` and `.
./voodoo generateSchema
```

now you should see `config.json5`
now you should see `config.json5` which might contain some useful defaults

`/config.json5`
```json5
{
"$schema": "./schema/config.schema.json",
"curseforgeGenerators": {
},
"forgeGenerators": {
},
"fabricGenerators": {
},
"overrides": {
}
"$schema": "./schema/config.schema.json",
"curseforgeGenerators": {},
"forgeGenerators": {},
"fabricGenerators": {},
"overrides": {}
}
```

### gitignore

these folders should probably be gitignored because they contain autogenerated content (lots of it)
so `init` created a gitignore file

??? note ".gitignore"
```gitignore
/.completions/
/_upload/
/reports/
/logs/
/docs/
/schema/
/wrapper/bin/
```
// TODO: use https://facelessuser.github.io/pymdown-extensions/extensions/snippets/ to load actual .gitignore

### Autocompletion Configuration

we are interested in fabric and fabric mods on curseforge
so we see there is already a section that filters curseforge mods by section
and a entry that generated the fabric modloader versions

`/config.json5`
```json5
{
"$schema": "./schema/config.schema.json",
"curseforgeGenerators": {
"Fabric": {
"section": "MODS",
"categories": [
"Fabric"
],
"mcVersions": [
"1.16",
"1.16.1",
"1.16.2",
"1.16.3"
]
}
},
"forgeGenerators": {
"$schema": "./schema/config.schema.json",
"curseforgeGenerators": {
"Fabric": {
"section": "MODS",
"categories": [
"Fabric"
]
}
},
"fabricGenerators": {
"Fabric": {
"requireStable": true
}
},
"overrides": {
"side_client": {
"type": "common",
"side": "CLIENT"
},
"fabricGenerators": {
"Fabric": {
"requireStable": true
}
"side_server": {
"type": "common",
"side": "SERVER"
},
"overrides": {
}
}
}
```

Expand Down Expand Up @@ -142,8 +123,7 @@ by default the modloader is set to `None`
"modloader": {
"type": "modloader.none"
},
"mods": [
]
"mods": {}
}
```

Expand All @@ -160,8 +140,7 @@ lets replace with with fabric
"type": "modloader.fabric",
"intermediateMappings": "Fabric/1.16.3"
},
"mods": [
]
"mods": {}
}
```

Expand Down Expand Up @@ -213,16 +192,23 @@ so lets add some mods
"type": "modloader.fabric",
"intermediateMappings": "Fabric/1.16.3"
},
"mods": [
"mods": {
"": [
{
"type": "curse",
"projectName": "Fabric/appleskin"
"type": "curse"
"curse_projectName": "Fabric/campanion"
}
],
"side_client": [
{
"type": "curse",
"curse_projectName": "Fabric/appleskin"
},
{
"type": "curse",
"projectName": "Fabric/hwyla"
"type": "curse",
"curse_projectName": "Fabric/hwyla"
}
]
],
}
```

Expand Down
111 changes: 48 additions & 63 deletions samples/config.json5
Original file line number Diff line number Diff line change
@@ -1,68 +1,53 @@
{
"$schema": "./schema/config.schema.json",
"curseforgeGenerators": {
"Mod": {
"section": "MODS",
"mcVersions": [
"1.12",
"1.12.1",
"1.12.2",
"1.15.2",
"1.16.4",
"1.16.5"
]
},
"Resource": {
"section": "RESOURCE_PACKS",
"mcVersions": []
},
"Fabric": {
"section": "MODS",
"categories": [
"Fabric"
],
"mcVersions": [
]
}
"$schema": "./schema/config.schema.json",
"curseforgeGenerators": {
"Mod": {
"section": "MODS"
},
"forgeGenerators": {
"Forge": {},
"Resource": {
"section": "RESOURCE_PACKS"
},
"fabricGenerators": {
"Fabric": {
"requireStable": true
}
},
"overrides": {
"client": {
"type": "common",
"side": "CLIENT"
},
"server": {
"type": "common",
"side": "SERVER"
},
"optional": {
"type": "common",
"optional": {
"selected": false
}
},
"optionalDefault": {
"type": "common",
"optional": {
"selected": true
}
},
"optionalStarred": {
"type": "common",
"optional": {
"recommendation": "starred"
}
},
"163Mod": {
"type": "common",
"validMcVersions": ["1.16.3"]
}
"Fabric": {
"section": "MODS",
"categories": [
"Fabric"
]
}
},
"forgeGenerators": {
"Forge": {},
},
"fabricGenerators": {
"Fabric": {
"requireStable": true
}
},
"overrides": {
"side_client": {
"type": "common",
"side": "CLIENT"
},
"side_server": {
"type": "common",
"side": "SERVER"
},
"optional": {
"type": "common",
"optional": {
"selected": false
}
},
"optional_default": {
"type": "common",
"optional": {
"selected": true
}
},
"optional_starred": {
"type": "common",
"optional": {
"recommendation": "starred"
}
},
}
}
Loading

0 comments on commit 4a952c8

Please sign in to comment.