GithubHelp home page GithubHelp logo

andfaulkner / kotlin-multiplatform-example-with-typescript Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 101 KB

Kotlin 1.2.* multi-platform example & experiments. Includes typescript, nodemon, etc.

License: MIT License

Kotlin 90.07% TypeScript 9.93%
multiplatform kotlin-js kotlin-android kotlin-examples kotlin-library node-kotlin kotlin-multiplatform kotlin-common kotlin-demo kotlin-features

kotlin-multiplatform-example-with-typescript's Introduction

kotlin-multiplatform-example-with-typescript

Kotlin 1.2.* multi-platform experiments

Locations

Source code

  • Shared/multiplatform code
    • ./src
  • JS-specific code
    • ./src-js
  • Java-specific code
    • ./src-jvm
  • Typescript code (consumes the JS-specific code's output)
    • ./ts

Build outputs

  • Final Kotlin build output
    • ./build
  • Final JS module build output (importable as module)
    • ./src-js/build
  • Final Java module build output - importable as module (NOTE: confirm this)
    • ./src-jvm/build/libs/src-jvm.jar
  • Final TS module build output (runnable)
    • ./build-js/src-js/build/js/index.js

Installation

Install modules:

yarn

Perform your initial build:

npm run start

Build and run

To build start->end then immediately run the module:

npm run start

...OR:

npm run buildrun-full

To just perform the Kotlin build:

./gradlew build

...OR:

npm run build-kotlin

To perform only the Typescript build:

npm run build-typescript

To run the (fully built) JS code:

npm run run-js

To watch the kotlin-js, kotlin-shared, & typescript dirs, and rebuild on code change:

npm run watch-buildrun-full

How it works

  ==================================================
 // Multiplatform library/module written in Kotlin \\
||===================================================================
|| [./src]                                          [./src-js]     ||
|| Common code ------------shared with------------> Kotlin-JS code ||
||                                                                 ||
|| [./src-jvm]                                      [./src]        ||
|| Kotlin-Java code --implements requirements of--> Common code    ||
||                                                                 ||
|| [./src-js]                                       [./src]        ||
|| Kotlin-JS code ---implements requirements- of--> Common code    ||
=====================================================================
             /\                                  /\
             ||                                  ||
     [consumes/imports]                  [consumes/imports]
             ||                                  ||
        =============             ================================
        || [./ts]  ||             || [./java] (not implemented) ||
        || TS code ||             || Runnable Java code         ||
        =============             ================================ [1]
             ||                                  ||
       [transpiles to]                           \/
             ||                            Displays output
             \/
  =========================
  || [./src-js/build/js] ||
  || Runnable JS code    ||
  =========================
             ||
             \/
       Displays output 

 -------------JS-------------    ---------------Java---------------

[1] Different code from the Kotlin-Java code mentioned in the multiplatform
    library/module block at the top of the diagram

Links

Much thanks to this tutorial for getting this started

kotlin-multiplatform-example-with-typescript's People

Contributors

andfaulkner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

krishnamurtyp

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.