From dc7f06194f2ffd36daaf05b0a503d3b9273dfdfc Mon Sep 17 00:00:00 2001 From: Nick Verwymeren Date: Thu, 18 Oct 2018 10:01:29 -0500 Subject: [PATCH 1/2] Allow the use of .graphql or .graphql.js Previously schema files could only end in .graphql files. This caused a problem with IDE's since these files are actually javascript files. This pull request should also detect ```.graphql.js``` files while keeping backward compatibility with the ```.graphql``` extension. --- packages/strapi-plugin-graphql/hooks/graphql/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/strapi-plugin-graphql/hooks/graphql/index.js b/packages/strapi-plugin-graphql/hooks/graphql/index.js index c6872a80f1..6b3e749cc1 100644 --- a/packages/strapi-plugin-graphql/hooks/graphql/index.js +++ b/packages/strapi-plugin-graphql/hooks/graphql/index.js @@ -35,7 +35,7 @@ module.exports = strapi => { // Load root configurations. new Promise((resolve, reject) => { glob( - './config/*.graphql', + './config/*{.graphql,.graphql.js}', { cwd: strapi.config.appPath, }, @@ -54,7 +54,7 @@ module.exports = strapi => { // Load APIs configurations. new Promise((resolve, reject) => { glob( - './api/*/config/*.graphql', + './api/*/config/*{.graphql,.graphql.js}', { cwd: strapi.config.appPath, }, @@ -73,7 +73,7 @@ module.exports = strapi => { // Load plugins configurations. new Promise((resolve, reject) => { glob( - './plugins/*/config/*.graphql', + './plugins/*/config/*{.graphql,.graphql.js}', { cwd: strapi.config.appPath, }, From 0034ebae411a3151da0ea97d486bf86ff62f51da Mon Sep 17 00:00:00 2001 From: Nick Verwymeren Date: Thu, 1 Nov 2018 10:12:46 -0500 Subject: [PATCH 2/2] Update index.js changed the glob as per @maturanomx comment --- packages/strapi-plugin-graphql/hooks/graphql/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/strapi-plugin-graphql/hooks/graphql/index.js b/packages/strapi-plugin-graphql/hooks/graphql/index.js index 6b3e749cc1..7530b4e042 100644 --- a/packages/strapi-plugin-graphql/hooks/graphql/index.js +++ b/packages/strapi-plugin-graphql/hooks/graphql/index.js @@ -35,7 +35,7 @@ module.exports = strapi => { // Load root configurations. new Promise((resolve, reject) => { glob( - './config/*{.graphql,.graphql.js}', + './config/*.graphql?(.js)', { cwd: strapi.config.appPath, }, @@ -54,7 +54,7 @@ module.exports = strapi => { // Load APIs configurations. new Promise((resolve, reject) => { glob( - './api/*/config/*{.graphql,.graphql.js}', + './api/*/config/*.graphql?(.js)', { cwd: strapi.config.appPath, }, @@ -73,7 +73,7 @@ module.exports = strapi => { // Load plugins configurations. new Promise((resolve, reject) => { glob( - './plugins/*/config/*{.graphql,.graphql.js}', + './plugins/*/config/*.graphql?(.js)', { cwd: strapi.config.appPath, },