Git Product home page Git Product logo

gradle-upgrade-interactive's Introduction

Gradle Upgrade Interactive

Build Status NPM

CLI to interactively upgrade Gradle dependencies, inspired by yarn.

Easily upgrade your dependencies and Gradle itself by simply selecting what you want to upgrade.

Requirements

Installation

To get the data for the outdated dependencies, the gradle-versions-plugin is required.

build.gradle

plugins {
  id "com.github.ben-manes.versions" version "0.49.0"
}

Install the CLI

npm i -g gradle-upgrade-interactive

Usage

Simply run gradle-upgrade-interactive.

Options:
  --help               Show help                                        [boolean]
  --version            Show version number                              [boolean]
  --resolution, -r     Controls the dependency resolution strategy.
                       Supported options:
                       * release: selects the latest release
                       * milestone: select the latest version being either a
                       milestone or a release (default)
                       * integration: selects the latest revision of the
                       dependency module (such as SNAPSHOT)             [string]
  --semver, -s         Which semantic version diffs to include
                       (https://semver.org). Flag can be used multiple times.
                       Supported options:
                       * major: Include upgrades with a major version change
                       * minor: Include upgrades with a minor version change
                       * patch: Include upgrades with a patch version change
                                                                         [array]
  --external-file, -e  Points to a file where dependencies have been declared,
                       e.g. gradle/dependencies.gradle. Option can be used
                       multiple times.                                   [array]
  --debug, -d          Prints debugging information, such as commands executed
                       and current status.           [boolean] [Standard: false]
  --path-to-report, -p Points to the path where the report.json is saved
                       standard is at the moment build/dependencyUpdates                   
  --no-color           Disables color output

How it works

The gradle-versions-plugin is called to generate a JSON report containing the outdated dependencies. The CLI will then prompt all outdated dependencies and the selected dependency upgrades will be written to the Gradle build file.

gradle-upgrade-interactive's People

Contributors

joergi avatar kevcodez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gradle-upgrade-interactive's Issues

Feature Request: Support Different Revision Levels

First, wow thank you so much for making this awesome program.
It works really great and is extremely helpful :)

The Gradle Versions Plugin supports selecting different revision types.

Could you add support for that as well?

PS: The gif you uploaded seems to be broken/missing. If you upload it to github as a comment in an issue/PR then you can just use that instead of hosting it elsewhere.

0.8.0: ReferenceError: exports is not defined in ES module scope

Installing the "new" 0.8.0 results in this error for me:

mduft@fril0666 /work/workspaces/deployment/deployment $ gradle-upgrade-interactive 
file:///home/mduft/.nvm/versions/node/v20.9.0/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:7
  exports.buildFiles = buildFiles;
  ^

ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/home/mduft/.nvm/versions/node/v20.9.0/lib/node_modules/gradle-upgrade-interactive/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at getBuildFiles (file:///home/mduft/.nvm/versions/node/v20.9.0/lib/node_modules/gradle-upgrade-interactive/buildFiles.js:7:3)
    at file:///home/mduft/.nvm/versions/node/v20.9.0/lib/node_modules/gradle-upgrade-interactive/index.js:37:20
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.9.0

Just to be sure, I also tried with older node.js LTS versions (18 & 16) with the same result. Downgrading to 0.7.4 brings it back to working order :)

report.json File not found

Please fix in the file index.js the line number 291:
const reportJsonPath = "${outputDir}/report.json";
the variable outputDir is not set because of " sign
The right way should be:
const reportJsonPath = ${outputDir}/report.json;

Cheers

Feature Request: support versions specified in separate file

Thanks for making something possible in Gradle that has been available for Maven for a long time :)

One possible improvement could be to provide support for versions that are defined in another file, such as gradle/dependencies.gradle.

The separate file is only part of the problem. Some like to define the dependency itself like:

ext {
    versions = [
        springBootVersion: '2.2.2.RELEASE',
    ]
    libs = [
        springBootStarterWeb: "org.springframework.boot:spring-boot-starter-web:${versions.springBootVersion}",
}

In such case the dependency would be referenced in build.gradle with something like implementation libs.springBootStarterWeb.

Quickly browsing through the code it seems that it's just reading the build file as a string and doing string replacements. Do you think it would be feasible to try to implement separate file support with the current approach?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.