diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f85543..b60814d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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')) }} @@ -36,12 +31,34 @@ 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 @@ -49,11 +66,69 @@ jobs: 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 }} diff --git a/eslint.config.mjs b/eslint.config.mjs index 9b30ef8..9c0b2d2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -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", }, }, diff --git a/package-lock.json b/package-lock.json index 6da3708..6e750b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,11 +19,8 @@ "@size-limit/preset-small-lib": "^11.1.6", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/fs-extra": "^11.0.4", - "@typescript-eslint/eslint-plugin": "^8.17.0", - "@typescript-eslint/parser": "^8.17.0", "@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", @@ -3151,6 +3148,8 @@ "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, diff --git a/package.json b/package.json index 488cdaf..c992ac1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/lib/readPackageJSON.ts b/src/lib/readPackageJSON.ts index 21b8f55..fc2890f 100644 --- a/src/lib/readPackageJSON.ts +++ b/src/lib/readPackageJSON.ts @@ -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 { diff --git a/src/plugins/extendConfig.ts b/src/plugins/extendConfig.ts index 7aeed9e..9a56386 100644 --- a/src/plugins/extendConfig.ts +++ b/src/plugins/extendConfig.ts @@ -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"; diff --git a/src/plugins/moveTypeDeclarations.ts b/src/plugins/moveTypeDeclarations.ts index 53406e6..da5f2f0 100644 --- a/src/plugins/moveTypeDeclarations.ts +++ b/src/plugins/moveTypeDeclarations.ts @@ -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) {