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

@ardatan/relay-compiler

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ardatan/relay-compiler

A compiler tool for building GraphQL-driven applications.

  • 12.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9M
increased by13.15%
Maintainers
1
Weekly downloads
 
Created

What is @ardatan/relay-compiler?

@ardatan/relay-compiler is a tool used to compile GraphQL queries, fragments, and mutations into optimized code for use with Relay, a JavaScript framework for building data-driven React applications. It helps in generating efficient and type-safe code, ensuring that the data requirements of your components are met.

What are @ardatan/relay-compiler's main functionalities?

Compiling GraphQL Queries

This feature allows you to compile GraphQL queries, fragments, and mutations into optimized code. The `compile` function takes in the schema, documents, and output directory as parameters and generates the necessary files.

const { compile } = require('@ardatan/relay-compiler');

const schema = 'path/to/schema.graphql';
const documents = 'path/to/documents.graphql';
const outputDir = 'path/to/output';

compile({ schema, documents, outputDir }).then(() => {
  console.log('Compilation successful!');
}).catch(error => {
  console.error('Compilation failed:', error);
});

Generating TypeScript Definitions

This feature allows you to generate TypeScript definitions for your GraphQL queries, fragments, and mutations. By specifying the `language` parameter as 'typescript', the compiler will produce type-safe code.

const { compile } = require('@ardatan/relay-compiler');

const schema = 'path/to/schema.graphql';
const documents = 'path/to/documents.graphql';
const outputDir = 'path/to/output';
const language = 'typescript';

compile({ schema, documents, outputDir, language }).then(() => {
  console.log('TypeScript definitions generated!');
}).catch(error => {
  console.error('Generation failed:', error);
});

Custom Plugin Support

This feature allows you to extend the functionality of the compiler by using custom plugins. By passing an array of plugins to the `compile` function, you can customize the compilation process to suit your needs.

const { compile } = require('@ardatan/relay-compiler');

const schema = 'path/to/schema.graphql';
const documents = 'path/to/documents.graphql';
const outputDir = 'path/to/output';
const plugins = [require('my-custom-plugin')];

compile({ schema, documents, outputDir, plugins }).then(() => {
  console.log('Compilation with custom plugins successful!');
}).catch(error => {
  console.error('Compilation failed:', error);
});

Other packages similar to @ardatan/relay-compiler

Keywords

FAQs

Package last updated on 09 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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