gql-imports
v1.2.364
Published
A boilerplate for graphql queries, fragments, mutators, and etc
Downloads
122
Maintainers
Readme
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
- Commit changes:
git commit -am "gql stuff added."
(assuming you're on master otherwise commit to your branch and PR) - Push changes:
git push
- Bump package version:
npm version patch
(patch level bump v1.0.x, this also compiles and pushes tags for you)