Code Monkey home page Code Monkey logo

Comments (2)

EmmanueleVilla avatar EmmanueleVilla commented on August 11, 2024 1

I've managed to add the js target with these dependencies:

[...]
js()
[...]
sourceSets["jsMain"].dependencies {
        implementation(Deps.Ktor.js) //"io.ktor:ktor-client-js:${Versions.ktor}"
        implementation(Deps.Ktor.jsCore) //"io.ktor:ktor-client-core-js:${Versions.ktor}"
        implementation(Deps.Ktor.jsJson) //"io.ktor:ktor-client-json-js:${Versions.ktor}"
        implementation(Deps.Ktor.jsLogging) //"io.ktor:ktor-client-logging-js:${Versions.ktor}"
        implementation(Deps.Ktor.jsSerialization) //"io.ktor:ktor-client-serialization-js:${Versions.ktor}"
        implementation(Deps.Coroutines.js) //"org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Versions.coroutines}"
        implementation(Deps.koinCoreJS) //"org.koin:koin-core-js:${Versions.koin}"
    }

There's not a version of sqldelight for js, so I worked around it:,

//stubbing sql driver since it's not yet present in js
    val sqlDriver = object : SqlDriver {
        override fun close() {
        }

        override fun currentTransaction(): Transacter.Transaction? = null

        override fun execute(
            identifier: Int?,
            sql: String,
            parameters: Int,
            binders: (SqlPreparedStatement.() -> Unit)?
        ) {}

        override fun executeQuery(
            identifier: Int?,
            sql: String,
            parameters: Int,
            binders: (SqlPreparedStatement.() -> Unit)?
        ): SqlCursor = object : SqlCursor {
            override fun close() {}

            override fun getBytes(index: Int): ByteArray? = null

            override fun getDouble(index: Int): Double? = null

            override fun getLong(index: Int): Long? = null

            override fun getString(index: Int): String? = null

            override fun next(): Boolean = false
        }

        override fun newTransaction(): Transacter.Transaction = object : Transacter.Transaction() {
            override val enclosingTransaction: Transacter.Transaction?
                get() = null

            override fun endTransaction(successful: Boolean) {
            }
        }

    }

I've already modified the whole template because I want to use redux-kotlin as the architecture, but I could make a pull request where I add js + tests to this template with a react companion project if you are interested, let me know!
Meanwhile I'll test everything in my project

from kampkit.

samhill303 avatar samhill303 commented on August 11, 2024

Hi, Thanks for checking out KaMPKit. As you found, we want to keep it focused on Mobile development and intentionally don't include other targets. Heads up, SQLDelight does have an in memory js driver cashapp/sqldelight#1486 .
But it's not currently published so you need to build it:
cashapp/sqldelight#1667

from kampkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.