mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-03 15:13:07 +00:00
Relocate our existing web code to subdirectories
- Move the frontend code into src/frontend - Move our custom element SSR system into src/htmlTransform. This is mostly in prep for merging in copy-cat's core, as that's a whole bunch of extra code.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
import cc.tweaked.gradle.getAbsolutePath
|
||||
|
||||
plugins {
|
||||
`lifecycle-base`
|
||||
id("cc-tweaked.node")
|
||||
@@ -21,13 +23,13 @@ val rollup by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) {
|
||||
description = "Bundles JS into rollup"
|
||||
|
||||
// Sources
|
||||
inputs.files(fileTree("src")).withPropertyName("sources")
|
||||
inputs.files(fileTree("src/frontend")).withPropertyName("sources")
|
||||
// Config files
|
||||
inputs.file("tsconfig.json").withPropertyName("Typescript config")
|
||||
inputs.file("rollup.config.js").withPropertyName("Rollup config")
|
||||
|
||||
// Output directory. Also defined in illuaminate.sexp and rollup.config.js
|
||||
output.set(buildDir.resolve("rollup"))
|
||||
output.set(layout.buildDirectory.dir("rollup"))
|
||||
|
||||
args = listOf("rollup", "--config", "rollup.config.js")
|
||||
}
|
||||
@@ -44,30 +46,38 @@ val illuaminateDocs by tasks.registering(cc.tweaked.gradle.IlluaminateExecToDir:
|
||||
inputs.files(project(":forge").tasks.named("luaJavadoc"))
|
||||
// Additional assets
|
||||
inputs.files(rollup)
|
||||
inputs.file("src/styles.css").withPropertyName("styles")
|
||||
inputs.file("src/frontend/styles.css").withPropertyName("styles")
|
||||
|
||||
// Output directory. Also defined in illuaminate.sexp and transform.tsx
|
||||
output.set(buildDir.resolve("illuaminate"))
|
||||
// Output directory. Also defined in illuaminate.sexp.
|
||||
output.set(layout.buildDirectory.dir("illuaminate"))
|
||||
|
||||
args = listOf("doc-gen")
|
||||
workingDir = rootProject.projectDir
|
||||
}
|
||||
|
||||
val jsxDocs by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) {
|
||||
val htmlTransform by tasks.registering(cc.tweaked.gradle.NpxExecToDir::class) {
|
||||
group = JavaBasePlugin.DOCUMENTATION_GROUP
|
||||
description = "Post-processes documentation to statically render some dynamic content."
|
||||
|
||||
val sources = fileTree("src/htmlTransform")
|
||||
|
||||
// Config files
|
||||
inputs.file("tsconfig.json").withPropertyName("Typescript config")
|
||||
// Sources
|
||||
inputs.files(fileTree("src")).withPropertyName("sources")
|
||||
inputs.file(file("src/export/index.json")).withPropertyName("export")
|
||||
inputs.files(sources).withPropertyName("sources")
|
||||
inputs.files(illuaminateDocs)
|
||||
|
||||
// Output directory. Also defined in src/transform.tsx
|
||||
output.set(buildDir.resolve("jsxDocs"))
|
||||
// Output directory.
|
||||
output.set(layout.buildDirectory.dir(name))
|
||||
|
||||
args = listOf("tsx", "src/transform.tsx")
|
||||
argumentProviders.add {
|
||||
listOf(
|
||||
"tsx", sources.dir.resolve("index.tsx").absolutePath,
|
||||
illuaminateDocs.get().output.getAbsolutePath(),
|
||||
sources.dir.resolve("export/index.json").absolutePath,
|
||||
output.getAbsolutePath(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val docWebsite by tasks.registering(Copy::class) {
|
||||
@@ -75,7 +85,7 @@ val docWebsite by tasks.registering(Copy::class) {
|
||||
description = "Assemble docs and assets together into the documentation website."
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
|
||||
from(jsxDocs)
|
||||
from(htmlTransform)
|
||||
|
||||
// Pick up assets from the /docs folder
|
||||
from(rootProject.file("doc")) {
|
||||
@@ -87,9 +97,9 @@ val docWebsite by tasks.registering(Copy::class) {
|
||||
// Grab illuaminate's assets. HTML files are provided by jsxDocs
|
||||
from(illuaminateDocs) { exclude("**/*.html") }
|
||||
// And item/block images from the data export
|
||||
from(file("src/export/items")) { into("images/items") }
|
||||
from(file("src/htmlTransform/export/items")) { into("images/items") }
|
||||
|
||||
into(buildDir.resolve("site"))
|
||||
into(layout.buildDirectory.dir("site"))
|
||||
}
|
||||
|
||||
tasks.assemble { dependsOn(docWebsite) }
|
||||
|
||||
Reference in New Issue
Block a user