Skip to content

Commit

Permalink
Require Node.js 18
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 6, 2023
1 parent 06cce54 commit 8677c85
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 21 deletions.
2 changes: 0 additions & 2 deletions .github/funding.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 20
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
10 changes: 5 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface XbarOptions {
type XbarOptions = {
/**
The text to show. The only required property.
*/
Expand Down Expand Up @@ -103,16 +103,16 @@ interface XbarOptions {
Enable parsing of ANSI codes.
*/
readonly ansi?: boolean;
}
};

export interface Options extends XbarOptions {
export type Options = {
/**
Add a submenu to the item. A submenu is composed of an array of items.
*/
readonly submenu?: Array<string | Options | typeof separator>;
}
} & XbarOptions;

export type TopLevelOptions = Omit<Options, 'text'>; // eslint-disable-line @typescript-eslint/ban-types
export type TopLevelOptions = Omit<Options, 'text'>;

/**
Add a separator.
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export const isXbar = process.env.__CFBundleIdentifier === 'com.xbarapp.app';

const encodeHref = url => {
url = encodeURI(url);
url = url.replace(/'/g, '%27');
url = url.replace(/&/g, '%26');
url = url.replaceAll('\'', '%27');
url = url.replaceAll('&', '%26');
return url;
};

export const _create = (input, options = {}, menuLevel = 0) => {
if (typeof options.text !== 'undefined') {
if (options.text !== undefined) {
throw new TypeError('The `text` option is not supported as a top-level option. Use it on an item instead.');
}

Expand Down
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expectAssignable, expectNotAssignable, expectType} from 'tsd';
import xbar, {TopLevelOptions, separator, isDarkMode} from './index.js';
import xbar, {type TopLevelOptions, separator, isDarkMode} from './index.js';

expectType<void>(
xbar([
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sindresorhus/xbar",
"version": "2.1.1",
"description": "Simplifies xbar (previously known as BitBar) app plugin creation",
"description": "Simplifies xbar app plugin creation",
"license": "MIT",
"repository": "sindresorhus/xbar",
"funding": "https://github.com/sponsors/sindresorhus",
Expand All @@ -11,9 +11,13 @@
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsd"
Expand All @@ -32,8 +36,8 @@
"bar"
],
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.18.0",
"xo": "^0.45.0"
"ava": "^5.3.1",
"tsd": "^0.29.0",
"xo": "^0.56.0"
}
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# xbar

> Simplifies [xbar](https://github.com/matryer/xbar) (previous known as BitBar) app plugin creation
> Simplifies [xbar](https://github.com/matryer/xbar) app plugin creation
Create your plugin using a nice API instead of having to manually construct a big string.

Expand Down

0 comments on commit 8677c85

Please sign in to comment.