Registry / devops / schemaglue

schemaglue

JSON →
library4.3.0jsnpmunverified

Version 4.3.0 (latest). A utility for breaking down a monolithic GraphQL schema and resolver files into smaller, domain-specific files, then gluing them back together. It supports TypeScript, custom glob patterns, and mixing .graphql files with inline schema strings. Designed for use with Apollo's graphql-tools and graphql-serverless. Release cadence is irregular; maintained by Neap. Key differentiator: opinionated file-based structuring that automatically discovers and combines schema fragments and resolvers.

npm install schemaglue
INSTALL
IMPORT
SIG · SCHEMAGLUE
S
schemaglue
devopsjavascriptv4.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import glue from 'schemaglue'
const { glue } = require('schemaglue')
Default export is the main glue function. Named import does not exist.
glue (CommonJS)
const glue = require('schemaglue')
const { schemaglue } = require('schemaglue')
CommonJS requires the entire module; default export is the glue function.
ESM TypeScript
import glue from 'schemaglue'
import * as glue from 'schemaglue'
TypeScript expects default import for ESM. The module is ESM-only starting v4.

Shows basic usage: scan a folder for GraphQL schema files and resolver modules, glue them together, then build an executable schema with graphql-tools.

// Install: npm install schemaglue graphql-tools graphql-serverless const glue = require('schemaglue'); const { makeExecutableSchema } = require('graphql-tools'); // Assumes folder structure: src/graphql/**/*.js (schema & resolver maps) const { schema, resolver } = glue('src/graphql', { js: '**/*.js', ignore: '**/excludedFile.js', }); const executableSchema = makeExecutableSchema({ typeDefs: schema, resolvers: resolver, }); console.log('Schema ready:', schema); console.log('Resolvers:', resolver);
Debug
Known issues
breakingVersion 4 drops support for Node.js < 12 and requires graphql-tools v4+.
fix
Upgrade Node.js to >=12 and ensure graphql-tools is at version 4 or higher.
affects: >=4.0.0
breakingThe default export changed from an object with multiple methods to a single glue function.
fix
Replace 'const { glue } = require("schemaglue")' with 'const glue = require("schemaglue")'.
affects: >=4.0.0
gotchaResolvers must be exported as default from each file (module.exports = { ... }), not named exports.
fix
Ensure resolver files use default export: module.exports = { Query: { ... } }.
affects: *
gotchaGlob patterns are relative to the provided directory. Absolute paths may not work as expected.
fix
Use relative paths from project root for the first argument.
affects: *
deprecatedThe 'extensions' option is deprecated in favor of custom glob patterns.
fix
Use 'js' and 'graphql' options to specify file extensions instead of 'extensions'.
affects: >=4.0.0
Errors
Common errors & fixes
Cannot find module 'schemaglue'
Missing installation or incorrect import path.
fix
Run 'npm install schemaglue --save' and ensure the import path is correct (e.g., 'const glue = require("schemaglue")').
TypeError: glue is not a function
Importing the module incorrectly (e.g., destructuring from a CommonJS require).
fix
Use 'const glue = require("schemaglue")' instead of 'const { glue } = require("schemaglue")'.
Expected a GraphQL schema string or an array of schema strings
Glue returned an empty schema or resolver due to missing files or incorrect glob pattern.
fix
Verify the root directory exists and contains JS files exporting default resolvers and .graphql files with type definitions.
Upgrade
Version history
4.3.0latest on npm
Audit
Dependencies
globrequiredUsed to find schema and resolver files based on glob patterns.
Agent activity
7 hits · last 30 days
node
6
Resources
schemaglue — npm install schemaglue · libregistry