Search Gradle plugins

io.github.scottpierce.kotlin-node-slim

Creates a slim nodejs project of only the dependencies used by a Kotlin Node JS Gradle module so that only the used dependencies can be packaged. This helps to greatly reduce the released file size, especially in projects with multiple javascript projects.

https://github.com/ScottPierce/kotlin-node-slim

Sources: https://github.com/ScottPierce/kotlin-node-slim

Version 0.0.9 (latest)

Created 11 July 2023.

When releasing a module in Kotlin JS, all dependencies from all other js projects are included in the node_modules directory. This adds significant bloat when trying to package a Kotlin nodejs application in a docker container, or ship it as a standalone application. This plugin iterates over the dependencies of the module recursively, collects all referenced npm dependencies, and then generates a small npm project.

Add this plugin to your build using the plugins DSL:

plugins {
  id("io.github.scottpierce.kotlin-node-slim") version "0.0.9"
}

See also:

  • Adding the plugin to build logic for usage in precompiled script plugins.

    See the relevant documentation for more information.

    Add this plugin as a dependency to <convention-plugins-build>/build.gradle(.kts):

    dependencies {
      implementation("io.github.scottpierce.kotlin-node-slim:io.github.scottpierce.kotlin-node-slim.gradle.plugin:0.0.9")
    }
    It can then be applied in the precompiled script plugin:
    plugins {
      id("io.github.scottpierce.kotlin-node-slim")
    }
  • The legacy method of plugin application. See the relevant documentation for more information.
    buildscript {
      repositories {
        gradlePluginPortal()
      }
      dependencies {
        classpath("io.github.scottpierce.kotlin-node-slim:io.github.scottpierce.kotlin-node-slim.gradle.plugin:0.0.9")
      }
    }
    
    apply(plugin = "io.github.scottpierce.kotlin-node-slim")
  • Applying plugins to all subprojects .