tweaked graphql codegen to work with new version

This commit is contained in:
Alexander Rose
2019-03-01 14:50:29 -08:00
parent aa4824a64b
commit 30dca2f2e9
4 changed files with 21 additions and 12 deletions

View File

@@ -5,17 +5,16 @@ const basePath = path.join(__dirname, '..', '..', 'src', 'mol-model-props', 'rcs
generate({
schema: 'http://rest-dev.rcsb.org/graphql',
documents: [
path.join(basePath, 'symmetry.gql.ts')
],
documents: {
[path.join(basePath, 'symmetry.gql.ts')]: {
loader: path.join(__dirname, 'loader.js')
},
},
generates: {
[path.join(basePath, 'types.ts')]: {
plugins: ['time', 'typescript-common', 'typescript-client']
}
},
// template: 'graphql-codegen-typescript-template',
// out: path.join(basePath),
// skipSchema: true,
overwrite: true,
config: path.join(__dirname, 'codegen.json')
}, true).then(

View File

@@ -0,0 +1,14 @@
const { parse } = require('graphql');
const { readFileSync } = require('fs');
module.exports = function(docString, config) {
const str = readFileSync(docString, { encoding: 'utf-8' }).trim()
.replace(/^export default `/, '')
.replace(/`$/, '')
return [
{
filePath: docString,
content: parse(str)
}
];
};

View File

@@ -1,8 +1,4 @@
// workaround so the query gets found by the codegen
function gql (strs: TemplateStringsArray) { return strs.raw.join('') }
export default
gql`query AssemblySymmetry($pdbId: String!) {
export default `query AssemblySymmetry($pdbId: String!) {
assemblies(pdbId: $pdbId) {
pdbx_struct_assembly {
id

View File

@@ -1,4 +1,4 @@
// Generated in 2019-01-30T16:38:09-08:00
// Generated in 2019-03-01T14:48:33-08:00
export type Maybe<T> = T | null;
/** Built-in scalar representing an instant in time */