Skip to content

Commit

Permalink
Merge pull request #133 from marmelab/revert-127-upgrade-deps
Browse files Browse the repository at this point in the history
Revert "Upgrade dependencies"
  • Loading branch information
fzaninotto authored Jan 19, 2022
2 parents 9c04eab + b410149 commit c6c663f
Show file tree
Hide file tree
Showing 6 changed files with 1,493 additions and 815 deletions.
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/jest": "^25.2.1",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.4.0",
"babel-loader": "^8.2.2",
"babel-loader": "^8.0.6",
"babel-plugin-add-module-exports": "^1.0.2",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
Expand All @@ -50,17 +50,19 @@
"lint-staged": "^10.1.7",
"prettier": "^2.0.5",
"supertest": "^4.0.2",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0"
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9"
},
"dependencies": {
"@apollo/client": "^3.4.13",
"@graphql-tools/schema": "^8.2.0",
"apollo-client": "^2.6.4",
"apollo-test-utils": "^0.3.2",
"cors": "^2.8.4",
"express": "^4.17.1",
"express-graphql": "^0.12.0",
"graphql": "^15.6.0",
"graphql-type-json": "^0.3.2",
"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",
"lodash.merge": "^4.6.2",
"reify": "^0.20.12",
Expand Down
14 changes: 14 additions & 0 deletions src/createApolloClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ApolloClient } from 'apollo-client';
import { mockNetworkInterfaceWithSchema } from 'apollo-test-utils';
import getSchemaFromData from './introspection/getSchemaFromData';

export default (data) => {
const schema = getSchemaFromData(data);
const mockNetworkInterface = mockNetworkInterfaceWithSchema({ schema });

const client = new ApolloClient({
networkInterface: mockNetworkInterface,
});

return client;
};
70 changes: 14 additions & 56 deletions src/introspection/getSchemaFromData.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ test('creates three query fields per data type', () => {
expect(queries['Post'].type.name).toEqual(PostType.name);
expect(queries['Post'].args).toEqual([
{
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
name: 'id',
type: new GraphQLNonNull(GraphQLID),
},
Expand All @@ -154,11 +151,8 @@ test('creates three query fields per data type', () => {
expect(queries['User'].type.name).toEqual(UserType.name);
expect(queries['User'].args).toEqual([
{
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
name: 'id',
type: new GraphQLNonNull(GraphQLID),
},
Expand All @@ -184,123 +178,87 @@ test('creates three mutation fields per data type', () => {
{
name: 'title',
type: new GraphQLNonNull(GraphQLString),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
{
name: 'views',
type: new GraphQLNonNull(GraphQLInt),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
{
name: 'user_id',
type: new GraphQLNonNull(GraphQLID),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
]);
expect(mutations['updatePost'].type.name).toEqual(PostType.name);
expect(mutations['updatePost'].args).toEqual([
{
name: 'id',
type: new GraphQLNonNull(GraphQLID),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
{
name: 'title',
type: GraphQLString,
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
{
name: 'views',
type: GraphQLInt,
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
{
name: 'user_id',
type: GraphQLID,
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
]);
expect(mutations['removePost'].type.name).toEqual(PostType.name);
expect(mutations['removePost'].args).toEqual([
{
name: 'id',
type: new GraphQLNonNull(GraphQLID),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
]);
expect(mutations['createUser'].type.name).toEqual(UserType.name);
expect(mutations['createUser'].args).toEqual([
{
name: 'name',
type: new GraphQLNonNull(GraphQLString),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
]);
expect(mutations['updateUser'].type.name).toEqual(UserType.name);
expect(mutations['updateUser'].args).toEqual([
{
name: 'id',
type: new GraphQLNonNull(GraphQLID),
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
{
name: 'name',
type: GraphQLString,
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
},
]);
expect(mutations['removeUser'].type.name).toEqual(UserType.name);
expect(mutations['removeUser'].args).toEqual([
{
astNode: undefined,
defaultValue: undefined,
description: undefined,
deprecationReason: undefined,
extensions: undefined,
description: null,
name: 'id',
type: new GraphQLNonNull(GraphQLID),
},
Expand Down
2 changes: 1 addition & 1 deletion src/schemaBuilder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeExecutableSchema } from '@graphql-tools/schema';
import { makeExecutableSchema } from 'graphql-tools';
import { printSchema } from 'graphql';
import getSchemaFromData from './introspection/getSchemaFromData';
import resolver from './resolver';
Expand Down
9 changes: 2 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ let plugins = [];
let outputFile;

if (process.env.NODE_ENV === 'production') {
outputFile = (target) => `${libraryName}.${target}.min.js`;
outputFile = target => `${libraryName}.${target}.min.js`;
} else {
outputFile = (target) => `${libraryName}.${target}.js`;
outputFile = target => `${libraryName}.${target}.js`;
}

const defaultConfig = {
Expand All @@ -21,11 +21,6 @@ const defaultConfig = {
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/,
},
{
include: /node_modules/,
test: /\.mjs$/,
type: 'javascript/auto',
},
],
},
resolve: {
Expand Down
Loading

0 comments on commit c6c663f

Please sign in to comment.