Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 2, 2025
1 parent eb0f77f commit 61dd2b5
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 76 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ insert_final_newline = true
[*.yml]
indent_style = space
indent_size = 2

[package.json]
indent_style = space
indent_size = 4
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
- push
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 22
- 14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
35 changes: 0 additions & 35 deletions .github/workflows/node.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ node_modules
yarn.lock
.nyc_output
coverage
index.d.ts
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function supportsHyperlink(stream: {
isTTY?: boolean | undefined;
}): boolean;

export declare const stdout: boolean;
export declare const stderr: boolean;
1 change: 1 addition & 0 deletions license
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)
Copyright (c) James Talmage <[email protected]> (https://github.com/jamestalmage)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Expand Down
34 changes: 13 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"name": "supports-hyperlinks",
"version": "3.1.0",
"description": "Detect if your terminal emulator supports hyperlinks",
"description": "Detect whether a terminal supports hyperlinks",
"license": "MIT",
"repository": "jamestalmage/supports-hyperlinks",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "James Talmage",
"email": "[email protected]",
"url": "github.com/jamestalmage"
},
"repository": "chalk/supports-hyperlinks",
"funding": "https://github.com/chalk/supports-hyperlinks?sponsor=1",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
Expand All @@ -19,9 +14,8 @@
"node": ">=14.18"
},
"scripts": {
"prepublishOnly": "npm run create-types",
"test": "xo && nyc ava && tsc",
"create-types": "tsc --project declaration.tsconfig.json"
"//test": "xo && ava && tsc",
"test": "ava"
},
"files": [
"index.js",
Expand All @@ -33,7 +27,12 @@
"link",
"terminal",
"hyperlink",
"cli"
"cli",
"detect",
"check",
"ansi",
"escapes",
"console"
],
"dependencies": {
"has-flag": "^4.0.0",
Expand All @@ -42,16 +41,9 @@
"devDependencies": {
"@tsconfig/node14": "^1.0.3",
"@types/supports-color": "^8.1.1",
"ava": "^2.2.0",
"ava": "^3.2.0",
"codecov": "^3.5.0",
"nyc": "^15.1.0",
"typescript": "^4.9.5",
"xo": "^0.24.0"
},
"nyc": {
"reporter": [
"lcov",
"text"
]
"xo": "^0.53.0"
}
}
17 changes: 4 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# supports-hyperlinks [![Build Status](https://travis-ci.org/jamestalmage/supports-hyperlinks.svg?branch=master)](https://travis-ci.org/jamestalmage/supports-hyperlinks) [![codecov](https://codecov.io/gh/jamestalmage/supports-hyperlinks/badge.svg?branch=master)](https://codecov.io/gh/jamestalmage/supports-hyperlinks?branch=master)
# supports-hyperlinks

> Detect whether a terminal emulator supports hyperlinks
> Detect whether a terminal supports hyperlinks
Terminal emulators are [starting to support hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda). While many terminals have long detected URL's and linkified them, allowing you to Command-Click or Control-Click them to open a browser, you were forced to print the long unsightly URL's on the screen. As of spring 2017 [a few terminals](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) began supporting HTML like links, where the link text and destination could be specified separately.

This module allows you to detect if hyperlinks are supported in the current Terminal.

As this is a new development, we anticipate the list of supported Terminals to grow rapidly. Please open an issue or submit a PR as new Terminals implement support.
As this is a new development, we anticipate the list of supported terminals to grow rapidly. Please open an issue or submit a PR as new terminals implement support.

## Install

```sh
npm install supports-hyperlinks
```


## Usage

```js
const supportsHyperlinks = require('supports-hyperlinks');
import supportsHyperlinks from 'supports-hyperlinks';

if (supportsHyperlinks.stdout) {
console.log('Terminal stdout supports hyperlinks');
Expand All @@ -38,11 +37,3 @@ Returns an `Object` with a `stdout` and `stderr` property for testing either str
Obeys the `--no-hyperlinks`, `--hyperlink=always`, and `--hyperlink=never` CLI flags.

Can be overridden by the user with the flags `--hyperlinks=always` and `--no-hyperlinks`. For situations where using those flags are not possible, add the environment variable `FORCE_HYPERLINK=1` to forcefully enable hyperlinks or `FORCE_HYPERLINK=0` to forcefully disable. The use of `FORCE_HYPERLINK` overrides all other hyperlink support checks.

## Related

* [`hyperlinker`](https://github.com/jamestalmage/hyperlinker): Write hyperlinks for the Terminal.

## License

MIT © [James Talmage](https://github.com/jamestalmage)
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import m from '.';
const test = require('ava');
const m = require('./index.js');

const isSupported = ({platform, env, argv, stream}) => {
platform = platform || 'darwin';
Expand Down

0 comments on commit 61dd2b5

Please sign in to comment.