mirror of
https://github.com/molstar/molstar.git
synced 2026-06-04 13:30:24 +08:00
tweaked graphql codegen to work with new version
This commit is contained in:
@@ -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(
|
||||
|
||||
14
data/rcsb-graphql/loader.js
Normal file
14
data/rcsb-graphql/loader.js
Normal 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)
|
||||
}
|
||||
];
|
||||
};
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user