graphbrainz/scripts/print-schema.js

15 lines
388 B
JavaScript
Raw Permalink Normal View History

import { graphql, introspectionQuery, printSchema } from 'graphql'
2016-08-20 05:59:32 +00:00
import schema from '../src/schema'
if (require.main === module) {
if (process.argv[2] === '--json') {
graphql(schema, introspectionQuery).then(result => {
console.log(JSON.stringify(result, null, 2))
}).catch(err => {
console.error(err)
})
} else {
console.log(printSchema(schema))
}
}