babel-plugin-rename-gql-operations

1.0.2 • Public • Published

babel-plugin-rename-gql-operations

Rename graphql operation names

Motivation

If your gql backend requires specific gql names, but those names are not known at author time

Example

Input:

import gql from 'graphql-tag';
// if using apollo v3
import { gql } from '@apollo/client';

const foo = gql` query foo { bar } `
"nameMapping": {
  "foo": "renameFoo"
}

Output:

const foo = gql` query renameFoo { bar } `

.babelrc

{
"plugins": [
    [
      "rename-gql-operations",
      {
        "nameMapping": {
          # your specific mappings
        }
      }
    ]
  ]
}

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-rename-gql-operations

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

7.5 kB

Total Files

22

Last publish

Collaborators

  • nathanael