Skip to content

Commit 5c6a05d

Browse files
authored
Merge branch 'main' into blog/may-2026-security-releases
2 parents 98c08f6 + ec1d037 commit 5c6a05d

1,901 files changed

Lines changed: 158281 additions & 79671 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig: https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[*.{yml,yaml}]
16+
indent_size = 2
17+
18+
[Makefile]
19+
indent_style = tab

.github/CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
# Codeowners
55
.github/CODEOWNERS @expressjs/docs-captains
66

7-
# Blog
8-
_posts @expressjs/express-tc
7+
# Blog - TODO: Add once Astro blog structure is set up
8+
9+
src/content/blog @expressjs/express-tc

.github/dependabot.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,54 @@ updates:
44
directory: /
55
schedule:
66
interval: monthly
7-
8-
- package-ecosystem: docker
9-
directory: /
10-
schedule:
11-
interval: monthly
12-
13-
- package-ecosystem: bundler
14-
directory: /
15-
schedule:
16-
interval: monthly
7+
groups:
8+
github-actions:
9+
patterns:
10+
- '*'
1711

1812
- package-ecosystem: npm
1913
directory: /
2014
schedule:
2115
interval: monthly
2216
open-pull-requests-limit: 10
23-
ignore:
24-
- dependency-name: "*"
25-
update-types: ["version-update:semver-major"]
17+
groups:
18+
astro:
19+
patterns:
20+
- '@astrojs/*'
21+
- 'astro'
22+
- 'astro-*'
23+
- 'prettier-plugin-astro'
24+
orama:
25+
patterns:
26+
- '@orama/*'
27+
- 'gray-matter'
28+
- 'mdast-util-from-markdown'
29+
- 'mdast-util-to-string'
30+
linters:
31+
patterns:
32+
- 'eslint'
33+
- 'eslint-*'
34+
- '@eslint/*'
35+
- 'prettier'
36+
- 'typescript-eslint'
37+
- 'globals'
38+
production:
39+
dependency-type: production
40+
exclude-patterns:
41+
- '@astrojs/*'
42+
- 'astro'
43+
- 'astro-*'
44+
- '@orama/*'
45+
- 'gray-matter'
46+
- 'mdast-util-from-markdown'
47+
- 'mdast-util-to-string'
48+
development:
49+
dependency-type: development
50+
exclude-patterns:
51+
- 'eslint'
52+
- 'eslint-*'
53+
- '@eslint/*'
54+
- 'prettier'
55+
- 'prettier-plugin-astro'
56+
- 'typescript-eslint'
57+
- 'globals'
Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
11
#!/bin/bash
22

3-
# This script replaces the contents of a section with the contents from the annotated source address or local file paths inside the DEST file.
3+
# This script replaces the contents of a section with the contents from the
4+
# annotated source address (SRC comments) inside the DEST file.
5+
# SRC comments use the format: {/* SRC: org/repo path/to/file */}
46

