Skip to content

Commit

Permalink
Merge pull request #169 from marmelab/update-deps
Browse files Browse the repository at this point in the history
Update tooling
  • Loading branch information
fzaninotto authored Apr 18, 2024
2 parents 918a426 + 2ad5865 commit 7f32987
Show file tree
Hide file tree
Showing 18 changed files with 2,924 additions and 5,891 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Use Node.js LTS
uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '20.x'
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib
dist
node_modules
.nvmrc
.nyc_output
Expand Down
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ install: package.json ## Install dependencies
@$(PKG) install

watch: ## continuously compile ES6 files to JS
NODE_ENV=development ./node_modules/.bin/webpack --watch
@yarn vite build --watch

test: ## Launch unit tests
@NODE_ENV=test ./node_modules/.bin/jest
@NODE_ENV=test NODE_OPTIONS="$$NODE_OPTIONS --experimental-vm-modules" ./node_modules/.bin/jest

watch-test: ## Launch unit tests and watch for changes
@NODE_ENV=test ./node_modules/.bin/jest --watch
@NODE_ENV=test NODE_OPTIONS="$$NODE_OPTIONS --experimental-vm-modules" ./node_modules/.bin/jest --watch

format: ## Format the source code
@./node_modules/.bin/eslint --fix ./src
Expand All @@ -25,4 +25,6 @@ run: ## Launch server with example data
@node ./bin/json-graphql-server.js example/data.js

build: ## Build production release
@NODE_ENV=production ./node_modules/.bin/webpack
@yarn vite build
@yarn vite build -c ./vite.config.node.js
@yarn vite build -c ./vite.config.umd.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ Then use the `jsonGraphqlExpress` express middleware:

```js
import express from 'express';
import jsonGraphqlExpress from 'json-graphql-server';
import jsonGraphqlExpress from 'json-graphql-server/node';

const PORT = 3000;
const app = express();
Expand All @@ -469,7 +469,7 @@ Useful when using XMLHttpRequest directly or libraries such as [axios](https://w
Add a `script` tag referencing the library:

```html
<script src="../lib/json-graphql-server.client.min.js"></script>
<script src="../dist/json-graphql-server.umd.js"></script>
```

It will expose the `JsonGraphqlServer` as a global object:
Expand Down
38 changes: 0 additions & 38 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion bin/json-graphql-server.js → bin/json-graphql-server.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require('reify');
var path = require('path');
var express = require('express');
var cors = require('cors');
var JsonGraphqlServer = require('../lib/json-graphql-server.node.min').default;
var JsonGraphqlServer = require('../dist/json-graphql-server-node').default;

var dataFilePath = process.argv.length > 2 ? process.argv[2] : './data.json';
var data = require(path.join(process.cwd(), dataFilePath));
Expand Down
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>
<button id="button">Load posts</button>
<script src="../lib/json-graphql-server.client.min.js"></script>
<script src="../dist/json-graphql-server.umd.cjs"></script>
<script type="text/javascript">
window.addEventListener('load', function() {
const data = {
Expand Down
67 changes: 35 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"name": "json-graphql-server",
"version": "2.4.1",
"main": "lib/json-graphql-server.node.min.js",
"browser": "lib/json-graphql-server.client.min.js",
"type": "module",
"main": "./dist/json-graphql-server.cjs",
"module": "./dist/json-graphql-server.js",
"exports": {
".": {
"import": "./dist/json-graphql-server.js",
"require": "./dist/json-graphql-server.cjs"
},
"./node": {
"import": "./dist/json-graphql-server-node.js",
"require": "./dist/json-graphql-server-node.cjs"
}
},
"repository": "[email protected]:marmelab/json-graphql-server.git",
"authors": [
"François Zaninotto",
Expand Down Expand Up @@ -30,44 +41,36 @@
]
},
"devDependencies": {
"@babel/cli": "^7.6.3",
"@babel/core": "^7.6.3",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.6.3",
"@types/jest": "^25.2.1",
"@types/jest": "^29.5.12",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.4.0",
"babel-loader": "^8.0.6",
"babel-plugin-add-module-exports": "^1.0.2",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.1",
"husky": "^4.2.5",
"jest": "^25.4.0",
"lint-staged": "^10.1.7",
"prettier": "^2.0.5",
"supertest": "^4.0.2",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9"
"babel-jest": "^29.7.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"supertest": "^6.3.4",
"vite": "^5.2.8"
},
"dependencies": {
"@apollo/client": "^3.9.11",
"cors": "^2.8.4",
"express": "^4.17.2",
"@graphql-tools/schema": "^10.0.3",
"cors": "^2.8.5",
"express": "^4.17.3",
"express-graphql": "^0.9.0",
"graphql": "^14.5.8",
"graphql-tag": "^2.10.1",
"graphql-tools": "^4.0.5",
"graphql-type-json": "^0.3.0",
"inflection": "^1.12.0",
"graphql": "^16.8.1",
"graphql-tag": "^2.12.6",
"graphql-type-json": "^0.3.2",
"inflection": "^3.0.0",
"lodash.merge": "^4.6.2",
"reify": "^0.20.12",
"xhr-mock": "^2.5.0"
"xhr-mock": "^2.5.1"
},
"bin": {
"json-graphql-server": "bin/json-graphql-server.js"
}
}
}
10 changes: 4 additions & 6 deletions src/handleRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ export default function (data) {

const query = JSON.parse(body);

return graphql(
return graphql({
schema,
query.query,
undefined,
undefined,
query.variables
).then(
source: query.query,
variableValues: query.variables
}).then(
(result) => ({
status: 200,
headers: { 'Content-Type': 'application/json' },
Expand Down
Loading

0 comments on commit 7f32987

Please sign in to comment.