1.2.364 • Published 7 months ago

gql-imports v1.2.364

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

gql-imports

A boilerplate package for graphql queries, fragments, mutators, and etc written with TypeScript using the graphql-tag package. Add your queries or whatever to ts/src and compile before committing.

  • To compile to JS: npm run compile

Sample Query Definition

From ts/src/gqlQueries.ts:

import gql from 'graphql-tag';

export const gqlQueries = {
  me: gql`
    query Me {
      me {
        id,
        firstName
      }
    }
  `,
};

To Install

npm i https://github.com/jointsoft/gql-imports --save-dev

Usage Example

import { graphql } from 'react-apollo';
import { gqlQueries } from 'gql-imports';

export class HomePage extends React.Component { ... }

export default graphql(gqlQueries.me)(HomePage);

Publishing Changes To This Package

  1. Commit changes: git commit -am "gql stuff added." (assuming you're on master otherwise commit to your branch and PR)
  2. Push changes: git push
  3. Bump package version: npm version patch (patch level bump v1.0.x, this also compiles and pushes tags for you)

NOTE: The publish step has been added to step 3 npm version patch, so no need to run npm publish any longer.