Skip to content

Commit

Permalink
chore(deps): maintain dependencies and migrate to eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Dec 3, 2024
1 parent 8781bbe commit 9ce1c43
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 23 deletions.
107 changes: 91 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master
on: push

jobs:
ci:
prepare:
name: Prepare (${{ matrix.os}}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [18]
node: [18, 20, 22]

steps:
- name: Set up Node
Expand All @@ -27,7 +21,8 @@ jobs:
uses: actions/checkout@master

- name: Cache node_modules
uses: actions/cache@v2
id: cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}
Expand All @@ -36,24 +31,104 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

suite:
needs: prepare
name: Suite (${{ matrix.os}}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18, 20, 22]

steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Retrieve node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Lint
run: npm run lint

- name: Types
run: npm run types

- name: Unit
run: npm run unit

- name: Build
run: npm run build

- name: Coverage
if: matrix.os == 'ubuntu-latest' && matrix.node == 18
if: matrix.os == 'ubuntu-latest' && matrix.node == 22
uses: codecov/codecov-action@v3

types:
needs: prepare
name: Types (${{ matrix.os}}, Node ${{ matrix.node }}, TS ${{ matrix.typescript }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [22]
# Add relevant versions from: https://majors.nullvoxpopuli.com/q?minors=on&packages=typescript
typescript: ["5.7"]

steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Retrieve node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Overwrite TypeScript
run: npm install --no-save typescript@${{ matrix.typescript }} && npx tsc --version

- name: Types
run: npm run types

size:
needs: prepare
if: github.event_name == 'pull_request'
name: Size (${{ matrix.os}}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [22]

steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master

- name: Retrieve node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Size
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == 18
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default tseslint.config(
],
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/consistent-type-imports": "error",
"tsdoc/syntax": "warn",
},
},
Expand Down
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@types/fs-extra": "^11.0.4",
"@vitest/coverage-v8": "^2.1.8",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-tsdoc": "^0.4.0",
"prettier": "^3.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/readPackageJSON.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from "node:fs";
import * as path from "node:path";

import { PackageJSON } from "../types";
import type { PackageJSON } from "../types";

export const readPackageJSON = (rootDir = process.cwd()): PackageJSON => {
try {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/extendConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import * as path from "node:path";
import typescript from "@rollup/plugin-typescript";
import { defuFn } from "defu";
import renameNodeModules from "rollup-plugin-rename-node-modules";
import { Plugin, UserConfig, defineConfig } from "vite";
import type { Plugin, UserConfig } from "vite";
import { defineConfig } from "vite";

import { builtins } from "../lib/builtins";

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/moveTypeDeclarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from "node:path";
import fse from "fs-extra";
import type { Plugin, ResolvedConfig } from "vite";

import { Options } from "../types";
import type { Options } from "../types";

export const moveTypeDeclarationsPlugin = (options: Options): Plugin | null => {
if (!options.dts) {
Expand Down

0 comments on commit 9ce1c43

Please sign in to comment.