From 1fbb5c3280465533013877ccda8f8d8ba1a5e250 Mon Sep 17 00:00:00 2001 From: LiaoLiao Date: Fri, 20 Sep 2024 23:50:56 +0800 Subject: [PATCH] build: some improvements --- .editorconfig | 3 ++- .github/dependabot.yml | 9 -------- .github/workflows/testing.yaml | 39 ++++++++++++++++------------------ .prettierrc.js | 11 ---------- .prettierrc.yaml | 6 ++++++ compose.yaml | 8 +++---- eslint.config.js | 15 +++++++------ package.json | 1 - pnpm-lock.yaml | 11 ++++------ tsconfig.json | 2 +- 10 files changed, 43 insertions(+), 62 deletions(-) delete mode 100644 .github/dependabot.yml delete mode 100644 .prettierrc.js create mode 100644 .prettierrc.yaml diff --git a/.editorconfig b/.editorconfig index e3207ea2..afa4ab88 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,4 +2,5 @@ root = true [*] indent_style = space -indent_size = 2 \ No newline at end of file +indent_size = 2 +charset = utf-8 \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 5d51371e..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -updates: - - package-ecosystem: 'npm' - directory: '/' - schedule: - interval: 'monthly' - time: '00:00' - timezone: 'America/New_York' - open-pull-requests-limit: 999 diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 0fdb45b5..c2f65925 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -1,40 +1,37 @@ -name: testing +name: Testing on: pull_request: branches: - main jobs: test: - name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: Node ${{ matrix.node_version }} + runs-on: ubuntu-22.04 strategy: matrix: - os: - - ubuntu-22.04 node_version: - - 14 - 16 - 18 - architecture: - - x64 + - 20 + - 22 steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: latest - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node_version }} check-latest: true - architecture: ${{ matrix.architecture }} - - run: docker compose up -d - - run: docker compose exec -T cluster-1_master-1 redis-cli --cluster create 127.0.0.1:16380 127.0.0.1:16381 127.0.0.1:16382 --cluster-yes - - run: docker compose exec -T cluster-2_master-1 redis-cli --cluster create 127.0.0.1:16480 127.0.0.1:16481 127.0.0.1:16482 --cluster-yes + architecture: x64 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + - name: Run docker-compose + uses: hoverkraft-tech/compose-action@v2.0.2 + with: + compose-file: './compose.yaml' + - run: docker compose exec cluster-m1 redis-cli -a mycluster --cluster create 127.0.0.1:7380 127.0.0.1:7381 127.0.0.1:7382 --cluster-yes - run: pnpm install --frozen-lockfile - run: pnpm -F "@liaoliaots/nestjs-redis" lint - run: pnpm -F "@liaoliaots/nestjs-redis" test - run: pnpm -F "@liaoliaots/nestjs-redis" test:e2e - - run: pnpm -F "@liaoliaots/nestjs-redis-health" lint - - run: pnpm -F "@liaoliaots/nestjs-redis-health" test - - run: pnpm -F "@liaoliaots/nestjs-redis-health" test:e2e - - run: docker compose down -v diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 102b7fb2..00000000 --- a/.prettierrc.js +++ /dev/null @@ -1,11 +0,0 @@ -const config = { - printWidth: 120, - tabWidth: 2, - singleQuote: true, - trailingComma: 'none', - arrowParens: 'avoid', - htmlWhitespaceSensitivity: 'strict', - endOfLine: 'auto' -}; - -export default config; diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 00000000..47ad98f8 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,6 @@ +printWidth: 120 +tabWidth: 2 +singleQuote: true +trailingComma: none +arrowParens: avoid +endOfLine: auto diff --git a/compose.yaml b/compose.yaml index 71e1143b..493296bd 100644 --- a/compose.yaml +++ b/compose.yaml @@ -5,16 +5,16 @@ services: image: redis/redis-stack-server:latest network_mode: host environment: - - 'REDIS_ARGS=--port 6380 --requirepass myredis --appendonly yes' + - 'REDIS_ARGS=--port 6380 --requirepass myredis' cluster-m1: image: redis:latest network_mode: host - command: 'redis-server --port 7380 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf --appendonly yes' + command: 'redis-server --port 7380 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf' cluster-m2: image: redis:latest network_mode: host - command: 'redis-server --port 7381 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf --appendonly yes' + command: 'redis-server --port 7381 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf' cluster-m3: image: redis:latest network_mode: host - command: 'redis-server --port 7382 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf --appendonly yes' + command: 'redis-server --port 7382 --requirepass mycluster --cluster-enabled yes --cluster-config-file nodes.conf' diff --git a/eslint.config.js b/eslint.config.js index 5fbd41f7..4b3533e1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -5,19 +5,21 @@ import prettier from 'eslint-plugin-prettier/recommended'; // @ts-ignore import jest from 'eslint-plugin-jest'; +const jestFiles = ['packages/*/test/**/*', 'packages/**/*.spec.ts']; + export default tseslint.config( { - ignores: ['.prettierrc.js', 'eslint.config.js', 'sample', '**/dist', 'packages/*/*.js'] + ignores: ['eslint.config.js', 'sample/', '**/dist/', 'packages/*/*.js'] }, eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked, ...tseslint.configs.stylisticTypeChecked, { - files: ['packages/**/test/**', 'packages/**/*.spec.ts'], + files: jestFiles, ...jest.configs['flat/recommended'] }, { - files: ['packages/**/test/**', 'packages/**/*.spec.ts'], + files: jestFiles, ...jest.configs['flat/style'] }, prettier, @@ -28,12 +30,11 @@ export default tseslint.config( ...globals.jest }, parserOptions: { - project: ['./packages/*/tsconfig.json'], + ecmaVersion: 2023, + projectService: true, tsconfigRootDir: import.meta.dirname } - } - }, - { + }, linterOptions: { reportUnusedDisableDirectives: true } diff --git a/package.json b/package.json index 48f276fa..f7885dee 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "@nestjs/common": "10.4.3", "@nestjs/core": "10.4.3", "@nestjs/platform-fastify": "10.4.3", - "@nestjs/terminus": "10.2.3", "@nestjs/testing": "10.4.3", "@tsconfig/node20": "20.1.4", "@types/eslint__js": "8.42.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f29c2b2f..b6300d69 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,6 @@ importers: '@nestjs/platform-fastify': specifier: 10.4.3 version: 10.4.3(@nestjs/common@10.4.3(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.3(@nestjs/common@10.4.3(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)(rxjs@7.8.1)) - '@nestjs/terminus': - specifier: 10.2.3 - version: 10.2.3(@nestjs/common@10.4.3(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.3(@nestjs/common@10.4.3(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)(rxjs@7.8.1) '@nestjs/testing': specifier: 10.4.3 version: 10.4.3(@nestjs/common@10.4.3(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.3(@nestjs/common@10.4.3(reflect-metadata@0.2.2)(rxjs@7.8.1))(reflect-metadata@0.2.2)(rxjs@7.8.1)) @@ -1229,8 +1226,8 @@ packages: engines: {node: '>=0.10.0'} hasBin: true - electron-to-chromium@1.5.25: - resolution: {integrity: sha512-kMb204zvK3PsSlgvvwzI3wBIcAw15tRkYk+NQdsjdDtcQWTp2RABbMQ9rUBy8KNEOM+/E6ep+XC3AykiWZld4g==} + electron-to-chromium@1.5.26: + resolution: {integrity: sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ==} emittery@0.13.1: resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} @@ -3777,7 +3774,7 @@ snapshots: browserslist@4.23.3: dependencies: caniuse-lite: 1.0.30001662 - electron-to-chromium: 1.5.25 + electron-to-chromium: 1.5.26 node-releases: 2.0.18 update-browserslist-db: 1.1.0(browserslist@4.23.3) @@ -3985,7 +3982,7 @@ snapshots: dependencies: jake: 10.9.2 - electron-to-chromium@1.5.25: {} + electron-to-chromium@1.5.26: {} emittery@0.13.1: {} diff --git a/tsconfig.json b/tsconfig.json index 640d2e73..0c2d01d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "@tsconfig/node20/tsconfig.json", - "include": ["*"], + "include": ["*.js"], "compilerOptions": { "noEmit": true, "allowJs": true,