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

graphql_tag_pluck

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql_tag_pluck

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

GraphqlTagPluck

A gem for plucking GraphQL queries / mutations / fragments defined by heredocs inside .rb files and exporting them into a json file.

Install this gem and run the following rake task to get the exported json file containing the list of GraphQL queries / mutations / fragments.

bundle exec rake graphql_tag_pluck:generate_graphql_operation_list

Usage

With a sample heredoc like the following inside a .rb file:

SAMPLE_QUERY = <<-GRAPHQL
  query SampleQuery {
    hoge
    fuga {
      piyo
    }
  }
GRAPHQL

will output json file like: (following json content is formatted)

{
  "SampleQuery": {
    "name": "SampleQuery",
    "source": "query SampleQuery {\n  hoge\n  fuga {\n    piyo\n  }\n}",
    "type": "query"
  }
}

by executing

bundle exec rake graphql_tag_pluck:generate_graphql_operation_list

Configuration

You can configure the following options by creating .graphqltagpluckconfig.yaml and specifying them inside.

  • graphql_heredoc_identifiers
    • An array of heredoc identifiers used to define GraphQL queries / mutations / fragments
    • default: ["GRAPHQL", "GQL"]
  • file_glob_pattern
    • A glob pattern to search for the heredocs containing GraphQL queries / mutations / fragments
    • default: "#{Dir.pwd}/**/*.rb"
  • output_path
    • The destination of exported json file path
    • default: "__generated__/graphql_operation_list.json"

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add graphql_tag_pluck

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 01 May 2024

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