Skip to content

Commit

Permalink
fix(generator): Sorts generated types by name and constructor.
Browse files Browse the repository at this point in the history
Generated files now thoroughly sort generated types. Previously, they were only sorted by constructor names which could lead to differences due to order of obtained types in array. Now, however, they also reflect their name when sorted.

- Updated Ava version to enable TypeScript tests
- Added prettier, husky
  • Loading branch information
maticzav committed Nov 17, 2018
1 parent 1a09609 commit 79d0417
Show file tree
Hide file tree
Showing 28 changed files with 1,528 additions and 1,863 deletions.
5 changes: 5 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
7 changes: 7 additions & 0 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
compileEnhancements: false,
verbose: true,
extensions: ['ts'],
require: ['ts-node/register'],
files: ['src/**/*.test.ts'],
}
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,28 @@
"scripts": {
"prepublish": "yarn build",
"clean": "rimraf dist",
"compile": "tsc --build",
"lint": "tslint src/**/*.ts",
"ava": "ava --verbose dist/**/*.test.js dist/*.test.js",
"compile": "tsc -d",
"lint": "tslint --project tsconfig.json {src}/**/*.ts && prettier-check --ignore-path .gitignore src/**/*.ts",
"build": "npm-run-all clean compile",
"test-only": "npm-run-all build ava",
"test": "npm-run-all lint test-only"
"pretest": "npm run build",
"test": "npm run lint && ava"
},
"devDependencies": {
"@types/graphql": "14.0.3",
"@types/node": "10.12.9",
"apollo-link": "1.2.3",
"ava": "0.25.0",
"ava": "^1.0.0-rc.2",
"graphql": "14.0.2",
"graphql-tag": "2.10.0",
"husky": "1.1.4",
"npm-run-all": "4.1.3",
"prettier": "^1.15.2",
"prettier-check": "^2.0.0",
"pretty-quick": "1.8.0",
"rimraf": "2.6.2",
"semantic-release": "15.12.0",
"tslint": "5.11.0",
"tslint-config-prettier": "1.16.0",
"tslint-config-standard": "8.0.1",
"typescript": "3.1.6"
},
Expand Down
5 changes: 5 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
semi: false,
singleQuote: true,
trailingComma: 'all',
}
Binary file removed src/codegen/FlowGenerator.test.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion src/codegen/FlowGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs'
import * as path from 'path'
import { buildSchema } from 'graphql'
import { FlowGenerator } from './FlowGenerator'
import { test } from 'ava'
import test from 'ava'

const typeDefs = fs.readFileSync(
path.join(__dirname, '../../src/codegen/fixtures/schema.graphql'),
Expand Down
Loading

0 comments on commit 79d0417

Please sign in to comment.