Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
  • Loading branch information
Robert Mosolgo and sarahs authored Nov 25, 2020
1 parent dd7f1df commit 15dbbee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
5 changes: 1 addition & 4 deletions script/graphql/build-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ const fs = require('fs')
function prependDatedEntry (changelogEntry, targetPath) {
// Build a `yyyy-mm-dd`-formatted date string
// and tag the changelog entry with it
const today = new Date()
const todayString = String(today.getFullYear()) + '-' +
String(today.getMonth() + 1).padStart(2, '0') + '-' +
String(today.getDate()).padStart(2, '0')
const today = new Date().toISOString().slice(0, 10)
changelogEntry.date = todayString

const previousChangelogString = fs.readFileSync(targetPath)
Expand Down
13 changes: 4 additions & 9 deletions script/graphql/update-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,15 @@ async function main () {

// 2. UPDATE UPCOMING CHANGES
const upcomingChangesPath = getDataFilepath('upcomingChanges', graphqlVersion)
let previousUpcomingChanges = null
if (fs.existsSync(upcomingChangesPath)) {
previousUpcomingChanges = yaml.safeLoad(fs.readFileSync(upcomingChangesPath, 'utf8'))
}
const previousUpcomingChanges = yaml.safeLoad(fs.readFileSync(upcomingChangesPath, 'utf8'))
const safeForPublicChanges = await getRemoteRawContent(upcomingChangesPath, graphqlVersion)
updateFile(upcomingChangesPath, safeForPublicChanges)
upcomingChangesJson[graphqlVersion] = await processUpcomingChanges(safeForPublicChanges)

// 3. UPDATE SCHEMAS
// note: schemas live in separate files per version
const schemaPath = getDataFilepath('schemas', graphqlVersion)
let previousSchemaString = null
if (fs.existsSync(upcomingChangesPath)) {
previousSchemaString = fs.readFileSync(schemaPath, 'utf8')
}
const previousSchemaString = fs.readFileSync(schemaPath, 'utf8')
const latestSchema = await getRemoteRawContent(schemaPath, graphqlVersion)
const safeForPublicSchema = removeHiddenMembers(schemaPath, latestSchema)
updateFile(schemaPath, safeForPublicSchema)
Expand All @@ -83,9 +77,10 @@ async function main () {
// because the objects page is too big to render on page load
prerenderedObjects[graphqlVersion] = await prerenderObjects(schemaJsonPerVersion)

// 5. UPDATE CHANGELOG
if (allVersions[version].nonEnterpriseDefault) {
// The Changelog is only build for free-pro-team@latest
const changelogEntry = createChangelogEntry(
const changelogEntry = await createChangelogEntry(
previousSchemaString,
safeForPublicSchema,
safeForPublicPreviews,
Expand Down

0 comments on commit 15dbbee

Please sign in to comment.