Skip to content

Commit

Permalink
Merge branch 'contributing' into contributing_actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Del committed Feb 1, 2025
2 parents 6004f7f + 2f9684f commit 516c736
Show file tree
Hide file tree
Showing 211 changed files with 2,852 additions and 836 deletions.
77 changes: 51 additions & 26 deletions .github/scripts/get-contributing.sh
Original file line number Diff line number Diff line change
@@ -1,55 +1,79 @@
#!/bin/bash

DEST="../../en/resources/contributing.md"
# This script replaces the contents of a section with the contents from the annotated source address or local file paths inside the DEST file.

# This script replaces the contents of a section with the contents from
# the annotated source address, from a local file.
# read contents of file into memory
DEST="../../en/resources/contributing.md"

# tracks the header level
# track the header level
level=''
# tracks repo & file for curl call
# tracks src for curl calls
src=''
# tracks file for local file copy
# tracks file paths for local file reads
local=''
while IFS= read -r line; do
# this section removes prev lines after file loads - src/load set to non-empty
while IFS= read -r line; do
# REMOVE PREVIOUS CONTENT SECTION
# if src or local tags are not empty
if [[ -n "$src" || -n "$local" ]]; then
# if line eq level - level is num of ##s
if [[ "$line" == "$level"'#'* ||
# line not a header)
"$line" != '#'* ]]; then
continue
# if current line not a horitzontal rule hr
if [[ "$line" != "----"* ]]; then
# if line == level -> level is num of ##s
if [[ "$line" == "$level"'#'* ||
# line not a header line
"$line" != '#'* ]]; then
# skip line and rewrite over old content
continue
fi
fi
fi

# PRINT TO PAGE SECTION
src=''
local=''
# if line is header - assign level num
# if line is header -> assign level num
if [[ "$line" == '#'* ]]; then
# this is header before SRC/LOCAL anchors
title=${line##*\#}
level="${line:0:$((${#line} - ${#title}))}"
# src on page
# if header has (#id-of-link) or {#id-on-page} patterns
if [[ $line =~ (\(\#.*\))\. || "$line" =~ \{\#.*\} ]]; then
# isolate the matching part of line
match=${BASH_REMATCH[0]}
# remove match leaving rest
rest=${line//${match}}
# remove any # symbols from start
title_rest=${rest##*\#}
# slice rest to get only level
level="${rest:0:$((${#rest} - ${#title_rest}))}"
else
# any other headers -> before SRC/LOCAL pages anchors
header=${line##*\#}
level="${line:0:$((${#line} - ${#header}))}"
fi
# if line is src anchor in read file
elif [[ "$line" == '<!-- SRC:'* ]]; then
# remove the first 10 chars
src=${line:10}
# % remove from end until after white space -> leave src details
src=${src% *}
# local on page
# if line is local anchor in read file
elif [[ "$line" == '<!-- LOCAL:'* ]]; then
# remove the first 12 chars
local=${line:12}
# % remove from end until after white space -> leave local details
local=${local% *}
# leave only path to file
local=${local#* }
fi

# execute line to the page
echo "$line"

if [[ -n "$local" ]]; then
# cat file -> outputs full content of file at local path
cat "$local" | \
# remove the top # headers from cp file
# remove the top 1# headers from cat'd file
sed -En '/^##|^[^#]/,$p' | \
# remove any starting w NOTE: lines
sed -E '/^[NOTE:*]/d' | \
# remove any lines with Not the Express JS Framework string
sed -E '/Not the Express JS Framework/I,$d'
# remove GH MD specific tags start w '[!NOTE\] + following line
sed -E '/^>\[!NOTE\]*/{N;d;}' | \
# change GH specific MD IMPORTANT tags to plain MD
sed -E 's/> \[!IMPORTANT\]/> **IMPORTANT:** /g'
echo
elif [[ -n "$src" ]]; then
echo
Expand All @@ -60,8 +84,9 @@ while IFS= read -r line; do
sed -En '/^##|^[^#]/,$p' | \
# add additional # every header
sed 's/^#/&'"${level:1}"'/g' | \
# format gh links when match
# format GH links when match
sed -E 's/(\[[^]]*\])\(([^):#]*)\)/\1(https:\/\/github.com\/'"$(sed 's/\//\\\//g' <<< "$repo")"'\/blob\/master\/\2)/g'
echo
fi
# read in dest file then write back to file
done <<<"$(< $DEST)" > $DEST
25 changes: 6 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,22 @@ jobs:
github.event.pull_request.draft != true &&
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved') ||
github.event_name != 'pull_request_review'
strategy:
matrix:
node-version:
- "16"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install Node.js ${{ matrix.node-version }}
shell: bash -l {0}
run: |
nvm install --default ${{ matrix.node-version }}
dirname "$(npm which)" >> "$GITHUB_PATH"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Node.js dependencies
run: npm install

- name: List environment
id: list_env
shell: bash
run: |
echo "node@$(node -v)"
echo "npm@$(npm -v)"
npm -s ls
- name: Run tests
shell: bash
run: npm test

- name: Check Docker support
shell: bash
run: |
Expand Down
67 changes: 0 additions & 67 deletions .github/workflows/translation.yml

This file was deleted.

12 changes: 12 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: 404
title: Page not found
description: We couldn’t find the page you’re looking for.
lang: en
---

# {{ page.title }}

We couldn’t find the page you’re looking for. Check the address or [head back home](/).

If this is a mistake, [let us know](https://github.com/expressjs/expressjs.com/issues/new/), and we will try to fix it!
Loading

0 comments on commit 516c736

Please sign in to comment.