Skip to content

Commit 2010d20

Browse files
authored
support updating multiple versions per line (#190)
1 parent a33d12e commit 2010d20

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

__snapshots__/generic.ts.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
exports['Generic updateContent can update multiple occurances of a versions per line 1'] = `
2+
# Anthropic Java API Library
3+
4+
> [!NOTE]
5+
> The Anthropic Java API Library is currently in _alpha_.
6+
>
7+
> There may be frequent breaking changes.
8+
>
9+
> Have thoughts or feedback? [File an issue](https://github.com/anthropics/anthropic-sdk-java/issues/new) or comment on [this thread](https://github.com/anthropics/anthropic-sdk-java/issues/30).
10+
11+
<!-- x-release-please-start-version -->
12+
13+
[![Maven Central](https://img.shields.io/maven-central/v/com.anthropic/anthropic-java)](https://central.sonatype.com/artifact/com.anthropic/anthropic-java/0.1.0-alpha.9)
14+
[![javadoc](https://javadoc.io/badge2/com.anthropic/anthropic-java/0.1.0-alpha.9/javadoc.svg)](https://javadoc.io/doc/com.anthropic/anthropic-java/0.1.0-alpha.9)
15+
16+
<!-- x-release-please-end -->
17+
18+
The Anthropic Java SDK provides convenient access to the Anthropic REST API from applications written in Java. It includes helper classes with helpful types and documentation for every request and response property.
19+
`
20+
121
exports['Generic updateContent updates generic version markers 1'] = `
222
/*
323
* Copyright 2021 Google LLC

src/updaters/generic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Version} from '../version';
1717
import {logger as defaultLogger, Logger} from '../util/logger';
1818

1919
const VERSION_REGEX =
20-
/(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<preRelease>[\w.]+))?(\+(?<build>[-\w.]+))?/;
20+
/(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<preRelease>[\w.]+))?(\+(?<build>[-\w.]+))?/g;
2121
const SINGLE_VERSION_REGEX = /\b\d+\b/;
2222
const INLINE_UPDATE_REGEX =
2323
/x-release-please-(?<scope>major|minor|patch|version)/;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Anthropic Java API Library
2+
3+
> [!NOTE]
4+
> The Anthropic Java API Library is currently in _alpha_.
5+
>
6+
> There may be frequent breaking changes.
7+
>
8+
> Have thoughts or feedback? [File an issue](https://github.com/anthropics/anthropic-sdk-java/issues/new) or comment on [this thread](https://github.com/anthropics/anthropic-sdk-java/issues/30).
9+
10+
<!-- x-release-please-start-version -->
11+
12+
[![Maven Central](https://img.shields.io/maven-central/v/com.anthropic/anthropic-java)](https://central.sonatype.com/artifact/com.anthropic/anthropic-java/0.1.0-alpha.8)
13+
[![javadoc](https://javadoc.io/badge2/com.anthropic/anthropic-java/0.1.0-alpha.8/javadoc.svg)](https://javadoc.io/doc/com.anthropic/anthropic-java/0.0.1-alpha.8)
14+
15+
<!-- x-release-please-end -->
16+
17+
The Anthropic Java SDK provides convenient access to the Anthropic REST API from applications written in Java. It includes helper classes with helpful types and documentation for every request and response property.

test/updaters/generic.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,18 @@ describe('Generic', () => {
3636
const newContent = pom.updateContent(oldContent);
3737
snapshot(newContent);
3838
});
39+
it('can update multiple occurances of a versions per line', async () => {
40+
const oldContent = readFileSync(
41+
resolve(fixturesPath, './README-java-multiple-versions-per-lint.md'),
42+
'utf8'
43+
).replace(/\r\n/g, '\n');
44+
const versions = new Map<string, Version>();
45+
const updater = new Generic({
46+
versionsMap: versions,
47+
version: Version.parse('0.1.0-alpha.9'),
48+
});
49+
const newContent = updater.updateContent(oldContent);
50+
snapshot(newContent);
51+
});
3952
});
4053
});

0 commit comments

Comments
 (0)