varabyte / kobweb-cli

The CLI binary that drives the interactive Kobweb experience. See varabyte/kobweb
Apache License 2.0
10 stars 5 forks source link

refactor: migrate to clikt-core module to reduce bundle size #17

Open EchoEllet opened 3 months ago

EchoEllet commented 3 months ago

Migrate from clikt (Mordant) to clikt-core module (has no dependencies) to reduce bundle size

Recently CliKt, which is a Kotlin Multiplatform command line interface parser and formatted, introduced Mordant as a dependency in Mordant 4.X which has dependencies that increase the size around 8-10 MB (See CliKt Issue #507 for more details).

CliKt was originally a command line parser similar to Kotlinx CLI and Kotlin Args Parser, though with each major release, it introduced new features and capabilities, Kobweb CLI use CliKt as a dependency for parsing the commands and formatting the output.

Kobweb CLI uses Kotter primarily as a CLI dependency which has its own dependencies.

Recently in CliKt 5.X (which hasn't been released yet and is available as 4.4.0.20-SNAPSHOT) introduced a new module called clikt-core in CliKt PR #516 that has no dependencies.

Notice that:

The size has been reduced from 23.1 MB to 12.5 MB, saving approximately 46% (around 10.6 MB).

A few things to keep in mind:

The latest version of CliKt that has the clikt-core require at least Kotlin 2.0.0.

EchoEllet commented 3 months ago

This PR is ready for review, though not yet ready for merge.