UNPKG

@nx/gradle

Version:

The Nx Plugin for Gradle allows Gradle tasks to be run through Nx

27 lines (26 loc) 932 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = update; const devkit_1 = require("@nx/devkit"); const has_gradle_plugin_1 = require("../../utils/has-gradle-plugin"); /* This function changes the plugin to v1 * Replace @nx/gradle with @nx/gradle/plugin-v1 */ function update(tree) { const nxJson = (0, devkit_1.readNxJson)(tree); if (!nxJson) { return; } if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) { return; } let gradlePluginIndex = nxJson.plugins.findIndex((p) => typeof p === 'string' ? p === '@nx/gradle' : p.plugin === '@nx/gradle'); let gradlePlugin = nxJson.plugins[gradlePluginIndex]; if (typeof gradlePlugin === 'string') { nxJson.plugins[gradlePluginIndex] = '@nx/gradle/plugin-v1'; } else { gradlePlugin.plugin = '@nx/gradle/plugin-v1'; } (0, devkit_1.updateNxJson)(tree, nxJson); }