diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 304b9c5..3abb0e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ env: on: push: - branches: [ master ] + branches: [ master , build, experimental ] repository_dispatch: types: [ build ] @@ -21,14 +21,14 @@ jobs: steps: # region Setup - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setting Up Node.js (${{ matrix.node-version }}) - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 + name: Setting Up Node.js (${{ matrix.node-version }}) with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.0.1 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: @@ -36,10 +36,9 @@ jobs: - name: Get Pnpm Cache Path id: pnpm-cache - run: | - echo "::set-output name=dir::$(pnpm store path)" + run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: pnpm cache with: path: ${{ steps.pnpm-cache.outputs.dir }} @@ -50,14 +49,15 @@ jobs: - run: "echo Cache Key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}" - run: "echo Cache Restore-Keys: ${{ runner.os }}-pnpm-store-" - run: "echo Pnpm Cache Hit: ${{ steps.pnpm-cache.outputs.cache-hit }}" - # regionend - # region Steps - run: pnpm install --frozen-lockfile if: "env.USE_LOCKFILE == 'true'" - run: pnpm install --no-lockfile if: "env.USE_LOCKFILE != 'true'" + # regionend + + # region Steps - run: pnpm build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f4e684b..ae6e10d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,25 +21,24 @@ jobs: steps: # region Setup - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setting Up Node.js (${{ matrix.node-version }}) - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 + name: Setting Up Node.js (${{ matrix.node-version }}) with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.0.1 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: - version: latest + version: latest - name: Get Pnpm Cache Path id: pnpm-cache - run: | - echo "::set-output name=dir::$(pnpm store path)" + run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: pnpm cache with: path: ${{ steps.pnpm-cache.outputs.dir }} @@ -50,14 +49,15 @@ jobs: - run: "echo Cache Key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}" - run: "echo Cache Restore-Keys: ${{ runner.os }}-pnpm-store-" - run: "echo Pnpm Cache Hit: ${{ steps.pnpm-cache.outputs.cache-hit }}" - # regionend - run: pnpm install --frozen-lockfile if: "env.USE_LOCKFILE == 'true'" - run: pnpm install --no-lockfile if: "env.USE_LOCKFILE != 'true'" + # regionend + # region Steps - run: pnpm build - run: pnpm lint @@ -73,7 +73,7 @@ jobs: - name: Documentation if: "env.ENABLE_DOCS == 'true'" - uses: crazy-max/ghaction-github-pages@v2 + uses: crazy-max/ghaction-github-pages@v4 with: jekyll: false target_branch: gh-pages diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 7ca0b72..524a0b8 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -18,14 +18,14 @@ jobs: steps: # region Setup - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setting Up Node.js (${{ matrix.node-version }}) - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 + name: Setting Up Node.js (${{ matrix.node-version }}) with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.0.1 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: @@ -33,10 +33,9 @@ jobs: - name: Get Pnpm Cache Path id: pnpm-cache - run: | - echo "::set-output name=dir::$(pnpm store path)" + run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: pnpm cache with: path: ${{ steps.pnpm-cache.outputs.dir }} @@ -47,14 +46,15 @@ jobs: - run: "echo Cache Key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}" - run: "echo Cache Restore-Keys: ${{ runner.os }}-pnpm-store-" - run: "echo Pnpm Cache Hit: ${{ steps.pnpm-cache.outputs.cache-hit }}" - # regionend - # region Steps - run: pnpm install --frozen-lockfile if: "env.USE_LOCKFILE == 'true'" - run: pnpm install --no-lockfile if: "env.USE_LOCKFILE != 'true'" + # regionend + + # region Steps - name: Commits to Lint run: git log ${{github.event.pull_request.base.sha}}..${{github.event.pull_request.head.sha}} --graph --abbrev-commit --decorate --format=format:'%h%d%n%s (%cr) - %an (%ae)%n%b' @@ -69,7 +69,5 @@ jobs: - run: pnpm coverage - name: Coverage - uses: romeovs/lcov-reporter-action@v0.2.16 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + uses: romeovs/lcov-reporter-action@v0.3.1 # regionend diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 229cf46..5982e12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,14 +21,14 @@ jobs: steps: # region Setup - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setting Up Node.js (${{ matrix.node-version }}) - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 + name: Setting Up Node.js (${{ matrix.node-version }}) with: node-version: ${{ matrix.node-version }} - - uses: pnpm/action-setup@v2.0.1 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: @@ -36,10 +36,9 @@ jobs: - name: Get Pnpm Cache Path id: pnpm-cache - run: | - echo "::set-output name=dir::$(pnpm store path)" + run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: pnpm cache with: path: ${{ steps.pnpm-cache.outputs.dir }} @@ -50,15 +49,15 @@ jobs: - run: "echo Cache Key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}" - run: "echo Cache Restore-Keys: ${{ runner.os }}-pnpm-store-" - run: "echo Pnpm Cache Hit: ${{ steps.pnpm-cache.outputs.cache-hit }}" - # regionend - # region Steps - run: pnpm install --frozen-lockfile if: "env.USE_LOCKFILE == 'true'" - - run: pnpm install + - run: pnpm install --no-lockfile if: "env.USE_LOCKFILE != 'true'" + # regionend + # region Steps - run: pnpm build - run: pnpm lint:eslint # test command will lint types diff --git a/.gitignore b/.gitignore index d0388a9..ed5f684 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,5 @@ docs coverage dist -.direnv !flake.lock - +.direnv diff --git a/eslint.config.js b/eslint.config.js index ed11a03..fcce69e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,3 +1,22 @@ -import config from "@alanscodelog/eslint-config" -export default config - +import { allFileTypes, tsEslintConfig, typescriptConfig } from "@alanscodelog/eslint-config" +export default tsEslintConfig( + // https://github.com/AlansCodeLog/eslint-config + ...typescriptConfig, + { + files: [`**/*.{${allFileTypes.join(",")}}`], + languageOptions: { + parserOptions: { + // eslint-disable-next-line camelcase + EXPERIMENTAL_useProjectService: false, + project: "./tsconfig.eslint.json", + }, + }, + ignores: [ + // ... + ], + }, + // RULE LINKS + // Eslint: https://eslint.org/docs/rules/ + // Typescript: https://typescript-eslint.io/rules/ + // Vue: https://eslint.vuejs.org/rules/ +) diff --git a/package.json b/package.json index b16b693..c423ffa 100644 --- a/package.json +++ b/package.json @@ -85,16 +85,16 @@ "prepare": "husky && npm run build" }, "dependencies": { - "@alanscodelog/utils": "4.0.0-beta.17" + "@alanscodelog/utils": "^4.0.0" }, "devDependencies": { "@alanscodelog/commitlint-config": "^3.0.1", - "@alanscodelog/eslint-config": "5.0.0-beta.2", + "@alanscodelog/eslint-config": "5.0.0-beta.3", "@alanscodelog/semantic-release-config": "^4.1.2", "@alanscodelog/tsconfigs": "^4.0.1", + "@commitlint/cli": "^19.3.0", "@types/node": "^20.4.1", "@vitest/coverage-v8": "^1.6.0", - "commitlint": "^19.3.0", "concurrently": "^8.2.0", "cross-env": "^7.0.3", "fast-glob": "^3.3.1", diff --git a/tests/.eslintrc.cjs b/tests/.eslintrc.cjs deleted file mode 100644 index 6d37e7b..0000000 --- a/tests/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */ -module.exports = { - root: false, - extends: [ - // ./node_modules/@alanscodelog/eslint-config/tests.js - "@alanscodelog/eslint-config/tests", - ], - parserOptions: { - // wut - project: "./tsconfig.eslint.json", - }, -} diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index a8cc5a7..682debe 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -3,9 +3,7 @@ // also here because I want to lint configs as well, but including them in the regular tsconfig can cause problems "extends": "./tsconfig.json", "compilerOptions": { - "strictNullChecks": true, "outDir": "dist", - "baseUrl": "." }, "include": [ "**/*", diff --git a/tsconfig.json b/tsconfig.json index 0f779a7..1beb7f9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,6 @@ // https://github.com/AlansCodeLog/tsconfigs "extends": "@alanscodelog/tsconfigs", "compilerOptions": { - // todo, temp - "noUncheckedIndexedAccess": false, "outDir": "dist", // "types": [ /* "node" */ @@ -19,7 +17,6 @@ "include": [ "src/**/*.ts", "src/**/*.js", - "tests/**/*.ts" ], "exclude": [] } diff --git a/tsconfig.types.json b/tsconfig.types.json index fc3541c..63f32bd 100644 --- a/tsconfig.types.json +++ b/tsconfig.types.json @@ -13,9 +13,6 @@ // preserve documentation "removeComments": false }, - "exclude": [ - "tests/**" - ], "tsc-alias": { "resolveFullPaths": true // for esm compatibility } diff --git a/vite.config.ts b/vite.config.ts index 0f29af6..e5ecf7a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,9 +1,8 @@ -import { run } from "@alanscodelog/utils/run" +import { run } from "@alanscodelog/utils/node" import glob from "fast-glob" import path from "path" import type { PluginOption } from "vite" import { externalizeDeps } from "vite-plugin-externalize-deps" -import tsconfigPaths from "vite-tsconfig-paths" import { defineConfig } from "vitest/config" @@ -18,17 +17,14 @@ export default async ({ mode }: { mode: string }) => defineConfig({ plugins: [ // it isn't enough to just pass the deps list to rollup.external since it will not exclude subpath exports externalizeDeps(), - // even if we don't use aliases, this is needed to get imports based on baseUrl working - tsconfigPaths(), - // runs build:types script which takes care of generating types and fixing type aliases and baseUrl imports + // runs build:types script which takes care of generating types typesPlugin(), ], build: { outDir: "dist", lib: { - entry: glob.sync(path.resolve(__dirname, "src/**/*.ts")), + entry: glob.sync(path.resolve(import.meta.dirname, "src/**/*.ts")), formats: ["es"], - }, rollupOptions: { output: { @@ -49,12 +45,6 @@ export default async ({ mode }: { mode: string }) => defineConfig({ test: { cache: process.env.CI ? false : undefined, }, - resolve: { - alias: [ - // for tests only, absolute path needed because of https://github.com/vitest-dev/vitest/issues/2425 - { find: /^@\/(.*)/, replacement: `${path.resolve("src")}/$1/index.ts` }, - ], - }, server: { // for locally linked repos when using vite server (i.e. not needed for libraries) fs: {