Make the staging files, for deployments, as lean as possible (#23049)
* Experiment with making the tarball smaller Part of #1248 * try this * stop debugging * delete translations too * delete heavy search indexes too * push and popd * try this hack * delete but leave directory * debug more * faster delete of translations * less loud * async await * async await * no tree * simplify * experimenting more * unfinished * only the large files * change order * brotli with level 6 * cope better with decorated rest json files * tidying * keep images * cleaning * cleaning up * refactored function * try this * better comment * remove console logging * more important changes * improved fs.accessSync check
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import readJsonFile from '../../lib/read-json-file.js'
|
||||
import { readCompressedJsonFileFallback } from '../../lib/read-json-file.js'
|
||||
import { allVersions } from '../../lib/all-versions.js'
|
||||
const previews = readJsonFile('./lib/graphql/static/previews.json')
|
||||
const upcomingChanges = readJsonFile('./lib/graphql/static/upcoming-changes.json')
|
||||
const changelog = readJsonFile('./lib/graphql/static/changelog.json')
|
||||
const prerenderedObjects = readJsonFile('./lib/graphql/static/prerendered-objects.json')
|
||||
const prerenderedInputObjects = readJsonFile('./lib/graphql/static/prerendered-input-objects.json')
|
||||
const previews = readCompressedJsonFileFallback('./lib/graphql/static/previews.json')
|
||||
const upcomingChanges = readCompressedJsonFileFallback('./lib/graphql/static/upcoming-changes.json')
|
||||
const changelog = readCompressedJsonFileFallback('./lib/graphql/static/changelog.json')
|
||||
const prerenderedObjects = readCompressedJsonFileFallback(
|
||||
'./lib/graphql/static/prerendered-objects.json'
|
||||
)
|
||||
const prerenderedInputObjects = readCompressedJsonFileFallback(
|
||||
'./lib/graphql/static/prerendered-input-objects.json'
|
||||
)
|
||||
|
||||
const explorerUrl =
|
||||
process.env.NODE_ENV === 'production'
|
||||
@@ -27,8 +29,8 @@ export default function graphqlContext(req, res, next) {
|
||||
const graphqlVersion = currentVersionObj.miscVersionName
|
||||
|
||||
req.context.graphql = {
|
||||
schemaForCurrentVersion: JSON.parse(
|
||||
fs.readFileSync(path.join(process.cwd(), `lib/graphql/static/schema-${graphqlVersion}.json`))
|
||||
schemaForCurrentVersion: readCompressedJsonFileFallback(
|
||||
`lib/graphql/static/schema-${graphqlVersion}.json`
|
||||
),
|
||||
previewsForCurrentVersion: previews[graphqlVersion],
|
||||
upcomingChangesForCurrentVersion: upcomingChanges[graphqlVersion],
|
||||
|
||||
Reference in New Issue
Block a user