Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit c8b6e2e

Browse files
committed
[Transform] Some correction after initial example tests
1 parent 8ac7b5a commit c8b6e2e

File tree

3 files changed

+128
-136
lines changed

3 files changed

+128
-136
lines changed

transform/src/createClassicNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ function createConcreteNode(transformedAST: ts.Expression, substitutions: ts.Var
244244
if (substitutions.length > 0) {
245245
body.unshift(
246246
ts.createVariableStatement(
247-
[ts.createToken(ts.SyntaxKind.ConstKeyword)],
248-
ts.createVariableDeclarationList(substitutions))
247+
undefined,
248+
ts.createVariableDeclarationList(substitutions, ts.NodeFlags.Const))
249249
);
250250
}
251251
return ts.createFunctionExpression(

transform/src/createModernNode.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function createModernNode(
4040
if (!definitionName) {
4141
throw new Error('GraphQL operations and fragments must contain names');
4242
}
43-
const requiredFile = definitionName + '.graphql';
43+
const requiredFile = definitionName + '.graphql.ts';
4444
const requiredPath = opts.artifactDirectory
4545
? getRelativeImportPath(fileName, opts.artifactDirectory, requiredFile)
4646
: GENERATED + requiredFile;
@@ -108,13 +108,5 @@ function getRelativeImportPath(
108108
artifactDirectory: string,
109109
fileToRequire: string,
110110
): string {
111-
112-
const relative = path.relative(
113-
path.dirname(fileName),
114-
path.resolve(artifactDirectory),
115-
);
116-
117-
const relativeReference = relative.length === 0 ? './' : '';
118-
119-
return relativeReference + path.join(relative, fileToRequire);
111+
return path.join(artifactDirectory, fileToRequire);
120112
}

0 commit comments

Comments
 (0)