Merge pull request #20017 from github/upgrade-esm
Enforce and Move to Top Level require
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
const parse = require('./read-frontmatter')
|
||||
const layoutNames = Object.keys(require('./layouts')).concat([false])
|
||||
const semver = require('semver')
|
||||
const layouts = require('./layouts')
|
||||
|
||||
const semverValidRange = semver.validRange
|
||||
const layoutNames = Object.keys(layouts).concat([false])
|
||||
const semverRange = {
|
||||
type: 'string',
|
||||
conform: require('semver').validRange,
|
||||
conform: semverValidRange,
|
||||
message: 'Must be a valid SemVer range'
|
||||
}
|
||||
const versionIds = Object.keys(require('./all-versions'))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const path = require('path')
|
||||
const patterns = require('../patterns')
|
||||
const supportedVersions = new Set(Object.keys(require('../all-versions')))
|
||||
const allVersions = require('../all-versions')
|
||||
const supportedVersions = new Set(Object.keys(allVersions))
|
||||
const getOldPathsFromPermalink = require('./get-old-paths-from-permalink')
|
||||
const { getVersionStringFromPath } = require('../path-utils')
|
||||
const { getNewVersionedPath } = require('../old-versions-utils')
|
||||
|
||||
@@ -6,7 +6,7 @@ const operations = {}
|
||||
fs.readdirSync(schemasPath)
|
||||
.forEach(filename => {
|
||||
const key = filename.replace('.json', '')
|
||||
const value = require(path.join(schemasPath, filename))
|
||||
const value = JSON.parse(fs.readFileSync(path.join(schemasPath, filename)))
|
||||
operations[key] = value
|
||||
})
|
||||
const allVersions = require('../all-versions')
|
||||
|
||||
@@ -19,7 +19,7 @@ versions.forEach(version => {
|
||||
// payload file: /path/to/check_run.completed.payload.json
|
||||
// payload path: check_run.completed
|
||||
const payloadPath = path.basename(payloadFile).replace('.payload.json', '')
|
||||
set(payloadsPerVersion, payloadPath, formatAsJsonCodeBlock(require(payloadFile)))
|
||||
set(payloadsPerVersion, payloadPath, formatAsJsonCodeBlock(JSON.parse(fs.readFileSync(payloadFile))))
|
||||
})
|
||||
|
||||
payloads[version] = payloadsPerVersion
|
||||
|
||||
Reference in New Issue
Block a user