Merge branch 'main' into avinal-improve-docs
This commit is contained in:
@@ -134,7 +134,8 @@ sections:
|
||||
- '`ghe-config-apply` occassionally fails with `ERROR: Failure waiting for nomad jobs to apply` until the Nomad job queue is cleared. This currently requires as admin to delete `/etc/nomad-jobs/queue`.'
|
||||
- When configuring a multiple replica node, the status of the replica can be incorrectly synchronized.
|
||||
- Customers attempting to restore a 3.0 backup to a new instance should not pre-configure the instance, as it may lead to a bad state for user logins. We recommend restoring to a fresh, unconfigured instance.
|
||||
- GitHub Enterprise Server 3.0 release candidates are not yet available in the Azure marketplace. To test RC1 in staging environments, start a 2.21 or 2.22 instance, and then upgrade it with the Azure upgrade package on the download page.
|
||||
- GitHub Enterprise Server 3.0 release candidates are not yet available in the Azure marketplace. To test release candidates in staging environments, start a 2.21 or 2.22 instance, and then upgrade it with the Azure upgrade package on the download page.
|
||||
- The image and upgrade package download size has increased. Customers on slow internet connections may find the packages take longer to download.
|
||||
|
||||
backups:
|
||||
- '{% data variables.product.prodname_ghe_server %} 3.0 requires at least [GitHub Enterprise Backup Utilities 3.0.0](https://github.com/github/backup-utils) for [Backups and Disaster Recovery](/enterprise-server@3.0/admin/configuration/configuring-backups-on-your-appliance).'
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/>
|
||||
{% endfor %}
|
||||
|
||||
<link rel="stylesheet" href="/dist/index.css">
|
||||
<link rel="stylesheet" href="{{ builtAssets.main.css }}">
|
||||
<link rel="alternate icon" type="image/png" href="/assets/images/site/favicon.png">
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/images/site/favicon.svg">
|
||||
</head>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<script src="/dist/index.js"></script>
|
||||
<script src="{{ builtAssets.main.js }}"></script>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Docs TOC</title>
|
||||
<link rel="stylesheet" href="/dist/index.css">
|
||||
<link rel="stylesheet" href="{{ builtAssets.main.css }}">
|
||||
<link rel="alternate icon" type="image/png" href="/assets/images/site/favicon.png">
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/images/site/favicon.svg">
|
||||
</head>
|
||||
|
||||
23
lib/built-asset-urls.js
Normal file
23
lib/built-asset-urls.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const crypto = require('crypto')
|
||||
|
||||
// Get an MD4 Digest Hex content hash, loosely based on Webpack `[contenthash]`
|
||||
function getContentHash (absFilePath) {
|
||||
const buffer = fs.readFileSync(absFilePath)
|
||||
const hash = crypto.createHash('md4')
|
||||
hash.update(buffer)
|
||||
return hash.digest('hex')
|
||||
}
|
||||
|
||||
function getUrl (relFilePath) {
|
||||
const absFilePath = path.join(process.cwd(), relFilePath)
|
||||
return `/${relFilePath}?hash=${getContentHash(absFilePath)}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
main: {
|
||||
js: getUrl('dist/index.js'),
|
||||
css: getUrl('dist/index.css')
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ const { getVersionStringFromPath, getProductStringFromPath, getPathWithoutLangua
|
||||
const productNames = require('../lib/product-names')
|
||||
const warmServer = require('../lib/warm-server')
|
||||
const featureFlags = Object.keys(require('../feature-flags'))
|
||||
const builtAssets = require('../lib/built-asset-urls')
|
||||
|
||||
// Supply all route handlers with a baseline `req.context` object
|
||||
// Note that additional middleware in middleware/index.js adds to this context object
|
||||
@@ -42,5 +43,8 @@ module.exports = async function contextualize (req, res, next) {
|
||||
req.context.siteTree = siteTree
|
||||
req.context.pages = pageMap
|
||||
|
||||
// JS + CSS asset paths
|
||||
req.context.builtAssets = builtAssets
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ const { get, getDOM, head } = require('../helpers/supertest')
|
||||
const { describeViaActionsOnly } = require('../helpers/conditional-runs')
|
||||
const path = require('path')
|
||||
const { loadPages } = require('../../lib/pages')
|
||||
const builtAssets = require('../../lib/built-asset-urls')
|
||||
|
||||
describe('server', () => {
|
||||
jest.setTimeout(60 * 1000)
|
||||
@@ -694,7 +695,8 @@ describe('?json query param for context debugging', () => {
|
||||
|
||||
describe('stylesheets', () => {
|
||||
it('compiles and sets the right content-type header', async () => {
|
||||
const res = await get('/dist/index.css')
|
||||
const stylesheetUrl = builtAssets.main.css
|
||||
const res = await get(stylesheetUrl)
|
||||
expect(res.statusCode).toBe(200)
|
||||
expect(res.headers['content-type']).toBe('text/css; charset=UTF-8')
|
||||
})
|
||||
@@ -703,7 +705,8 @@ describe('stylesheets', () => {
|
||||
describe('client-side JavaScript bundle', () => {
|
||||
let res
|
||||
beforeAll(async (done) => {
|
||||
res = await get('/dist/index.js')
|
||||
const scriptUrl = builtAssets.main.js
|
||||
res = await get(scriptUrl)
|
||||
done()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user