Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Add configurable literalTag #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ExtractGQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type ExtractGQLOptions = {
queryTransformers?: QueryTransformer[],
extension?: string,
inJsCode?: boolean,
literalTag?: string,
};

export class ExtractGQL {
Expand Down Expand Up @@ -111,12 +112,14 @@ export class ExtractGQL {
queryTransformers = [],
extension = 'graphql',
inJsCode = false,
literalTag = 'gql',
}: ExtractGQLOptions) {
this.inputFilePath = inputFilePath;
this.outputFilePath = outputFilePath;
this.queryTransformers = queryTransformers;
this.extension = extension;
this.inJsCode = inJsCode;
this.literalTag = literalTag;
}

// Add a query transformer to the end of the list of query transformers.
Expand Down Expand Up @@ -370,5 +373,9 @@ export const main = (argv: YArgsv) => {
options.extension = argv['extension'];
}

if (argv['literal_tag']) {
options.literalTag = argv['literal_tag'];
}

new ExtractGQL(options).extract();
};