🔧 Replace Vite/Vitest with TypeScript 7 and node --test

- Use tsc 7 for build (vite no longer needed for a Node library)
- Use node --test with --experimental-strip-types for tests (vitest dropped)
- Use c8 for coverage instead of vitest's built-in coverage
- Add tsconfig.build.json separating typecheck from emit config
- Drop DOM lib, add strict noUncheckedIndexedAccess/noImplicitOverride
- Pin engines.node to >=22.6 (required for --experimental-strip-types)
- Update CI to Node 24 LTS (unflagged strip-types)
- Add @types/node for node:test / node:assert types
This commit is contained in:
tmu committed 2026-09-03 09:54:21 +00:00
1 parent cac1349c95
commit 3530262261
7 files changed
+3635 -7421

No files matched your search

+3 -9
View File
@@ -5,7 +5,7 @@ on:
branches: [main] branches: [main]
pull_request: pull_request:
branches: [main] branches: [main]
workflow_dispatch: workflow_dispatch: {}
jobs: jobs:
build: build:
@@ -14,18 +14,12 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 24
cache: "npm" cache: "npm"
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run check - run: npm run check
- run: npm run test:ci - run: npm run test:ci
- run: npm run check:outdated
- run: npm run check:cspell
- run: npm run check:tsc
- run: npm run check:eslint
- run: npm run check:prettier
- run: npm run check:package
- name: Upload coverage - name: Upload coverage
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@@ -40,7 +34,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 24
registry-url: "https://registry.npmjs.org/" registry-url: "https://registry.npmjs.org/"
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
+3583 -7351
View File
File diff suppressed because it is too large. Load diff
+28 -28
View File
@@ -1,6 +1,5 @@
{ {
"name": "tiny-pattern-ts", "name": "tiny-pattern-ts",
"private": true,
"version": "0.0.0", "version": "0.0.0",
"description": "Pattern matching for TypeScript/ESM environments (F#-style, not regex)", "description": "Pattern matching for TypeScript/ESM environments (F#-style, not regex)",
"keywords": [ "keywords": [
@@ -14,57 +13,58 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,
"engines": {
"node": ">=22.6"
},
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"files": [ "files": [
"dist" "dist",
"README.md",
"LICENSE"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/tmueller/tiny-pattern-ts.git" "url": "https://github.com/tmueller/tiny-pattern-ts.git"
}, },
"scripts": { "scripts": {
"dev": "vite", "build": "tsc -p tsconfig.build.json",
"build": "vite build && tsc --emitDeclarationOnly", "clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
"clean": "rimraf dist", "test": "npm run check:tsc && node --test --experimental-strip-types --no-warnings src/",
"clean:build": "rimraf dist", "test:unit": "node --test --experimental-strip-types --no-warnings src/",
"test": "npm run check:tsc && npm run test:unit", "test:ci": "c8 --reporter=text --reporter=lcov --reporter=html node --test --experimental-strip-types --no-warnings src/",
"test:unit": "vitest run", "check": "npm run check:oxlint && npm run check:oxfmt && npm run check:tsc && npm run check:cspell && npm run check:package && npm run check:outdated",
"test:ci": "vitest run --coverage --reporter=dot --reporter=lcov --run", "check:oxlint": "oxlint src",
"check": "npm run check:eslint && npm run check:prettier && npm run check:cspell && npm run check:tsc && npm run check:package && npm run check:outdated", "check:oxfmt": "oxfmt --check src",
"check:eslint": "eslint . --ext .ts,.tsx,.js,.jsx",
"check:prettier": "prettier --check .",
"check:cspell": "cspell .",
"check:tsc": "tsc --noEmit", "check:tsc": "tsc --noEmit",
"check:cspell": "cspell .",
"check:package": "sort-package-json --check", "check:package": "sort-package-json --check",
"check:outdated": "check-outdated", "check:outdated": "check-outdated",
"fix": "npm run fix:eslint && npm run fix:prettier && npm run fix:package", "fix:oxlint": "oxlint --fix src",
"fix:eslint": "eslint . --ext .ts,.tsx,.js,.jsx --fix", "fix:oxfmt": "oxfmt src",
"fix:prettier": "prettier --write .",
"fix:package": "sort-package-json --write", "fix:package": "sort-package-json --write",
"use:git-commit-message": "cp commit-message-template .git/COMMIT_EDITMSG || true" "use:git-commit-message": "cp commit-message-template .git/COMMIT_EDITMSG || true"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.31.1", "@types/node": "^22.10.0",
"@typescript-eslint/parser": "^8.31.1", "c8": "^10.1.3",
"changesets": "^1.0.2",
"check-outdated": "^2.13.0", "check-outdated": "^2.13.0",
"cspell": "^8.19.3", "cspell": "^8.19.3",
"eslint": "^9.25.1",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"lefthook": "^1.11.12", "lefthook": "^1.11.12",
"prettier": "^3.5.3", "oxfmt": "^0.66.0",
"oxlint": "^1.81.0",
"sort-package-json": "^3.1.0", "sort-package-json": "^3.1.0",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"type-fest": "^4.40.1", "type-fest": "^4.40.1",
"typescript": "~5.7.2", "typescript": "^7.0.2"
"vite": "^6.3.1",
"vitest": "^2.1.9"
} }
} }
-1
View File
@@ -1 +0,0 @@
/// <reference types="vite/client" />
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"rootDir": "src",
"outDir": "dist"
},
"exclude": ["src/**/*.test.ts", "src/**/__tests__/**"]
}
+12 -21
View File
@@ -1,20 +1,11 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "es2024",
"useDefineForClassFields": true, "module": "nodenext",
"module": "ESNext", "moduleResolution": "nodenext",
"lib": [
"ES2022",
"DOM"
],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "Node",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": false, "lib": ["es2024"],
/* Linting */ "skipLibCheck": true,
"strict": true, "strict": true,
"noImplicitAny": true, "noImplicitAny": true,
"noImplicitThis": true, "noImplicitThis": true,
@@ -25,22 +16,22 @@
"strictPropertyInitialization": true, "strictPropertyInitialization": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noUncheckedSideEffectImports": true, "isolatedModules": true,
"verbatimModuleSyntax": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true,
"outDir": "dist", "outDir": "dist",
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"composite": false, "composite": false,
"types": [ "types": ["node"]
"vitest"
]
}, },
"include": [ "include": ["src"]
"src"
]
} }
-11
View File
@@ -1,11 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
coverage: {
reporter: ["text", "html", "lcov"],
include: ["src/**/*.ts"],
exclude: ["src/**/*.test.ts", "test/**"],
},
},
});