keep-a-changelog
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -1,3 +0,1 @@ | ||
<!-- deno-fmt-ignore-file --> | ||
# Changelog | ||
@@ -9,7 +7,19 @@ All notable changes to this project will be documented in this file. | ||
## [3.4.1] - 2023-10-10 | ||
## [2.5.0] - 2023-11-07 | ||
### Added | ||
- Automatic detection of github and gitlab urls and build the links accordingly [#35] | ||
- New option --head to set the HEAD name [#37] | ||
### Changed | ||
- Deprecated function `compareLinkBuilder`, use `tagLinkBuilder` instead | ||
### Fixed | ||
- Trailing slash of the remote url is now removed [#36] | ||
- Updated dependencies | ||
## [2.4.1] - 2023-10-10 | ||
### Fixed | ||
- Breaking changes after updating `semver` package | ||
## [3.4.0] - 2023-10-10 | ||
## [2.4.0] - 2023-10-10 | ||
### Added | ||
@@ -69,5 +79,9 @@ - New function `compareLinkBuilder` [#33]. | ||
[#33]: https://github.com/oscarotero/keep-a-changelog/issues/33 | ||
[#35]: https://github.com/oscarotero/keep-a-changelog/issues/35 | ||
[#36]: https://github.com/oscarotero/keep-a-changelog/issues/36 | ||
[#37]: https://github.com/oscarotero/keep-a-changelog/issues/37 | ||
[3.4.1]: https://github.com/oscarotero/keep-a-changelog/compare/v3.4.0...v3.4.1 | ||
[3.4.0]: https://github.com/oscarotero/keep-a-changelog/compare/v2.3.0...v3.4.0 | ||
[2.5.0]: https://github.com/oscarotero/keep-a-changelog/compare/v2.4.1...v2.5.0 | ||
[2.4.1]: https://github.com/oscarotero/keep-a-changelog/compare/v2.4.0...v2.4.1 | ||
[2.4.0]: https://github.com/oscarotero/keep-a-changelog/compare/v2.3.0...v2.4.0 | ||
[2.3.0]: https://github.com/oscarotero/keep-a-changelog/compare/v2.2.1...v2.3.0 | ||
@@ -74,0 +88,0 @@ [2.2.1]: https://github.com/oscarotero/keep-a-changelog/compare/v2.2.0...v2.2.1 |
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
import { parse as parseIni } from "./deps/deno.land/x/ini@v2.1.0/mod.js"; | ||
import getSettingsForURL from "./src/settings.js"; | ||
const argv = parseFlag(dntShim.Deno.args, { | ||
@@ -18,4 +19,5 @@ default: { | ||
quiet: false, | ||
head: null, | ||
}, | ||
string: ["file", "format", "url"], | ||
string: ["file", "format", "url", "head"], | ||
boolean: ["https", "init", "latest-release", "quiet"], | ||
@@ -65,17 +67,2 @@ }); | ||
} | ||
if (!changelog.url) { | ||
if (argv.url) { | ||
changelog.url = argv.url; | ||
} | ||
else { | ||
const url = getRemoteUrl(argv.https); | ||
if (url) { | ||
changelog.url = url; | ||
} | ||
else { | ||
console.error(red('Please, set the repository url with --url="https://github.com/username/repository"')); | ||
dntShim.Deno.exit(1); | ||
} | ||
} | ||
} | ||
save(file, changelog); | ||
@@ -90,6 +77,17 @@ } | ||
function save(file, changelog, isNew = false) { | ||
const url = changelog.url; | ||
if (url && url.includes("gitlab.com")) { | ||
changelog.head = "master"; | ||
changelog.url = argv.url || changelog.url || getRemoteUrl(argv.https); | ||
if (!changelog.url) { | ||
console.error(red('Please, set the repository url with --url="https://github.com/username/repository"')); | ||
changelog.url = "https://example.com"; | ||
} | ||
if (changelog.url) { | ||
const settings = getSettingsForURL(changelog.url); | ||
if (settings) { | ||
changelog.head = settings.head; | ||
changelog.tagLinkBuilder = settings.tagLink; | ||
} | ||
} | ||
if (argv.head) { | ||
changelog.head = argv.head; | ||
} | ||
dntShim.Deno.writeTextFileSync(file, changelog.toString()); | ||
@@ -122,3 +120,4 @@ if (isNew) { | ||
} | ||
return remoteUrl.href; | ||
// remove trailing slashes | ||
return remoteUrl.href.replace(/\/+$/, ""); | ||
} | ||
@@ -125,0 +124,0 @@ catch (err) { |
@@ -12,3 +12,5 @@ import Release from "./Release.js"; | ||
tagNameBuilder?: (release: Release) => string; | ||
/** @deprecated: Use tagLinkBuilder() instead */ | ||
compareLinkBuilder?: (previous: Release, release: Release) => string; | ||
tagLinkBuilder?: (url: string, tag: string, previous?: string) => string; | ||
format: "compact" | "markdownlint"; | ||
@@ -15,0 +17,0 @@ constructor(title: string, description?: string); |
@@ -52,2 +52,3 @@ import { eq, parse } from "./deps.js"; | ||
}); | ||
/** @deprecated: Use tagLinkBuilder() instead */ | ||
Object.defineProperty(this, "compareLinkBuilder", { | ||
@@ -59,2 +60,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(this, "tagLinkBuilder", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "format", { | ||
@@ -91,2 +98,12 @@ enumerable: true, | ||
} | ||
if (this.tagLinkBuilder) { | ||
const url = this.url; | ||
if (!previous) { | ||
return this.tagLinkBuilder(this.url, this.tagName(release)); | ||
} | ||
if (!release.date || !release.version) { | ||
return this.tagLinkBuilder(url, this.head, this.tagName(previous)); | ||
} | ||
return this.tagLinkBuilder(url, this.tagName(release), this.tagName(previous)); | ||
} | ||
if (!previous) { | ||
@@ -93,0 +110,0 @@ return `${this.url}/releases/tag/${this.tagName(release)}`; |
@@ -1,2 +0,2 @@ | ||
export { compare, eq, format, parse, } from "../deps/deno.land/std@0.203.0/semver/mod.js"; | ||
export type { SemVer } from "../deps/deno.land/std@0.203.0/semver/mod.js"; | ||
export { compare, eq, format, parse, } from "../deps/deno.land/std@0.205.0/semver/mod.js"; | ||
export type { SemVer } from "../deps/deno.land/std@0.205.0/semver/mod.js"; |
@@ -1,1 +0,1 @@ | ||
export { compare, eq, format, parse, } from "../deps/deno.land/std@0.203.0/semver/mod.js"; | ||
export { compare, eq, format, parse, } from "../deps/deno.land/std@0.205.0/semver/mod.js"; |
@@ -8,3 +8,3 @@ { | ||
"name": "keep-a-changelog", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "Node package to parse and generate changelogs following the [keepachangelog](https://keepachangelog.com/) format.", | ||
@@ -11,0 +11,0 @@ "homepage": "https://github.com/oscarotero/keep-a-changelog#readme", |
@@ -142,3 +142,3 @@ # Changelog | ||
```sh | ||
deno install --allow-read --allow-write --name changelog https://deno.land/x/changelog/bin.ts | ||
deno install --allow-read --allow-write -fr --name changelog https://deno.land/x/changelog/bin.ts | ||
``` | ||
@@ -186,3 +186,3 @@ | ||
changelog --latest-release | ||
> 0.3.1 | ||
> 2.0.0 | ||
``` | ||
@@ -203,1 +203,2 @@ | ||
| `--quiet` | Do not output error messages | | ||
| `--head` | Customize the `head` reference | |
@@ -26,2 +26,5 @@ #!/usr/bin/env node | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -34,2 +37,3 @@ require("./_dnt.polyfills.js"); | ||
const mod_js_4 = require("./deps/deno.land/x/ini@v2.1.0/mod.js"); | ||
const settings_js_1 = __importDefault(require("./src/settings.js")); | ||
const argv = (0, mod_js_3.parse)(dntShim.Deno.args, { | ||
@@ -44,4 +48,5 @@ default: { | ||
quiet: false, | ||
head: null, | ||
}, | ||
string: ["file", "format", "url"], | ||
string: ["file", "format", "url", "head"], | ||
boolean: ["https", "init", "latest-release", "quiet"], | ||
@@ -91,17 +96,2 @@ }); | ||
} | ||
if (!changelog.url) { | ||
if (argv.url) { | ||
changelog.url = argv.url; | ||
} | ||
else { | ||
const url = getRemoteUrl(argv.https); | ||
if (url) { | ||
changelog.url = url; | ||
} | ||
else { | ||
console.error(red('Please, set the repository url with --url="https://github.com/username/repository"')); | ||
dntShim.Deno.exit(1); | ||
} | ||
} | ||
} | ||
save(file, changelog); | ||
@@ -116,6 +106,17 @@ } | ||
function save(file, changelog, isNew = false) { | ||
const url = changelog.url; | ||
if (url && url.includes("gitlab.com")) { | ||
changelog.head = "master"; | ||
changelog.url = argv.url || changelog.url || getRemoteUrl(argv.https); | ||
if (!changelog.url) { | ||
console.error(red('Please, set the repository url with --url="https://github.com/username/repository"')); | ||
changelog.url = "https://example.com"; | ||
} | ||
if (changelog.url) { | ||
const settings = (0, settings_js_1.default)(changelog.url); | ||
if (settings) { | ||
changelog.head = settings.head; | ||
changelog.tagLinkBuilder = settings.tagLink; | ||
} | ||
} | ||
if (argv.head) { | ||
changelog.head = argv.head; | ||
} | ||
dntShim.Deno.writeTextFileSync(file, changelog.toString()); | ||
@@ -148,3 +149,4 @@ if (isNew) { | ||
} | ||
return remoteUrl.href; | ||
// remove trailing slashes | ||
return remoteUrl.href.replace(/\/+$/, ""); | ||
} | ||
@@ -151,0 +153,0 @@ catch (err) { |
@@ -12,3 +12,5 @@ import Release from "./Release.js"; | ||
tagNameBuilder?: (release: Release) => string; | ||
/** @deprecated: Use tagLinkBuilder() instead */ | ||
compareLinkBuilder?: (previous: Release, release: Release) => string; | ||
tagLinkBuilder?: (url: string, tag: string, previous?: string) => string; | ||
format: "compact" | "markdownlint"; | ||
@@ -15,0 +17,0 @@ constructor(title: string, description?: string); |
@@ -54,2 +54,3 @@ "use strict"; | ||
}); | ||
/** @deprecated: Use tagLinkBuilder() instead */ | ||
Object.defineProperty(this, "compareLinkBuilder", { | ||
@@ -61,2 +62,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(this, "tagLinkBuilder", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, "format", { | ||
@@ -93,2 +100,12 @@ enumerable: true, | ||
} | ||
if (this.tagLinkBuilder) { | ||
const url = this.url; | ||
if (!previous) { | ||
return this.tagLinkBuilder(this.url, this.tagName(release)); | ||
} | ||
if (!release.date || !release.version) { | ||
return this.tagLinkBuilder(url, this.head, this.tagName(previous)); | ||
} | ||
return this.tagLinkBuilder(url, this.tagName(release), this.tagName(previous)); | ||
} | ||
if (!previous) { | ||
@@ -95,0 +112,0 @@ return `${this.url}/releases/tag/${this.tagName(release)}`; |
@@ -1,2 +0,2 @@ | ||
export { compare, eq, format, parse, } from "../deps/deno.land/std@0.203.0/semver/mod.js"; | ||
export type { SemVer } from "../deps/deno.land/std@0.203.0/semver/mod.js"; | ||
export { compare, eq, format, parse, } from "../deps/deno.land/std@0.205.0/semver/mod.js"; | ||
export type { SemVer } from "../deps/deno.land/std@0.205.0/semver/mod.js"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parse = exports.format = exports.eq = exports.compare = void 0; | ||
var mod_js_1 = require("../deps/deno.land/std@0.203.0/semver/mod.js"); | ||
var mod_js_1 = require("../deps/deno.land/std@0.205.0/semver/mod.js"); | ||
Object.defineProperty(exports, "compare", { enumerable: true, get: function () { return mod_js_1.compare; } }); | ||
@@ -6,0 +6,0 @@ Object.defineProperty(exports, "eq", { enumerable: true, get: function () { return mod_js_1.eq; } }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
573735
276
14208
202