graphql-config-parser
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "graphql-config-parser", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -26,4 +26,6 @@ # graphql-config | ||
### Configuration via `$GRAPHQL_ENDPOINT` environment variable | ||
> Note: This requires Node 5 installed or higher | ||
### Method 1: Configuration via `$GRAPHQL_ENDPOINT` environment variable | ||
The easiest way to configure your project is by setting an environment variable called `GRAPHQL_ENDPOINT` to your GraphQL endpoint. | ||
@@ -35,3 +37,3 @@ | ||
### Configuration via `.graphqlrc` file | ||
### Method 2: Configuration via `.graphqlrc` file | ||
@@ -64,3 +66,3 @@ You can either use your actual GraphQL endpoint or if preferred a local JSON schema file. | ||
### Configuration via `package.json` file | ||
### Method 3: Configuration via `package.json` file | ||
@@ -72,4 +74,6 @@ Use the same configuration options as for the `.graphqlrc` file but wrap it into an object with the key `graphql`. | ||
"dependencies": { ... }, | ||
"request": { | ||
"url": "https://example.com/graphql" | ||
"graphql": { | ||
"request": { | ||
"url": "https://example.com/graphql" | ||
} | ||
} | ||
@@ -96,5 +100,9 @@ } | ||
const config = parse() | ||
resolveSchema(config).then((schema) => { | ||
// use json schema for your tool/plugin | ||
}) | ||
resolveSchema(config) | ||
.then((schema) => { | ||
// use json schema for your tool/plugin | ||
}) | ||
.catch((err) => { | ||
console.error(err) | ||
}) | ||
``` | ||
@@ -101,0 +109,0 @@ |
@@ -12,2 +12,3 @@ "use strict"; | ||
const fs_1 = require('fs'); | ||
const path_1 = require('path'); | ||
const introspectionQuery_1 = require('graphql/utilities/introspectionQuery'); | ||
@@ -47,3 +48,3 @@ const fetch = require('node-fetch'); | ||
case 'file': | ||
const schema = require(config.file); | ||
const schema = require(path_1.join(process.cwd(), config.file)); | ||
console.log(`Loaded GraphQL schema from ${config.file}`); | ||
@@ -50,0 +51,0 @@ return Promise.resolve(schema); |
import { isWebUri } from 'valid-url' | ||
import { readFileSync } from 'fs' | ||
import { join } from 'path' | ||
import { introspectionQuery } from 'graphql/utilities/introspectionQuery' | ||
@@ -59,3 +60,3 @@ import * as fetch from 'node-fetch' | ||
case 'file': | ||
const schema = require(config.file) | ||
const schema = require(join(process.cwd(), config.file)) | ||
console.log(`Loaded GraphQL schema from ${config.file}`) | ||
@@ -62,0 +63,0 @@ return Promise.resolve(schema) |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
15400
193
110