Skip to content

Commit

Permalink
build: update node versions, switch to building with eslint (#544)
Browse files Browse the repository at this point in the history
* bump node version support

* switch to esbuild building

* add esbuild-jest
  • Loading branch information
philihp authored Jul 5, 2024
1 parent 33d6561 commit e8ef0db
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 36 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ jobs:
fail-fast: false
matrix:
node-version:
- 17.x # deprecated
- 18.x # maintainence ends 2025-04-30
- 19.x # deprecated
- 20.x # maintainence ends 2026-04-30
- 21.x # maintainence ends 2024-06-01
- 22.x # maintainence ends 2027-04-30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -34,7 +32,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 22.x
- run: npm install
- run: npm run build --if-present
- run: npm run test:coverage
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.15.0
22.3.0
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default () => ({
modulePathIgnorePatterns: ["dist/"],
transform: {
"^.+\\.tsx?$": [
"esbuild-jest",
{
sourcemap: true
}
]
}
})
6 changes: 6 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
"src/**/*.{ts,tsx,js,jsx,json}": [
"prettier --write",
"eslint --fix",
]
}
31 changes: 13 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"type": "module",
"main": "./dist/index.js",
"scripts": {
"build": "tsc -p tsconfig.build.json",
"build": "tsup",
"lint": "eslint .",
"prepare": "husky install && npm run build",
"prepare": "husky && npm run build",
"test": "jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch"
Expand All @@ -26,24 +26,23 @@
"sort"
],
"devDependencies": {
"@babel/cli": "7.24.7",
"@babel/core": "7.24.7",
"@babel/preset-env": "7.24.7",
"@philihp/prettier-config": "1.0.0",
"@tsconfig/node20": "20.1.4",
"@tsconfig/recommended": "1.0.7",
"@types/jest": "29.5.12",
"eslint": "9.6.0",
"esbuild-jest": "0.5.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-prettier": "5.1.3",
"fast-shuffle": "6.1.0",
"husky": "9.0.11",
"jest": "29.7.0",
"tsup": "8.1.0",
"typescript": "5.5.3",
"typescript-eslint": "7.15.0",
"lint-staged": "15.2.7",
"prettier": "3.3.2",
"ts-jest": "29.1.5",
"typescript": "5.5.2",
"typescript-eslint": "8.0.0-alpha.37"
"ts-jest": "29.1.5"
},
"homepage": "https://github.com/philihp/sort-unwind#readme",
"repository": {
Expand All @@ -53,17 +52,13 @@
"bugs": {
"url": "https://github.com/philihp/sort-unwind/issues"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"modulePathIgnorePatterns": [
"dist/"
]
},
"lint-staged": {
"src/**/*.{js,json,ts}": [
"eslint --ext .js,.json,.ts --fix"
]
},
"prettier": "@philihp/prettier-config"
"prettier": "@philihp/prettier-config",
"engines": {
"node": ">=18.0.0"
}
}
6 changes: 0 additions & 6 deletions tsconfig.build.json

This file was deleted.

8 changes: 1 addition & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"declaration": true,
"outDir": "./dist",
"strict": true
},
"extends": "@tsconfig/recommended/tsconfig.json",
"include": [
"./src/**/*"
]
Expand Down
10 changes: 10 additions & 0 deletions tsup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ["src/", "!src/**/__tests__/**", "!src/**/*.test.*"],
splitting: false,
sourcemap: "inline",
dts: true,
clean: true,
format: ["cjs","esm"]
})

0 comments on commit e8ef0db

Please sign in to comment.