Skip to content

Commit bd4495b

Browse files
committed
Setup
1 parent c019734 commit bd4495b

27 files changed

+3910
-74
lines changed

Diff for: .circleci/config.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/node:10
6+
working_directory: ~/repo
7+
8+
steps:
9+
- checkout
10+
11+
- restore_cache:
12+
keys:
13+
- v1-dependencies-{{ checksum "package.json" }}
14+
- v1-dependencies-
15+
16+
- run: yarn install
17+
18+
- save_cache:
19+
paths:
20+
- node_modules
21+
key: v1-dependencies-{{ checksum "package.json" }}
22+
23+
- run: yarn test
24+
- run: yarn build

Diff for: .editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
7+
[**.js, **.ts, **.json,**.yml]
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 2

Diff for: .prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"bracketSpacing": false,
3+
"singleQuote": true,
4+
"trailingComma": "all"
5+
}

Diff for: __tests__/enum.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { buildASTSchema } from 'graphql';
1+
import {buildASTSchema} from 'graphql';
22
import gql from 'graphql-tag';
33

4-
import { diff } from '../src/index';
5-
import { CriticalityLevel } from '../src/changes/change';
4+
import {diff} from '../src/index';
5+
import {CriticalityLevel} from '../src/changes/change';
66

77
test('enum with new value', () => {
88
const schemaA = buildASTSchema(gql`

Diff for: __tests__/schema.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { buildASTSchema } from 'graphql';
1+
import {buildASTSchema} from 'graphql';
22
import gql from 'graphql-tag';
33

4-
import { diff } from '../src/index';
5-
import { CriticalityLevel, Change } from '../src/changes/change';
4+
import {diff} from '../src/index';
5+
import {CriticalityLevel, Change} from '../src/changes/change';
66

77
test('same schema', () => {
88
const schemaA = buildASTSchema(gql`

Diff for: lint-staged.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'{src,__tests__}/**/*.ts': ['prettier --write', 'git add'],
3+
};

Diff for: package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
},
2222
"scripts": {
2323
"build": "tsc",
24+
"test": "jest",
25+
"format": "prettier --config .prettierrc --write \"{src,__tests__}/**/*.ts\"",
2426
"clean": "rm -rf dist/",
27+
"precommit": "lint-staged",
2528
"prebuild": "npm run clean",
26-
"prepublishOnly": "npm run build",
27-
"test": "jest"
29+
"prepublishOnly": "npm run build"
2830
},
2931
"peerDependencies": {
3032
"graphql": "^0.13.0 || ^14.0.0"
@@ -35,6 +37,8 @@
3537
"graphql": "14.0.2",
3638
"graphql-tag": "2.10.0",
3739
"jest": "23.6.0",
40+
"lint-staged": "8.0.4",
41+
"prettier": "1.15.2",
3842
"ts-jest": "23.10.4",
3943
"typescript": "3.1.6"
4044
}

Diff for: renovate.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": [
3+
"config:js-lib"
4+
],
5+
"timezone": "Europe/Warsaw",
6+
"schedule": [
7+
"after 11pm and before 6am on every weekday"
8+
],
9+
"prCreation": "not-pending",
10+
"automerge": true,
11+
"major": {
12+
"automerge": false
13+
},
14+
"assignees": [
15+
"@kamilkisiela"
16+
],
17+
"reviewers": [
18+
"@kamilkisiela"
19+
],
20+
"enabledManagers": ["yarn"]
21+
}

Diff for: src/changes/argument.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import { GraphQLArgument, GraphQLObjectType, GraphQLField, GraphQLInterfaceType } from 'graphql';
1+
import {
2+
GraphQLArgument,
3+
GraphQLObjectType,
4+
GraphQLField,
5+
GraphQLInterfaceType,
6+
} from 'graphql';
27

3-
import { Change, CriticalityLevel } from './change';
4-
import { safeChangeForInputValue } from '../utils/graphql';
8+
import {Change, CriticalityLevel} from './change';
9+
import {safeChangeForInputValue} from '../utils/graphql';
510

