Skip to content

Commit d0346c4

Browse files
committed
fix: rm terminalLink.isSupported checks
They're not needed - the terminal-link package checks this internally and formats the URL using parentheses and zero-width spaces. As it is the logic is dropping the URL in terminals like VSCode's/Cursor's.
1 parent 04dc206 commit d0346c4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

source/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const _npRootDirectory = fileURLToPath(new URL('..', import.meta.url));
3434
export const {package_: npPackage, rootDirectory: npRootDirectory} = await readPackage(_npRootDirectory);
3535

3636
export const linkifyIssues = (url, message) => {
37-
if (!(url && terminalLink.isSupported)) {
37+
if (!url) {
3838
return message;
3939
}
4040

@@ -50,15 +50,15 @@ export const linkifyIssues = (url, message) => {
5050
};
5151

5252
export const linkifyCommit = (url, commit) => {
53-
if (!(url && terminalLink.isSupported)) {
53+
if (!url) {
5454
return commit;
5555
}
5656

5757
return terminalLink(commit, `${url}/commit/${commit}`);
5858
};
5959

6060
export const linkifyCommitRange = (url, commitRange) => {
61-
if (!(url && terminalLink.isSupported)) {
61+
if (!url) {
6262
return commitRange;
6363
}
6464

test/util/hyperlinks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test('linkifyIssues returns raw message if terminalLink is not supported', verif
3636
linksSupported: false,
3737
}, ({t, util: {linkifyIssues}}) => {
3838
const message = 'Commit message - fixes #6';
39-
t.is(linkifyIssues(MOCK_REPO_URL, message), message);
39+
t.is(linkifyIssues(MOCK_REPO_URL, message), `${message} (\u200B${MOCK_REPO_URL}/issues/6\u200B)`);
4040
});
4141

4242
test('linkifyCommit correctly links commits', verifyLinks, {
@@ -54,7 +54,7 @@ test('linkifyCommit returns raw commit hash if url is not provided', verifyLinks
5454
test('linkifyCommit returns raw commit hash if terminalLink is not supported', verifyLinks, {
5555
linksSupported: false,
5656
}, ({t, util: {linkifyCommit}}) => {
57-
t.is(linkifyCommit(MOCK_REPO_URL, MOCK_COMMIT_HASH), MOCK_COMMIT_HASH);
57+
t.is(linkifyCommit(MOCK_REPO_URL, MOCK_COMMIT_HASH), `${MOCK_COMMIT_HASH} (\u200B${MOCK_REPO_URL}/commit/${MOCK_COMMIT_HASH}\u200B)`);
5858
});
5959

6060
test('linkifyCommitRange returns raw commitRange if url is not provided', verifyLinks, {
@@ -66,7 +66,7 @@ test('linkifyCommitRange returns raw commitRange if url is not provided', verify
6666
test('linkifyCommitRange returns raw commitRange if terminalLink is not supported', verifyLinks, {
6767
linksSupported: false,
6868
}, ({t, util: {linkifyCommitRange}}) => {
69-
t.is(linkifyCommitRange(MOCK_REPO_URL, MOCK_COMMIT_RANGE), MOCK_COMMIT_RANGE);
69+
t.is(linkifyCommitRange(MOCK_REPO_URL, MOCK_COMMIT_RANGE), `${MOCK_COMMIT_RANGE} (\u200B${MOCK_REPO_URL}/compare/${MOCK_COMMIT_RANGE}\u200B)`);
7070
});
7171

7272
test('linkifyCommitRange correctly links commit range', verifyLinks, {

0 commit comments

Comments
 (0)