Skip to content

Commit

Permalink
Refactor tnoodle-ui package bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Aug 16, 2022
1 parent 0c3c25c commit 955c89c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/tnoodle-ui"
directory: "/ui"
schedule:
interval: "monthly"
- package-ecosystem: "github-actions"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: 'tnoodle-ui/coverage/lcov.info'
base-path: 'tnoodle-ui'
path-to-lcov: 'ui/coverage/lcov.info'
base-path: 'ui'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.worldcubeassociation.tnoodle.core.util

object FrontendUtil {
const val FRONTEND_BINDING_PACKAGE = "wca/tnoodle-ui"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.worldcubeassociation.tnoodle.build

import org.worldcubeassociation.tnoodle.core.util.FrontendUtil

object FrontendBindings {
const val PACKAGE_ROOT = FrontendUtil.FRONTEND_BINDING_PACKAGE
}
1 change: 1 addition & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
api(libs.tnoodle.scrambles)

implementation(project(":build-tools"))

implementation(libs.kotlinx.coroutines.core)
implementation(libs.ktor.server.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
Expand Down
1 change: 1 addition & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ configurations {

dependencies {
implementation(project(":core"))
implementation(project(":build-tools"))

implementation(libs.zip4j)
implementation(libs.markdownj.core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@ package org.worldcubeassociation.tnoodle.server.routing.statics
import io.ktor.server.http.content.*
import io.ktor.server.routing.*
import org.worldcubeassociation.tnoodle.core.RouteHandler
import org.worldcubeassociation.tnoodle.core.util.FrontendUtil.FRONTEND_BINDING_PACKAGE

object StaticResourceHandler : RouteHandler {
override fun install(router: Route) {
router.static {
resource("robots.txt", "wca/tnoodle-ui/robots.txt")
resource("robots.txt", "$FRONTEND_BINDING_PACKAGE/robots.txt")
}

router.static("css") {
resources("css")
}

router.static("scramble") {
resources("wca/tnoodle-ui")
defaultResource("wca/tnoodle-ui/index.html")
resources(FRONTEND_BINDING_PACKAGE)
defaultResource("$FRONTEND_BINDING_PACKAGE/index.html")

static("static") {
resources("wca/tnoodle-ui/static")
resources("$FRONTEND_BINDING_PACKAGE/static")
}

static("oauth") {
resource("*", "wca/tnoodle-ui/index.html")
resource("*", "$FRONTEND_BINDING_PACKAGE/index.html")
}
}

Expand Down
4 changes: 3 additions & 1 deletion ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import com.github.gradle.node.NodeExtension

import org.worldcubeassociation.tnoodle.build.FrontendBindings.PACKAGE_ROOT

description = "A web ui for TNoodle that uses modern technology"

plugins {
Expand Down Expand Up @@ -60,7 +62,7 @@ tasks.create<Zip>("packageReactFrontend") {
include("robots.txt")
include("manifest.json")

into("wca/tnoodle-ui")
into(PACKAGE_ROOT)
}
}

Expand Down

0 comments on commit 955c89c

Please sign in to comment.