5-
# read contents of file into memory
6-
DEST="../../en/resources/contributing.md"
7+
DEST="../../src/content/pages/en/resources/contributing.mdx"
8+
9+
# Shared content transformations
10+
transform_content() {
11+
local content="$1"
12+
local level="$2"
13+
14+
# Keep only from first ## onward (skip title/badges)
15+
content=$(echo "$content" | sed -En '/^##|^[^#]/,$p')
16+
17+
# Downgrade headings based on parent level
18+
content=$(echo "$content" | sed 's/^#/&'"${level:1}"'/g')
19+
20+
# Convert GitHub callouts to Alert components
21+
content=$(echo "$content" | perl -0777 -pe '
22+
s/> \[!(IMPORTANT|NOTE|TIP|CAUTION|WARNING)\]\s*\n((?:>.*\n)*)/
23+
my $type = lc($1);
24+
my %map = (important => "info", note => "info", tip => "info", caution => "warning", warning => "warning");
25+
my $alert = $map{$type} || "info";
26+
my $body = $2;
27+
$body =~ s|^> ?||gm;
28+
"<Alert type=\"$alert\">\n\n${body}\n<\/Alert>\n"
29+
/ge')
30+
31+
# Convert HTML comments to MDX comments
32+
content=$(echo "$content" | sed -E 's/<!--(.*)-->/\{\/\*\1\*\/\}/g')
33+
34+
# Convert self-closing HTML tags for MDX compatibility
35+
content=$(echo "$content" | sed -E 's/<(br|hr|img)([^/]*[^/])?\s*>/<\1\2 \/>/gi')
36+
37+
echo "$content"
38+
}
739

8-
# track the header level
940
level=''
10-
# tracks src for curl calls
1141
src=''
12-
# tracks file paths for local file reads
13-
local=''
14-
while IFS= read -r line; do
15-
# REMOVE PREVIOUS CONTENT SECTION
16-
# if src or local tags are not empty
17-
if [[ -n "$src" || -n "$local" ]]; then
18-
# if current line not a horitzontal rule hr
19-
if [[ "$line" != "----"* ]]; then
20-
# if line == level -- level is num of ##
21-
if [[ "$line" == "$level"'#'* ||
22-
# line not a header line
23-
"$line" != '#'* ]]; then
24-
# skip line and rewrite over old content
25-
continue
42+
43+
while IFS= read -r line; do
44+
# Skip lines from previous SRC section (will be replaced)
45+
if [[ -n "$src" ]]; then
46+
if [[ "$line" != "----"* ]]; then
47+
if [[ "$line" == "$level"'#'* || "$line" != '#'* ]]; then
48+
continue
2649
fi
2750
fi
2851
fi
2952

30-
# PRINT TO PAGE SECTION
3153
src=''
32-
local=''
33-
# if line is a header
54+
55+
# Track heading level
3456
if [[ "$line" == '#'* ]]; then
35-
# if header has (#id-of-link) or {#id-on-page} patterns
3657
if [[ $line =~ (\(\#.*\))\. || "$line" =~ \{\#.*\} ]]; then
37-
# isolate the matching part of line
3858
match=${BASH_REMATCH[0]}
39-
# remove match - leaving rest
4059
rest=${line//${match}}
41-
# remove any # symbols from start
4260
title_rest=${rest##*\#}
43-
# slice rest of line to get only level
4461
level="${rest:0:$((${#rest} - ${#title_rest}))}"
4562
else
46-
# any other headers -- these before SRC/LOCAL pages anchors
47-
header=${line##*\#}
63+
header=${line##*\#}
4864
level="${line:0:$((${#line} - ${#header}))}"
4965
fi
50-
# if line is SRC anchor in read file
51-
elif [[ "$line" == '<!-- SRC:'* ]]; then
52-
# remove the first 10 chars
53-
src=${line:10}
54-
# % remove from end until after white space -- leaves src details
55-
src=${src% *}
56-
# if line is LOCAL anchor in read file
57-
elif [[ "$line" == '<!-- LOCAL:'* ]]; then
58-
# remove the first 12 chars
59-
local=${line:12}
60-
# % remove from end until after white space -- leave local details
61-
local=${local% *}
62-
# leave only path to file
63-
local=${local#* }
64-
fi
65-
# prints line to the page
66+
# Detect SRC comment (MDX format)
67+
elif [[ "$line" == '{/* SRC:'* ]]; then
68+
src=${line:9}
69+
src=${src%% \*/*}
70+
fi
71+
6672
echo "$line"
67-
68-
if [[ -n "$local" ]]; then
69-
# cat file -- outputs full contents of file at local path
70-
cat "$local" | \
71-
# remove the top 1# headers from cat'd file
72-
sed -En '/^##|^[^#]/,$p' | \
73-
# remove GH MD specific tags start w '[!NOTE\] + the following line
74-
sed -E '/^>\[!NOTE\]*/{N;d;}' | \
75-
# change GH specific MD IMPORTANT tags -> change into plain MD
76-
sed -E 's/> \[!IMPORTANT\]/> **IMPORTANT:** /g'
77-
echo
78-
elif [[ -n "$src" ]]; then
73+
74+
if [[ -n "$src" ]]; then
7975
echo
8076
path=${src#* }
8177
repo=${src% *}
82-
curl -s "https://raw.githubusercontent.com/${repo}/master/${path}" | \
83-
# if line is ## or not #
84-
sed -En '/^##|^[^#]/,$p' | \
85-
# add additional # every header
86-
sed 's/^#/&'"${level:1}"'/g' | \
87-
# format GH links when match
88-
sed -E 's/(\[[^]]*\])\(([^):#]*)\)/\1(https:\/\/github.com\/'"$(sed 's/\//\\\//g' <<< "$repo")"'\/blob\/master\/\2)/g'
78+
79+
echo "fetching $repo/$path..." >&2
80+
RAW=$(curl -s "https://raw.githubusercontent.com/${repo}/HEAD/${path}")
81+
82+
# Convert relative links to absolute GitHub URLs
83+
BASEURL="https://github.com/${repo}/blob/HEAD"
84+
RAW=$(echo "$RAW" | sed -E "s|\]\(([^)#/][^):]*)\)|](${BASEURL}/\1)|g")
85+
86+
TRANSFORMED=$(transform_content "$RAW" "$level")
87+
echo "$TRANSFORMED"
8988
echo
9089
fi
91-
# read in dest file then write back to file
9290
done <<<"$(< $DEST)" > $DEST
91+
92+
echo "Updated $DEST"

.github/scripts/get-express-version.mjs

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/scripts/get-readmes.sh

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
(cat <<LIST_END
1111
expressjs body-parser master
1212
expressjs compression master
13-
expressjs connect-rid master
1413
expressjs cookie-parser master
1514
expressjs cookie-session master
1615
expressjs cors master
@@ -25,26 +24,88 @@ expressjs serve-static master
2524
expressjs session master
2625
expressjs timeout master
2726
expressjs vhost master
28-
expressjs express master/examples
2927
LIST_END
3028
) | while read org repo branch; do
29+
# TODO: change the DEST when astro project is in the root of the repo instead of in a subdirectory.
3130
# Write the README.md to a file named after the repo
32-
DEST="../../_includes/readmes/$repo.md"
31+
DEST="../../src/content/pages/en/resources/middleware/$repo.mdx"
3332
# When fetching from a branch of a gh repo
3433
GHURL="https://raw.githubusercontent.com/$org/$repo/$branch/README.md"
3534
# When fetching from the latest release of a node module
3635
NPMURL="https://registry.npmjs.org/$repo"
36+
37+
# Fetch version and description from npm registry
38+
NPM_DATA=$(curl -s "$NPMURL")
39+
VERSION=$(echo "$NPM_DATA" | jq -r '.["dist-tags"].latest // empty')
40+
DESC=$(echo "$NPM_DATA" | jq -r '.description // empty')
41+
42+
# Preserve existing frontmatter if the file already exists
43+
FRONTMATTER=""
44+
if [ -f "$DEST" ]; then
45+
FRONTMATTER=$(awk '/^---$/{c++;next} c==1{print} c==2{exit}' "$DEST")
46+
fi
47+
3748
if [ -z "$branch" ]; then
3849
# No branch means latest release, so fetch from npmjs.org
3950
echo "fetching $org/$repo from latest npmjs.org release..."
40-
curl -s $NPMURL | jq -r '.readme|rtrimstr("\n")' > $DEST
51+
CONTENT=$(echo "$NPM_DATA" | jq -r '.readme|rtrimstr("\n")')
4152
else
4253
# This allows us to specify a branch other than master if we want to.
4354
# In this case, the branch name is added to the readme name in the filename.
4455
if [ "$branch" != "master" ]; then
45-
DEST="../../_includes/readmes/$repo-$branch.md"
56+
DEST="../../src/content/pages/en/resources/middleware/$repo-$branch.mdx"
4657
fi
4758
echo "fetching $org/$repo/$branch from GitHub's raw content domain..."
48-
curl -s $GHURL > $DEST
59+
CONTENT=$(curl -s $GHURL)
60+
fi
61+
62+
# Remove the first h1 heading (title is rendered by the layout)
63+
CONTENT=$(echo "$CONTENT" | sed '0,/^# /{/^# /d}')
64+
65+
# Remove badge lines ([![...][...]][...] patterns and reference-style badge links)
66+
CONTENT=$(echo "$CONTENT" | sed '/^\[\!\[.*\]\[.*\]\]\[.*\]$/d')
67+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*img\.shields\.io/d')
68+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*badgen\.net/d')
69+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*coveralls\.io/d')
70+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*github\.com\/.*\/actions/d')
71+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*securityscorecards\.dev/d')
72+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*opencollective\.com.*\/badge/d')
73+
CONTENT=$(echo "$CONTENT" | sed '/^\[.*\]:.*bestpractices\.coreinfrastructure\.org/d')
74+
# Remove HTML badge lines (<a><img></a> patterns)
75+
CONTENT=$(echo "$CONTENT" | sed '/<a[^>]*><img[^>]*><\/a>/d')
76+
77+
# Convert GitHub callouts to Alert components
78+
CONTENT=$(echo "$CONTENT" | perl -0777 -pe '
79+
s/> \[!(IMPORTANT|NOTE|TIP|CAUTION|WARNING)\]\n((?:>.*\n)*)/
80+
my $type = lc($1);
81+
my %map = (important => "info", note => "info", tip => "info", caution => "warning", warning => "warning");
82+
my $alert = $map{$type} || "info";
83+
my $body = $2;
84+
$body =~ s|^> ?||gm;
85+
"<Alert type=\"$alert\">\n\n${body}\n<\/Alert>\n"
86+
/ge')
87+
88+
# Convert HTML comments to MDX comments
89+
CONTENT=$(echo "$CONTENT" | sed -E 's/<!--(.*)-->/\{\/\*\1\*\/\}/g')
90+
91+
# Convert self-closing HTML tags for MDX compatibility
92+
CONTENT=$(echo "$CONTENT" | sed -E 's/<(br|hr|img)([^/]*[^/])?\s*>/<\1\2 \/>/gi')
93+
94+
# Convert relative links to absolute GitHub URLs
95+
BASEURL="https://github.com/$org/$repo/blob/HEAD"
96+
CONTENT=$(echo "$CONTENT" | sed -E "s|\]\(([^)#/][^):]*)\)|](${BASEURL}/\1)|g")
97+
98+
# Build the MDX import and component
99+
IMPORT="import MiddlewareInfo from '@components/patterns/MiddlewareInfo/MiddlewareInfo.astro';
100+
import Alert from '@components/primitives/Alert/Alert.astro';"
101+
GITHUB_URL="https://github.com/$org/$repo"
102+
NPM_PAGE="https://www.npmjs.com/package/$repo"
103+
COMPONENT="<MiddlewareInfo version=\"${VERSION}\" github=\"${GITHUB_URL}\" npm=\"${NPM_PAGE}\" />"
104+
105+
# Write with frontmatter preserved
106+
if [ -n "$FRONTMATTER" ]; then
107+
printf '%s\n%s\n%s\n\n%s\n\n%s\n\n%s\n' "---" "$FRONTMATTER" "---" "$IMPORT" "$COMPONENT" "$CONTENT" > $DEST
108+
else
109+
printf '%s\n%s\n%s\n%s\n\n%s\n\n%s\n\n%s\n' "---" "title: $repo middleware" "description: $DESC" "---" "$IMPORT" "$COMPONENT" "$CONTENT" > $DEST
49110
fi
50111
done

0 commit comments

Comments
 (0)