Skip to content

Commit

Permalink
[core] GraphQL: Rename from "vX" to "genX" in GraphQL
Browse files Browse the repository at this point in the history
As this might confuse users, as "v1" is in the URL, and actually has nothing to do with the generation at all. We decided to change this to "genX" so they will be properly separated by name.
  • Loading branch information
saasen committed Feb 27, 2020
1 parent 37346a7 commit a64a631
Show file tree
Hide file tree
Showing 17 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions packages/@sanity/core/src/actions/graphql/deployApiAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const getSanitySchema = require('./getSanitySchema')
const extractFromSanitySchema = require('./extractFromSanitySchema')
const SchemaError = require('./SchemaError')

const v1 = require('./v1')
const v2 = require('./v2')
const gen1 = require('./gen1')
const gen2 = require('./gen2')

const latestGeneration = 'v2'
const latestGeneration = 'gen2'
const generations = {
v1,
v2
gen1,
gen2
}

module.exports = async function deployApiActions(args, context) {
Expand Down Expand Up @@ -122,7 +122,7 @@ module.exports = async function deployApiActions(args, context) {

spinner.succeed()
output.print('GraphQL API deployed to:')
output.print(client.getUrl(response.location.replace(/^\/(v1|v\d{4}-\d{2}-\d{2})\//, '/')))
output.print(client.getUrl(response.location.replace(/^\/(gen1|v\d{4}-\d{2}-\d{2})\//, '/')))
} catch (err) {
spinner.fail()
throw err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = extracted => {
const filters = generateTypeFilters(extracted.types)
const queries = generateTypeQueries(extracted.types, filters)
const types = extracted.types.concat(filters)
return {types, queries, interfaces: extracted.interfaces, generation: 'v1'}
return {types, queries, interfaces: extracted.interfaces, generation: 'gen1'}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = extracted => {
const queries = generateTypeQueries(extracted.types, filters, sortings)
const types = extracted.types.concat(filters).concat(sortings)

return {types, queries, interfaces: extracted.interfaces, generation: 'v2'}
return {types, queries, interfaces: extracted.interfaces, generation: 'gen2'}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const helpText = `
Options
--dataset <dataset> Deploy API for the given dataset
--tag <tag> Deploy API to given tag (defaults to 'default')
--generation <generation> API generation to deploy (defaults to 'v2')
--generation <generation> API generation to deploy (defaults to 'gen2')
--playground Deploy a GraphQL playground for easily testing queries (public)
--no-playground Skip playground prompt (do not deploy a playground)
--force Deploy API without confirming breaking changes
Examples
sanity graphql deploy
sanity graphql deploy --playground
sanity graphql deploy --generation v1
sanity graphql deploy --generation gen1
sanity graphql deploy --dataset staging --no-playground
sanity graphql deploy --dataset staging --tag next --no-playground
sanity graphql deploy --no-playground --force
Expand Down

0 comments on commit a64a631

Please sign in to comment.