Added introspection results to build pipeline

This commit is contained in:
Wyatt Johnson
2017-07-25 17:29:51 +10:00
parent 0c8def722b
commit 2e74e2fe62
3 changed files with 26 additions and 0 deletions
+2
View File
@@ -5,6 +5,8 @@ dist
npm-debug.log*
dump.rdb
client/coral-framework/graphql/introspection.json
.env
*.cfg
+2
View File
@@ -7,7 +7,9 @@
"postinstall": "./bin/cli plugins reconcile --skip-remote",
"start": "./bin/cli serve -j -w",
"dev-start": "nodemon -w . -w bin/cli -w bin/cli-serve --config .nodemon.json --exec \"./bin/cli -c .env serve -j -w\"",
"prebuild": "WEBPACK=true NODE_ENV=test ./scripts/generateIntrospectionResult.js",
"build": "WEBPACK=true NODE_ENV=production webpack -p --config webpack.config.js --bail",
"prebuild-watch": "WEBPACK=true NODE_ENV=test ./scripts/generateIntrospectionResult.js",
"build-watch": "WEBPACK=true NODE_ENV=development webpack --progress --config webpack.config.js --watch",
"lint": "eslint bin/* .",
"lint-fix": "eslint bin/* . --fix",
+22
View File
@@ -0,0 +1,22 @@
#! /usr/bin/env node
const path = require('path');
const introspectionFilename = path.resolve(__dirname, '..', 'client', 'coral-framework', 'graphql', 'introspection.json');
const fs = require('fs');
const {graphql, introspectionQuery} = require('graphql');
const schema = require('../graph/schema');
graphql(schema, introspectionQuery)
.then(({data}) => {
// Serialize the introspection result as JSON.
const introspectionResult = JSON.stringify(data, null, 2);
// Write the introspection result to the filesystem.
fs.writeFileSync(introspectionFilename, introspectionResult, 'utf8');
})
.catch((err) => {
console.error(err);
process.exit(1);
});