Skip to content

Commit 15dbbee

Browse files
Robert Mosolgosarahs
andauthored
Apply suggestions from code review
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
1 parent dd7f1df commit 15dbbee

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

script/graphql/build-changelog.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ const fs = require('fs')
1212
function prependDatedEntry (changelogEntry, targetPath) {
1313
// Build a `yyyy-mm-dd`-formatted date string
1414
// and tag the changelog entry with it
15-
const today = new Date()
16-
const todayString = String(today.getFullYear()) + '-' +
17-
String(today.getMonth() + 1).padStart(2, '0') + '-' +
18-
String(today.getDate()).padStart(2, '0')
15+
const today = new Date().toISOString().slice(0, 10)
1916
changelogEntry.date = todayString
2017

2118
const previousChangelogString = fs.readFileSync(targetPath)

script/graphql/update-files.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,15 @@ async function main () {
5858

5959
// 2. UPDATE UPCOMING CHANGES
6060
const upcomingChangesPath = getDataFilepath('upcomingChanges', graphqlVersion)
61-
let previousUpcomingChanges = null
62-
if (fs.existsSync(upcomingChangesPath)) {
63-
previousUpcomingChanges = yaml.safeLoad(fs.readFileSync(upcomingChangesPath, 'utf8'))
64-
}
61+
const previousUpcomingChanges = yaml.safeLoad(fs.readFileSync(upcomingChangesPath, 'utf8'))
6562
const safeForPublicChanges = await getRemoteRawContent(upcomingChangesPath, graphqlVersion)
6663
updateFile(upcomingChangesPath, safeForPublicChanges)
6764
upcomingChangesJson[graphqlVersion] = await processUpcomingChanges(safeForPublicChanges)
6865

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

80+
// 5. UPDATE CHANGELOG
8681
if (allVersions[version].nonEnterpriseDefault) {
8782
// The Changelog is only build for free-pro-team@latest
88-
const changelogEntry = createChangelogEntry(
83+
const changelogEntry = await createChangelogEntry(
8984
previousSchemaString,
9085
safeForPublicSchema,
9186
safeForPublicPreviews,

0 commit comments

Comments
 (0)