This is an experiment/demonstration of implementing a library in Kotlin targeting JavaScript/TypeScript.
- IntelliJ IDEA Kotlin/JS Gradle project
- A* pathfinding algorithm implemented in Kotlin
- Gradle
browserProductionWebpack
target producesastar-kotlin-js.js
library demo
Vue project usesastar-kotlin-js.js
library to visualize pathfinding
Note that the A* implementation is for demonstration purposes. I just wanted something a bit interesting to visualize. It's not optimized for production use, and might not even be correct.
- IntelliJ IDEA
- Kotlin/JS
- Gradle
- Kotlin
- Vue
- Vue-Cli
- Vuetify
- Vue Class Component
- Vue Property Decorator
- Vue Class Store
- TypeScript
- GitHub Pages
- Coffee
I learned many things along the way, which I should write down... more to follow...
Initial setup:
- In
build/js/packages/astar-kotlin-js
runyarn link
- In
demo
runyarn link astar-kotlin-js
During development:
- In
demo
runyarn serve
for hot-reloading development server - Run
browserDevelopmentWebpack
gradle task after making any kotlin code changes
Active yarn serve
process will pick up any changes.
Prefer not to make code changes with the release commit, just update version and build docs. Always start (and develop) in develop
branch. Never make changes directly to master
. Merging to master
defines a release, must be tagged, and will trigger CI/CD (just GitHub Pages hosting at this point).
git checkout develop
- Update
build.gradle
with versionX.Y.Z
- For GitHub Pages hosting:
- Run
browserProductionWebpack
gradle task - In
demo
runyarn build
- Remove old
docs
& movedemo/dist
todocs
- Remove
docs/js/*.map
sourcemaps (unneeded in repo) - In
docs
runhttp-server
to see if distribution works
- Run
git commit -am "vX.Y.Z"
git checkout master && git merge develop && git tag X.Y.Z
# nov
git push --all && git push --tags
git checkout develop
# back to work
GitHub Pages is hosting
/docs
offmaster
branch.
TODO: These steps could be more automated (especially the
docs
build).
MIT License © Nathaniel Baughman
Share and enjoy :)