added kvision web-map, cleaning up a few gradle things (tokens)
This commit is contained in:
parent
29d190b8f4
commit
6d60428ab9
31 changed files with 323 additions and 87 deletions
26
LICENSE
26
LICENSE
|
|
@ -1,24 +1,6 @@
|
||||||
COPYRIGHT (C) LIMITED USE SOFTWARE LICENSE AGREEMENT
|
Copyright (C) 2021 adam@adamko.dev
|
||||||
|
|
||||||
All rights are reserved by the copyright holder.
|
This file is part of the Kafkatorio project.
|
||||||
|
|
||||||
Permission is granted to use this software as a Factorio mod.
|
The Kafkatorio project cannot be copied and/or distributed
|
||||||
|
without the express permission of the author - adam@adamko.dev
|
||||||
Permission is granted distribute this software under the
|
|
||||||
condition that the distribution is publicly accessible,
|
|
||||||
and no payment or registration is required. Additionally,
|
|
||||||
all distributions must include the full source code of the
|
|
||||||
software, without restrictions or limitations.
|
|
||||||
|
|
||||||
Permission is granted to make modifications to this software
|
|
||||||
under the condition that any claim of ownership is
|
|
||||||
relinquished, and any modification becomes the property of
|
|
||||||
the original copyright holder of this software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
||||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
For more information contact fredthedeadhead@gmail.com
|
|
||||||
|
|
|
||||||
16
README.md
16
README.md
|
|
@ -6,13 +6,20 @@
|
||||||
1. converts data to images
|
1. converts data to images
|
||||||
2. hosts a web map
|
2. hosts a web map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
While this project is under development, [no license](https://choosealicense.com/no-permission/)
|
||||||
|
is provided.
|
||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|
||||||
* add settings
|
* add settings
|
||||||
* is active - whether files are exported or not
|
* is active - whether files are exported or not
|
||||||
* delete files - clean up all files
|
* delete files - clean up all files
|
||||||
* tick-rate - how often reports are generated (
|
* tick-rate - how often reports are generated
|
||||||
* requires on some sort of in-mod cache of map<entity-id, event>)
|
* requires on some sort of in-mod cache of map<entity-id, event>
|
||||||
* also divide by game-speed? to keep ratio the same
|
* also divide by game-speed? to keep ratio the same
|
||||||
|
|
||||||
### to investigate:
|
### to investigate:
|
||||||
|
|
@ -48,4 +55,7 @@ https://github.com/dvidelabs/flatcc
|
||||||
#### CBOR
|
#### CBOR
|
||||||
|
|
||||||
https://www.zash.se/lua-cbor.html
|
https://www.zash.se/lua-cbor.html
|
||||||
https://code.zash.se/lua-cbor/archive/68b3a36d0816.tar.gz
|
https://code.zash.se/lua-cbor/archive/68b3a36d0816.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,32 @@ plugins {
|
||||||
`build-dashboard`
|
`build-dashboard`
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.adamko"
|
group = "dev.adamko.kafkatorio"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
|
|
||||||
|
val licenseFile: RegularFile by extra(layout.projectDirectory.file("LICENSE"))
|
||||||
|
|
||||||
|
val projectTokens: MutableMap<String, String> by extra(
|
||||||
|
mutableMapOf(
|
||||||
|
"project.version" to "$version",
|
||||||
|
"rootProject.name" to rootProject.name,
|
||||||
|
"date.year" to "${java.time.LocalDate.now().year}",
|
||||||
|
"author.email" to "adam@adamko.dev",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
isDownloadSources = true
|
||||||
|
isDownloadJavadoc = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.wrapper {
|
tasks.wrapper {
|
||||||
gradleVersion = "7.3"
|
gradleVersion = "7.3.1"
|
||||||
distributionType = Wrapper.DistributionType.ALL
|
distributionType = Wrapper.DistributionType.ALL
|
||||||
}
|
}
|
||||||
|
tasks.assemble { dependsOn(tasks.wrapper) }
|
||||||
|
|
||||||
val startInfra by tasks.registering {
|
val startInfra by tasks.registering {
|
||||||
group = project.name
|
group = project.name
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,4 @@ idea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.assemble { dependsOn(tasks.htmlDependencyReport) }
|
//tasks.assemble { dependsOn(tasks.htmlDependencyReport) }
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,6 @@ plugins {
|
||||||
group = "${rootProject.group}.${project.name}"
|
group = "${rootProject.group}.${project.name}"
|
||||||
version = rootProject.version
|
version = rootProject.version
|
||||||
|
|
||||||
val licenseFile: RegularFile by extra(rootProject.layout.projectDirectory.file("LICENSE"))
|
|
||||||
|
|
||||||
val tokens: MutableMap<String, String> by extra(
|
|
||||||
mutableMapOf(
|
|
||||||
"project.version" to "$version",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
idea {
|
idea {
|
||||||
module {
|
module {
|
||||||
isDownloadSources = true
|
isDownloadSources = true
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ fun Configuration.factorioModAttributes(objects: ObjectFactory): Configuration =
|
||||||
attribute(BUNDLING_ATTRIBUTE, objects.named(Bundling.EMBEDDED))
|
attribute(BUNDLING_ATTRIBUTE, objects.named(Bundling.EMBEDDED))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Configuration.typescriptAttributes(objects: ObjectFactory) =
|
fun Configuration.typescriptAttributes(objects: ObjectFactory): Configuration =
|
||||||
attributes {
|
attributes {
|
||||||
attribute(USAGE_ATTRIBUTE, objects.named("typescript"))
|
attribute(USAGE_ATTRIBUTE, objects.named("typescript"))
|
||||||
attribute(CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
|
attribute(CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
package dev.adamko.kafkatorio.lang
|
package dev.adamko.kafkatorio.lang
|
||||||
|
|
||||||
import org.gradle.kotlin.dsl.kotlin
|
import org.gradle.kotlin.dsl.kotlin
|
||||||
import com.github.gradle.node.npm.task.NpmTask
|
|
||||||
import com.github.gradle.node.task.NodeTask
|
|
||||||
import org.gradle.kotlin.dsl.dependencies
|
|
||||||
import org.gradle.kotlin.dsl.extra
|
|
||||||
import org.gradle.kotlin.dsl.getting
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dukat.DtsResolver
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask
|
|
||||||
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
|
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask
|
||||||
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
|
@ -19,6 +11,8 @@ plugins {
|
||||||
id("dev.adamko.kafkatorio.lang.node")
|
id("dev.adamko.kafkatorio.lang.node")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// not in use at the moment
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
js(IR) {
|
js(IR) {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
|
|
@ -31,9 +25,9 @@ kotlin {
|
||||||
dependencies {
|
dependencies {
|
||||||
val kotlinWrappersVersion = "0.0.1-pre.270-kotlin-1.6.0"
|
val kotlinWrappersVersion = "0.0.1-pre.270-kotlin-1.6.0"
|
||||||
implementation(
|
implementation(
|
||||||
project.dependencies.enforcedPlatform(
|
project.dependencies.enforcedPlatform(
|
||||||
"org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}"
|
"org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,16 @@ val updatePackageJson by tasks.registering(UpdatePackageJson::class) {
|
||||||
group = NodePlugin.NODE_GROUP
|
group = NodePlugin.NODE_GROUP
|
||||||
description = "Read the package.json file and update the version and name, based on the project."
|
description = "Read the package.json file and update the version and name, based on the project."
|
||||||
|
|
||||||
propertiesToCheck["version"] = "${project.version}"
|
propertiesToCheck.put("version", "${project.version}")
|
||||||
|
|
||||||
// check to see if the properties are already up-to-date
|
// check to see if the properties are already up-to-date
|
||||||
onlyIf(!areJsonPropertiesUpToDate(packageJsonFile) { propertiesToCheck })
|
onlyIf(!areJsonPropertiesUpToDate(packageJsonFile) { propertiesToCheck.get() })
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val packageJsonContent = packageJsonFile.get().asFile.readText()
|
val packageJsonContent = packageJsonFile.get().asFile.readText()
|
||||||
val packageJson = jsonMapper.parseToJsonElement(packageJsonContent).jsonObject
|
val packageJson = jsonMapper.parseToJsonElement(packageJsonContent).jsonObject
|
||||||
|
|
||||||
val newJsonProps = propertiesToCheck.mapValues { (_, newVal) -> JsonPrimitive(newVal) }
|
val newJsonProps = propertiesToCheck.get().mapValues { (_, newVal) -> JsonPrimitive(newVal) }
|
||||||
|
|
||||||
val packageJsonUpdate = JsonObject(packageJson + newJsonProps)
|
val packageJsonUpdate = JsonObject(packageJson + newJsonProps)
|
||||||
val packageJsonContentUpdated =
|
val packageJsonContentUpdated =
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,20 @@ package dev.adamko.kafkatorio.task
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.file.RegularFileProperty
|
import org.gradle.api.file.RegularFileProperty
|
||||||
|
import org.gradle.api.provider.MapProperty
|
||||||
import org.gradle.api.tasks.Input
|
import org.gradle.api.tasks.Input
|
||||||
import org.gradle.api.tasks.OutputFile
|
import org.gradle.api.tasks.OutputFile
|
||||||
|
|
||||||
abstract class UpdatePackageJson : DefaultTask() {
|
abstract class UpdatePackageJson : DefaultTask() {
|
||||||
@get:Input
|
@get:Input
|
||||||
val propertiesToCheck: MutableMap<String, String> = mutableMapOf()
|
abstract val propertiesToCheck: MapProperty<String, String>
|
||||||
@get:OutputFile
|
@get:OutputFile
|
||||||
abstract val packageJsonFile: RegularFileProperty
|
abstract val packageJsonFile: RegularFileProperty
|
||||||
|
|
||||||
|
init {
|
||||||
|
super.doFirst {
|
||||||
|
propertiesToCheck.disallowChanges()
|
||||||
|
packageJsonFile.disallowChanges()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ log4j2 = "2.14.1"
|
||||||
qosLogback = "1.2.5"
|
qosLogback = "1.2.5"
|
||||||
kafka = "3.0.0"
|
kafka = "3.0.0"
|
||||||
kotlinx-serialization = "1.3.1"
|
kotlinx-serialization = "1.3.1"
|
||||||
|
kvision = "5.6.1"
|
||||||
|
|
||||||
## test ##
|
## test ##
|
||||||
junit = "5.8.1"
|
junit = "5.8.1"
|
||||||
|
|
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import dev.adamko.kafkatorio.gradle.factorioModAttributes
|
||||||
import dev.adamko.kafkatorio.gradle.typescriptAttributes
|
import dev.adamko.kafkatorio.gradle.typescriptAttributes
|
||||||
import groovy.json.JsonOutput
|
import groovy.json.JsonOutput
|
||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.npm.SemVer
|
||||||
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
|
@ -23,16 +24,18 @@ description =
|
||||||
val modName: String by extra("${rootProject.name}-events")
|
val modName: String by extra("${rootProject.name}-events")
|
||||||
val distributionZipName: String by extra("${modName}_${project.version}.zip")
|
val distributionZipName: String by extra("${modName}_${project.version}.zip")
|
||||||
|
|
||||||
|
// version of Factorio that the mod is compatible with (must only be "major.minor" - patch causes error)
|
||||||
|
val modFactorioCompatibility = SemVer.from(libs.versions.factorio.get()).run { "$major.$minor" }
|
||||||
|
|
||||||
val tokens: MutableMap<String, String> by project.extra
|
val licenseFile: RegularFile by rootProject.extra
|
||||||
tokens += mapOf(
|
val projectTokens: MutableMap<String, String> by rootProject.extra
|
||||||
|
projectTokens += mapOf(
|
||||||
"mod.name" to modName,
|
"mod.name" to modName,
|
||||||
"mod.title" to "Kafkatorio Events",
|
"mod.title" to "Kafkatorio Events",
|
||||||
"mod.description" to (project.description ?: ""),
|
"mod.description" to (project.description ?: ""),
|
||||||
"factorio.version" to libs.versions.factorio.get().substringBeforeLast("."),
|
"factorio.version" to modFactorioCompatibility,
|
||||||
)
|
)
|
||||||
|
|
||||||
val licenseFile: RegularFile by project.extra
|
|
||||||
val tsSrcDir: Directory = layout.projectDirectory.dir("src/main/typescript")
|
val tsSrcDir: Directory = layout.projectDirectory.dir("src/main/typescript")
|
||||||
|
|
||||||
node {
|
node {
|
||||||
|
|
@ -52,7 +55,7 @@ val typescriptToLua by tasks.registering(NpmTask::class) {
|
||||||
description = "Convert Typescript To Lua"
|
description = "Convert Typescript To Lua"
|
||||||
group = project.name
|
group = project.name
|
||||||
|
|
||||||
dependsOn(tasks.npmInstall, fetchEventsSchema)
|
dependsOn(tasks.npmInstall, installEventsSchema)
|
||||||
|
|
||||||
execOverrides { standardOutput = System.out }
|
execOverrides { standardOutput = System.out }
|
||||||
|
|
||||||
|
|
@ -84,7 +87,7 @@ val typescriptToLua by tasks.registering(NpmTask::class) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val fetchEventsSchema by tasks.registering(Sync::class) {
|
val installEventsSchema by tasks.registering(Sync::class) {
|
||||||
description = "Fetch the latest shared data-model"
|
description = "Fetch the latest shared data-model"
|
||||||
group = project.name
|
group = project.name
|
||||||
|
|
||||||
|
|
@ -124,10 +127,10 @@ distributions {
|
||||||
}
|
}
|
||||||
from(licenseFile)
|
from(licenseFile)
|
||||||
from(typescriptToLua.map { it.outputs })
|
from(typescriptToLua.map { it.outputs })
|
||||||
filter<ReplaceTokens>("tokens" to tokens)
|
filter<ReplaceTokens>("tokens" to projectTokens)
|
||||||
includeEmptyDirs = false
|
includeEmptyDirs = false
|
||||||
exclude {
|
exclude {
|
||||||
// exclude empty lines
|
// exclude empty files
|
||||||
it.file.run {
|
it.file.run {
|
||||||
isFile && useLines { lines -> lines.all { line -> line.isBlank() } }
|
isFile && useLines { lines -> lines.all { line -> line.isBlank() } }
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +199,6 @@ val downloadFactorioApiDocs by tasks.registering {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val factorioModProvider by configurations.registering {
|
val factorioModProvider by configurations.registering {
|
||||||
asProvider()
|
asProvider()
|
||||||
factorioModAttributes(objects)
|
factorioModAttributes(objects)
|
||||||
|
|
@ -204,13 +206,11 @@ val factorioModProvider by configurations.registering {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.updatePackageJson {
|
tasks.updatePackageJson {
|
||||||
propertiesToCheck["name"] = "${rootProject.name}-${project.name}"
|
propertiesToCheck.put("name", "${rootProject.name}-${project.name}")
|
||||||
packageJsonFile.set(layout.projectDirectory.file("src/main/typescript/package.json"))
|
packageJsonFile.set(layout.projectDirectory.file("src/main/typescript/package.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.assemble { dependsOn(fetchEventsSchema, tasks.updatePackageJson) }
|
tasks.assemble { dependsOn(installEventsSchema, tasks.updatePackageJson) }
|
||||||
//tasks.build { dependsOn(packageMod) }
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//idea {
|
//idea {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"version": "@project.version@",
|
"version": "@project.version@",
|
||||||
"title": "@mod.title@",
|
"title": "@mod.title@",
|
||||||
"description": "@mod.description@",
|
"description": "@mod.description@",
|
||||||
"author": "fredthedeadhead",
|
"author": "@author.email@",
|
||||||
"factorio_version": "@factorio.version@",
|
"factorio_version": "@factorio.version@",
|
||||||
"dependencies": []
|
"dependencies": []
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "kafkatorio-events-mod",
|
"name": "kafkatorio-events-mod",
|
||||||
"version": "0.1.0",
|
"version": "0.1.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "kafkatorio-events-mod",
|
"name": "kafkatorio-events-mod",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tstl",
|
"build": "tstl",
|
||||||
|
|
@ -9,8 +9,7 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.13.0"
|
"node": ">=10.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {},
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lua-types": "^2.11.0",
|
"lua-types": "^2.11.0",
|
||||||
"@types/node": "^12.0.8",
|
"@types/node": "^12.0.8",
|
||||||
|
|
@ -21,10 +20,8 @@
|
||||||
"//": {
|
"//": {
|
||||||
"typed-factorio": "0.10.0"
|
"typed-factorio": "0.10.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"license": "UNLICENSED",
|
||||||
},
|
"peerDependencies": {},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {},
|
||||||
},
|
"bundledDependencies": []
|
||||||
"bundledDependencies": [
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
// Generated by TypeScriptGenerator - do edit this file manually
|
||||||
// Generated code - do edit this file manually
|
|
||||||
|
|
||||||
interface FactorioObjectData {
|
interface FactorioObjectData {
|
||||||
object_name: string;
|
object_name: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,9 @@ fun main(args: Array<String>) {
|
||||||
|
|
||||||
@Language("TypeScript")
|
@Language("TypeScript")
|
||||||
val header = """
|
val header = """
|
||||||
|
|// Generated by TypeScriptGenerator - do edit this file manually
|
||||||
// Generated code - do edit this file manually
|
|
|
||||||
|
""".trimMargin()
|
||||||
|
|
||||||
""".trimIndent()
|
|
||||||
|
|
||||||
object PropertyNameTransformer : ClassTransformer {
|
object PropertyNameTransformer : ClassTransformer {
|
||||||
override fun transformPropertyName(
|
override fun transformPropertyName(
|
||||||
|
|
|
||||||
39
modules/web-map/.gettext.json
Normal file
39
modules/web-map/.gettext.json
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"js": {
|
||||||
|
"parsers": [
|
||||||
|
{
|
||||||
|
"expression": "tr",
|
||||||
|
"arguments": {
|
||||||
|
"text": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "ntr",
|
||||||
|
"arguments": {
|
||||||
|
"text": 0,
|
||||||
|
"textPlural": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "gettext",
|
||||||
|
"arguments": {
|
||||||
|
"text": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "ngettext",
|
||||||
|
"arguments": {
|
||||||
|
"text": 0,
|
||||||
|
"textPlural": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"glob": {
|
||||||
|
"pattern": "src/**/*.kt"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"headers": {
|
||||||
|
"Language": ""
|
||||||
|
},
|
||||||
|
"output": "src/main/resources/i18n/messages.pot"
|
||||||
|
}
|
||||||
8
modules/web-map/.gitignore
vendored
Normal file
8
modules/web-map/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
.*/
|
||||||
|
build/
|
||||||
|
out/
|
||||||
|
/refresh.sh
|
||||||
|
*.imp
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
*.idea
|
||||||
72
modules/web-map/build.gradle.kts
Normal file
72
modules/web-map/build.gradle.kts
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("dev.adamko.kafkatorio.base")
|
||||||
|
kotlin("plugin.serialization")
|
||||||
|
kotlin("js") // version kotlinVersion
|
||||||
|
id("io.kvision") version "5.6.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js(IR) {
|
||||||
|
browser {
|
||||||
|
runTask {
|
||||||
|
outputFileName = "main.bundle.js"
|
||||||
|
sourceMaps = false
|
||||||
|
devServer = KotlinWebpackConfig.DevServer(
|
||||||
|
open = false,
|
||||||
|
port = 3000,
|
||||||
|
proxy = mutableMapOf(
|
||||||
|
"/kv/*" to "http://localhost:8080",
|
||||||
|
"/kvws/*" to mapOf("target" to "ws://localhost:8080", "ws" to true)
|
||||||
|
),
|
||||||
|
static = mutableListOf("$buildDir/processedResources/js/main")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
webpackTask {
|
||||||
|
outputFileName = "main.bundle.js"
|
||||||
|
}
|
||||||
|
testTask {
|
||||||
|
useKarma {
|
||||||
|
useChromeHeadless()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binaries.executable()
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
val kvisionVersion: String = libs.versions.kvision.get()
|
||||||
|
|
||||||
|
main {
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation("org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7")
|
||||||
|
|
||||||
|
implementation("io.kvision:kvision:$kvisionVersion")
|
||||||
|
implementation("io.kvision:kvision-bootstrap:$kvisionVersion")
|
||||||
|
implementation("io.kvision:kvision-bootstrap-css:$kvisionVersion")
|
||||||
|
implementation("io.kvision:kvision-bootstrap-icons:$kvisionVersion")
|
||||||
|
implementation("io.kvision:kvision-fontawesome:$kvisionVersion")
|
||||||
|
implementation("io.kvision:kvision-state:$kvisionVersion")
|
||||||
|
implementation("io.kvision:kvision-chart:$kvisionVersion")
|
||||||
|
|
||||||
|
val kotlinWrappersVersion = "0.0.1-pre.270-kotlin-1.6.0"
|
||||||
|
implementation(
|
||||||
|
project.dependencies.enforcedPlatform(
|
||||||
|
"org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val webDir = file("src/main/web")
|
||||||
|
resources.srcDir(webDir)
|
||||||
|
}
|
||||||
|
test {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-js"))
|
||||||
|
implementation("io.kvision:kvision-testutils:$kvisionVersion")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package dev.adamko.kafkatorio.webmap
|
||||||
|
|
||||||
|
import io.kvision.Application
|
||||||
|
import io.kvision.CoreModule
|
||||||
|
import io.kvision.BootstrapModule
|
||||||
|
import io.kvision.BootstrapCssModule
|
||||||
|
import io.kvision.BootstrapIconsModule
|
||||||
|
import io.kvision.FontAwesomeModule
|
||||||
|
import io.kvision.ChartModule
|
||||||
|
import io.kvision.html.div
|
||||||
|
import io.kvision.module
|
||||||
|
import io.kvision.panel.root
|
||||||
|
import io.kvision.startApplication
|
||||||
|
|
||||||
|
class App : Application() {
|
||||||
|
override fun start() {
|
||||||
|
root("kvapp") {
|
||||||
|
div("Hello world")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
startApplication(
|
||||||
|
::App,
|
||||||
|
module.hot,
|
||||||
|
BootstrapModule,
|
||||||
|
BootstrapCssModule,
|
||||||
|
BootstrapIconsModule,
|
||||||
|
FontAwesomeModule,
|
||||||
|
ChartModule,
|
||||||
|
CoreModule
|
||||||
|
)
|
||||||
|
}
|
||||||
12
modules/web-map/src/main/web/index.html
Normal file
12
modules/web-map/src/main/web/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>KVision Template</title>
|
||||||
|
<script type="text/javascript" src="main.bundle.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="kvapp"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package test.dev.adamko.kafkatorio.webmap
|
||||||
|
|
||||||
|
import io.kvision.test.SimpleSpec
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
class AppSpec : SimpleSpec {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun render() {
|
||||||
|
run {
|
||||||
|
assertTrue(true, "Dummy test")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
modules/web-map/webpack.config.d/bootstrap.js
vendored
Normal file
3
modules/web-map/webpack.config.d/bootstrap.js
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, type: 'asset'});
|
||||||
|
config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, type: 'asset'});
|
||||||
|
config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, type: 'asset/resource'});
|
||||||
2
modules/web-map/webpack.config.d/css.js
Normal file
2
modules/web-map/webpack.config.d/css.js
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
config.module.rules.push({ test: /\.css$/, use: ["style-loader", { loader: "css-loader", options: {sourceMap: false} } ] });
|
||||||
|
|
||||||
6
modules/web-map/webpack.config.d/file.js
Normal file
6
modules/web-map/webpack.config.d/file.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
config.module.rules.push(
|
||||||
|
{
|
||||||
|
test: /\.(jpe?g|png|gif|svg)$/i,
|
||||||
|
type: 'asset/resource'
|
||||||
|
}
|
||||||
|
);
|
||||||
6
modules/web-map/webpack.config.d/handlebars.js
Normal file
6
modules/web-map/webpack.config.d/handlebars.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
config.module.rules.push(
|
||||||
|
{
|
||||||
|
test: /\.hbs$/i,
|
||||||
|
loader: 'handlebars-loader'
|
||||||
|
}
|
||||||
|
);
|
||||||
9
modules/web-map/webpack.config.d/jquery.js
vendored
Normal file
9
modules/web-map/webpack.config.d/jquery.js
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
;(function() {
|
||||||
|
const webpack = require('webpack')
|
||||||
|
|
||||||
|
config.plugins.push(new webpack.ProvidePlugin({
|
||||||
|
$: "jquery",
|
||||||
|
jQuery: "jquery",
|
||||||
|
"window.jQuery": "jquery"
|
||||||
|
}));
|
||||||
|
})();
|
||||||
15
modules/web-map/webpack.config.d/moment.js
Normal file
15
modules/web-map/webpack.config.d/moment.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
;(function() {
|
||||||
|
const webpack = require('webpack')
|
||||||
|
try {
|
||||||
|
const moment = require("moment");
|
||||||
|
config.plugins.push(new webpack.IgnorePlugin({
|
||||||
|
resourceRegExp: /^\.\/locale$/,
|
||||||
|
contextRegExp: /moment$/,
|
||||||
|
}));
|
||||||
|
config.plugins.push(new webpack.ProvidePlugin({
|
||||||
|
moment: "moment",
|
||||||
|
"window.moment": "moment"
|
||||||
|
}));
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
})();
|
||||||
15
modules/web-map/webpack.config.d/webpack.js
Normal file
15
modules/web-map/webpack.config.d/webpack.js
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
config.resolve.modules.push("../../processedResources/js/main");
|
||||||
|
|
||||||
|
if (config.devServer) {
|
||||||
|
config.devServer.hot = true;
|
||||||
|
config.devtool = 'eval-cheap-source-map';
|
||||||
|
} else {
|
||||||
|
config.devtool = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable bundle size warning
|
||||||
|
config.performance = {
|
||||||
|
assetFilter: function (assetFilename) {
|
||||||
|
return !assetFilename.endsWith('.js');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -12,6 +12,7 @@ include(
|
||||||
":modules:infra-kafka-pipe",
|
":modules:infra-kafka-pipe",
|
||||||
|
|
||||||
":modules:kt-rcon",
|
":modules:kt-rcon",
|
||||||
|
":modules:web-map",
|
||||||
)
|
)
|
||||||
|
|
||||||
enableFeaturePreview("VERSION_CATALOGS")
|
enableFeaturePreview("VERSION_CATALOGS")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue