From 1bae0b4c68238ac26ad2d22529e7ccf80e32c145 Mon Sep 17 00:00:00 2001 From: fraxken Date: Thu, 25 Dec 2025 22:26:33 +0100 Subject: [PATCH 1/2] refactor: migrate to Node.js type striping --- package.json | 9 ++++----- src/class/Completion.class.ts | 2 +- src/class/InputBuffer.class.ts | 4 ++-- src/class/KeyListener.class.ts | 6 +++--- src/index.ts | 2 +- src/utils/index.ts | 4 ++-- test/KeyListener.class.test.ts | 2 +- test/utils.test.ts | 2 +- tsconfig.json | 2 +- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index d7a8bb7..488d114 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "build": "tsc", "prepublishOnly": "npm run build && pkg-ok", - "test": "tsx --test test/**/*.test.ts", + "test": "node --test test/**/*.test.ts", "coverage": "c8 -r html npm test", "lint": "eslint src test" }, @@ -42,13 +42,12 @@ "fastest-levenshtein": "^1.0.16" }, "devDependencies": { - "@openally/config.eslint": "^2.1.0", - "@openally/config.typescript": "^1.0.3", + "@openally/config.eslint": "^2.2.0", + "@openally/config.typescript": "^1.2.1", "@types/node": "^25.0.2", "c8": "^10.1.3", "pkg-ok": "^3.0.0", - "tsx": "^4.19.4", - "typescript": "^5.8.3" + "typescript": "^5.9.3" }, "engines": { "node": ">=22" diff --git a/src/class/Completion.class.ts b/src/class/Completion.class.ts index 01d9fea..896ccdd 100644 --- a/src/class/Completion.class.ts +++ b/src/class/Completion.class.ts @@ -6,7 +6,7 @@ import { stripVTControlCharacters } from "node:util"; import { localMatchOf, stringLength -} from "../utils/index.js"; +} from "../utils/index.ts"; export interface FindHintOptions { /** diff --git a/src/class/InputBuffer.class.ts b/src/class/InputBuffer.class.ts index 9b4fa6b..3534145 100644 --- a/src/class/InputBuffer.class.ts +++ b/src/class/InputBuffer.class.ts @@ -2,8 +2,8 @@ import * as TTY from "node:tty"; // Import Internal Dependencies -import { Cursor } from "./Cursor.class.js"; -import { stringLength } from "../utils/index.js"; +import { Cursor } from "./Cursor.class.ts"; +import { stringLength } from "../utils/index.ts"; export interface ReplaceOptions { clearOutput?: boolean; diff --git a/src/class/KeyListener.class.ts b/src/class/KeyListener.class.ts index 32f642b..13ed07a 100644 --- a/src/class/KeyListener.class.ts +++ b/src/class/KeyListener.class.ts @@ -2,9 +2,9 @@ import * as TTY from "node:tty"; // Import Internal Dependencies -import { History } from "./History.class.js"; -import { Completion } from "./Completion.class.js"; -import { InputBuffer } from "./InputBuffer.class.js"; +import { History } from "./History.class.ts"; +import { Completion } from "./Completion.class.ts"; +import { InputBuffer } from "./InputBuffer.class.ts"; type Key = { sequence?: string; diff --git a/src/index.ts b/src/index.ts index d35efda..fb6e0fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import { emitKeypressEvents } from "node:readline"; import { KeyListener, type KeyListenerOptions -} from "./class/KeyListener.class.js"; +} from "./class/KeyListener.class.ts"; export type StdinOptions = KeyListenerOptions; diff --git a/src/utils/index.ts b/src/utils/index.ts index d673312..b62be0c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,2 +1,2 @@ -export * from "./localMatchOf.js"; -export * from "./stringLength.js"; +export * from "./localMatchOf.ts"; +export * from "./stringLength.ts"; diff --git a/test/KeyListener.class.test.ts b/test/KeyListener.class.test.ts index f8aa8d8..518f072 100644 --- a/test/KeyListener.class.test.ts +++ b/test/KeyListener.class.test.ts @@ -4,7 +4,7 @@ import assert from "node:assert"; import * as TTY from "node:tty"; // Import Internal Dependencies -import { KeyListener } from "../src/class/KeyListener.class.js"; +import { KeyListener } from "../src/class/KeyListener.class.ts"; type MockTTYWriteStream = { write: ReturnType; diff --git a/test/utils.test.ts b/test/utils.test.ts index d1516c7..f3b38c8 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -7,7 +7,7 @@ import assert from "node:assert"; import { localMatchOf, stringLength -} from "../src/utils/index.js"; +} from "../src/utils/index.ts"; describe("localMatchOf", () => { const arr = ["hello world", "hello everyone", "foo bar", "baz qux", "hello", "foobar"]; diff --git a/tsconfig.json b/tsconfig.json index 0dd9788..134c2ae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@openally/config.typescript", + "extends": "@openally/config.typescript/esm-ts-next", "compilerOptions": { "outDir": "dist", "rootDir": "./src", From ef1a71fe120e999c406ed77f611a8e90009b4ef2 Mon Sep 17 00:00:00 2001 From: fraxken Date: Thu, 25 Dec 2025 22:27:55 +0100 Subject: [PATCH 2/2] chore: enhance NPM default security --- .github/dependabot.yml | 4 ++++ .github/workflows/node.js.yml | 4 ++-- .npmrc | 2 ++ package.json | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d4abe09..8b7deb1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,8 @@ updates: directory: / schedule: interval: monthly + cooldown: + default-days: 5 groups: github-actions: patterns: @@ -14,6 +16,8 @@ updates: versioning-strategy: widen schedule: interval: weekly + cooldown: + default-days: 5 groups: dependencies: dependency-type: "production" diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1b13254..8427ce3 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,7 +16,7 @@ jobs: runs-on: ${{matrix.os}} strategy: matrix: - node-version: [22.x] + node-version: [24.x] os: [ubuntu-latest, windows-latest, macos-latest] fail-fast: false steps: @@ -30,6 +30,6 @@ jobs: with: node-version: ${{ matrix.node-version }} - name: Install dependencies - run: npm i + run: npm install --ignore-scripts - name: Run tests run: npm run test diff --git a/.npmrc b/.npmrc index 43c97e7..304fb65 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,3 @@ package-lock=false +ignore-scripts=true +save-exact=true diff --git a/package.json b/package.json index 488d114..2f684a4 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ }, "homepage": "https://github.com/TopCli/stdin#readme", "dependencies": { - "fastest-levenshtein": "^1.0.16" + "fastest-levenshtein": "1.0.16" }, "devDependencies": { "@openally/config.eslint": "^2.2.0",