611
export function fieldArgumentDescriptionChanged(
712
type: GraphQLObjectType | GraphQLInterfaceType,

Diff for: src/changes/directive.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { GraphQLDirective } from 'graphql';
1+
import {GraphQLDirective} from 'graphql';
22

3-
import { Change, CriticalityLevel } from './change';
3+
import {Change, CriticalityLevel} from './change';
44

55
export function directiveRemoved(directive: GraphQLDirective): Change {
66
return {

Diff for: src/changes/enum.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { GraphQLEnumType, GraphQLEnumValue } from 'graphql';
1+
import {GraphQLEnumType, GraphQLEnumValue} from 'graphql';
22

3-
import { Change, CriticalityLevel } from '../changes/change';
3+
import {Change, CriticalityLevel} from '../changes/change';
44

55
export function enumValueRemoved(
66
oldEnum: GraphQLEnumType,

Diff for: src/changes/field.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
GraphQLInterfaceType,
77
} from 'graphql';
88

9-
import { Change, CriticalityLevel } from './change';
10-
import { safeChangeForField } from '../utils/graphql';
9+
import {Change, CriticalityLevel} from './change';
10+
import {safeChangeForField} from '../utils/graphql';
1111

1212
export function fieldRemoved(
1313
type: GraphQLObjectType | GraphQLInterfaceType,

Diff for: src/changes/input.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
isNonNullType,
55
} from 'graphql';
66

7-
import { Change, CriticalityLevel } from './change';
8-
import { safeChangeForInputValue } from '../utils/graphql';
7+
import {Change, CriticalityLevel} from './change';
8+
import {safeChangeForInputValue} from '../utils/graphql';
99

1010
export function inputFieldRemoved(
1111
input: GraphQLInputObjectType,

Diff for: src/changes/object.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
1+
import {GraphQLInterfaceType, GraphQLObjectType} from 'graphql';
22

3-
import { Change, CriticalityLevel } from './change';
3+
import {Change, CriticalityLevel} from './change';
44

55
export function objectTypeInterfaceAdded(
66
iface: GraphQLInterfaceType,
@@ -27,7 +27,9 @@ export function objectTypeInterfaceRemoved(
2727
reason:
2828
'Removing an interface from an object type can cause existing queries that use this in a fragment spread to error.',
2929
},
30-
message: `'${type.name}' object no longer implements '${iface.name}' interface`,
30+
message: `'${type.name}' object no longer implements '${
31+
iface.name
32+
}' interface`,
3133
path: type.name,
3234
};
3335
}

Diff for: src/changes/schema.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { GraphQLSchema } from 'graphql';
1+
import {GraphQLSchema} from 'graphql';
22

3-
import { Change, CriticalityLevel } from './change';
3+
import {Change, CriticalityLevel} from './change';
44

55
export function schemaQueryTypeChanged(
66
oldSchema: GraphQLSchema,

Diff for: src/changes/type.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { GraphQLNamedType } from 'graphql';
1+
import {GraphQLNamedType} from 'graphql';
22

3-
import { Change, CriticalityLevel } from './change';
3+
import {Change, CriticalityLevel} from './change';
44

55
export function typeRemoved(type: GraphQLNamedType): Change {
66
return {

Diff for: src/changes/union.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { GraphQLUnionType, GraphQLObjectType } from 'graphql';
2-
import { Change, CriticalityLevel } from './change';
1+
import {GraphQLUnionType, GraphQLObjectType} from 'graphql';
2+
import {Change, CriticalityLevel} from './change';
33

44
export function unionMemberRemoved(
55
union: GraphQLUnionType,

Diff for: src/diff/argument.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
GraphQLInterfaceType,
77
} from 'graphql';
88

9-
import { Change } from '../changes/change';
9+
import {Change} from '../changes/change';
1010
import {
1111
fieldArgumentDescriptionChanged,
1212
fieldArgumentDefaultChanged,

Diff for: src/diff/enum.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { GraphQLEnumType, GraphQLEnumValue } from 'graphql';
1+
import {GraphQLEnumType, GraphQLEnumValue} from 'graphql';
22

33
import {
44
enumValueRemoved,
55
enumValueAdded,
66
enumValueDescriptionChanged,
77
enumValueDeprecationReasonChanged,
88
} from '../changes/enum';
9-
import { Change } from '../changes/change';
10-
import { unionArrays, diffArrays } from '../utils/arrays';
9+
import {Change} from '../changes/change';
10+
import {unionArrays, diffArrays} from '../utils/arrays';
1111

1212
export function changesInEnum(
1313
oldEnum: GraphQLEnumType,
@@ -31,13 +31,15 @@ export function changesInEnum(
3131
changes.push(...added.map(v => enumValueAdded(newEnum, v)));
3232
changes.push(...removed.map(v => enumValueRemoved(oldEnum, v)));
3333

34-
common.forEach(({ oldValue, newValue }) => {
34+
common.forEach(({oldValue, newValue}) => {
3535
if (oldValue.description !== newValue.description) {
3636
changes.push(enumValueDescriptionChanged(newEnum, oldValue, newValue));
3737
}
3838

3939
if (oldValue.deprecationReason !== newValue.deprecationReason) {
40-
changes.push(enumValueDeprecationReasonChanged(newEnum, oldValue, newValue));
40+
changes.push(
41+
enumValueDeprecationReasonChanged(newEnum, oldValue, newValue),
42+
);
4143
}
4244
});
4345

Diff for: src/diff/field.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import {
66
GraphQLInterfaceType,
77
} from 'graphql';
88

9-
import { Change } from '../changes/change';
9+
import {Change} from '../changes/change';
1010
import {
1111
fieldDescriptionChanged,
1212
fieldDeprecationReasonChanged,
1313
fieldTypeChanged,
1414
fieldArgumentAdded,
1515
fieldArgumentRemoved,
1616
} from '../changes/field';
17-
import { changesInArgument } from './argument';
18-
import { unionArrays, diffArrays } from '../utils/arrays';
17+
import {changesInArgument} from './argument';
18+
import {unionArrays, diffArrays} from '../utils/arrays';
1919

2020
export function changesInField(
2121
type: GraphQLObjectType | GraphQLInterfaceType,
@@ -52,7 +52,7 @@ export function changesInField(
5252
inNew: newArgs.find(a => a.name === name) as GraphQLArgument,
5353
}));
5454

55-
common.forEach(({ inOld, inNew }) => {
55+
common.forEach(({inOld, inNew}) => {
5656
changes.push(...changesInArgument(type, oldField, inOld, inNew));
5757
});
5858

Diff for: src/diff/input.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import {
2-
GraphQLInputObjectType,
3-
GraphQLInputField,
4-
isEqualType,
5-
} from 'graphql';
6-
import { Change } from '../changes/change';
7-
import { diffArrays, unionArrays } from '../utils/arrays';
1+
import {GraphQLInputObjectType, GraphQLInputField, isEqualType} from 'graphql';
2+
import {Change} from '../changes/change';
3+
import {diffArrays, unionArrays} from '../utils/arrays';
84
import {
95
inputFieldAdded,
106
inputFieldRemoved,
@@ -29,7 +25,7 @@ export function changesInInputObject(
2925
inNew: newFields[name],
3026
}));
3127

32-
common.forEach(({ inOld, inNew }) => {
28+
common.forEach(({inOld, inNew}) => {
3329
changes.push(...changesInInputField(oldInput, inOld, inNew));
3430
});
3531

Diff for: src/diff/interface.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { GraphQLInterfaceType } from 'graphql';
1+
import {GraphQLInterfaceType} from 'graphql';
22

3-
import { Change } from '../changes/change';
4-
import { fieldRemoved, fieldAdded } from '../changes/field';
5-
import { changesInField } from './field';
6-
import { diffArrays, unionArrays } from '../utils/arrays';
3+
import {Change} from '../changes/change';
4+
import {fieldRemoved, fieldAdded} from '../changes/field';
5+
import {changesInField} from './field';
6+
import {diffArrays, unionArrays} from '../utils/arrays';
77

88
export function changesInInterface(
99
oldInterface: GraphQLInterfaceType,
@@ -13,7 +13,7 @@ export function changesInInterface(
1313

1414
changes.push(...addedFields(oldInterface, newInterface));
1515
changes.push(...removedFields(oldInterface, newInterface));
16-
changedFields(oldInterface, newInterface).forEach(({ inOld, inNew }) => {
16+
changedFields(oldInterface, newInterface).forEach(({inOld, inNew}) => {
1717
changes.push(...changesInField(oldInterface, inOld, inNew));
1818
});
1919

Diff for: src/diff/object.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { GraphQLObjectType, GraphQLInterfaceType } from 'graphql';
1+
import {GraphQLObjectType, GraphQLInterfaceType} from 'graphql';
22

3-
import { Change } from '../changes/change';
3+
import {Change} from '../changes/change';
44
import {
55
objectTypeInterfaceAdded,
66
objectTypeInterfaceRemoved,
77
} from '../changes/object';
8-
import { fieldRemoved, fieldAdded } from '../changes/field';
9-
import { changesInField } from './field';
10-
import { diffArrays, unionArrays } from '../utils/arrays';
8+
import {fieldRemoved, fieldAdded} from '../changes/field';
9+
import {changesInField} from './field';
10+
import {diffArrays, unionArrays} from '../utils/arrays';
1111

1212
export function changesInObject(
1313
oldType: GraphQLObjectType,
@@ -22,7 +22,7 @@ export function changesInObject(
2222
changes.push(...addedFields(oldType, newType));
2323
changes.push(...removedFields(oldType, newType));
2424

25-
changedFields(oldType, newType).forEach(({ inOld, inNew }) => {
25+
changedFields(oldType, newType).forEach(({inOld, inNew}) => {
2626
changes.push(...changesInField(oldType, inOld, inNew));
2727
});
2828

0 commit comments

Comments
 (0)