0.2.0 • Published 10 years ago
gulp-graphql v0.2.0
gulp-graphql
Keep your graphql schema up-to-date with gulp! Made for gulp 3
Features
- Attempts to generate a graphql schema from
schema.js - Can output both
schema.jsonandschema.graphql
Installation
npm install gulp-graphql --save-devUsage
Example gulpfile.babel.js:
import gulp from 'gulp';
import schema from 'gulp-graphql';
gulp.task("schema", () => {
console.log("Generating graphql schema...");
return gulp.src("src/data/schema.js")
.pipe(schema({
json: true,
graphql: false,
}))
.on('error', console.log)
.pipe(gulp.dest("src/data"))
.pipe(gulp.dest("dist/data"));
});
gulp.task('watch-schema', () => {
gulp.watch("src/data/schema.js", [ 'schema' ]);
});
gulp.task("default", ["schema"]);Options
json(optional) (default:true) * Generate a graphql schema from yourschema.jsand output toschema.jsongraphql(optional) (default:true) * Output schema as a readableschema.graphqlfilefileName(optional) (default:schema) * Base name for your schema file, no extensionindentation(optional) (default:2) * Takes anIntegerfor indentation spaces ofschema.jsongraphqlPath(optional) * Override for where to findgraphqlmodule.
Notes
Passing in graphql via init is a hack that I'm not thrilled about but seems to work.
Release log
0.2.0
- No longer needs to be initialized!
- Attempts to find modules
graphqlandgraphql/utitliteson its own.
0.1.0
- Generates graphql
schema.jsonandschema.graphqlfiles w/ tests.
Licence
MIT License