@nx/maven 22.1.0-beta.2 → 22.1.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/migrations/0-0-8/update-pom-xml-version.d.ts +7 -0
- package/dist/migrations/0-0-8/update-pom-xml-version.d.ts.map +1 -0
- package/dist/migrations/0-0-8/update-pom-xml-version.js +11 -0
- package/dist/plugins/dependencies.d.ts.map +1 -1
- package/dist/plugins/dependencies.js +10 -2
- package/dist/utils/pom-xml-updater.d.ts +10 -0
- package/dist/utils/pom-xml-updater.d.ts.map +1 -0
- package/dist/utils/pom-xml-updater.js +45 -0
- package/dist/utils/versions.d.ts +1 -1
- package/dist/utils/versions.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Migration for @nx/maven v0.0.8
|
|
4
|
+
* Updates the Maven plugin version from 0.0.7 to 0.0.8 in user pom.xml files
|
|
5
|
+
*/
|
|
6
|
+
export default function update(tree: Tree): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=update-pom-xml-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-pom-xml-version.d.ts","sourceRoot":"","sources":["../../../src/migrations/0-0-8/update-pom-xml-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC;;;GAGG;AACH,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,iBAE9C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const pom_xml_updater_1 = require("../../utils/pom-xml-updater");
|
|
5
|
+
/**
|
|
6
|
+
* Migration for @nx/maven v0.0.8
|
|
7
|
+
* Updates the Maven plugin version from 0.0.7 to 0.0.8 in user pom.xml files
|
|
8
|
+
*/
|
|
9
|
+
async function update(tree) {
|
|
10
|
+
(0, pom_xml_updater_1.updateNxMavenPluginVersion)(tree, '0.0.8');
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/plugins/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/plugins/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,YAAY,CAAC;AASnE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBA2DhC,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.createDependencies = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const maven_data_cache_1 = require("./maven-data-cache");
|
|
6
6
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
7
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
8
|
const types_1 = require("./types");
|
|
8
9
|
const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
9
10
|
const path_1 = require("path");
|
|
@@ -36,7 +37,14 @@ const createDependencies = async (options, context) => {
|
|
|
36
37
|
return [];
|
|
37
38
|
}
|
|
38
39
|
devkit_1.logger.verbose('[Maven Dependencies] Found Maven data with', mavenData.createDependenciesResults.length, 'dependencies');
|
|
39
|
-
//
|
|
40
|
-
|
|
40
|
+
// Create a mapping from project root to project name
|
|
41
|
+
const rootToProjectMap = (0, internal_1.createProjectRootMappingsFromProjectConfigurations)(context.projects);
|
|
42
|
+
// Extract and transform dependencies from the mavenData
|
|
43
|
+
const transformedDependencies = mavenData.createDependenciesResults.map((dep) => ({
|
|
44
|
+
...dep,
|
|
45
|
+
source: rootToProjectMap.get(dep.source),
|
|
46
|
+
target: rootToProjectMap.get(dep.target),
|
|
47
|
+
}));
|
|
48
|
+
return transformedDependencies;
|
|
41
49
|
};
|
|
42
50
|
exports.createDependencies = createDependencies;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Updates the version of dev.nx.maven:nx-maven-plugin in pom.xml files.
|
|
4
|
+
* Only updates the version element that belongs to the nx-maven-plugin.
|
|
5
|
+
*
|
|
6
|
+
* @param tree - Nx Tree instance
|
|
7
|
+
* @param version - The new version to set
|
|
8
|
+
*/
|
|
9
|
+
export declare function updateNxMavenPluginVersion(tree: Tree, version: string): void;
|
|
10
|
+
//# sourceMappingURL=pom-xml-updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pom-xml-updater.d.ts","sourceRoot":"","sources":["../../src/utils/pom-xml-updater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CA2C5E"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateNxMavenPluginVersion = updateNxMavenPluginVersion;
|
|
4
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
5
|
+
/**
|
|
6
|
+
* Updates the version of dev.nx.maven:nx-maven-plugin in pom.xml files.
|
|
7
|
+
* Only updates the version element that belongs to the nx-maven-plugin.
|
|
8
|
+
*
|
|
9
|
+
* @param tree - Nx Tree instance
|
|
10
|
+
* @param version - The new version to set
|
|
11
|
+
*/
|
|
12
|
+
function updateNxMavenPluginVersion(tree, version) {
|
|
13
|
+
const pomPath = 'pom.xml';
|
|
14
|
+
if (!tree.exists(pomPath)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const content = tree.read(pomPath, 'utf-8');
|
|
18
|
+
const parser = new xmldom_1.DOMParser();
|
|
19
|
+
const doc = parser.parseFromString(content);
|
|
20
|
+
let hasChanges = false;
|
|
21
|
+
// Find all plugin elements in the document
|
|
22
|
+
const plugins = Array.from(doc.getElementsByTagName('plugin'));
|
|
23
|
+
for (const plugin of plugins) {
|
|
24
|
+
// Check if this is the nx-maven-plugin by looking for groupId and artifactId
|
|
25
|
+
const groupId = plugin.getElementsByTagName('groupId')[0];
|
|
26
|
+
const artifactId = plugin.getElementsByTagName('artifactId')[0];
|
|
27
|
+
const isNxMavenPlugin = groupId?.textContent?.trim() === 'dev.nx.maven' &&
|
|
28
|
+
artifactId?.textContent?.trim() === 'nx-maven-plugin';
|
|
29
|
+
// If this is the nx-maven-plugin, update its version
|
|
30
|
+
if (isNxMavenPlugin) {
|
|
31
|
+
const versionElement = plugin.getElementsByTagName('version')[0];
|
|
32
|
+
const currentVersion = versionElement?.textContent?.trim();
|
|
33
|
+
if (currentVersion && currentVersion !== version) {
|
|
34
|
+
versionElement.textContent = version;
|
|
35
|
+
hasChanges = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// If content changed, write it back using XML serializer to preserve formatting
|
|
40
|
+
if (hasChanges) {
|
|
41
|
+
const serializer = new xmldom_1.XMLSerializer();
|
|
42
|
+
const updatedContent = serializer.serializeToString(doc);
|
|
43
|
+
tree.write(pomPath, updatedContent);
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/utils/versions.d.ts
CHANGED
package/dist/utils/versions.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/maven",
|
|
3
|
-
"version": "22.1.0-beta.
|
|
3
|
+
"version": "22.1.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nx plugin for Maven integration",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "Victor Savkin",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@nx/devkit": "22.1.0-beta.
|
|
48
|
+
"@nx/devkit": "22.1.0-beta.4",
|
|
49
49
|
"@xmldom/xmldom": "^0.8.10",
|
|
50
50
|
"tslib": "^2.3.0"
|
|
51
51
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@types/xmldom": "^0.1.34",
|
|
56
56
|
"jest": "^30.0.2",
|
|
57
57
|
"memfs": "^4.9.2",
|
|
58
|
-
"nx": "22.1.0-beta.
|
|
58
|
+
"nx": "22.1.0-beta.4",
|
|
59
59
|
"ts-jest": "^29.4.0",
|
|
60
60
|
"typescript": "~5.9.2"
|
|
61
61
|
},
|