Skip to content

Gradle plugin for checking your Kotlin/JS NPM package versions.

License

Notifications You must be signed in to change notification settings

chrimaeon/gradle-npm-versions

Repository files navigation

Gradle Licenses Plugin Build & Test

License Gradle Plugin gradlePluginPortal

This Gradle plugin provides a task to check NPM package version for your Kotlin Multiplatform project.

Usage

Integration

Using the plugins DSL

Kotlin
plugins {
    id("com.cmgapps.npm.versions") version "0.3.0"
}
Groovy
plugins {
    id 'com.cmgapps.npm.versions' version '0.3.0'
}

Using legacy plugin application

Kotlin
buildscript {
    repositories {
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
    dependencies {
        classpath("com.cmgapps.gradle:gradle-npm-versions-plugin:0.3.0")
    }
}

apply(plugin = "com.cmgapps.npm.versions")
Groovy
buildscript {
    repositories {
        maven {
            url 'https://plugins.gradle.org/m2/'
        }
    }
    dependencies {
        classpath 'com.cmgapps.gradle:gradle-npm-versions-plugin:0.3.0'
    }
}

apply plugin: 'com.cmgapps.npm.versions'

Task

Applying the plugin will create tasks to check for NPM Package Version

  • npmVersions

This will check the NPM Registry for the latest version available for your npm dependencies.

Configuration

With the npmVersions extension you can enable the file reporters and output file location. There are 4 reporters:

  • Plain Text: Same format as the console output
  • JSON: A JSON of the package versions
  • HTML: An HTML website
  • XML: An XML of the packages.
npmVersions {
    plainText {
        enabled.set(true)
        outputFile.set(project.layout.buildDirectory.file("npmVersions.txt"))
    }
    json {
        enabled.set(true)
    }
    html {
        enabled.set(true)
    }
    xml {
        enabled.set(true)
    }
}

Output

The console output will look like this:

┌──────────────┐
│ NPM Packages │
└──────────────┘

The following packages are using the latest version:
 · bootstrap:5.3.3

The following packages have updated versions:
 · kotlin [1.0 -> 1.9.23]

License

Copyright (c) 2024. Christian Grach <christian.grach@cmgapps.com>

SPDX-License-Identifier: Apache-2.0