Skip to content

Commit

Permalink
feat: cleanup all queries to use proper graphql syntax
Browse files Browse the repository at this point in the history
Bumped various dependencies for performance boosts as well
  • Loading branch information
favna committed May 16, 2020
1 parent c4ae2bc commit ef61373
Show file tree
Hide file tree
Showing 16 changed files with 6,117 additions and 5,496 deletions.
11 changes: 7 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ To get ready to work on the codebase, please do the following:
2. Run `yarn install`
3. Code your heart out!
4. Ensure your changes compile (`yarn build`) and run by testing them using GraphQL Playground.

- You can start compiling in watch mode with `yarn watch`
- You can start a dev server with `yarn dev`

- You can start compiling in watch mode with `yarn watch`
5. If you have any substantial code changes make sure these are covered in unit tests
6. Run `yarn lint && yarn test` to run ESLint and ensure all tests pass
- In order to run tests you will need to have the API running locally, ideally through Docker:

```sh
docker container run --name graphql-pokemon -d --expose 8080 -p 4000:8080 -it favware/graphql-pokemon:latest
```

7. Submit a pull request
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github: Favna
github: [Favna, Favware]
patreon: Favna
custom: https://donatebot.io/checkout/512303595966824458
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Quality
name: Continuous Integration

on:
push:
Expand All @@ -7,8 +7,8 @@ on:
pull_request:

jobs:
ESLint:
name: ESLint
Linting:
name: Linting
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
Expand All @@ -27,11 +27,30 @@ jobs:
run: yarn
- name: Run ESLint
uses: icrawl/action-eslint@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Typescript:
name: Typescript
Testing:
name: Unit Tests
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Restore CI Cache
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-12-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn
- name: Run Jest
run: yarn test

Building:
name: Compiling TypeScript
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
Expand All @@ -45,10 +64,10 @@ jobs:
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-10-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-12-${{ hashFiles('**/yarn.lock') }}
- name: Install Deps
run: yarn
- name: Build Source
- name: Compile TypeScript
uses: icrawl/action-tsc@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
build: src
37 changes: 0 additions & 37 deletions .github/workflows/test.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .gqlconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* .gqlconfig */
{
schema: {
files: "node_modules/@favware/graphql-pokemon/generated/ts/graphql-pokemon.graphql"
},
query: {
files: [ /* define file paths which you'd like the gql parser to watch and give autocomplete suggestions for */
{
match: 'src/*.ts', // match multiple extensions
parser: ['EmbeddedQueryParser', { startTag: 'gql`', endTag: '`' }], // parse any query inside gql template literal
},
],
},
}
14 changes: 7 additions & 7 deletions __tests__/MoveIntent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('MoveIntent', () => {

expect(res.status).toBe(200);
expect(ssml).toBe(oneLine`
<speak>Return, Max 102 power at maximum Happiness.
<speak>Return, Power is equal to the greater of (user's Happiness * 2/5), rounded down, or 1.
Return is a Normal type move.
Return has a base power of 0 and it has 20 pp.
Under normal conditions this move will have a priority of 0 and an accuracy of 100%.
Expand Down Expand Up @@ -191,14 +191,14 @@ describe('MoveIntent', () => {

expect(res.status).toBe(200);
expect(ssml).toBe(oneLine`
<speak>G-max Volt Crash, Paralyzes opponents.
Base Power scales with the base move's Base Power.
G-max Volt Crash is an Electric type move.
<speak>G-max Volt Crash, Power is equal to the base move's Max Move power.
If this move is successful, each Pokemon on the opposing side becomes paralyzed,
even if they have a substitute. G-max Volt Crash is an Electric type move.
G-max Volt Crash has a base power of 10 and it has 10 pp.
Under normal conditions this move will have a priority of 0 and an accuracy of 100%.
In battles with multiple Pokémon on each side it will have an effect on all adjacent foes.
This move is a G MAX move and can only be used by G Max Pikachu.
G-max Volt Crash is available in the generation 8 games.</speak>
In battles with multiple Pokémon on each side it will have an effect on all
adjacent foes. This move is a G MAX move and can only be used by
G Max Pikachu. G-max Volt Crash is available in the generation 8 games.</speak>
`);
});
});
8 changes: 6 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
module.exports = {
displayName: 'ts-jest',
preset: 'ts-jest',
testEnvironment: 'node',
testRunner: 'jest-circus/runner',
testMatch: ['<rootDir>/__tests__/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/__tests__/jest.setup.ts'],
testRunner: 'jest-circus/runner'
globals: {
'ts-jest': {
tsConfig: '<rootDir>/__tests__/tsconfig.json'
}
}
};
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,36 @@
"dependencies": {
"@klasa/utils": "^0.0.4",
"alexa-app": "^4.2.3",
"apollo-boost": "^0.4.7",
"apollo-boost": "^0.4.9",
"confusables": "^1.0.0",
"cross-fetch": "^3.0.4",
"graphql": "^14.6.0",
"graphql": "^15.0.0",
"graphql-tag": "^2.10.3"
},
"devDependencies": {
"@favware/eslint-config": "3.3.1",
"@favware/graphql-pokemon": "^1.8.4",
"@favware/ts-config": "^1.1.3",
"@favware/eslint-config": "4.0.0",
"@favware/graphql-pokemon": "^3.1.2",
"@favware/ts-config": "^2.0.0",
"@playlyfe/gql": "^2.6.2",
"@types/common-tags": "^1.8.0",
"@types/express": "^4.17.6",
"@types/jest": "^25.2.1",
"@types/node": "^13.13.4",
"@types/jest": "^25.2.2",
"@types/node": "^14.0.1",
"@types/supertest": "^2.0.9",
"common-tags": "^1.8.0",
"eslint": "^6.8.0",
"express": "^4.17.1",
"fs-nextra": "^0.4.7",
"fs-nextra": "^0.5.1",
"husky": "^4.2.5",
"jest": "^25.5.4",
"jest-circus": "^25.5.4",
"jest": "^26.0.1",
"jest-circus": "^26.0.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"supertest": "^4.0.2",
"ts-jest": "^25.4.0",
"ts-node": "^8.9.1",
"typescript": "^3.8.3"
"ts-jest": "^26.0.0",
"ts-node": "^8.10.1",
"typescript": "^3.9.2"
},
"engines": {
"node": ">=10",
Expand Down Expand Up @@ -86,8 +87,8 @@
}
},
"resolutions": {
"acorn": "^7.1.1",
"minimist": "^1.2.2",
"acorn": "^7.2.0",
"minimist": "^1.2.5",
"kind-of": "^6.0.3"
}
}
Loading

0 comments on commit ef61373

Please sign in to comment.