Skip to content

Commit 406a10f

Browse files
authored
Merge pull request #11 from fingerprintjs/feat/default-heading
Adds a default heading to the generated release notes
2 parents 56ab0c0 + 6a276a4 commit 406a10f

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ Add the plugin to your `.releaserc` configuration:
4949

5050
### Plugin Configuration Reference
5151

52-
| Key | Type | Default | Description |
53-
|------------------------------------|----------|-----------|------------------------------------------------------------------------------|
54-
| `heading` | `string` | | Optional h3 heading shown before listing platform specific version ranges. |
55-
| `platforms` | `object` | | Top-level object defining configuration for each platform. |
56-
| `platforms.iOS` | `object` | | Configuration for the iOS dependency version resolution. |
57-
| `platforms.iOS.podSpecJsonPath` | `string` | | Path to the PODSPEC json file containing iOS dependency metadata. |
58-
| `platforms.iOS.dependencyName` | `string` | | Name of the dependency to extract the version. |
59-
| `platforms.iOS.displayName` | `string` | `iOS` | Name for the iOS dependency shown in release notes. |
60-
| `platforms.android` | `object` | | Configuration for the Android dependency version resolution. |
61-
| `platforms.android.path` | `string` | | Relative path to the Android project directory which contains `build.gradle. |
62-
| `platforms.android.gradleTaskName` | `string` | | Name of the custom Gradle task that outputs the dependency version. |
63-
| `platforms.android.displayName` | `string` | `android` | Name for the Android dependency shown in release notes. |
52+
| Key | Type | Default | Description |
53+
|------------------------------------|----------|-----------------------|------------------------------------------------------------------------------|
54+
| `heading` | `string` | `Native Dependencies` | Optional h3 heading shown before listing platform specific version ranges. |
55+
| `platforms` | `object` | | Top-level object defining configuration for each platform. |
56+
| `platforms.iOS` | `object` | | Configuration for the iOS dependency version resolution. |
57+
| `platforms.iOS.podSpecJsonPath` | `string` | | Path to the PODSPEC json file containing iOS dependency metadata. |
58+
| `platforms.iOS.dependencyName` | `string` | | Name of the dependency to extract the version. |
59+
| `platforms.iOS.displayName` | `string` | `iOS` | Name for the iOS dependency shown in release notes. |
60+
| `platforms.android` | `object` | | Configuration for the Android dependency version resolution. |
61+
| `platforms.android.path` | `string` | | Relative path to the Android project directory which contains `build.gradle. |
62+
| `platforms.android.gradleTaskName` | `string` | | Name of the custom Gradle task that outputs the dependency version. |
63+
| `platforms.android.displayName` | `string` | `android` | Name for the Android dependency shown in release notes. |
6464

6565
> **Note:** You can configure one or both platforms depending on your project needs. At least one platform
6666
> (`iOS` or `android`) must be configured. The plugin will throw an error if both are omitted.

src/generateNotes.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { resolve as androidResolve } from './platforms/android'
44
import { resolve as iOSResolve } from './platforms/iOS'
55

66
const formatter = (platforms: { displayName: string; versionRange: string }[], heading?: string) => {
7-
let result = ''
8-
9-
if (heading) {
10-
result += `### ${heading}\n\n`
11-
}
7+
let result = `### ${heading ?? 'Native Dependencies'}\n\n`
128

139
result += platforms
1410
.map(({ displayName, versionRange }) => {

test/index.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const generateNotesContext = {
2727

2828
describe('index', () => {
2929
describe('generateNotes', () => {
30+
const defaultHeading = '### Native Dependencies'
31+
3032
it('is a function', () => {
3133
expect(generateNotes).toBeInstanceOf(Function)
3234
})
@@ -42,7 +44,7 @@ describe('index', () => {
4244
},
4345
generateNotesContext
4446
)
45-
).resolves.toBe(`* ${android.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
47+
).resolves.toBe(`${defaultHeading}\n\n* ${android.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
4648
}, 30000)
4749
it('resolves android version (backport)', async () => {
4850
const android = pluginConfig.platforms.android
@@ -54,7 +56,7 @@ describe('index', () => {
5456
},
5557
generateNotesContext
5658
)
57-
).resolves.toBe(`* ${android.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
59+
).resolves.toBe(`${defaultHeading}\n\n* ${android.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
5860
}, 30000)
5961
it('resolves iOS version', async () => {
6062
const iOS = pluginConfig.platforms.iOS
@@ -68,7 +70,7 @@ describe('index', () => {
6870
},
6971
generateNotesContext
7072
)
71-
).resolves.toBe(`* ${iOS.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
73+
).resolves.toBe(`${defaultHeading}\n\n* ${iOS.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
7274
})
7375
it('resolves iOS version (backport)', async () => {
7476
const iOS = pluginConfig.platforms.iOS
@@ -80,7 +82,7 @@ describe('index', () => {
8082
},
8183
generateNotesContext
8284
)
83-
).resolves.toBe(`* ${iOS.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
85+
).resolves.toBe(`${defaultHeading}\n\n* ${iOS.displayName} Version Range: **\`>= 1.2.3 and < 4.5.6\`**`)
8486
})
8587
it('throws error on cwd not set', async () => {
8688
const testGenerateNotesContext = {

0 commit comments

Comments
 (0)