1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Update a few enterprise release steps (#19072)

This commit is contained in:
Rachael Sewell
2021-06-15 15:07:15 -07:00
committed by GitHub
parent e7d75e0d93
commit bdf724c922
4 changed files with 63 additions and 7 deletions

View File

@@ -51,19 +51,24 @@ if (!fs.existsSync(newSchemaFile)) {
const previewsFile = path.join(graphqlStaticDir, 'previews.json')
const changesFile = path.join(graphqlStaticDir, 'upcoming-changes.json')
const objectsFile = path.join(graphqlStaticDir, 'prerendered-objects.json')
const inputObjectsFile = path.join(graphqlStaticDir, 'prerendered-input-objects.json')
const previews = require(previewsFile)
const changes = require(changesFile)
const objects = require(objectsFile)
const inputObjects = require(inputObjectsFile)
// The prerendered objects file for the "old version" contains hardcoded links with the old version number.
// We need to update those links to include the new version to prevent a test from failing.
const regexOldVersion = new RegExp(oldVersion, 'gi')
const stringifiedObject = JSON.stringify(objects[oldVersionId])
.replace(regexOldVersion, newVersion)
const stringifiedInputObject = JSON.stringify(inputObjects[oldVersionId])
.replace(regexOldVersion, newVersion)
previews[newVersionId] = previews[oldVersionId]
changes[newVersionId] = changes[oldVersionId]
objects[newVersionId] = JSON.parse(stringifiedObject)
inputObjects[newVersionId] = JSON.parse(stringifiedInputObject)
// check that it worked
if (!Object.keys(previews).includes(newVersionId)) {
@@ -81,10 +86,16 @@ if (!Object.keys(objects).includes(newVersionId)) {
process.exit(1)
}
if (!Object.keys(inputObjects).includes(newVersionId)) {
console.log(`Error! Can't find ${newVersionId} in ${inputObjectsFile}.`)
process.exit(1)
}
// write the new files
fs.writeFileSync(previewsFile, JSON.stringify(previews, null, 2))
fs.writeFileSync(changesFile, JSON.stringify(changes, null, 2))
fs.writeFileSync(objectsFile, JSON.stringify(objects, null, 2))
fs.writeFileSync(inputObjectsFile, JSON.stringify(inputObjects, null, 2))
// now create the new version directory in data/graphql
const srcDir = path.join(graphqlDataDir, oldVersionId)