Skip to content

Commit

Permalink
Move apollo-graphql package into the apollo-tooling repo
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-scheer authored and abernix committed Feb 14, 2019

Verified

This commit was signed with the committer’s verified signature.
abernix Jesse Rosenberger
1 parent ba39cda commit 3decc83
Showing 14 changed files with 132 additions and 102 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@

- `apollo-codegen-typescript`
- Add `/* eslint-disable */` in generated files header [#1017](https://github.com/apollographql/apollo-tooling/pull/1017)
- `apollo-graphql`
- Move apollo-graphql package from apollo-server to apollo-tooling

## `apollo@2.5.0`, `apollo-language-server@1.5.0`, `vscode-apollo@1.5.0`

47 changes: 36 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@
"apollo-codegen-swift": "file:packages/apollo-codegen-swift",
"apollo-codegen-typescript": "file:packages/apollo-codegen-typescript",
"apollo-env": "file:packages/apollo-env",
"apollo-graphql": "file:packages/apollo-graphql",
"apollo-language-server": "file:packages/apollo-language-server",
"vscode-apollo": "file:packages/vscode-apollo"
},
4 changes: 2 additions & 2 deletions packages/apollo-graphql/.npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*
!src/**/*
!dist/**/*
dist/**/*.test.*
!lib/**/*
lib/**/*.test.*
!package.json
!README.md
3 changes: 0 additions & 3 deletions packages/apollo-graphql/jest.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions packages/apollo-graphql/package.json
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
"name": "apollo-graphql",
"version": "0.1.0",
"description": "Apollo GraphQL utility library",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"keywords": [],
"author": "Apollo <opensource@apollographql.com>",
"license": "MIT",
@@ -14,6 +14,6 @@
"lodash.sortby": "^4.7.0"
},
"peerDependencies": {
"graphql": "^14.0.0"
"graphql": "^14.0.2"
}
}
58 changes: 29 additions & 29 deletions packages/apollo-graphql/src/__tests__/signature.test.ts
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
import { DocumentNode } from 'graphql';
import { default as gql, disableFragmentWarnings } from 'graphql-tag';
import { DocumentNode } from "graphql";
import { default as gql, disableFragmentWarnings } from "graphql-tag";

import {
printWithReducedWhitespace,
hideLiterals,
dropUnusedDefinitions,
sortAST,
removeAliases,
} from '../transforms';
removeAliases
} from "../transforms";

// The gql duplicate fragment warning feature really is just warnings; nothing
// breaks if you turn it off in tests.
disableFragmentWarnings();

describe('aggressive signature', () => {
describe("aggressive signature", () => {
function aggressive(ast: DocumentNode, operationName: string): string {
return printWithReducedWhitespace(
removeAliases(
hideLiterals(sortAST(dropUnusedDefinitions(ast, operationName))),
),
hideLiterals(sortAST(dropUnusedDefinitions(ast, operationName)))
)
);
}

const cases = [
// Test cases borrowed from optics-agent-js.
{
name: 'basic test',
operationName: '',
name: "basic test",
operationName: "",
input: gql`
{
user {
name
}
}
`,
output: '{user{name}}',
output: "{user{name}}"
},
{
name: 'basic test with query',
operationName: '',
name: "basic test with query",
operationName: "",
input: gql`
query {
user {
name
}
}
`,
output: '{user{name}}',
output: "{user{name}}"
},
{
name: 'basic with operation name',
operationName: 'OpName',
name: "basic with operation name",
operationName: "OpName",
input: gql`
query OpName {
user {
name
}
}
`,
output: 'query OpName{user{name}}',
output: "query OpName{user{name}}"
},
{
name: 'with various inline types',
operationName: 'OpName',
name: "with various inline types",
operationName: "OpName",
input: gql`
query OpName {
user {
name(apple: [[10]], cat: ENUM_VALUE, bag: { input: "value" })
}
}
`,
output: 'query OpName{user{name(apple:[],bag:{},cat:ENUM_VALUE)}}',
output: "query OpName{user{name(apple:[],bag:{},cat:ENUM_VALUE)}}"
},
{
name: 'with various argument types',
operationName: 'OpName',
name: "with various argument types",
operationName: "OpName",
input: gql`
query OpName($c: Int!, $a: [[Boolean!]!], $b: EnumType) {
user {
@@ -83,11 +83,11 @@ describe('aggressive signature', () => {
}
`,
output:
'query OpName($a:[[Boolean!]!],$b:EnumType,$c:Int!){user{name(apple:$a,bag:$b,cat:$c)}}',
"query OpName($a:[[Boolean!]!],$b:EnumType,$c:Int!){user{name(apple:$a,bag:$b,cat:$c)}}"
},
{
name: 'fragment',
operationName: '',
name: "fragment",
operationName: "",
input: gql`
{
user {
@@ -104,11 +104,11 @@ describe('aggressive signature', () => {
jkl
}
`,
output: '{user{name...Bar}}fragment Bar on User{asd}',
output: "{user{name...Bar}}fragment Bar on User{asd}"
},
{
name: 'full test',
operationName: 'Foo',
name: "full test",
operationName: "Foo",
input: gql`
query Foo($b: Int, $a: Boolean) {
user(name: "hello", age: 5) {
@@ -137,8 +137,8 @@ describe('aggressive signature', () => {
`,
output:
'query Foo($a:Boolean,$b:Int){user(age:0,name:""){name tz...Bar...on User{bee hello}}}' +
'fragment Bar on User{age@skip(if:$a)...Nested}fragment Nested on User{blah}',
},
"fragment Bar on User{age@skip(if:$a)...Nested}fragment Nested on User{blah}"
}
];
cases.forEach(({ name, operationName, input, output }) => {
test(name, () => {
Loading

0 comments on commit 3decc83

Please sign in to comment.