Skip to content

Commit 91b264e

Browse files
committed
Require Node.js 20
1 parent f245b8c commit 91b264e

File tree

6 files changed

+18
-27
lines changed

6 files changed

+18
-27
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 22
13+
- 24
1414
- 20
15-
- 18
1615
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
16+
- uses: actions/checkout@v5
17+
- uses: actions/setup-node@v5
1918
with:
2019
node-version: ${{ matrix.node-version }}
2120
- run: npm install

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function calculateWidthHeight(imageWidth, imageHeight, inputWidth, inputHeight,
7171
}
7272

7373
async function render(buffer, {width: inputWidth, height: inputHeight, preserveAspectRatio}) {
74-
const image = await Jimp.fromBuffer(Buffer.from(buffer));
74+
const image = await Jimp.fromBuffer(Buffer.from(buffer)); // eslint-disable-line n/prefer-global/buffer
7575
const {bitmap} = image;
7676

7777
const {width, height} = calculateWidthHeight(bitmap.width, bitmap.height, inputWidth, inputHeight, preserveAspectRatio);
@@ -156,11 +156,11 @@ async function renderKitty(buffer, {width: inputWidth, height: inputHeight, pres
156156
rows = Math.floor(terminalRows * percentage);
157157
} else if (typeof inputHeight === 'number') {
158158
rows = Math.min(inputHeight, terminalRows);
159-
} else if (!preserveAspectRatio) {
160-
// Only set full height if not preserving aspect ratio
159+
} else if (preserveAspectRatio) {
160+
// If preserveAspectRatio and no height specified, set max height
161161
rows = terminalRows;
162162
} else {
163-
// If preserveAspectRatio and no height specified, set max height
163+
// Only set full height if not preserving aspect ratio
164164
rows = terminalRows;
165165
}
166166

@@ -172,7 +172,7 @@ async function renderKitty(buffer, {width: inputWidth, height: inputHeight, pres
172172

173173
if (!isPng) {
174174
// Convert to PNG if needed
175-
const image = await Jimp.fromBuffer(Buffer.from(buffer));
175+
const image = await Jimp.fromBuffer(Buffer.from(buffer)); // eslint-disable-line n/prefer-global/buffer
176176
imageBuffer = await image.getBuffer('image/png');
177177
}
178178

@@ -187,7 +187,7 @@ async function renderKitty(buffer, {width: inputWidth, height: inputHeight, pres
187187
// Terminal cells are approximately 2:1 (height:width)
188188
const cellAspectRatio = 0.5;
189189
const terminalAspectRatio = (columns * cellAspectRatio) / rows;
190-
190+
191191
if (imageAspectRatio > terminalAspectRatio) {
192192
// Image is wider than terminal space - constrain by width
193193
drawImageWithKitty(imageBuffer, columns, undefined);

index.test-d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
},
1818
"sideEffects": false,
1919
"engines": {
20-
"node": ">=18"
20+
"node": ">=20"
2121
},
2222
"scripts": {
23-
"test": "xo && ava && tsd"
23+
"test": "xo && ava"
2424
},
2525
"files": [
2626
"index.js",
@@ -50,17 +50,16 @@
5050
"sequence"
5151
],
5252
"dependencies": {
53-
"chalk": "^5.4.1",
54-
"image-dimensions": "^2.3.0",
53+
"chalk": "^5.6.2",
54+
"image-dimensions": "^2.5.0",
5555
"jimp": "^1.6.0",
5656
"log-update": "^6.1.0",
5757
"render-gif": "^2.0.4",
5858
"term-img": "^7.0.0"
5959
},
6060
"devDependencies": {
61-
"@types/node": "^22.10.5",
62-
"ava": "^6.2.0",
63-
"tsd": "^0.31.2",
64-
"xo": "^0.60.0"
61+
"@types/node": "^24.3.1",
62+
"ava": "^6.4.1",
63+
"xo": "^1.2.2"
6564
}
6665
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Custom handler which is run when the animation playback is stopped.
120120

121121
This can be set to perform a cleanup when playback has finished.
122122

123-
### Terminal Protocol Support
123+
## Terminal Protocol Support
124124

125125
It automatically detects and uses the best available protocol:
126126

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'node:fs';
2-
import delay from 'delay';
2+
import {setTimeout as delay} from 'node:timers/promises';
33
import test from 'ava';
44
import terminalImage from './index.js';
55

0 commit comments

Comments
 (0)