-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import module specifier ending (#139)
* Add config option to add extension to import paths * Add importModuleSpecifierEnding to changelog * importModuleSpecifierEnding for docs and playground
- Loading branch information
1 parent
0ec733b
commit ce8c8a1
Showing
11 changed files
with
121 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/tests/fixtures/configOptions/importModuleSpecifierEnding.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// {"importModuleSpecifierEnding": ".js"} | ||
|
||
/** @gqlType */ | ||
export default class SomeType { | ||
/** @gqlField */ | ||
hello: string; | ||
} | ||
|
||
/** @gqlField */ | ||
export function greeting(t: SomeType): string { | ||
return t.hello + " world!"; | ||
} |
50 changes: 50 additions & 0 deletions
50
src/tests/fixtures/configOptions/importModuleSpecifierEnding.ts.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
----------------- | ||
INPUT | ||
----------------- | ||
// {"importModuleSpecifierEnding": ".js"} | ||
|
||
/** @gqlType */ | ||
export default class SomeType { | ||
/** @gqlField */ | ||
hello: string; | ||
} | ||
|
||
/** @gqlField */ | ||
export function greeting(t: SomeType): string { | ||
return t.hello + " world!"; | ||
} | ||
|
||
----------------- | ||
OUTPUT | ||
----------------- | ||
-- SDL -- | ||
type SomeType { | ||
greeting: String @metadata(argCount: 1, exportName: "greeting", tsModulePath: "grats/src/tests/fixtures/configOptions/importModuleSpecifierEnding.ts") | ||
hello: String @metadata | ||
} | ||
-- TypeScript -- | ||
import { greeting as someTypeGreetingResolver } from "./importModuleSpecifierEnding.js"; | ||
import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; | ||
export function getSchema(): GraphQLSchema { | ||
const SomeTypeType: GraphQLObjectType = new GraphQLObjectType({ | ||
name: "SomeType", | ||
fields() { | ||
return { | ||
greeting: { | ||
name: "greeting", | ||
type: GraphQLString, | ||
resolve(source) { | ||
return someTypeGreetingResolver(source); | ||
} | ||
}, | ||
hello: { | ||
name: "hello", | ||
type: GraphQLString | ||
} | ||
}; | ||
} | ||
}); | ||
return new GraphQLSchema({ | ||
types: [SomeTypeType] | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters