diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..6e233f8 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,36 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x, 24.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + - uses: pnpm/action-setup@0609f0983b7a228f052f81ef4c3d6510cae254ad + with: + version: 6.10.0 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: pnpm install + - run: pnpm ci:lint + - run: pnpm ci:format + - run: pnpm ci:coverage + - run: pnpm test diff --git a/package.json b/package.json index 836e920..774564f 100644 --- a/package.json +++ b/package.json @@ -5,20 +5,25 @@ "type": "module", "scripts": { "clean": "rm -rf .nyc_output coverage dist", - "test": "nyc mocha 'src/**/*.test.ts' --require=tsx", + "test": "nyc --reporter html --reporter text mocha 'src/**/*.test.ts' --require=tsx", "lint": "eslint --fix 'src/**/*.ts'", "format": "prettier --write --ignore-unknown .", - "coverage": "nyc report --reporter html && open coverage/index.html", - "coverage:check": "nyc check-coverage --lines 90 --branches 80 --statements 90", - "prepare": "husky" + "coverage": "open coverage/index.html", + "prepare": "husky", + "ci:lint": "eslint 'src/**/*.ts'", + "ci:format": "prettier --check --ignore-unknown .", + "ci:coverage": "nyc check-coverage --lines 90 --branches 80 --statements 90" }, + "engines": { + "node": ">=22" + }, + "packageManager": "pnpm@10.12.1", "lint-staged": { "**/*": [ "pnpm lint", "pnpm format" ] }, - "packageManager": "pnpm@10.12.1", "devDependencies": { "@eslint/js": "^9.31.0", "@types/chai": "^5.2.2",