refactor unnecessary use of process.exit(1) (#21974)
This commit is contained in:
@@ -22,8 +22,7 @@ const dataFilenames = JSON.parse(
|
||||
|
||||
// check for required PAT
|
||||
if (!process.env.GITHUB_TOKEN) {
|
||||
console.error('Error! You must have a GITHUB_TOKEN set in an .env file to run this script.')
|
||||
process.exit(1)
|
||||
throw new Error('Error! You must have a GITHUB_TOKEN set in an .env file to run this script.')
|
||||
}
|
||||
|
||||
const versionsToBuild = Object.keys(allVersions)
|
||||
@@ -33,13 +32,12 @@ const currentLanguage = 'en'
|
||||
main()
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const previewsJson = {}
|
||||
const upcomingChangesJson = {}
|
||||
const prerenderedObjects = {}
|
||||
const prerenderedInputObjects = {}
|
||||
|
||||
const siteData = await loadData()
|
||||
const siteData = loadData()
|
||||
|
||||
// create a bare minimum context for rendering the graphql-object.html layout
|
||||
const context = {
|
||||
@@ -56,9 +54,7 @@ async function main() {
|
||||
|
||||
// 1. UPDATE PREVIEWS
|
||||
const previewsPath = getDataFilepath('previews', graphqlVersion)
|
||||
const safeForPublicPreviews = yaml.load(
|
||||
await getRemoteRawContent(previewsPath, graphqlVersion)
|
||||
)
|
||||
const safeForPublicPreviews = yaml.load(await getRemoteRawContent(previewsPath, graphqlVersion))
|
||||
await updateFile(previewsPath, yaml.dump(safeForPublicPreviews))
|
||||
previewsJson[graphqlVersion] = processPreviews(safeForPublicPreviews)
|
||||
|
||||
@@ -113,10 +109,7 @@ async function main() {
|
||||
}
|
||||
|
||||
await updateStaticFile(previewsJson, path.join(graphqlStaticDir, 'previews.json'))
|
||||
await updateStaticFile(
|
||||
upcomingChangesJson,
|
||||
path.join(graphqlStaticDir, 'upcoming-changes.json')
|
||||
)
|
||||
await updateStaticFile(upcomingChangesJson, path.join(graphqlStaticDir, 'upcoming-changes.json'))
|
||||
await updateStaticFile(
|
||||
prerenderedObjects,
|
||||
path.join(graphqlStaticDir, 'prerendered-objects.json')
|
||||
@@ -128,10 +121,6 @@ async function main() {
|
||||
|
||||
// Ensure the YAML linter runs before checkinging in files
|
||||
execSync('npx prettier -w "**/*.{yml,yaml}"')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// get latest from github/github
|
||||
|
||||
Reference in New Issue
Block a user