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.5

Created 25 February 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.

Using the plugins DSL:

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

Using legacy plugin application:

buildscript {
  repositories {
    maven {
      url = uri("https://plugins.gradle.org/m2/")
    }
  }
  dependencies {
    classpath("io.github.scottpierce.kotlin-node-slim:kotlin-node-slim:0.0.5")
  }
}

apply(plugin = "io.github.scottpierce.kotlin-node-slim")

Using the plugins DSL:

plugins {
  id "io.github.scottpierce.kotlin-node-slim" version "0.0.5"
}

Using legacy plugin application:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "io.github.scottpierce.kotlin-node-slim:kotlin-node-slim:0.0.5"
  }
}

apply plugin: "io.github.scottpierce.kotlin-node-slim"

Learn how to apply plugins to subprojects