{"id":15442219,"url":"https://github.com/ardatan/graphql-import-node","last_synced_at":"2025-04-06T18:17:35.758Z","repository":{"id":33388446,"uuid":"158014143","full_name":"ardatan/graphql-import-node","owner":"ardatan","description":"Import 'graphql' files in NodeJS","archived":false,"fork":false,"pushed_at":"2023-07-11T23:38:32.000Z","size":81,"stargazers_count":80,"open_issues_count":4,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T17:11:40.914Z","etag":null,"topics":["graphql","graphql-import","javascript","node","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ardatan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-17T18:43:02.000Z","updated_at":"2024-09-13T16:37:53.000Z","dependencies_parsed_at":"2024-06-18T13:49:49.988Z","dependency_job_id":"f90a1190-6fc9-429a-94fe-e70e55f75bee","html_url":"https://github.com/ardatan/graphql-import-node","commit_stats":{"total_commits":16,"total_committers":7,"mean_commits":"2.2857142857142856","dds":0.75,"last_synced_commit":"dfe9d912133d0cb8bafc22bbe6c96a12c6c3f254"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardatan%2Fgraphql-import-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardatan%2Fgraphql-import-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardatan%2Fgraphql-import-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardatan%2Fgraphql-import-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ardatan","download_url":"https://codeload.github.com/ardatan/graphql-import-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526768,"owners_count":20953143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-import","javascript","node","nodejs","typescript"],"created_at":"2024-10-01T19:25:48.460Z","updated_at":"2025-04-06T18:17:35.720Z","avatar_url":"https://github.com/ardatan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL Import Node\n\nThis extension makes your NodeJS application able to import `graphql` files. It uses `require.extensions` to allow you to import/require from `.graphql` files in NodeJS environment. The imported content will be a compiled version of the GraphQL string (`DocumentNode`).\n\nIt needs to be installed `graphql` on the project. Then, you can install it using npm or yarn;\n\n```\nyarn add graphql-import-node\n```\n\nAfter that, you need to load this library before anything else.\n\n## Usage with Node (JavaScript)\n\nMake sure to run your NodeJS process with `-r` flag:\n\n```\nnode -r graphql-import-node/register index.js\n```\n\nOr, you can require it manually in your index file:\n\n```js\n// CommonJS\nrequire('graphql-import-node/register');\n```\n\n```js\n// ES2016\nimport 'graphql-import-node';\n```\n\nNow you should be able to do:\n\n```js\nconst schema = require('./schema.graphql');\n```\n\n## Usage with TypeScript\n\nIf you are using TypeScript (with `ts-node` or `ts-node-dev`), make sure to add the same `-r graphql-import-node/register` flag:\n\n```\nts-node -r graphql-import-node/register index.ts\n```\n\nor to have typings for `*.graphql` files it'd better to add the import the library like below;\n\n```ts\nimport 'graphql-import-node';\n```\n\nNow you should be able to do:\n\n```ts\nimport * as schema from './schema.graphql';\n```\n\n## Usage with Jest\n\nIf you are running a test environment like Jest, you should add the following configuration to your Jest config:\n\n```json\n{\n  \"transform\": {\n    \"^.+\\\\.graphql$\": \"graphql-import-node/jest\"\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardatan%2Fgraphql-import-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fardatan%2Fgraphql-import-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardatan%2Fgraphql-import-node/lists"}