Merge branch 'main' into repo-sync
This commit is contained in:
@@ -31,6 +31,7 @@ A time-based one-time password (TOTP) application automatically generates an aut
|
|||||||
- [1Password](https://support.1password.com/one-time-passwords/)
|
- [1Password](https://support.1password.com/one-time-passwords/)
|
||||||
- [Authy](https://authy.com/guides/github/)
|
- [Authy](https://authy.com/guides/github/)
|
||||||
- [LastPass Authenticator](https://lastpass.com/auth/)
|
- [LastPass Authenticator](https://lastpass.com/auth/)
|
||||||
|
- [Microsoft Authenticator](https://www.microsoft.com/en-us/account/authenticator/)
|
||||||
|
|
||||||
{% tip %}
|
{% tip %}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module.exports = function dataDirectory (dir, opts = {}) {
|
|||||||
break
|
break
|
||||||
case '.yaml':
|
case '.yaml':
|
||||||
case '.yml':
|
case '.yml':
|
||||||
set(data, key, yaml.safeLoad(fileContent, { filename }))
|
set(data, key, yaml.load(fileContent, { filename }))
|
||||||
break
|
break
|
||||||
case '.md':
|
case '.md':
|
||||||
case '.markdown':
|
case '.markdown':
|
||||||
|
|||||||
@@ -222,7 +222,9 @@ class Page {
|
|||||||
const { page } = guide
|
const { page } = guide
|
||||||
guide.type = page.type
|
guide.type = page.type
|
||||||
if (page.topics) {
|
if (page.topics) {
|
||||||
this.allTopics = union(this.allTopics, page.topics)
|
this.allTopics = union(this.allTopics, page.topics).sort(
|
||||||
|
(a, b) => a.localeCompare(b, page.languageCode)
|
||||||
|
)
|
||||||
guide.topics = page.topics
|
guide.topics = page.topics
|
||||||
}
|
}
|
||||||
delete guide.page
|
delete guide.page
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const getAlgoliaClient = require('./algolia-client')
|
|||||||
|
|
||||||
module.exports = async function getRemoteIndexNames () {
|
module.exports = async function getRemoteIndexNames () {
|
||||||
const algoliaClient = getAlgoliaClient()
|
const algoliaClient = getAlgoliaClient()
|
||||||
const indices = await algoliaClient.listIndexes()
|
const indices = await algoliaClient.listIndices()
|
||||||
|
|
||||||
// ignore other indices that may be present in the Algolia account like `helphub-`, etc
|
// ignore other indices that may be present in the Algolia account like `helphub-`, etc
|
||||||
const indexNames = indices.items
|
const indexNames = indices.items
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class AlgoliaIndex {
|
|||||||
const client = getAlgoliaClient()
|
const client = getAlgoliaClient()
|
||||||
|
|
||||||
// return an empty array if the index does not exist yet
|
// return an empty array if the index does not exist yet
|
||||||
const { items: indices } = await client.listIndexes()
|
const { items: indices } = await client.listIndices()
|
||||||
|
|
||||||
if (!indices.find(index => index.name === this.name)) {
|
if (!indices.find(index => index.name === this.name)) {
|
||||||
console.log(`index '${this.name}' does not exist!`)
|
console.log(`index '${this.name}' does not exist!`)
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ module.exports = function (app) {
|
|||||||
|
|
||||||
// *** Security ***
|
// *** Security ***
|
||||||
app.use(require('./cors'))
|
app.use(require('./cors'))
|
||||||
app.use(require('./csp')) // Must come before helmet
|
|
||||||
app.use(require('helmet')())
|
app.use(require('helmet')())
|
||||||
|
app.use(require('./csp')) // Must come after helmet
|
||||||
app.use(require('./cookie-parser')) // Must come before csrf
|
app.use(require('./cookie-parser')) // Must come before csrf
|
||||||
app.use(express.json()) // Must come before csrf
|
app.use(express.json()) // Must come before csrf
|
||||||
app.use(require('./csrf'))
|
app.use(require('./csrf'))
|
||||||
|
|||||||
7400
package-lock.json
generated
7400
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
174
package.json
174
package.json
@@ -9,80 +9,80 @@
|
|||||||
},
|
},
|
||||||
"license": "(MIT AND CC-BY-4.0)",
|
"license": "(MIT AND CC-BY-4.0)",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.12.9",
|
"@babel/core": "^7.14.3",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||||
"@babel/plugin-syntax-class-properties": "^7.12.1",
|
"@babel/plugin-syntax-class-properties": "^7.12.1",
|
||||||
"@babel/plugin-transform-modules-amd": "^7.12.1",
|
"@babel/plugin-transform-modules-amd": "^7.14.2",
|
||||||
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
|
"@babel/plugin-transform-modules-commonjs": "^7.14.0",
|
||||||
"@babel/plugin-transform-react-jsx": "^7.12.7",
|
"@babel/plugin-transform-react-jsx": "^7.14.3",
|
||||||
"@babel/plugin-transform-runtime": "^7.11.0",
|
"@babel/plugin-transform-runtime": "^7.14.3",
|
||||||
"@babel/preset-env": "^7.12.7",
|
"@babel/preset-env": "^7.14.2",
|
||||||
"@babel/preset-react": "^7.12.7",
|
"@babel/preset-react": "^7.13.13",
|
||||||
"@babel/runtime": "^7.11.2",
|
"@babel/runtime": "^7.14.0",
|
||||||
"@graphql-inspector/core": "^2.3.0",
|
"@graphql-inspector/core": "^2.5.0",
|
||||||
"@graphql-tools/load": "^6.2.5",
|
"@graphql-tools/load": "^6.2.8",
|
||||||
"@primer/components": "^28.0.1",
|
"@primer/components": "^28.0.4",
|
||||||
"@primer/css": "^16.2.0",
|
"@primer/css": "^16.2.0",
|
||||||
"@primer/octicons": "^13.0.0",
|
"@primer/octicons": "^14.1.0",
|
||||||
"@primer/octicons-react": "^13.0.0",
|
"@primer/octicons-react": "^14.1.0",
|
||||||
"ajv": "^6.11.0",
|
"ajv": "^6.11.0",
|
||||||
"algoliasearch": "^3.35.1",
|
"algoliasearch": "^4.9.1",
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.2.2",
|
||||||
"babel-preset-env": "^1.7.0",
|
"babel-preset-env": "^1.7.0",
|
||||||
"browser-date-formatter": "^3.0.3",
|
"browser-date-formatter": "^3.0.3",
|
||||||
"change-case": "^3.1.0",
|
"change-case": "^4.1.2",
|
||||||
"cheerio": "^1.0.0-rc.3",
|
"cheerio": "^1.0.0-rc.3",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"connect-datadog": "0.0.9",
|
"connect-datadog": "0.0.9",
|
||||||
"connect-slashes": "^1.4.0",
|
"connect-slashes": "^1.4.0",
|
||||||
"cookie-parser": "^1.4.5",
|
"cookie-parser": "^1.4.5",
|
||||||
"copy-webpack-plugin": "^6.0.3",
|
"copy-webpack-plugin": "^8.1.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.3",
|
||||||
"css-loader": "^4.3.0",
|
"css-loader": "^5.2.4",
|
||||||
"csurf": "^1.11.0",
|
"csurf": "^1.11.0",
|
||||||
"date-fns": "^2.21.3",
|
"date-fns": "^2.21.3",
|
||||||
"directory-tree": "^2.2.5",
|
"directory-tree": "^2.2.9",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^9.0.2",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-rate-limit": "^5.1.3",
|
"express-rate-limit": "^5.2.6",
|
||||||
"express-timeout-handler": "^2.2.0",
|
"express-timeout-handler": "^2.2.0",
|
||||||
"flat": "^5.0.0",
|
"flat": "^5.0.2",
|
||||||
"github-slugger": "^1.2.1",
|
"github-slugger": "^1.3.0",
|
||||||
"got": "^9.6.0",
|
"got": "^11.8.2",
|
||||||
"gray-matter": "^4.0.2",
|
"gray-matter": "^4.0.3",
|
||||||
"hast-util-from-parse5": "^6.0.1",
|
"hast-util-from-parse5": "^6.0.1",
|
||||||
"hast-util-parse-selector": "^2.2.5",
|
"hast-util-parse-selector": "^2.2.5",
|
||||||
"hast-util-select": "^4.0.2",
|
"hast-util-select": "^4.0.2",
|
||||||
"hast-util-to-string": "^1.0.4",
|
"hast-util-to-string": "^1.0.4",
|
||||||
"hastscript": "^6.0.0",
|
"hastscript": "^6.0.0",
|
||||||
"helmet": "^3.21.2",
|
"helmet": "^4.6.0",
|
||||||
"highlightjs-graphql": "^1.0.2",
|
"highlightjs-graphql": "^1.0.2",
|
||||||
"hot-shots": "^8.2.0",
|
"hot-shots": "^8.3.1",
|
||||||
"html-entities": "^1.2.1",
|
"html-entities": "^1.2.1",
|
||||||
"imurmurhash": "^0.1.4",
|
"imurmurhash": "^0.1.4",
|
||||||
"is-url": "^1.2.4",
|
"is-url": "^1.2.4",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"js-yaml": "^3.14.0",
|
"js-yaml": "^4.1.0",
|
||||||
"linkinator": "^2.13.6",
|
"linkinator": "^2.13.6",
|
||||||
"liquidjs": "^9.22.1",
|
"liquidjs": "^9.22.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lunr": "^2.3.9",
|
"lunr": "^2.3.9",
|
||||||
"lunr-languages": "^1.4.0",
|
"lunr-languages": "^1.4.0",
|
||||||
"mdast-util-from-markdown": "^0.8.4",
|
"mdast-util-from-markdown": "^0.8.4",
|
||||||
"mini-css-extract-plugin": "^1.4.1",
|
"mini-css-extract-plugin": "^1.6.0",
|
||||||
"mkdirp": "^1.0.3",
|
"mkdirp": "^1.0.4",
|
||||||
"morgan": "^1.9.1",
|
"morgan": "^1.10.0",
|
||||||
"next": "^10.2.0",
|
"next": "^10.2.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"parse5": "^6.0.1",
|
"parse5": "^6.0.1",
|
||||||
"port-used": "^2.0.8",
|
"port-used": "^2.0.8",
|
||||||
"rate-limit-redis": "^2.1.0",
|
"rate-limit-redis": "^2.1.0",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.2",
|
||||||
"redis": "^3.1.1",
|
"redis": "^3.1.2",
|
||||||
"redis-mock": "^0.56.3",
|
"redis-mock": "^0.56.3",
|
||||||
"rehype-autolink-headings": "^2.0.5",
|
"rehype-autolink-headings": "^2.0.5",
|
||||||
"rehype-highlight": "^4.1.0",
|
"rehype-highlight": "^4.1.0",
|
||||||
@@ -93,89 +93,89 @@
|
|||||||
"remark-gemoji-to-emoji": "^1.1.0",
|
"remark-gemoji-to-emoji": "^1.1.0",
|
||||||
"remark-parse": "^7.0.2",
|
"remark-parse": "^7.0.2",
|
||||||
"remark-rehype": "^5.0.0",
|
"remark-rehype": "^5.0.0",
|
||||||
"resolve-url-loader": "^3.1.2",
|
"resolve-url-loader": "^4.0.0",
|
||||||
"revalidator": "^0.3.1",
|
"revalidator": "^0.3.1",
|
||||||
"rimraf": "^3.0.0",
|
"rimraf": "^3.0.2",
|
||||||
"rss-parser": "^3.12.0",
|
"rss-parser": "^3.12.0",
|
||||||
"sass": "^1.26.3",
|
"sass": "^1.32.13",
|
||||||
"sass-loader": "^9.0.2",
|
"sass-loader": "^11.1.1",
|
||||||
"search-with-your-keyboard": "1.1.0",
|
"search-with-your-keyboard": "1.1.0",
|
||||||
"semver": "^5.7.1",
|
"semver": "^7.3.5",
|
||||||
"slash": "^3.0.0",
|
"slash": "^3.0.0",
|
||||||
"strip-html-comments": "^1.0.0",
|
"strip-html-comments": "^1.0.0",
|
||||||
"style-loader": "^1.2.1",
|
"style-loader": "^2.0.0",
|
||||||
"styled-components": "^5.3.0",
|
"styled-components": "^5.3.0",
|
||||||
"throng": "^5.0.0",
|
"throng": "^5.0.0",
|
||||||
"unified": "^8.4.2",
|
"unified": "^8.4.2",
|
||||||
"unist-util-visit": "^2.0.3",
|
"unist-util-visit": "^2.0.3",
|
||||||
"uuid": "^8.3.0",
|
"uuid": "^8.3.2",
|
||||||
"walk-sync": "^1.1.4",
|
"walk-sync": "^2.2.0",
|
||||||
"webpack": "^5.30.0",
|
"webpack": "^5.37.0",
|
||||||
"webpack-cli": "^4.6.0"
|
"webpack-cli": "^4.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.7",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/github": "^5.0.0",
|
||||||
"@octokit/rest": "^16.43.2",
|
"@octokit/rest": "^18.5.3",
|
||||||
"@types/lodash": "^4.14.168",
|
"@types/lodash": "^4.14.169",
|
||||||
"@types/react": "^17.0.4",
|
"@types/react": "^17.0.6",
|
||||||
"@types/react-dom": "^17.0.3",
|
"@types/react-dom": "^17.0.5",
|
||||||
"async": "^3.2.0",
|
"async": "^3.2.0",
|
||||||
"await-sleep": "0.0.1",
|
"await-sleep": "0.0.1",
|
||||||
"aws-sdk": "^2.610.0",
|
"aws-sdk": "^2.909.0",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-plugin-styled-components": "^1.12.0",
|
"babel-plugin-styled-components": "^1.12.0",
|
||||||
"chalk": "^4.0.0",
|
"chalk": "^4.1.1",
|
||||||
"commander": "^6.2.0",
|
"commander": "^7.2.0",
|
||||||
"count-array-values": "^1.2.1",
|
"count-array-values": "^1.2.1",
|
||||||
"csp-parse": "0.0.2",
|
"csp-parse": "0.0.2",
|
||||||
"csv-parse": "^4.8.8",
|
"csv-parse": "^4.15.4",
|
||||||
"csv-parser": "^2.3.3",
|
"csv-parser": "^3.0.0",
|
||||||
"dedent": "^0.7.0",
|
"dedent": "^0.7.0",
|
||||||
"del": "^4.1.1",
|
"del": "^6.0.0",
|
||||||
"domwaiter": "^1.1.0",
|
"domwaiter": "^1.3.0",
|
||||||
"eslint": "^7.13.0",
|
"eslint": "^7.26.0",
|
||||||
"eslint-config-standard": "^16.0.1",
|
"eslint-config-standard": "^16.0.2",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.23.2",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^5.1.0",
|
||||||
"event-to-promise": "^0.8.0",
|
"event-to-promise": "^0.8.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.7",
|
||||||
"graphql": "^14.5.8",
|
"graphql": "^15.5.0",
|
||||||
"heroku-client": "^3.1.0",
|
"heroku-client": "^3.1.0",
|
||||||
"http-status-code": "^2.1.0",
|
"http-status-code": "^2.1.0",
|
||||||
"husky": "^4.2.1",
|
"husky": "^6.0.0",
|
||||||
"image-size": "^0.7.4",
|
"image-size": "^1.0.0",
|
||||||
"japanese-characters": "^1.1.0",
|
"japanese-characters": "^1.1.0",
|
||||||
"javascript-stringify": "^2.0.1",
|
"javascript-stringify": "^2.1.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"jest-expect-message": "^1.0.2",
|
"jest-expect-message": "^1.0.2",
|
||||||
"jest-github-actions-reporter": "^1.0.2",
|
"jest-github-actions-reporter": "^1.0.3",
|
||||||
"jest-puppeteer": "^4.4.0",
|
"jest-puppeteer": "^5.0.3",
|
||||||
"jest-silent-reporter": "^0.2.1",
|
"jest-silent-reporter": "^0.5.0",
|
||||||
"jest-slow-test-reporter": "^1.0.0",
|
"jest-slow-test-reporter": "^1.0.0",
|
||||||
"jimp": "^0.16.1",
|
"jimp": "^0.16.1",
|
||||||
"make-promises-safe": "^5.1.0",
|
"make-promises-safe": "^5.1.0",
|
||||||
"mime": "^2.4.4",
|
"mime": "^2.4.4",
|
||||||
"mock-express-response": "^0.2.2",
|
"mock-express-response": "^0.3.0",
|
||||||
"mockdate": "^3.0.2",
|
"mockdate": "^3.0.5",
|
||||||
"nock": "^13.0.4",
|
"nock": "^13.0.11",
|
||||||
"nodemon": "^2.0.4",
|
"nodemon": "^2.0.7",
|
||||||
"npm-merge-driver-install": "^2.0.0",
|
"npm-merge-driver-install": "^2.0.1",
|
||||||
"object-hash": "^2.0.1",
|
"object-hash": "^2.1.1",
|
||||||
"pa11y-ci": "^2.4.0",
|
"pa11y-ci": "^2.4.1",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.3.0",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"puppeteer": "^5.5.0",
|
"puppeteer": "^9.1.1",
|
||||||
"replace": "^1.2.0",
|
"replace": "^1.2.1",
|
||||||
"robots-parser": "^2.1.1",
|
"robots-parser": "^2.3.0",
|
||||||
"start-server-and-test": "^1.12.0",
|
"start-server-and-test": "^1.12.2",
|
||||||
"strip-ansi": "^6.0.0",
|
"strip-ansi": "^7.0.0",
|
||||||
"supertest": "^4.0.2",
|
"supertest": "^6.1.3",
|
||||||
"typescript": "^4.2.4",
|
"typescript": "^4.2.4",
|
||||||
"url-template": "^2.0.8",
|
"url-template": "^2.0.8",
|
||||||
"webpack-dev-middleware": "^4.1.0",
|
"webpack-dev-middleware": "^4.2.0",
|
||||||
"website-scraper": "^4.2.0",
|
"website-scraper": "^4.2.3",
|
||||||
"xlsx-populate": "^1.21.0"
|
"xlsx-populate": "^1.21.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ const languagesToSkip = Object.keys(require('../lib/languages'))
|
|||||||
const enterpriseReleasesToSkip = new RegExp(`${root}.+?[/@](${deprecated.join('|')})(/|$)`)
|
const enterpriseReleasesToSkip = new RegExp(`${root}.+?[/@](${deprecated.join('|')})(/|$)`)
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
path: program.path || englishRoot,
|
path: program.opts().path || englishRoot,
|
||||||
concurrency: 300,
|
concurrency: 300,
|
||||||
// If this is a dry run, turn off recursion.
|
// If this is a dry run, turn off recursion.
|
||||||
recurse: !program.dryRun,
|
recurse: !program.opts().dryRun,
|
||||||
silent: true,
|
silent: true,
|
||||||
// The values in this array are treated as regexes.
|
// The values in this array are treated as regexes.
|
||||||
linksToSkip: [
|
linksToSkip: [
|
||||||
@@ -86,7 +86,7 @@ async function main () {
|
|||||||
// Without this, undefined codes get JSON.stringified as `0`, which is not useful output.
|
// Without this, undefined codes get JSON.stringified as `0`, which is not useful output.
|
||||||
.map(link => { link.status = link.status || 'Invalid'; return link })
|
.map(link => { link.status = link.status || 'Invalid'; return link })
|
||||||
|
|
||||||
if (!program.doNotRetry) {
|
if (!program.opts().doNotRetry) {
|
||||||
// Links to retry individually.
|
// Links to retry individually.
|
||||||
const linksToRetry = brokenLinks
|
const linksToRetry = brokenLinks
|
||||||
.filter(link => retryStatusCodes.includes(link.status))
|
.filter(link => retryStatusCodes.includes(link.status))
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const path = require('path')
|
|||||||
const yaml = require('js-yaml')
|
const yaml = require('js-yaml')
|
||||||
const inputFile = path.join(__dirname, '../data/glossary.yml')
|
const inputFile = path.join(__dirname, '../data/glossary.yml')
|
||||||
|
|
||||||
const glossary = yaml.safeLoad(fs.readFileSync(inputFile, 'utf8'))
|
const glossary = yaml.load(fs.readFileSync(inputFile, 'utf8'))
|
||||||
|
|
||||||
console.log(glossary)
|
console.log(glossary)
|
||||||
const external = []
|
const external = []
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ program
|
|||||||
.option('-u, --unlink', 'remove the symlinks')
|
.option('-u, --unlink', 'remove the symlinks')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const { pathToEarlyAccessRepo, unlink } = program
|
const { pathToEarlyAccessRepo, unlink } = program.opts()
|
||||||
|
|
||||||
if (!pathToEarlyAccessRepo && !unlink) {
|
if (!pathToEarlyAccessRepo && !unlink) {
|
||||||
throw new Error('Must provide either `--path-to-early-access-repo <PATH>` or `--unlink`')
|
throw new Error('Must provide either `--path-to-early-access-repo <PATH>` or `--unlink`')
|
||||||
|
|||||||
@@ -25,17 +25,19 @@ program
|
|||||||
.option('-r, --remove', 'Remove "early-access" from data and image paths.')
|
.option('-r, --remove', 'Remove "early-access" from data and image paths.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
if (!(program.add || program.remove)) {
|
const { add, remove, pathToEarlyAccessContentFile } = program.opts()
|
||||||
|
|
||||||
|
if (!(add || remove)) {
|
||||||
console.error('Error! Must specify either `--add` or `--remove`.')
|
console.error('Error! Must specify either `--add` or `--remove`.')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
let earlyAccessContentAndDataFiles
|
let earlyAccessContentAndDataFiles
|
||||||
if (program.pathToEarlyAccessContentFile) {
|
if (pathToEarlyAccessContentFile) {
|
||||||
earlyAccessContentAndDataFiles = path.posix.join(process.cwd(), program.pathToEarlyAccessContentFile)
|
earlyAccessContentAndDataFiles = path.posix.join(process.cwd(), pathToEarlyAccessContentFile)
|
||||||
|
|
||||||
if (!fs.existsSync(earlyAccessContentAndDataFiles)) {
|
if (!fs.existsSync(earlyAccessContentAndDataFiles)) {
|
||||||
console.error(`Error! ${program.pathToEarlyAccessContentFile} can't be found. Make sure the path starts with 'content/early-access'.`)
|
console.error(`Error! ${pathToEarlyAccessContentFile} can't be found. Make sure the path starts with 'content/early-access'.`)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
earlyAccessContentAndDataFiles = [earlyAccessContentAndDataFiles]
|
earlyAccessContentAndDataFiles = [earlyAccessContentAndDataFiles]
|
||||||
@@ -60,7 +62,7 @@ earlyAccessContentAndDataFiles
|
|||||||
|
|
||||||
const replacements = {}
|
const replacements = {}
|
||||||
|
|
||||||
if (program.add) {
|
if (add) {
|
||||||
dataRefs
|
dataRefs
|
||||||
// Since we're adding early-access to the path, filter for those that do not already include it
|
// Since we're adding early-access to the path, filter for those that do not already include it
|
||||||
.filter(dataRef => !dataRef.includes('data early-access.'))
|
.filter(dataRef => !dataRef.includes('data early-access.'))
|
||||||
@@ -78,7 +80,7 @@ earlyAccessContentAndDataFiles
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (program.remove) {
|
if (remove) {
|
||||||
dataRefs
|
dataRefs
|
||||||
// Since we're removing early-access from the path, filter for those that include it
|
// Since we're removing early-access from the path, filter for those that include it
|
||||||
.filter(dataRef => dataRef.includes('{% data early-access.'))
|
.filter(dataRef => dataRef.includes('{% data early-access.'))
|
||||||
@@ -131,7 +133,7 @@ function checkVariable (dataRef) {
|
|||||||
if (!fs.existsSync(variablePath)) return false
|
if (!fs.existsSync(variablePath)) return false
|
||||||
|
|
||||||
// If the variable file exists but doesn't have the referenced key, exclude it
|
// If the variable file exists but doesn't have the referenced key, exclude it
|
||||||
const variableFileContent = yaml.safeLoad(fs.readFileSync(variablePath, 'utf8'))
|
const variableFileContent = yaml.load(fs.readFileSync(variablePath, 'utf8'))
|
||||||
return variableFileContent[variableKey]
|
return variableFileContent[variableKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ program
|
|||||||
.option('-d, --dry-run', 'only scrape the first 10 pages for testing purposes')
|
.option('-d, --dry-run', 'only scrape the first 10 pages for testing purposes')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const pathToArchivalRepo = program.pathToArchivalRepo
|
const pathToArchivalRepo = program.opts().pathToArchivalRepo
|
||||||
const dryRun = program.dryRun
|
const dryRun = program.opts().dryRun
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ program
|
|||||||
.option('-r, --release <NUMBER>', 'Enterprise Server release number. Example: 2.19')
|
.option('-r, --release <NUMBER>', 'Enterprise Server release number. Example: 2.19')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
|
const release = program.opts().release
|
||||||
|
|
||||||
// verify CLI options
|
// verify CLI options
|
||||||
if (!program.release) {
|
if (!release) {
|
||||||
console.log(program.description() + '\n')
|
console.log(program.description() + '\n')
|
||||||
program.options.forEach(opt => {
|
program.options.forEach(opt => {
|
||||||
console.log(opt.flags)
|
console.log(opt.flags)
|
||||||
@@ -36,13 +38,13 @@ if (!program.release) {
|
|||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enterpriseServerReleases.all.includes(program.release)) {
|
if (!enterpriseServerReleases.all.includes(release)) {
|
||||||
console.log(`You specified ${program.release}! Please specify a supported or deprecated release number from lib/enterprise-server-releases.js`)
|
console.log(`You specified ${release}! Please specify a supported or deprecated release number from lib/enterprise-server-releases.js`)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const versionToDeprecate = `enterprise-server@${program.release}`
|
const versionToDeprecate = `enterprise-server@${release}`
|
||||||
const currentIndex = indexOf(enterpriseServerReleases.all, program.release)
|
const currentIndex = indexOf(enterpriseServerReleases.all, release)
|
||||||
const nextOldestRelease = nth(enterpriseServerReleases.all, currentIndex - 1)
|
const nextOldestRelease = nth(enterpriseServerReleases.all, currentIndex - 1)
|
||||||
const nextOldestVersion = `enterprise-server@${nextOldestRelease}`
|
const nextOldestVersion = `enterprise-server@${nextOldestRelease}`
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ program
|
|||||||
.option('-o, --oldVersion <version>', 'The version to copy the files from. Must be in <plan@release> format.')
|
.option('-o, --oldVersion <version>', 'The version to copy the files from. Must be in <plan@release> format.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const newVersion = program.newVersion
|
const newVersion = program.opts().newVersion
|
||||||
const oldVersion = program.oldVersion
|
const oldVersion = program.opts().oldVersion
|
||||||
|
|
||||||
if (!(newVersion && oldVersion)) {
|
if (!(newVersion && oldVersion)) {
|
||||||
console.log('Error! You must provide --newVersion and --oldVersion.')
|
console.log('Error! You must provide --newVersion and --oldVersion.')
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ program
|
|||||||
.option('-o, --oldVersion <version>', 'The existing version to copy the REST files from. Must be in <plan@release> format.')
|
.option('-o, --oldVersion <version>', 'The existing version to copy the REST files from. Must be in <plan@release> format.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const newVersion = program.newVersion
|
const newVersion = program.opts().newVersion
|
||||||
const oldVersion = program.oldVersion
|
const oldVersion = program.opts().oldVersion
|
||||||
|
|
||||||
if (!(newVersion && oldVersion)) {
|
if (!(newVersion && oldVersion)) {
|
||||||
console.log('Error! You must provide --newVersion and --oldVersion.')
|
console.log('Error! You must provide --newVersion and --oldVersion.')
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ program
|
|||||||
.option('-o, --oldVersion <version>', 'The version to copy the payloads from. Must be in <plan@release> format.')
|
.option('-o, --oldVersion <version>', 'The version to copy the payloads from. Must be in <plan@release> format.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const newVersion = program.newVersion
|
const newVersion = program.opts().newVersion
|
||||||
const oldVersion = program.oldVersion
|
const oldVersion = program.opts().oldVersion
|
||||||
|
|
||||||
if (!(newVersion && oldVersion)) {
|
if (!(newVersion && oldVersion)) {
|
||||||
console.log('Error! You must provide --newVersion and --oldVersion.')
|
console.log('Error! You must provide --newVersion and --oldVersion.')
|
||||||
|
|||||||
@@ -27,20 +27,22 @@ program
|
|||||||
.option('-t, --translations', 'Run the script on content and data in translations too.')
|
.option('-t, --translations', 'Run the script on content and data in translations too.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
if (!program.ghesRelease) {
|
const { ghesRelease, products, translations } = program.opts()
|
||||||
|
|
||||||
|
if (!ghesRelease) {
|
||||||
console.error('Must provide an Enterprise Server release number!')
|
console.error('Must provide an Enterprise Server release number!')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`✅ Adding AE versioning based on GHES ${program.ghesRelease} versioning`)
|
console.log(`✅ Adding AE versioning based on GHES ${ghesRelease} versioning`)
|
||||||
|
|
||||||
if (program.products) {
|
if (products) {
|
||||||
console.log(`✅ Running on the following products: ${program.products}`)
|
console.log(`✅ Running on the following products: ${products}`)
|
||||||
} else {
|
} else {
|
||||||
console.log('✅ Running on all products')
|
console.log('✅ Running on all products')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (program.translations) {
|
if (translations) {
|
||||||
console.log('✅ Running on both English and translated content and data\n')
|
console.log('✅ Running on both English and translated content and data\n')
|
||||||
} else {
|
} else {
|
||||||
console.log('✅ Running on English content and data\n')
|
console.log('✅ Running on English content and data\n')
|
||||||
@@ -59,8 +61,8 @@ const englishContentFiles = walkContent(contentPath)
|
|||||||
const englishDataFiles = walkData(dataPath)
|
const englishDataFiles = walkData(dataPath)
|
||||||
|
|
||||||
function walkContent (dirPath) {
|
function walkContent (dirPath) {
|
||||||
const products = program.products || ['']
|
const productArray = products || ['']
|
||||||
return products.map(product => {
|
return productArray.map(product => {
|
||||||
dirPath = path.join(contentPath, product)
|
dirPath = path.join(contentPath, product)
|
||||||
return walk(dirPath, { includeBasePath: true, directories: false })
|
return walk(dirPath, { includeBasePath: true, directories: false })
|
||||||
.filter(file => file.includes('/content/'))
|
.filter(file => file.includes('/content/'))
|
||||||
@@ -76,7 +78,7 @@ function walkData (dirPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let allContentFiles, allDataFiles
|
let allContentFiles, allDataFiles
|
||||||
if (program.translations) {
|
if (translations) {
|
||||||
const translatedContentFiles = walkContent(translationsPath)
|
const translatedContentFiles = walkContent(translationsPath)
|
||||||
const translatedDataFiles = walkData(translationsPath)
|
const translatedDataFiles = walkData(translationsPath)
|
||||||
allContentFiles = englishContentFiles.concat(translatedContentFiles)
|
allContentFiles = englishContentFiles.concat(translatedContentFiles)
|
||||||
@@ -113,7 +115,7 @@ allContentFiles
|
|||||||
const { data, content } = frontmatter(fs.readFileSync(file, 'utf8'))
|
const { data, content } = frontmatter(fs.readFileSync(file, 'utf8'))
|
||||||
|
|
||||||
// Return early if the current page frontmatter does not apply to either GHAE or the given GHES release
|
// Return early if the current page frontmatter does not apply to either GHAE or the given GHES release
|
||||||
if (!(data.versions['github-ae'] || versionSatisfiesRange(program.ghesRelease, data.versions['enterprise-server']))) return
|
if (!(data.versions['github-ae'] || versionSatisfiesRange(ghesRelease, data.versions['enterprise-server']))) return
|
||||||
|
|
||||||
const conditionalsToUpdate = getConditionalsToUpdate(content)
|
const conditionalsToUpdate = getConditionalsToUpdate(content)
|
||||||
if (!conditionalsToUpdate.length) return
|
if (!conditionalsToUpdate.length) return
|
||||||
@@ -181,5 +183,5 @@ function doesReleaseSatisfyConditional (enterpriseServerMatch) {
|
|||||||
// Example range: >2.21
|
// Example range: >2.21
|
||||||
const range = `${semverOperator}${number}`
|
const range = `${semverOperator}${number}`
|
||||||
|
|
||||||
return versionSatisfiesRange(program.ghesRelease, range)
|
return versionSatisfiesRange(ghesRelease, range)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ if (!(Object.keys(allVersions).includes(options.version))) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the release candidate variable
|
// Load the release candidate variable
|
||||||
const releaseCandidateData = yaml.safeLoad(fs.readFileSync(releaseCandidateYaml, 'utf8'))
|
const releaseCandidateData = yaml.load(fs.readFileSync(releaseCandidateYaml, 'utf8'))
|
||||||
|
|
||||||
// Create or remove the variable
|
// Create or remove the variable
|
||||||
if (options.action === 'create') {
|
if (options.action === 'create') {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ async function main () {
|
|||||||
if (path.endsWith('yml')) {
|
if (path.endsWith('yml')) {
|
||||||
let data; let errors = []
|
let data; let errors = []
|
||||||
try {
|
try {
|
||||||
data = yaml.safeLoad(fileContents)
|
data = yaml.load(fileContents)
|
||||||
} catch {}
|
} catch {}
|
||||||
if (data && schema) {
|
if (data && schema) {
|
||||||
({ errors } = revalidator.validate(data, schema))
|
({ errors } = revalidator.validate(data, schema))
|
||||||
|
|||||||
@@ -65,13 +65,13 @@ async function main () {
|
|||||||
|
|
||||||
// 1. UPDATE PREVIEWS
|
// 1. UPDATE PREVIEWS
|
||||||
const previewsPath = getDataFilepath('previews', graphqlVersion)
|
const previewsPath = getDataFilepath('previews', graphqlVersion)
|
||||||
const safeForPublicPreviews = yaml.safeLoad(await getRemoteRawContent(previewsPath, graphqlVersion))
|
const safeForPublicPreviews = yaml.load(await getRemoteRawContent(previewsPath, graphqlVersion))
|
||||||
updateFile(previewsPath, yaml.safeDump(safeForPublicPreviews))
|
updateFile(previewsPath, yaml.safeDump(safeForPublicPreviews))
|
||||||
previewsJson[graphqlVersion] = processPreviews(safeForPublicPreviews)
|
previewsJson[graphqlVersion] = processPreviews(safeForPublicPreviews)
|
||||||
|
|
||||||
// 2. UPDATE UPCOMING CHANGES
|
// 2. UPDATE UPCOMING CHANGES
|
||||||
const upcomingChangesPath = getDataFilepath('upcomingChanges', graphqlVersion)
|
const upcomingChangesPath = getDataFilepath('upcomingChanges', graphqlVersion)
|
||||||
const previousUpcomingChanges = yaml.safeLoad(fs.readFileSync(upcomingChangesPath, 'utf8'))
|
const previousUpcomingChanges = yaml.load(fs.readFileSync(upcomingChangesPath, 'utf8'))
|
||||||
const safeForPublicChanges = await getRemoteRawContent(upcomingChangesPath, graphqlVersion)
|
const safeForPublicChanges = await getRemoteRawContent(upcomingChangesPath, graphqlVersion)
|
||||||
updateFile(upcomingChangesPath, safeForPublicChanges)
|
updateFile(upcomingChangesPath, safeForPublicChanges)
|
||||||
upcomingChangesJson[graphqlVersion] = await processUpcomingChanges(safeForPublicChanges)
|
upcomingChangesJson[graphqlVersion] = await processUpcomingChanges(safeForPublicChanges)
|
||||||
@@ -106,7 +106,7 @@ async function main () {
|
|||||||
safeForPublicSchema,
|
safeForPublicSchema,
|
||||||
safeForPublicPreviews,
|
safeForPublicPreviews,
|
||||||
previousUpcomingChanges.upcoming_changes,
|
previousUpcomingChanges.upcoming_changes,
|
||||||
yaml.safeLoad(safeForPublicChanges).upcoming_changes
|
yaml.load(safeForPublicChanges).upcoming_changes
|
||||||
)
|
)
|
||||||
if (changelogEntry) {
|
if (changelogEntry) {
|
||||||
prependDatedEntry(changelogEntry, path.join(process.cwd(), 'lib/graphql/static/changelog.json'))
|
prependDatedEntry(changelogEntry, path.join(process.cwd(), 'lib/graphql/static/changelog.json'))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const { groupBy } = require('lodash')
|
|||||||
const renderContent = require('../../../lib/render-content')
|
const renderContent = require('../../../lib/render-content')
|
||||||
|
|
||||||
module.exports = async function processUpcomingChanges (upcomingChangesYml) {
|
module.exports = async function processUpcomingChanges (upcomingChangesYml) {
|
||||||
const upcomingChanges = yaml.safeLoad(upcomingChangesYml).upcoming_changes
|
const upcomingChanges = yaml.load(upcomingChangesYml).upcoming_changes
|
||||||
|
|
||||||
for (const change of upcomingChanges) {
|
for (const change of upcomingChanges) {
|
||||||
change.date = change.date.slice(0, 10)
|
change.date = change.date.slice(0, 10)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function move (dir) {
|
|||||||
.forEach(file => {
|
.forEach(file => {
|
||||||
const fullPath = path.join(file.basePath, file.relativePath)
|
const fullPath = path.join(file.basePath, file.relativePath)
|
||||||
const fileContent = fs.readFileSync(fullPath, 'utf8')
|
const fileContent = fs.readFileSync(fullPath, 'utf8')
|
||||||
const data = flat(yaml.safeLoad(fileContent))
|
const data = flat(yaml.load(fileContent))
|
||||||
|
|
||||||
Object.keys(data).forEach(key => {
|
Object.keys(data).forEach(key => {
|
||||||
const value = get(data, key)
|
const value = get(data, key)
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ program
|
|||||||
.option('-d, --dry-run', 'print URLs to be purged without actually purging')
|
.option('-d, --dry-run', 'print URLs to be purged without actually purging')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const singleUrl = program.single
|
const singleUrl = program.opts().single
|
||||||
const batchFile = program.batch
|
const batchFile = program.opts().batch
|
||||||
const dryRun = program.dryRun
|
const dryRun = program.opts().dryRun
|
||||||
|
|
||||||
// verify CLI options
|
// verify CLI options
|
||||||
if (!singleUrl && !batchFile) {
|
if (!singleUrl && !batchFile) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const relativePath = fs.existsSync(pathArg)
|
|||||||
? path.relative(process.cwd(), pathArg)
|
? path.relative(process.cwd(), pathArg)
|
||||||
: pathArg
|
: pathArg
|
||||||
|
|
||||||
if (program.preferMain) {
|
if (program.opts().preferMain) {
|
||||||
try {
|
try {
|
||||||
execSync(`git checkout main -- ${relativePath}`, { stdio: 'pipe' })
|
execSync(`git checkout main -- ${relativePath}`, { stdio: 'pipe' })
|
||||||
console.log('-> reverted to file from main branch: %s', relativePath)
|
console.log('-> reverted to file from main branch: %s', relativePath)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ program
|
|||||||
.requiredOption('-f, --files [files...]', 'A list of OpenAPI description files to check. Can parse literal glob patterns.')
|
.requiredOption('-f, --files [files...]', 'A list of OpenAPI description files to check. Can parse literal glob patterns.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const filenames = program.files
|
const filenames = program.opts().files
|
||||||
|
|
||||||
const filesToCheck = filenames.flatMap(filename => glob.sync(filename))
|
const filesToCheck = filenames.flatMap(filename => glob.sync(filename))
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ program
|
|||||||
.option('--decorate-only', '⚠️ Only used by a 🤖 to generate decorated schema files from existing dereferenced schema files.')
|
.option('--decorate-only', '⚠️ Only used by a 🤖 to generate decorated schema files from existing dereferenced schema files.')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
const decorateOnly = program.decorateOnly
|
const decorateOnly = program.opts().decorateOnly
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ describe('Liquid references', () => {
|
|||||||
'in "%s"',
|
'in "%s"',
|
||||||
async (yamlRelPath, yamlAbsPath) => {
|
async (yamlRelPath, yamlAbsPath) => {
|
||||||
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
||||||
const dictionary = yaml.safeLoad(fileContents, { filename: yamlRelPath })
|
const dictionary = yaml.load(fileContents, { filename: yamlRelPath })
|
||||||
|
|
||||||
const matches = []
|
const matches = []
|
||||||
|
|
||||||
|
|||||||
10
tests/fixtures/changelog-entry.json
vendored
10
tests/fixtures/changelog-entry.json
vendored
@@ -2,8 +2,8 @@
|
|||||||
"previewChanges": [
|
"previewChanges": [
|
||||||
{
|
{
|
||||||
"changes": [
|
"changes": [
|
||||||
"Field `Query.previewField` changed type from `PreviewType` to `PreviewType!`",
|
"Type for argument `changeTypeArgument` on field 'PreviewType.field1` changed from `Int` to `Float'",
|
||||||
"Type for argument `changeTypeArgument` on field 'PreviewType.field1` changed from `Int` to `Float'"
|
"Field `Query.previewField` changed type from `PreviewType` to `PreviewType!`"
|
||||||
],
|
],
|
||||||
"title": "The [Test preview](/graphql/overview/schema-previews#test-preview) includes these changes:"
|
"title": "The [Test preview](/graphql/overview/schema-previews#test-preview) includes these changes:"
|
||||||
}
|
}
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
{
|
{
|
||||||
"changes": [
|
"changes": [
|
||||||
"Field `removedField` was removed from object type `Query`",
|
"Field `removedField` was removed from object type `Query`",
|
||||||
"Type for argument `argumentMadeRequired` on field `Query.argumentsField` changed from `Int` to `Int!`",
|
|
||||||
"Type for argument `argumentMadeOptional` on field `Query.argumentsField` changed from `Int!` to `Int`",
|
|
||||||
"Argument `removedRequiredArgument: Int!` was removed from field `Query.argumentsField`",
|
"Argument `removedRequiredArgument: Int!` was removed from field `Query.argumentsField`",
|
||||||
"Argument `removedOptionalArgument: Int!` was removed from field `Query.argumentsField`"
|
"Argument `removedOptionalArgument: Int!` was removed from field `Query.argumentsField`",
|
||||||
|
"Type for argument `argumentMadeRequired` on field `Query.argumentsField` changed from `Int` to `Int!`",
|
||||||
|
"Type for argument `argumentMadeOptional` on field `Query.argumentsField` changed from `Int!` to `Int`"
|
||||||
],
|
],
|
||||||
"title": "The GraphQL schema includes these changes:"
|
"title": "The GraphQL schema includes these changes:"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ describe('creating a changelog from old schema and new schema', () => {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const previews = yaml.safeLoad(`
|
const previews = yaml.load(`
|
||||||
- title: Test preview
|
- title: Test preview
|
||||||
description: This preview is just for test
|
description: This preview is just for test
|
||||||
toggled_by: ':test_preview'
|
toggled_by: ':test_preview'
|
||||||
@@ -58,14 +58,14 @@ describe('creating a changelog from old schema and new schema', () => {
|
|||||||
- '@github/engineering'
|
- '@github/engineering'
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const oldUpcomingChanges = yaml.safeLoad(`
|
const oldUpcomingChanges = yaml.load(`
|
||||||
upcoming_changes:
|
upcoming_changes:
|
||||||
- location: EnterprisePendingCollaboratorEdge.isUnlicensed
|
- location: EnterprisePendingCollaboratorEdge.isUnlicensed
|
||||||
description: '\`isUnlicensed\` will be removed.'
|
description: '\`isUnlicensed\` will be removed.'
|
||||||
date: '2021-01-01T00:00:00+00:00'
|
date: '2021-01-01T00:00:00+00:00'
|
||||||
`).upcoming_changes
|
`).upcoming_changes
|
||||||
|
|
||||||
const newUpcomingChanges = yaml.safeLoad(`
|
const newUpcomingChanges = yaml.load(`
|
||||||
upcoming_changes:
|
upcoming_changes:
|
||||||
- location: Query.stableField
|
- location: Query.stableField
|
||||||
description: '\`stableField\` will be removed.'
|
description: '\`stableField\` will be removed.'
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ describe('lint markdown content', () => {
|
|||||||
yamlScheduledWorkflows = (await Promise.all(yamlScheduledWorkflows.map(async (snippet) => {
|
yamlScheduledWorkflows = (await Promise.all(yamlScheduledWorkflows.map(async (snippet) => {
|
||||||
// If we don't parse the Liquid first, yaml loading chokes on {% raw %} tags
|
// If we don't parse the Liquid first, yaml loading chokes on {% raw %} tags
|
||||||
const rendered = await renderContent.liquid.parseAndRender(snippet)
|
const rendered = await renderContent.liquid.parseAndRender(snippet)
|
||||||
const parsed = yaml.safeLoad(rendered)
|
const parsed = yaml.load(rendered)
|
||||||
return parsed.on.schedule
|
return parsed.on.schedule
|
||||||
})))
|
})))
|
||||||
.flat()
|
.flat()
|
||||||
@@ -479,7 +479,7 @@ describe('lint yaml content', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
||||||
dictionary = yaml.safeLoad(fileContents, { filename: yamlRelPath })
|
dictionary = yaml.load(fileContents, { filename: yamlRelPath })
|
||||||
|
|
||||||
isEarlyAccess = yamlRelPath.split('/').includes('early-access')
|
isEarlyAccess = yamlRelPath.split('/').includes('early-access')
|
||||||
})
|
})
|
||||||
@@ -670,7 +670,7 @@ describe('lint release notes', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
||||||
dictionary = yaml.safeLoad(fileContents, { filename: yamlRelPath })
|
dictionary = yaml.load(fileContents, { filename: yamlRelPath })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('matches the schema', () => {
|
it('matches the schema', () => {
|
||||||
@@ -716,7 +716,7 @@ describe('lint learning tracks', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
const fileContents = await readFileAsync(yamlAbsPath, 'utf8')
|
||||||
dictionary = yaml.safeLoad(fileContents, { filename: yamlRelPath })
|
dictionary = yaml.load(fileContents, { filename: yamlRelPath })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('matches the schema', () => {
|
it('matches the schema', () => {
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ describe('server', () => {
|
|||||||
test('sets Content Security Policy (CSP) headers', async () => {
|
test('sets Content Security Policy (CSP) headers', async () => {
|
||||||
const res = await get('/en')
|
const res = await get('/en')
|
||||||
expect('content-security-policy' in res.headers).toBe(true)
|
expect('content-security-policy' in res.headers).toBe(true)
|
||||||
expect('x-content-security-policy' in res.headers).toBe(true)
|
|
||||||
expect('x-webkit-csp' in res.headers).toBe(true)
|
|
||||||
|
|
||||||
const csp = new (require('csp-parse'))(res.headers['content-security-policy'])
|
const csp = new (require('csp-parse'))(res.headers['content-security-policy'])
|
||||||
expect(csp.get('default-src')).toBe("'none'")
|
expect(csp.get('default-src')).toBe("'none'")
|
||||||
|
|||||||
Reference in New Issue
Block a user