39
loading...
This website collects cookies to deliver better user experience
lib/taks/graphql.rake
. require "graphql/rake_task"
require "rake"
GraphQL::RakeTask.new(
load_schema: -> (_task) {
require_relative '../../app/graphql/dcms_schema'
DcmsSchema
}
)
namespace :graphql do
task export: :environment do
Rake::Task["graphql:schema:dump"].invoke
end
end
graphql/rake_task
so we can declare a graphql rake task and require rake
to be able to invoke a rake task from within the file.graphql:schema:dump
. Inside the load_schema
callback we require our schema definition file and return the schema class at the end of the callback.GraphQL::RakeTask.new(
load_schema: -> (_task) {
require_relative '../../app/graphql/dcms_schema'
DcmsSchema
}
)
namespace :graphql do
task export: :environment do
Rake::Task["graphql:schema:dump"].invoke
end
end
Rake::Task["graphql:schema:dump"].invoke
$ rake graphql:export
schema.graphql
and schema.json
in the root of your project.