From 93d6520ebcc53dc1cc754e3d8bd0f4e4aaa8de44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20Mei=C3=9Fner?= Date: Thu, 5 Sep 2024 22:03:41 -0500 Subject: [PATCH 1/7] Fix NodeJS compatibility at runtime #93 --- fix-hybrid-module.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fix-hybrid-module.sh b/fix-hybrid-module.sh index 4792b5f..5b003cc 100755 --- a/fix-hybrid-module.sh +++ b/fix-hybrid-module.sh @@ -4,8 +4,12 @@ cat >dist/cjs/package.json <dist/esm/package.json < Date: Sat, 7 Sep 2024 11:09:59 -0500 Subject: [PATCH 2/7] Add esm/cjs exports to package.json, update hybrid fix scripts --- fix-hybrid-module.sh | 7 +++++-- fix-hybrid-module.test.cjs.sh | 4 +++- fix-hybrid-module.test.esm.sh | 5 +++++ package.json | 6 ++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/fix-hybrid-module.sh b/fix-hybrid-module.sh index 5b003cc..43b290c 100755 --- a/fix-hybrid-module.sh +++ b/fix-hybrid-module.sh @@ -4,7 +4,7 @@ cat >dist/cjs/package.json <dist/esm/package.json <dist/esm/package.json <dist/test/cjs/package.json <dist/test/esm/package.json < Date: Sat, 7 Sep 2024 11:29:42 -0500 Subject: [PATCH 3/7] Setup Github workflow --- .github/workflows/ci.yaml | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f26ec70 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,84 @@ +name: Test And Build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test-and-build: + runs-on: ubuntu-latest + strategy: + matrix: + graphql-version: ['~14.6', '~14.7', '~15.0', '~16.0'] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 'latest' + + - name: Restore cache + uses: actions/cache@v2 + with: + path: node_modules + key: v1-dependencies-${{ hashFiles('package.json') }}-${{ matrix.graphql-version }} + restore-keys: | + v1-dependencies- + + - name: Install dependencies + if: matrix.graphql-version != '' + run: yarn install --ignore-scripts + + - name: Add specific graphql version + if: matrix.graphql-version != '' + run: yarn --ignore-scripts add --dev graphql@${{ matrix.graphql-version }} + + - name: Install dependencies with frozen lockfile + if: matrix.graphql-version == '' + run: yarn install --frozen-lockfile + + - name: Save cache + uses: actions/cache@v2 + with: + path: node_modules + key: v1-dependencies-${{ hashFiles('package.json') }}-${{ matrix.graphql-version }} + + - name: Run tests + run: yarn test + + test-and-build-with-typecheck: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 'latest' + + - name: Restore cache + uses: actions/cache@v2 + with: + path: node_modules + key: v1-dependencies-${{ hashFiles('package.json') }} + restore-keys: | + v1-dependencies- + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Save cache + uses: actions/cache@v2 + with: + path: node_modules + key: v1-dependencies-${{ hashFiles('package.json') }} + + - name: Run tests + run: yarn test From aef28221e7e8813c0923832c8c64eafab1c56d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20Mei=C3=9Fner?= Date: Sat, 7 Sep 2024 11:31:44 -0500 Subject: [PATCH 4/7] Switch CI branch name --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f26ec70..92e2476 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,10 +3,10 @@ name: Test And Build on: push: branches: - - main + - master pull_request: branches: - - main + - master jobs: test-and-build: From 6ee7ac349c36c01929651e3a372c0ddaf51f5504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20Mei=C3=9Fner?= Date: Sat, 7 Sep 2024 11:38:55 -0500 Subject: [PATCH 5/7] Update github action node version --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 92e2476..2d35416 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v2 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: 'latest' @@ -59,7 +59,7 @@ jobs: uses: actions/checkout@v2 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: 'latest' From 13367e08f40fb5eee7615fd76b83d6730d2bd7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20Mei=C3=9Fner?= Date: Sun, 8 Sep 2024 21:54:20 -0500 Subject: [PATCH 6/7] Add multi OS support for hybrid module fix --- fix-hybrid-module.sh | 32 +++++++++++++++++++++++++++----- fix-hybrid-module.test.cjs.sh | 10 +++++++++- fix-hybrid-module.test.esm.sh | 15 ++++++++++++--- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/fix-hybrid-module.sh b/fix-hybrid-module.sh index 43b290c..3c46b4e 100755 --- a/fix-hybrid-module.sh +++ b/fix-hybrid-module.sh @@ -1,18 +1,40 @@ +#!/bin/bash + +# Create package.json for CommonJS cat >dist/cjs/package.json <dist/esm/package.json <dist/test/cjs/package.json <dist/test/esm/package.json < Date: Thu, 12 Sep 2024 20:20:01 -0500 Subject: [PATCH 7/7] Drop support for GraphQL v14 --- .circleci/config.yml | 59 --------------------------------------- .github/workflows/ci.yaml | 4 +-- README.md | 1 - package.json | 2 +- 4 files changed, 3 insertions(+), 63 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 159d1de..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details -# -version: 2.1 - -workflows: - all-tests: - jobs: - - test-and-build: - # Override graphql-version to test against specific versions. Type checking is disabled due missing - # definitions for field extensions in older @types/graphql versions - matrix: - parameters: - graphql-version: ['~14.6', '~14.7', '~15.0', '~16.0'] - - test-and-build: - # Leave graphql-version unspecified to respect the lockfile and also run tsc - name: test-and-build-with-typecheck - -jobs: - test-and-build: - parameters: - graphql-version: - type: string - default: '' - - docker: - # specify the version you desire here - - image: circleci/node:latest - - working_directory: ~/repo - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }}-<< parameters.graphql-version >> - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - when: - condition: << parameters.graphql-version >> - steps: - - run: yarn install --ignore-scripts - - run: yarn --ignore-scripts add --dev graphql@<< parameters.graphql-version >> - - unless: - condition: << parameters.graphql-version >> - steps: - - run: yarn install --frozen-lockfile - - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }}-<< parameters.graphql-version >> - - # run tests! - - run: yarn test diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2d35416..a633b2e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Test And Build +name: CI on: push: @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - graphql-version: ['~14.6', '~14.7', '~15.0', '~16.0'] + graphql-version: ['~15.0', '~16.0'] steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/README.md b/README.md index e94943a..935ce89 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![npm](https://img.shields.io/npm/dm/graphql-query-complexity)](https://www.npmjs.com/package/graphql-query-complexity) [![npm version](https://badge.fury.io/js/graphql-query-complexity.svg)](https://badge.fury.io/js/graphql-query-complexity) -[![CircleCI](https://circleci.com/gh/slicknode/graphql-query-complexity.svg?style=shield)](https://circleci.com/gh/slicknode/graphql-query-complexity) [![Twitter Follow](https://img.shields.io/twitter/follow/slicknode?style=social)](https://twitter.com/slicknode) This library provides GraphQL query analysis to reject complex queries to your GraphQL server. diff --git a/package.json b/package.json index 6f77229..13a62c7 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "lodash.get": "^4.4.2" }, "peerDependencies": { - "graphql": "^14.6.0 || ^15.0.0 || ^16.0.0" + "graphql": "^15.0.0 || ^16.0.0" }, "files": [ "dist",