Skip to content

Commit 01a0e3c

Browse files
authored
repo sync
2 parents acc669a + 66feb7a commit 01a0e3c

File tree

7 files changed

+37
-6
lines changed

7 files changed

+37
-6
lines changed

data/release-notes/3-0/0-rc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ sections:
134134
- '`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`.'
135135
- When configuring a multiple replica node, the status of the replica can be incorrectly synchronized.
136136
- 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.
137-
- 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.
137+
- 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.
138+
- The image and upgrade package download size has increased. Customers on slow internet connections may find the packages take longer to download.
138139

139140
backups:
140141
- '{% 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).'

includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/>
2424
{% endfor %}
2525

26-
<link rel="stylesheet" href="/dist/index.css">
26+
<link rel="stylesheet" href="{{ builtAssets.main.css }}">
2727
<link rel="alternate icon" type="image/png" href="/assets/images/site/favicon.png">
2828
<link rel="icon" type="image/svg+xml" href="/assets/images/site/favicon.svg">
2929
</head>

includes/scripts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<script src="/dist/index.js"></script>
1+
<script src="{{ builtAssets.main.js }}"></script>

layouts/dev-toc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8" />
55
<title>Docs TOC</title>
6-
<link rel="stylesheet" href="/dist/index.css">
6+
<link rel="stylesheet" href="{{ builtAssets.main.css }}">
77
<link rel="alternate icon" type="image/png" href="/assets/images/site/favicon.png">
88
<link rel="icon" type="image/svg+xml" href="/assets/images/site/favicon.svg">
99
</head>

lib/built-asset-urls.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const fs = require('fs')
2+
const path = require('path')
3+
const crypto = require('crypto')
4+
5+
// Get an MD4 Digest Hex content hash, loosely based on Webpack `[contenthash]`
6+
function getContentHash (absFilePath) {
7+
const buffer = fs.readFileSync(absFilePath)
8+
const hash = crypto.createHash('md4')
9+
hash.update(buffer)
10+
return hash.digest('hex')
11+
}
12+
13+
function getUrl (relFilePath) {
14+
const absFilePath = path.join(process.cwd(), relFilePath)
15+
return `/${relFilePath}?hash=${getContentHash(absFilePath)}`
16+
}
17+
18+
module.exports = {
19+
main: {
20+
js: getUrl('dist/index.js'),
21+
css: getUrl('dist/index.css')
22+
}
23+
}

middleware/context.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const { getVersionStringFromPath, getProductStringFromPath, getPathWithoutLangua
77
const productNames = require('../lib/product-names')
88
const warmServer = require('../lib/warm-server')
99
const featureFlags = Object.keys(require('../feature-flags'))
10+
const builtAssets = require('../lib/built-asset-urls')
1011

1112
// Supply all route handlers with a baseline `req.context` object
1213
// 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) {
4243
req.context.siteTree = siteTree
4344
req.context.pages = pageMap
4445

46+
// JS + CSS asset paths
47+
req.context.builtAssets = builtAssets
48+
4549
return next()
4650
}

tests/rendering/server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { get, getDOM, head } = require('../helpers/supertest')
44
const { describeViaActionsOnly } = require('../helpers/conditional-runs')
55
const path = require('path')
66
const { loadPages } = require('../../lib/pages')
7+
const builtAssets = require('../../lib/built-asset-urls')
78

89
describe('server', () => {
910
jest.setTimeout(60 * 1000)
@@ -694,7 +695,8 @@ describe('?json query param for context debugging', () => {
694695

695696
describe('stylesheets', () => {
696697
it('compiles and sets the right content-type header', async () => {
697-
const res = await get('/dist/index.css')
698+
const stylesheetUrl = builtAssets.main.css
699+
const res = await get(stylesheetUrl)
698700
expect(res.statusCode).toBe(200)
699701
expect(res.headers['content-type']).toBe('text/css; charset=UTF-8')
700702
})
@@ -703,7 +705,8 @@ describe('stylesheets', () => {
703705
describe('client-side JavaScript bundle', () => {
704706
let res
705707
beforeAll(async (done) => {
706-
res = await get('/dist/index.js')
708+
const scriptUrl = builtAssets.main.js
709+
res = await get(scriptUrl)
707710
done()
708711
})
709712

0 commit comments

Comments
 (0)