diff options
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | build.gradle.kts | 58 | ||||
-rw-r--r-- | example/build.gradle.kts | 7 | ||||
-rw-r--r-- | example/src/main/kotlin/moe/nea89/website/test/AsciiArt.kt (renamed from src/main/kotlin/moe/nea89/website/AsciiArt.kt) | 2 | ||||
-rw-r--r-- | example/src/main/kotlin/moe/nea89/website/test/index.kt (renamed from src/main/kotlin/moe/nea89/website/index.kt) | 4 | ||||
-rw-r--r-- | example/src/main/resources/asciiart/boob.txt (renamed from src/main/resources/asciiart/boob.txt) | 0 | ||||
-rw-r--r-- | example/src/main/resources/images/me.jpeg (renamed from src/main/resources/images/me.jpeg) | bin | 567270 -> 567270 bytes | |||
-rw-r--r-- | example/src/main/resources/images/moisturized.jpg (renamed from src/main/resources/images/moisturized.jpg) | bin | 41960 -> 41960 bytes | |||
-rw-r--r-- | example/src/main/resources/index.html (renamed from src/main/resources/index.html) | 2 | ||||
-rw-r--r-- | example/webpack.config.d/noopenbrowser.js (renamed from webpack.config.d/noopenbrowser.js) | 0 | ||||
-rw-r--r-- | example/webpack.config.d/style.js (renamed from webpack.config.d/style.js) | 4 | ||||
-rw-r--r-- | settings.gradle.kts | 1 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea89/website/KConsole.kt | 1 |
13 files changed, 46 insertions, 37 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c09ee8..97357be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,11 +8,11 @@ jobs: - uses: actions/setup-java@v1 with: java-version: 8 - - run: ./gradlew clean build + - run: ./gradlew clean :example:build - name: Github Pages uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/master' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build/distributions + publish_dir: ./example/build/distributions diff --git a/build.gradle.kts b/build.gradle.kts index f6ef050..af77441 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,45 +1,43 @@ plugins { kotlin("js") version "1.6.0" - kotlin("plugin.serialization") version "1.6.0" id("com.github.node-gradle.node") version "3.1.1" } -repositories { - mavenCentral() -} - -kotlin { - sourceSets.all { - languageSettings.optIn("kotlin.ExperimentalStdlibApi") - languageSettings.optIn("kotlin.RequiresOptIn") +allprojects { + apply(plugin = "org.jetbrains.kotlin.js") + repositories { + mavenCentral() } - js(IR) { - browser { - commonWebpackConfig { - sourceMaps = true - cssSupport.enabled = true + + kotlin { + sourceSets.all { + languageSettings.optIn("kotlin.ExperimentalStdlibApi") + languageSettings.optIn("kotlin.RequiresOptIn") + } + js(IR) { + browser { + commonWebpackConfig { + sourceMaps = true + cssSupport.enabled = true + } } + binaries.executable() } - binaries.executable() } -} -val processResources by tasks.getting(Copy::class) + afterEvaluate { + rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> { + versions.webpackCli.version = "4.10.0" + } + } -dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-RC") + dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-RC") - implementation(enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:0.0.1-pre.256-kotlin-1.5.31")) - implementation("org.jetbrains.kotlin-wrappers:kotlin-styled") - implementation(npm("@fontsource/comic-mono", "^4.5.0")) - implementation(npm("prop-types", "^15.6.2")) -} - -afterEvaluate { - rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> { - versions.webpackCli.version="4.10.0" + implementation(enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:0.0.1-pre.256-kotlin-1.5.31")) + implementation("org.jetbrains.kotlin-wrappers:kotlin-styled") + // implementation(npm("prop-types", "^15.6.2")) } } - group = "moe.nea" -version = "1.0-SNAPSHOT"
\ No newline at end of file +version = "0.0.1"
\ No newline at end of file diff --git a/example/build.gradle.kts b/example/build.gradle.kts new file mode 100644 index 0000000..46f4a6d --- /dev/null +++ b/example/build.gradle.kts @@ -0,0 +1,7 @@ + +dependencies { + implementation(npm("@fontsource/comic-mono", "^4.5.0")) + implementation(rootProject) +} + + diff --git a/src/main/kotlin/moe/nea89/website/AsciiArt.kt b/example/src/main/kotlin/moe/nea89/website/test/AsciiArt.kt index 6acc8b5..30123f6 100644 --- a/src/main/kotlin/moe/nea89/website/AsciiArt.kt +++ b/example/src/main/kotlin/moe/nea89/website/test/AsciiArt.kt @@ -1,4 +1,4 @@ -package moe.nea89.website +package moe.nea89.website.test import kotlinext.js.require diff --git a/src/main/kotlin/moe/nea89/website/index.kt b/example/src/main/kotlin/moe/nea89/website/test/index.kt index e52d942..9fdb2c1 100644 --- a/src/main/kotlin/moe/nea89/website/index.kt +++ b/example/src/main/kotlin/moe/nea89/website/test/index.kt @@ -1,4 +1,4 @@ -package moe.nea89.website +package moe.nea89.website.test import kotlinext.js.require import kotlinx.browser.document @@ -8,6 +8,7 @@ import kotlinx.html.img import kotlinx.html.js.a import kotlinx.html.js.div import kotlinx.html.js.p +import moe.nea89.website.* import styled.injectGlobal import kotlin.time.Duration.Companion.milliseconds @@ -33,6 +34,7 @@ fun main() { injectGlobal(Styles.global) val root = document.body!!.append.div() val console = KConsole.createFor(root, fileSystem = defaultFileSystem) + console.addLine("Starting up terminal.") console.PS1 = ">" console.rerender() console.registerCommand(command("cwd", "pwd") { diff --git a/src/main/resources/asciiart/boob.txt b/example/src/main/resources/asciiart/boob.txt index 6ce2b11..6ce2b11 100644 --- a/src/main/resources/asciiart/boob.txt +++ b/example/src/main/resources/asciiart/boob.txt diff --git a/src/main/resources/images/me.jpeg b/example/src/main/resources/images/me.jpeg Binary files differindex 1d829fa..1d829fa 100644 --- a/src/main/resources/images/me.jpeg +++ b/example/src/main/resources/images/me.jpeg diff --git a/src/main/resources/images/moisturized.jpg b/example/src/main/resources/images/moisturized.jpg Binary files differindex 89767ea..89767ea 100644 --- a/src/main/resources/images/moisturized.jpg +++ b/example/src/main/resources/images/moisturized.jpg diff --git a/src/main/resources/index.html b/example/src/main/resources/index.html index ca5f28f..46c68c6 100644 --- a/src/main/resources/index.html +++ b/example/src/main/resources/index.html @@ -9,6 +9,6 @@ </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> -<script type="text/javascript" src="neamoe.js"></script> +<script type="text/javascript" src="example.js"></script> </body> </html>
\ No newline at end of file diff --git a/webpack.config.d/noopenbrowser.js b/example/webpack.config.d/noopenbrowser.js index 27eb2d8..27eb2d8 100644 --- a/webpack.config.d/noopenbrowser.js +++ b/example/webpack.config.d/noopenbrowser.js diff --git a/webpack.config.d/style.js b/example/webpack.config.d/style.js index 0b521a8..3bdbd3c 100644 --- a/webpack.config.d/style.js +++ b/example/webpack.config.d/style.js @@ -1,3 +1,5 @@ config.resolve.modules.push("src/main/resources/") +config.resolve.modules.push(".") config.module.rules.push({test: /\.txt$/, type: 'asset/source'}) -config.module.rules.push({test: /\.(png|jpg|jpeg|svg|gif)$/i, type: 'asset/resource'})
\ No newline at end of file +config.module.rules.push({test: /\.(png|jpg|jpeg|svg|gif)$/i, type: 'asset/resource'}) +console.log("Hahahahahah") diff --git a/settings.gradle.kts b/settings.gradle.kts index fefb772..f846eaa 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,3 @@ rootProject.name = "neamoe" +include(":example") diff --git a/src/main/kotlin/moe/nea89/website/KConsole.kt b/src/main/kotlin/moe/nea89/website/KConsole.kt index dd37223..56a6e3c 100644 --- a/src/main/kotlin/moe/nea89/website/KConsole.kt +++ b/src/main/kotlin/moe/nea89/website/KConsole.kt @@ -34,7 +34,6 @@ class KConsole( element.classList.add(Styles.consoleClass) val console = KConsole(element, text, prompt, fileSystem) document.body!!.onkeydown = console::keydown - console.addLine("Starting up terminal.") console.rerender() return console } |