Skip to content

Commit

Permalink
Fix path resolution to github api schema (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
dagda1 authored Nov 30, 2022
1 parent a398035 commit 995b6bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changes/schema-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@simulacrum/github-api-simulator": patch
---
Fix path resolution to github api schema
9 changes: 6 additions & 3 deletions packages/github-api/src/service/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { createServer } from '@graphql-yoga/node';
import { createResolvers } from './resolvers';
import type { ServerInstance, SimulatedData } from './types';
import path from 'path';
import fs from 'fs';

function getSchema(): string {
return path.join(
process.cwd(),
let root = path.dirname(path.join('..', '..', '..')) === 'dist' ? path.join(__dirname, '..', '..', '..', '..') : path.join(__dirname, '..', '..', '..');

return fs.readFileSync(path.join(
root,
'schema',
'schema.docs-enterprise.graphql',
);
), 'utf-8');
}

export function createHandler({
Expand Down

0 comments on commit 995b6bb

Please sign in to comment.