Skip to content

Commit 71ac0a6

Browse files
committed
Merge branch 'main' of github.com:HTTPArchive/almanac.httparchive.org into production
2 parents 19a6d1c + 3ddb800 commit 71ac0a6

8 files changed

Lines changed: 137 additions & 201 deletions

File tree

src/config/last_updated.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
},
3737
"/static/js/send-web-vitals.js": {
3838
"date_published": "2021-02-24T00:00:00.000Z",
39-
"date_modified": "2024-02-23T00:00:00.000Z",
40-
"hash": "dbdf76e48652c343c8d368cf130f7928"
39+
"date_modified": "2024-03-19T00:00:00.000Z",
40+
"hash": "894f90d1e739fb10194e73258c7946ec"
4141
},
4242
"/static/js/web-vitals.js": {
4343
"date_published": "2020-11-13T00:00:00.000Z",

src/package-lock.json

Lines changed: 88 additions & 166 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"node-fetch": "3.3.2",
4242
"node-watch": "0.7.4",
4343
"prettier": "3.2.5",
44-
"puppeteer": "22.2.0",
44+
"puppeteer": "22.5.0",
4545
"rainbow-code": "2.1.7",
4646
"recursive-readdir": "2.2.3",
4747
"run-script-os": "1.1.6",

src/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
flask==3.0.2
22
flask-talisman==1.1.0
33
gunicorn==21.2.0
4-
pytest==8.0.1
4+
pytest==8.1.1
55
pytest-watch==4.2.0
66
pytest-cov==4.1.0
77
sqlfluff==1.4.5

src/static/js/send-web-vitals.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,35 @@ function sendWebVitals() {
2323
// LoAFs that intersect with the event.
2424
return entry.startTime < (loaf.startTime + loaf.duration) && loaf.startTime < (entry.startTime + entry.duration);
2525
}).forEach(loaf => {
26+
const loafEndTime = loaf.startTime + loaf.duration;
2627
loaf.scripts.forEach(script => {
27-
const totalDuration = script.startTime + script.duration;
28-
if (totalDuration > loafAttribution.debug_loaf_script_total_duration) {
29-
loafAttribution = {
30-
// Stats for the LoAF entry itself.
31-
debug_loaf_entry_start_time: loaf.startTime,
32-
debug_loaf_entry_end_time: loaf.startTime + loaf.duration,
33-
debug_loaf_entry_work_duration: loaf.renderStart ? loaf.renderStart - loaf.startTime : loaf.duration,
34-
debug_loaf_entry_render_duration: loaf.renderStart ? loaf.startTime + loaf.duration - loaf.renderStart : 0,
35-
debug_loaf_entry_total_forced_style_and_layout_duration: loaf.scripts.reduce((sum, script) => sum + script.forcedStyleAndLayoutDuration, 0),
36-
debug_loaf_entry_pre_layout_duration: loaf.styleAndLayoutStart ? loaf.styleAndLayoutStart - loaf.renderStart : 0,
37-
debug_loaf_entry_style_and_layout_duration: loaf.styleAndLayoutStart ? loaf.startTime + loaf.duration - loaf.styleAndLayoutStart : 0,
38-
39-
// Stats for the longest script in the LoAF entry.
40-
debug_loaf_script_total_duration: totalDuration,
41-
debug_loaf_script_compile_duration: script.executionStart - script.startTime,
42-
debug_loaf_script_exec_duration: script.startTime + script.duration - script.executionStart,
43-
debug_loaf_script_invoker: script.invoker,
44-
debug_loaf_script_type: script.invokerType,
45-
debug_loaf_script_source_url: script.sourceURL,
46-
debug_loaf_script_source_function_name: script.sourceFunctionName,
47-
debug_loaf_script_source_char_position: script.sourceCharPosition,
48-
49-
// LoAF metadata.
50-
debug_loaf_meta_length: longAnimationFrames.length,
51-
}
28+
if (script.duration <= loafAttribution.debug_loaf_script_total_duration) {
29+
return;
30+
}
31+
loafAttribution = {
32+
// Stats for the LoAF entry itself.
33+
debug_loaf_entry_start_time: loaf.startTime,
34+
debug_loaf_entry_end_time: loafEndTime,
35+
debug_loaf_entry_work_duration: loaf.renderStart ? loaf.renderStart - loaf.startTime : loaf.duration,
36+
debug_loaf_entry_render_duration: loaf.renderStart ? loafEndTime - loaf.renderStart : 0,
37+
debug_loaf_entry_total_forced_style_and_layout_duration: loaf.scripts.reduce((sum, script) => sum + script.forcedStyleAndLayoutDuration, 0),
38+
debug_loaf_entry_pre_layout_duration: loaf.styleAndLayoutStart ? loaf.styleAndLayoutStart - loaf.renderStart : 0,
39+
debug_loaf_entry_style_and_layout_duration: loaf.styleAndLayoutStart ? loafEndTime - loaf.styleAndLayoutStart : 0,
40+
41+
// Stats for the longest script in the LoAF entry.
42+
debug_loaf_script_total_duration: script.duration,
43+
debug_loaf_script_compile_duration: script.executionStart - script.startTime,
44+
debug_loaf_script_exec_duration: script.startTime + script.duration - script.executionStart,
45+
debug_loaf_script_source: script.sourceLocation || script.invoker || script.name, // TODO: remove after Chrome 123
46+
debug_loaf_script_type: script.invokerType || script.type, // TODO: remove `|| script.type` after Chrome 123
47+
// New in Chrome 122/123 (will be null until then)
48+
debug_loaf_script_invoker: script.invoker,
49+
debug_loaf_script_source_url: script.sourceURL,
50+
debug_loaf_script_source_function_name: script.sourceFunctionName,
51+
debug_loaf_script_source_char_position: script.sourceCharPosition,
52+
53+
// LoAF metadata.
54+
debug_loaf_meta_length: longAnimationFrames.length,
5255
}
5356
});
5457
});

src/templates/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta http-equiv="origin-trial" content="AqqBKXKVFUu6Op5aphalxMRl8CECiZ0BVlee+zWMM1E9R6oLnNQPRIXd5F8gEYxahMwEzEjOYKzA3Nf6jIc08AEAAAB0eyJvcmlnaW4iOiJodHRwczovL2h0dHBhcmNoaXZlLm9yZzo0NDMiLCJmZWF0dXJlIjoiTG9uZ0FuaW1hdGlvbkZyYW1lVGltaW5nIiwiZXhwaXJ5IjoxNzE2OTQwNzk5LCJpc1N1YmRvbWFpbiI6dHJ1ZX0=">
78
{% block head %}
89
<title>{% block title %}The Web Almanac{% endblock %}</title>
910
<link rel="stylesheet" href="{{ get_versioned_filename('/static/css/normalize.css') }}">

src/tools/scripts/deploy.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ function check_continue {
6464
fi
6565
}
6666

67+
if [ ! "$(which pgrep)" ]; then
68+
echo "Need pgrep installed. Try 'brew install proctools'"
69+
exit 1
70+
fi
71+
6772
echo "Beginning the Web Almanac deployment process"
6873

6974
# This script must be run from src directory
@@ -95,7 +100,7 @@ git status
95100
git pull
96101
git pull origin main
97102

98-
if [ "$(pgrep -f 'python main.py')" ]; then
103+
if [ "$(pgrep -if 'python main.py')" ]; then
99104
echo "Killing existing server to run a fresh version"
100105
pkill -9 python main.py
101106
fi
@@ -192,7 +197,7 @@ git status
192197
echo "Checking out main branch"
193198
git checkout main
194199

195-
if [ "$(pgrep -f 'python main.py')" ]; then
200+
if [ "$(pgrep -if 'python main.py')" ]; then
196201
echo "Killing server so backgrounded version isn't left there"
197202
pkill -9 -f "python main.py"
198203
fi

src/tools/scripts/run_and_test_website.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ if [ -d "src" ]; then
4646
cd src
4747
fi
4848

49-
if [ "$(pgrep -f 'python main.py')" ]; then
49+
if [ ! "$(which pgrep)" ]; then
50+
echo "Need pgrep installed. Try 'brew install proctools'"
51+
exit 1
52+
fi
53+
54+
if [ "$(pgrep -if 'python main.py')" ]; then
5055
echo "Killing existing server to run a fresh version"
5156
pkill -9 -f "python main.py"
5257
fi
5358

54-
if [ "$(pgrep -f 'node ./tools/generate/chapter_watcher')" ]; then
59+
if [ "$(pgrep -if 'node ./tools/generate/chapter_watcher')" ]; then
5560
echo "Killing existing watcher to run a fresh version"
5661
pkill -9 -f "node ./tools/generate/chapter_watcher"
5762
fi
@@ -65,7 +70,7 @@ python main.py background &
6570
# Sleep for a couple of seconds to make sure server is up
6671
sleep 2
6772
# Check website is running as won't have got feedback as backgrounded
68-
pgrep -f "python main.py"
73+
pgrep -if "python main.py"
6974

7075
echo "Installing node modules"
7176
npm install
@@ -98,7 +103,7 @@ if [ "${debug}" == "1" ]; then
98103
echo "Monitoring templates for changes"
99104
npm run watch &
100105

101-
if [ "$(pgrep -f 'python main.py')" ]; then
106+
if [ "$(pgrep -if 'python main.py')" ]; then
102107
echo "Killing server to run a fresh version in debug mode"
103108
pkill -9 -f "python main.py"
104109
fi

0 commit comments

Comments
 (0)