Skip to content

Commit

Permalink
#Release JVM 4.2.2 and JS 5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vsirotin committed Jul 1, 2024
1 parent 588a7bd commit e13c139
Show file tree
Hide file tree
Showing 11 changed files with 396 additions and 225 deletions.
37 changes: 20 additions & 17 deletions RELEASING.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions apps/jvm/java-console/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ group = "eu.sirotin.kotunil.app.java"
version = project.extra["kotunil-jvm-stable-version"]!!

repositories {
//mavenCentral()
mavenLocal()
mavenCentral()
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion apps/jvm/kotlin-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ On success the application will show in the console the text:

**Test successfully completed!**

and number of tested objects and executed tests.
Compare number in lines of printed table.

## How to properly write KotUniL's formulas
KotUniL is a multiplatform library.
Expand Down
3 changes: 1 addition & 2 deletions apps/jvm/kotlin-console/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ group = "eu.sirotin.kotunil.app.kotlin"
version = project.extra["kotunil-jvm-stable-version"]!!

repositories {
//mavenCentral()
mavenLocal()
mavenCentral()
}

dependencies {
Expand Down
27 changes: 27 additions & 0 deletions apps/node_ts_app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# KotUniL - Kotlin Console Demo Application


This demo demonstrate the use of **KotUniL** library in a Node.JS console application developed with TypeScript
and tests all available in library objects and functions.

**KotUniL** covers all units of **International System of Units** (SI)
like meter, second etc. [(see Wikipedia)](https://en.wikipedia.org/wiki/International_System_of_Units)
as well as SI- Prefixes (micro, nano etc.) and some other common units like currencies, percentages etc.

You can learn about functions and objects of **KotUniL** library in central [.../si-units/README.md](https://github.com/vsirotin/si-units/blob/8a4c1406be962031dd32724470fd15367c230e5d/README.md).
You can learn examples of using the library in Kotlin-Console in [.../si-units/apps/jvm/kotlin-console/src/main/kotlin/eu/sirotin/kotunil/app/kotlin/TutorialTest.kt](https://github.com/vsirotin/si-units/blob/8a4c1406be962031dd32724470fd15367c230e5d/apps/jvm/kotlin-console/src/main/kotlin/eu/sirotin/kotunil/app/kotlin/TutorialTest.kt).

## How to start console application
You can start the test with a commnad:
```bash
./gradlew :apps:node_ts_app:startConsole
```

On success the application will show a list of test and table with expected and real data.
Compare number in lines of printed table.

## How to properly write KotUniL's formulas
KotUniL is a multiplatform library.
You can read about how to properly write physics and other formulas
using the objects and functions of the KotUniL library in document
["Rules for writing KotUniL formulas in different programming languages"](https://github.com/vsirotin/si-units/blob/c3f1b87c2fa4b35adc64b676318e27eae3e246e5/RulesWritingFormulas.md).
55 changes: 37 additions & 18 deletions apps/node_ts_app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ tasks.register<com.github.gradle.node.task.NodeTask>("startConsole"){
dependsOn("build")
}

tasks.register<com.github.gradle.node.task.NodeTask>("startWeb"){
script.set(file("dist/index.js"))
args.addAll("run", "dev")
dependsOn("build")
logger.quiet("to complete watching enter Ctrl + C")
}

tasks.register<com.github.gradle.node.npm.task.NpmTask>("installAllProduction"){
args.addAll("install", "express", "mongoose", "cors", "mongodb", "dotenv", "nodemon")
Expand All @@ -27,22 +21,14 @@ tasks.register<com.github.gradle.node.npm.task.NpmTask>("installAllDevelopment")
dependsOn("installAllProduction")
}

tasks.register<com.github.gradle.node.npm.task.NpmTask>("installTypeScript"){
args.addAll("install", "typescript", "--save-dev")
}

tasks.register("compileTypeScript") {
doLast {
exec {
executable("tsc")
}
logger.quiet("Please see result of compilation in 'dist' directory")
}
tasks.register<com.github.gradle.node.npm.task.NpmTask>("install"){
args.addAll("install")
dependsOn("installAllDevelopment")
}

tasks.register<com.github.gradle.node.npm.task.NpmTask>("build"){
args.addAll("run", "build")
dependsOn("installAllDevelopment")
dependsOn("install")
}

fun File.deleteDirContent(){
Expand All @@ -59,6 +45,39 @@ tasks.register<Delete>("clean") {
}


// Replace a value for key in configuration file
fun replaceValueForKey(filePath: String, key: String, newValue: String) {
val file = File(filePath)
if (!file.exists()) {
println("File $filePath does not exist")
return
}
val lines = file.readLines()

val updatedLines = lines.map { line ->
if (line.contains(key)) {
val posDP = line.indexOf(":")
val prefix = line.substring(0, posDP + 1)
"$prefix ${newValue},"
} else {
line
}
}
file.writeText(updatedLines.joinToString(System.lineSeparator()))
}

tasks.register("switchToMPNCentral") {
doLast {
val kotunilJvmStableVersion = project.rootProject.extra["kotunil-js-version"] as String
replaceValueForKey("apps/node_ts_app/package.json", "kotunil-js-lib", "\"${kotunilJvmStableVersion}\"")
}
}

tasks.register("switchNodeTestToLocalJsLibrary") {
doLast {
replaceValueForKey("apps/node_ts_app/package.json", "kotunil-js-lib", "\"file:../../js-lib/dist\"")
}
}



Expand Down
Loading

0 comments on commit e13c139

Please sign in to comment.