This Gradle plugin provides a task to check NPM package version for your Kotlin Multiplatform project.
Kotlin
plugins {
id("com.cmgapps.npm.versions") version "0.3.0"
}
Groovy
plugins {
id 'com.cmgapps.npm.versions' version '0.3.0'
}
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'
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.
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)
}
}
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]
Copyright (c) 2024. Christian Grach <christian.grach@cmgapps.com>
SPDX-License-Identifier: Apache-2.0