Skip to content

Commit

Permalink
upgrade to v1.1.0
Browse files Browse the repository at this point in the history
add graphql-config related logs
update README with graphql-config
  • Loading branch information
Chnapy committed Jun 12, 2022
1 parent 91302c0 commit e8b76f1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ Then add plugin to your `tsconfig.json`
"compilerOptions": {
"plugins": [
{
"name": "ts-gql-plugin",
"schema": "./schema.graphql"
"name": "ts-gql-plugin"
}
]
}
}
```

Since this plugin use [graphql-config](https://www.graphql-config.com/docs/user/user-introduction) you should add a config file targeting your GraphQL schema.

```json
// .graphqlrc
{
"schema": "./schema.graphql"
}
```

Depending on how you want to use it:

- [with your editor](#vscode)
Expand Down Expand Up @@ -69,10 +77,10 @@ gql(`#graphql
## Configuration

| Property | Description |
| -------- | ------------------------------------------------------------------------------------ |
| schema | **Required.** Path to GraphQL schema. |
| logLevel | Plugin log level. Values `'default'` - `'verbose'` - `'debug'`. Default `'default'`. |
| Property | Description |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| graphqlConfigPath | Optional. Path to GraphQL config file. By default `graphql-config` will lookup to current directory [multiple file naming](https://www.graphql-config.com/docs/user/user-usage#config-search-places). |
| logLevel | Optional. Plugin log level. Values `'default'` - `'verbose'` - `'debug'`. Default `'default'`. |

> Checkout config type in [plugin-config.ts](./src/plugin-config.ts).
Expand Down Expand Up @@ -103,6 +111,8 @@ You can see plugin logs openning TS server log

Then search for `ts-gql-plugin` occurences.

> To see more logs consider passing `logLevel` to `'verbose'` !
### GraphQL extension

To have highlighting between other features, you can use [GraphQL extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql) for VSCode.
Expand Down Expand Up @@ -147,7 +157,7 @@ gql`

### Issues

Please fill issues with relevant logs.
Please fill issues with reproductible steps & relevant logs (check VSCode [TS server logs](#ts-server-logs)).

### Work on this project - get started

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-gql-plugin",
"version": "1.0.0",
"version": "1.1.0",
"packageManager": "yarn@3.2.1",
"license": "MIT",
"main": "./dist/plugin.js",
Expand Down
6 changes: 4 additions & 2 deletions src/source-update/create-source-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export const createSourceUpdater = (
filepath: graphqlConfigPath,
throwOnMissing: true,
throwOnEmpty: true,
});
}).getDefault();

logger.log(`GraphQL config loaded from ${graphqlConfig.filepath}`);
logger.log(`GraphQL schema loaded from ${graphqlConfig.schema}`);

const schemaInfosPromise = graphqlConfig
.getDefault()
.getSchema('DocumentNode')
.then(async (schemaDocument) => ({
schemaDocument,
Expand Down

0 comments on commit e8b76f1

Please sign in to comment.