Skip to content

Commit

Permalink
fix(): resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 13, 2020
2 parents a30a3c2 + bdf1780 commit e814d54
Show file tree
Hide file tree
Showing 4 changed files with 1,656 additions and 692 deletions.
20 changes: 12 additions & 8 deletions lib/graphql-ast.explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import {
InterfaceDeclarationStructure,
ParameterDeclarationStructure,
SourceFile,
StructureKind,
NewLineKind,
} from 'ts-morph';
import { DEFINITIONS_FILE_HEADER } from './graphql.constants';

let tsMorphLib: typeof import('ts-morph') | undefined;

@Injectable()
export class GraphQLAstExplorer {
private readonly root = ['Query', 'Mutation', 'Subscription'];
Expand All @@ -39,13 +39,13 @@ export class GraphQLAstExplorer {
if (!documentNode) {
return;
}
const tsMorphLib = await import('ts-morph');
tsMorphLib = await import('ts-morph');
const tsAstHelper = new tsMorphLib.Project({
manipulationSettings: {
newLineKind:
process.platform === 'win32'
? NewLineKind.CarriageReturnLineFeed
: NewLineKind.LineFeed,
? tsMorphLib.NewLineKind.CarriageReturnLineFeed
: tsMorphLib.NewLineKind.LineFeed,
},
});
const tsFile = tsAstHelper.createSourceFile(outputPath, '', {
Expand Down Expand Up @@ -99,7 +99,9 @@ export class GraphQLAstExplorer {
mode: 'class' | 'interface',
) {
const structureKind =
mode === 'class' ? StructureKind.Class : StructureKind.Interface;
mode === 'class'
? tsMorphLib.StructureKind.Class
: tsMorphLib.StructureKind.Interface;
const rootInterface = this.addClassOrInterface(tsFile, mode, {
name: 'ISchema',
isExported: true,
Expand Down Expand Up @@ -143,7 +145,9 @@ export class GraphQLAstExplorer {
);
if (!parentRef) {
const structureKind =
mode === 'class' ? StructureKind.Class : StructureKind.Interface;
mode === 'class'
? tsMorphLib.StructureKind.Class
: tsMorphLib.StructureKind.Interface;
const isRoot = this.root.indexOf(parentName) >= 0;
parentRef = this.addClassOrInterface(tsFile, mode, {
name: this.addSymbolIfRoot(upperFirst(parentName)),
Expand Down Expand Up @@ -277,7 +281,7 @@ export class GraphQLAstExplorer {
name: get(element, 'name.value'),
type: name,
hasQuestionToken: !required,
kind: StructureKind.Parameter,
kind: tsMorphLib.StructureKind.Parameter,
};
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/generate-token.util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import * as uuid from 'uuid/v4';
import { v4 } from 'uuid';

export const generateString = () => uuid();
export const generateString = () => v4();

0 comments on commit e814d54

Please sign in to comment.