Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-config

Package Overview
Dependencies
Maintainers
4
Versions
320
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-config - npm Package Compare versions

Comparing version 1.0.9 to 1.1.0

13

lib/__tests__/basic/getGraphQLConfig.js

@@ -5,2 +5,3 @@ "use strict";

var path_1 = require("path");
var graphql_1 = require("graphql");
var schema = require('../schema.json');

@@ -17,3 +18,5 @@ var _1 = require("../../");

});
ava_1.default('returns a correct root dir', function (t) { return t.deepEqual(config.configDir, CONFIG_DIR); });
ava_1.default('returns a correct root dir', function (t) {
t.deepEqual(config.configDir, CONFIG_DIR);
});
ava_1.default('returns a correct schema path', function (t) {

@@ -23,1 +26,9 @@ t.deepEqual(config.getProjectConfig('testWithSchema').schemaPath, path_1.join(CONFIG_DIR, '__schema__/StarWarsSchema.graphql'));

});
ava_1.default('reads single schema', function (t) {
var typeDefs = "type Query {\n hello: String!\n}\n";
t.is(graphql_1.printSchema(config.getProjectConfig('testSchemaA').getSchema()), typeDefs);
});
ava_1.default('reads imported schema', function (t) {
var typeDefs = "type Query {\n hello: String!\n user: User!\n}\n\ntype User {\n name: String\n}\n";
t.is(graphql_1.printSchema(config.getProjectConfig('testSchemaB').getSchema()), typeDefs);
});

12

lib/utils.js

@@ -48,2 +48,3 @@ "use strict";

var path_1 = require("path");
var graphql_import_1 = require("graphql-import");
var minimatch = require("minimatch");

@@ -135,8 +136,8 @@ var yaml = require("js-yaml");

function readSchema(path) {
var data = fs_1.readFileSync(path, 'utf-8');
// FIXME: prefix error
switch (path_1.extname(path)) {
case '.graphql':
return valueToSchema(data);
return valueToSchema(graphql_import_1.importSchema(path));
case '.json':
var data = fs_1.readFileSync(path, { encoding: 'utf-8' });
var introspection = JSON.parse(data);

@@ -153,5 +154,8 @@ return valueToSchema(introspection);

}
else if (typeof schema === 'string' || schema instanceof graphql_1.Source) {
else if (typeof schema === 'string') {
return graphql_1.buildSchema(schema);
}
else if (schema instanceof graphql_1.Source) {
return graphql_1.buildSchema(schema);
}
else if (typeof schema === 'object' && !Array.isArray(schema)) {

@@ -213,3 +217,3 @@ return introspectionToSchema(schema);

}
var _ = result[0], key = result[1], value = result[2];
var _1 = result[0], key = result[1], value = result[2];
extensions[key] = value;

@@ -216,0 +220,0 @@ }

{
"name": "graphql-config",
"version": "1.0.9",
"version": "1.1.0",
"description": "The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)",

@@ -16,3 +16,3 @@ "main": "lib/index.js",

"build": "npm run clean && tsc",
"copy-test-assets": "cpx \"src/**/{.graphqlconfig,.graphqlconfig.yml,.graphqlconfig.yaml,*.json}\" lib",
"copy-test-assets": "cpx \"src/**/{.graphqlconfig*,*.graphql,*.json}\" lib",
"test-only": "npm run build && npm run copy-test-assets && ava --verbose lib/__tests__/**/*.js --serial",

@@ -54,3 +54,3 @@ "test": "tslint src/**/*.ts && npm run test-only"

"@types/node-fetch": "1.6.7",
"ava": "^0.23.0",
"ava": "^0.24.0",
"babel-polyfill": "^6.26.0",

@@ -66,2 +66,3 @@ "babel-preset-es2015": "^6.16.0",

"graphql": "^0.11.7",
"graphql-import": "^0.1.5",
"graphql-request": "^1.4.0",

@@ -68,0 +69,0 @@ "js-yaml": "^3.10.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc