File tree Expand file tree Collapse file tree 7 files changed +143
-64
lines changed Expand file tree Collapse file tree 7 files changed +143
-64
lines changed Load Diff This file was deleted. 
Original file line number Diff line number Diff line change 1+ name : CI 
2+ 
3+ on :
4+   push :
5+     branches :
6+       - master 
7+   pull_request :
8+     branches :
9+       - master 
10+ 
11+ jobs :
12+   test-and-build :
13+     runs-on : ubuntu-latest 
14+     strategy :
15+       matrix :
16+         graphql-version : ['~15.0', '~16.0'] 
17+     steps :
18+       - name : Checkout repository 
19+         uses : actions/checkout@v2 
20+ 
21+       - name : Set up Node.js 
22+         uses : actions/setup-node@v4 
23+         with :
24+           node-version : ' latest' 
25+ 
26+       - name : Restore cache 
27+         uses : actions/cache@v2 
28+         with :
29+           path : node_modules 
30+           key : v1-dependencies-${{ hashFiles('package.json') }}-${{ matrix.graphql-version }} 
31+           restore-keys : | 
32+             v1-dependencies- 
33+ 
34+ name : Install dependencies 
35+         if : matrix.graphql-version != '' 
36+         run : yarn install --ignore-scripts 
37+ 
38+       - name : Add specific graphql version 
39+         if : matrix.graphql-version != '' 
40+         run : yarn --ignore-scripts add --dev graphql@${{ matrix.graphql-version }} 
41+ 
42+       - name : Install dependencies with frozen lockfile 
43+         if : matrix.graphql-version == '' 
44+         run : yarn install --frozen-lockfile 
45+ 
46+       - name : Save cache 
47+         uses : actions/cache@v2 
48+         with :
49+           path : node_modules 
50+           key : v1-dependencies-${{ hashFiles('package.json') }}-${{ matrix.graphql-version }} 
51+ 
52+       - name : Run tests 
53+         run : yarn test 
54+ 
55+   test-and-build-with-typecheck :
56+     runs-on : ubuntu-latest 
57+     steps :
58+       - name : Checkout repository 
59+         uses : actions/checkout@v2 
60+ 
61+       - name : Set up Node.js 
62+         uses : actions/setup-node@v4 
63+         with :
64+           node-version : ' latest' 
65+ 
66+       - name : Restore cache 
67+         uses : actions/cache@v2 
68+         with :
69+           path : node_modules 
70+           key : v1-dependencies-${{ hashFiles('package.json') }} 
71+           restore-keys : | 
72+             v1-dependencies- 
73+ 
74+ name : Install dependencies 
75+         run : yarn install --frozen-lockfile 
76+ 
77+       - name : Save cache 
78+         uses : actions/cache@v2 
79+         with :
80+           path : node_modules 
81+           key : v1-dependencies-${{ hashFiles('package.json') }} 
82+ 
83+       - name : Run tests 
84+         run : yarn test 
Original file line number Diff line number Diff line change 22
33[ ![ npm] ( https://img.shields.io/npm/dm/graphql-query-complexity )] ( https://www.npmjs.com/package/graphql-query-complexity ) 
44[ ![ npm version] ( https://badge.fury.io/js/graphql-query-complexity.svg )] ( https://badge.fury.io/js/graphql-query-complexity ) 
5- [ ![ CircleCI] ( https://circleci.com/gh/slicknode/graphql-query-complexity.svg?style=shield )] ( https://circleci.com/gh/slicknode/graphql-query-complexity ) 
65[ ![ Twitter Follow] ( https://img.shields.io/twitter/follow/slicknode?style=social )] ( https://twitter.com/slicknode ) 
76
87This library provides GraphQL query analysis to reject complex queries to your GraphQL server.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ 
3+ #  Create package.json for CommonJS
14cat > dist/cjs/package.json << !EOF 
25{ 
36    "type": "commonjs" 
47} 
58!EOF 
69
10+ #  Define the file paths
11+ cjs_file_path=" dist/cjs/QueryComplexity.js" 
12+ esm_file_path=" dist/esm/QueryComplexity.js" 
13+ find_path=" dist/esm" 
14+ 
15+ #  Detect the operating system and use the appropriate sed command
16+ if  [[ " $OSTYPE " ==  " darwin" *  ]];  then 
17+   #  macOS (BSD sed)
18+   sed -i ' ' ' s/require("graphql\/execution\/values")/require("graphql\/execution\/values.js")/' " $cjs_file_path " 
19+ else 
20+   #  Linux (GNU sed)
21+   sed -i ' s/require("graphql\/execution\/values")/require("graphql\/execution\/values.js")/' " $cjs_file_path " 
22+ fi 
23+ 
24+ #  Create package.json for ES modules
725cat > dist/esm/package.json << !EOF 
826{ 
927    "type": "module" 
1028} 
1129!EOF 
30+ 
31+ #  Detect the operating system and use the appropriate sed command
32+ if  [[ " $OSTYPE " ==  " darwin" *  ]];  then 
33+   #  macOS (BSD sed)
34+   sed -i ' ' ' s/from ' \' ' graphql\/execution\/values' \' ' ;/from ' \' ' graphql\/execution\/values.mjs' \' ' ;/' " $esm_file_path " 
35+   find " $find_path " " *.js" ' ' ' s/from ' \' ' graphql' \' ' ;/from ' \' ' graphql\/index.mjs' \' ' ;/' 
36+ else 
37+   #  Linux (GNU sed)
38+   sed -i ' s/from ' \' ' graphql\/execution\/values' \' ' ;/from ' \' ' graphql\/execution\/values.mjs' \' ' ;/' " $esm_file_path " 
39+   find " $find_path " " *.js" ' s/from ' \' ' graphql' \' ' ;/from ' \' ' graphql\/index.mjs' \' ' ;/' 
40+ fi 
Original file line number Diff line number Diff line change @@ -2,4 +2,14 @@ cat >dist/test/cjs/package.json <<!EOF
22{ 
33    "type": "commonjs" 
44} 
5- !EOF 
5+ !EOF 
6+ 
7+ file_path=" dist/test/cjs/QueryComplexity.js" 
8+ 
9+ if  [[ " $OSTYPE " ==  " darwin" *  ]];  then 
10+   #  macOS (BSD sed)
11+   sed -i ' ' ' s/require("graphql\/execution\/values")/require("graphql\/execution\/values.js")/' " $file_path " 
12+ else 
13+   #  Linux (GNU sed)
14+   sed -i ' s/require("graphql\/execution\/values")/require("graphql\/execution\/values.js")/' " $file_path " 
15+ fi 
Original file line number Diff line number Diff line change @@ -3,3 +3,17 @@ cat >dist/test/esm/package.json <<!EOF
33    "type": "module" 
44} 
55!EOF 
6+ 
7+ file_path=" dist/test/esm/QueryComplexity.js" 
8+ find_path=" dist/test/esm" 
9+ 
10+ #  Detect the operating system and use the appropriate sed command
11+ if  [[ " $OSTYPE " ==  " darwin" *  ]];  then 
12+   #  macOS (BSD sed)
13+   sed -i ' ' ' s/from ' \' ' graphql\/execution\/values' \' ' ;/from ' \' ' graphql\/execution\/values.mjs' \' ' ;/' " $file_path " 
14+   find " $find_path " " *.js" ' ' ' s/from ' \' ' graphql' \' ' ;/from ' \' ' graphql\/index.mjs' \' ' ;/' 
15+ else 
16+   #  Linux (GNU sed)
17+   sed -i ' s/from ' \' ' graphql\/execution\/values' \' ' ;/from ' \' ' graphql\/execution\/values.mjs' \' ' ;/' " $file_path " 
18+   find " $find_path " " *.js" ' s/from ' \' ' graphql' \' ' ;/from ' \' ' graphql\/index.mjs' \' ' ;/' 
19+ fi 
Original file line number Diff line number Diff line change 1616    "build:test:esm" : " tsc -p ./tsconfig.test.esm.json && ./fix-hybrid-module.test.esm.sh" 
1717    "test" : " npm run lint && npm run build:test:cjs && npm run testonly:cjs && npm run build:test:esm && npm run testonly:esm" 
1818    "testonly:cjs" : " mocha --check-leaks --exit --full-trace 'dist/test/cjs/**/__tests__/**/*-test.js'" 
19-     "testonly:esm" : " mocha -n experimental-json-modules --check-leaks --exit --full-trace 'dist/test/esm/**/__tests__/**/*-test.js'" 
19+     "testonly:esm" : " mocha -n experimental-json-modules --loader=ts-node/esm -- check-leaks --exit --full-trace 'dist/test/esm/**/__tests__/**/*-test.js'" 
2020    "dist" : " npm run clean && npm run build" 
2121    "prepare" : " npm run clean && npm run dist" 
2222  },
2727    "lodash.get" : " ^4.4.2" 
2828  },
2929  "peerDependencies" : {
30-     "graphql" : " ^14.6.0 || ^ 15.0.0 || ^16.0.0" 
30+     "graphql" : " ^15.0.0 || ^16.0.0" 
3131  },
3232  "files" : [
3333    " dist" 
4747    "." : {
4848      "import" : " ./dist/esm/index.js" 
4949      "require" : " ./dist/cjs/index.js" 
50-     }
50+     },
51+     "./esm" : " ./dist/esm/index.js" 
52+     "./cjs" : " ./dist/cjs/index.js" 
5153  },
5254  "author" : " Ivo Meißner" 
5355  "license" : " MIT" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments