@firefoxic/utils 0.1.0 → 0.1.1

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.
@@ -81,7 +81,12 @@ function updateChangelogLinks (content, newVersion) {
81
81
  if (!linkMatch) throw new Error(`Invalid CHANGELOG.md: [Unreleased] link syntax is incorrect.`)
82
82
 
83
83
  const previousVersion = linkMatch[2]
84
- const newLink = `${linkMatch[1]}${newVersion}${linkMatch[3]}\n[${newVersion}]${linkMatch[1]}${previousVersion}...v${newVersion}`
84
+ const existingVersionRegex = new RegExp(`\\[${previousVersion}\\]:`)
85
+ const newVersionLinkPath = content.match(existingVersionRegex)
86
+ ? `${linkMatch[1]}${previousVersion}...v${newVersion}`
87
+ : `${linkMatch[1].replace(`compare`, `releases/tag`)}${newVersion}`
85
88
 
86
- return content.replace(linkRegex, newLink)
89
+ const newLinks = `${linkMatch[1]}${newVersion}${linkMatch[3]}\n[${newVersion}]${newVersionLinkPath}`
90
+
91
+ return content.replace(linkRegex, newLinks)
87
92
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firefoxic/utils",
3
3
  "description": "Collection of useful utilities for JavaScript and Node.js.",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Sergey Artemov",