Socket
Socket
Sign inDemoInstall

commit-and-tag-version

Package Overview
Dependencies
244
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 12.1.0 to 12.2.0

lib/updaters/types/maven.js

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [12.2.0](https://github.com/absolute-version/commit-and-tag-version/compare/v12.1.0...v12.2.0) (2024-01-15)
### Features
* **updater:** add maven pom.xml file support ([#33](https://github.com/absolute-version/commit-and-tag-version/issues/33), [#109](https://github.com/absolute-version/commit-and-tag-version/issues/109)) ([#123](https://github.com/absolute-version/commit-and-tag-version/issues/123)) ([6466beb](https://github.com/absolute-version/commit-and-tag-version/commit/6466bebf849bbdcdaebf493a1ccce9670c469fde))
## [12.1.0](https://github.com/absolute-version/commit-and-tag-version/compare/v12.0.0...v12.1.0) (2024-01-06)

@@ -7,0 +14,0 @@

4

lib/updaters/index.js

@@ -6,2 +6,3 @@ const path = require('path');

'plain-text': require('./types/plain-text'),
maven: require('./types/maven'),
gradle: require('./types/gradle'),

@@ -27,2 +28,5 @@ csproj: require('./types/csproj'),

}
if (/pom.xml/.test(filename)) {
return getUpdaterByType('maven');
}
if (/build.gradle/.test(filename)) {

@@ -29,0 +33,0 @@ return getUpdaterByType('gradle');

4

package.json
{
"name": "commit-and-tag-version",
"version": "12.1.0",
"version": "12.2.0",
"description": "replacement for `npm version` with automatic CHANGELOG generation",

@@ -52,3 +52,5 @@ "bin": "bin/cli.js",

"git-semver-tags": "^5.0.0",
"jsdom": "^23.2.0",
"semver": "^7.5.4",
"w3c-xmlserializer": "^5.0.0",
"yargs": "^17.7.2"

@@ -55,0 +57,0 @@ },

@@ -9,3 +9,2 @@ # Commit and Tag Version

A utility for versioning using [semver](https://semver.org/) and CHANGELOG generation powered by [Conventional Commits](https://conventionalcommits.org).

@@ -24,2 +23,3 @@

- [`bumpFiles`, `packageFiles` and `updaters`](#bumpfiles-packagefiles-and-updaters)
- [Maven Support (Java/Kotlin)](#maven-support-javakotlin)
- [Gradle Support (Java/Kotlin)](#gradle-support-javakotlin)

@@ -60,3 +60,3 @@ - [.NET Support](#net-support)

### How It Works:
### How It Works

@@ -89,2 +89,10 @@ 1. Follow the [Conventional Commits Specification](https://conventionalcommits.org) in your repository.

### Maven Support (Java/Kotlin)
If you are using Maven, then just point to your `pom.xml` file.
```sh
commit-and-tag-version --packageFiles pom.xml --bumpFiles pom.xml
```
### Gradle Support (Java/Kotlin)

@@ -102,2 +110,3 @@

This is going to read and update only the `<Version>` tag in the file.
```sh

@@ -156,3 +165,3 @@ commit-and-tag-version --packageFiles <YOUR-PROJECT-NAME>.csproj --bumpFiles <YOUR-PROJECT-NAME>.csproj

> Note for users who have migrated to
> Note for users who have migrated to
`commit-and-tag-version` from `standard-version`: the previous package.json configuration key of `standard-version` will still work.

@@ -321,3 +330,3 @@

As an example to change from using GitHub to track your items to using your projects Jira use a
`postchangelog` script to replace the url fragment containing 'https://github.com/`myproject`/issues/'
`postchangelog` script to replace the url fragment containing '<https://github.com/`myproject`/issues/>'
with a link to your Jira - assuming you have already installed [replace](https://www.npmjs.com/package/replace)

@@ -324,0 +333,0 @@

@@ -1183,2 +1183,70 @@ 'use strict';

it('bumps version in Maven `pom.xml` file with CRLF Line Endings', async function () {
const expected = fs.readFileSync(
'./test/mocks/pom-6.4.0-crlf.xml',
'utf-8',
);
const filename = 'pom.xml';
mock({
bump: 'minor',
realTestFiles: [
{
filename,
path: './test/mocks/pom-6.3.1-crlf.xml',
},
],
});
await exec({
packageFiles: [{ filename, type: 'maven' }],
bumpFiles: [{ filename, type: 'maven' }],
});
// filePath is the first arg passed to writeFileSync
const packageJsonWriteFileSynchCall = findWriteFileCallForPath({
writeFileSyncSpy,
filename,
});
if (!packageJsonWriteFileSynchCall) {
throw new Error(`writeFileSynch not invoked with path ${filename}`);
}
const calledWithContentStr = packageJsonWriteFileSynchCall[1];
expect(calledWithContentStr).toEqual(expected);
});
it('bumps version in Maven `pom.xml` file with LF Line Endings', async function () {
const expected = fs.readFileSync(
'./test/mocks/pom-6.4.0-lf.xml',
'utf-8',
);
const filename = 'pom.xml';
mock({
bump: 'minor',
realTestFiles: [
{
filename,
path: './test/mocks/pom-6.3.1-lf.xml',
},
],
});
await exec({
packageFiles: [{ filename, type: 'maven' }],
bumpFiles: [{ filename, type: 'maven' }],
});
// filePath is the first arg passed to writeFileSync
const packageJsonWriteFileSynchCall = findWriteFileCallForPath({
writeFileSyncSpy,
filename,
});
if (!packageJsonWriteFileSynchCall) {
throw new Error(`writeFileSynch not invoked with path ${filename}`);
}
const calledWithContentStr = packageJsonWriteFileSynchCall[1];
expect(calledWithContentStr).toEqual(expected);
});
it('bumps version in Gradle `build.gradle.kts` file', async function () {

@@ -1190,2 +1258,3 @@ const expected = fs.readFileSync(

const filename = 'build.gradle.kts';
mock({

@@ -1195,3 +1264,3 @@ bump: 'minor',

{
filename: 'build.gradle.kts',
filename,
path: './test/mocks/build-6.3.1.gradle.kts',

@@ -1203,8 +1272,7 @@ },

await exec({
packageFiles: [{ filename: 'build.gradle.kts', type: 'gradle' }],
bumpFiles: [{ filename: 'build.gradle.kts', type: 'gradle' }],
packageFiles: [{ filename, type: 'gradle' }],
bumpFiles: [{ filename, type: 'gradle' }],
});
// filePath is the first arg passed to writeFileSync
const filename = 'build.gradle.kts';
const packageJsonWriteFileSynchCall = findWriteFileCallForPath({

@@ -1211,0 +1279,0 @@ writeFileSyncSpy,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc