Skip to content

Commit

Permalink
feat(types): Initial commit
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
jimthedev committed Sep 5, 2016
0 parents commit ee1c208
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '6'
- '5'
- '4'
- '0.12'
before_install:
- npm i -g npm@^2.0.0
before_script:
- npm prune
after_success:
- 'curl -Lo travis_after_all.py https://git.io/travis_after_all'
- python travis_after_all.py
- export $(cat .to_export_back) &> /dev/null
- npm run semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Description

**gra** is a wrapper around GraphQL's type module. It makes the syntax slightly less repetitive.

## Usage

### Install

```
npm install --save graphql
npm install --save gra
```

### Use it

```
var g = require('gra');
g.int
g.id
g.float
g.str
g.bool
g.obj
g.list
g.interface
g.union
g.enum
g.input
g.nonNull
g.scalar
```

`g.int` is the same as using `GraphQLInt`

Each of the above can be used in place of its [more verbose cousin](http://graphql.org/docs/api-reference-type-system/).

GraphQL is a peerDependency of this project so you should not be hard coded to a specific GraphQL version.

## Inspiration

https://twitter.com/samerbuna/status/771719039441702912
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "gra",
"description": "",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
"type": "git",
"url": "https://github.com/jimthedev/gra.git"
},
"keywords": [],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/jimthedev/gra/issues"
},
"homepage": "https://github.com/jimthedev/gra#readme",
"devDependencies": {
"cz-conventional-changelog": "^1.2.0",
"semantic-release": "^4.3.5"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"peerDependencies": {
"graphql": "^0.7.0"
}
}
19 changes: 19 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var gqlType = require('graphql/type');

var gra = {
int: gqlType.GraphQLInt,
id: gqlType.GraphQLID,
float: gqlType.GraphQLFloat,
str: gqlType.GraphQLString,
bool: gqlType.GraphQLBoolean,
scalar: gqlType.GraphQLScalarType,
obj: gqlType.GraphQLObjectType,
interface: gqlType.GraphQLInterfaceType,
union: gqlType.GraphQLUnionType,
enum: gqlType.GraphQLEnumType,
input: gqlType.GraphQLInputObjectType,
list: gqlType.GraphQLList,
nonNull: gqlType.GraphQLNonNull,
}

module.exports = gra;

0 comments on commit ee1c208

Please sign in to comment.