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 new file mode 100644 index 0000000..a633b2e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,84 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test-and-build: + runs-on: ubuntu-latest + strategy: + matrix: + graphql-version: ['~15.0', '~16.0'] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v4 + 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@v4 + 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 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/fix-hybrid-module.sh b/fix-hybrid-module.sh index 4792b5f..3c46b4e 100755 --- a/fix-hybrid-module.sh +++ b/fix-hybrid-module.sh @@ -1,11 +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 <