* remove FEATURE_NEW_VERSIONS from feature-flags.json * remove process.env.FEATURE_NEW_VERSIONS from include files * remove process.env.FEATURE_NEW_VERSIONS from lib files * remove process.env.FEATURE_NEW_VERSIONS from middleware files * remove process.env.FEATURE_NEW_VERSIONS from script files * remove process.env.FEATURE_NEW_VERSIONS from test files * update test fixtures to use new versions as canonical fixtures
30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
const previews = require('../../lib/graphql/static/previews')
|
|
const upcomingChanges = require('../../lib/graphql/static/upcoming-changes')
|
|
const changelog = require('../../lib/graphql/static/changelog')
|
|
const prerenderedObjects = require('../../lib/graphql/static/prerendered-objects')
|
|
const { getOldVersionFromNewVersion } = require('../../lib/old-versions-utils')
|
|
|
|
// TODO do we need to support staging? https://graphql-stage.github.com/explorer
|
|
const explorerUrl = process.env.NODE_ENV === 'production'
|
|
? 'https://graphql.github.com/explorer'
|
|
: 'http://localhost:3000'
|
|
|
|
module.exports = async (req, res, next) => {
|
|
// ignore requests to non-GraphQL reference paths
|
|
if (!req.path.includes('/graphql/')) return next()
|
|
|
|
// TODO need to update this to the new versions in coordination with the updater scripts
|
|
const currentOldVersion = getOldVersionFromNewVersion(req.context.currentVersion)
|
|
|
|
req.context.graphql = {
|
|
schemaForCurrentVersion: require(`../../lib/graphql/static/schema-${currentOldVersion}`),
|
|
previewsForCurrentVersion: previews[currentOldVersion],
|
|
upcomingChangesForCurrentVersion: upcomingChanges[currentOldVersion],
|
|
prerenderedObjectsForCurrentVersion: prerenderedObjects[currentOldVersion],
|
|
explorerUrl,
|
|
changelog
|
|
}
|
|
|
|
return next()
|
|
}
|