Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contributing.md Enhancement #1683

Merged
merged 21 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 68 additions & 12 deletions .github/scripts/get-contributing.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,92 @@
#!/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.
# read contents of file into memory
DEST="../../en/resources/contributing.md"

# track the header level
level=''
# tracks src for curl calls
src=''
while IFS= read -r line; do
if [[ -n "$src" ]] && [[ "$line" != '#'* || "$line" == "$level"'#'* ]]; then
continue
# tracks file paths for local file reads
local=''
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 current line not a horitzontal rule hr
if [[ "$line" != "----"* ]]; then
# if line == level -- level is num of ##
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 a header
if [[ "$line" == '#'* ]]; then
title=${line##*\#}
level="${line:0:$((${#line} - ${#title}))}"
# 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 of line to get only level
level="${rest:0:$((${#rest} - ${#title_rest}))}"
else
# any other headers -- these 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 -- leaves src details
src=${src% *}
fi

# 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
# prints line to the page
echo "$line"

if [[ -n "$src" ]]; then

if [[ -n "$local" ]]; then
# cat file -- outputs full contents of file at local path
cat "$local" | \
# remove the top 1# headers from cat'd file
sed -En '/^##|^[^#]/,$p' | \
# remove GH MD specific tags start w '[!NOTE\] + the following line
sed -E '/^>\[!NOTE\]*/{N;d;}' | \
# change GH specific MD IMPORTANT tags -> change into plain MD
sed -E 's/> \[!IMPORTANT\]/> **IMPORTANT:** /g'
echo
elif [[ -n "$src" ]]; then
echo
path=${src#* }
repo=${src% *}
curl -s "https://raw.githubusercontent.com/${repo}/master/${path}" | \
# if line is ## or not #
sed -En '/^##|^[^#]/,$p' | \
# add additional # every header
sed 's/^#/&'"${level:1}"'/g' | \
# 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
145 changes: 122 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,115 @@
## Contributing to expressjs.com
# Contributing to Expressjs.com

This repository is only for issues related to the website [http://expressjs.com](http://expressjs.com). For issues related to Express, the framework, go to [https://github.com/expressjs/express](https://github.com/expressjs/express).
### The Official Documentation of the Express JS Framework

Feel free to make changes to the template files or the document files. The supporting docs are located in their respective directories, and the API docs are located under the `_includes` directory.
This is the contribution documentation for the [Expressjs.com](https://github.com/expressjs/expressjs.com) website.

Content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License. See https://creativecommons.org/licenses/by-sa/3.0/us/ for a layman's summary;
See [LICENSE.md](LICENSE.md) for the full license.
>[!NOTE]
> This is not the repo for Express JS framework. To contribute to the _[Express JS framework](https://github.com/expressjs/express_)_, check out the [Github repo contributing page](https://github.com/expressjs/express/blob/master/Contributing.md) or the website's [Contributing to Express](https://expressjs.com/en/resources/contributing.html) page.


#### Need some ideas? These are some typical issues.

1. **Website issues**:
If you see anything on the site that could use a tune-up, think about how to fix it.

- Display or screen sizing problems
- Mobile responsiveness issues
- Missing or broken accessibility features
- Website outages
- Broken links
- Page structure or user interface enhancements


2. **Content Issues**:
Fix anything related to site content or typos.
- Spelling errors
- Incorrect/outdated Express JS documentation
- Missing content


3. **Translation Issues**: Fix any translation errors or contribute new content.
- Fix spelling errors
- Fix incorrect/poorly translated words
- Translate new content
> [!IMPORTANT]
> All translation submissions are currently paused. See this [notice](#notice-we-have-paused-all-translation-contributions) for more information.

- Check out the [Contributing translations](#contributing-translations) section below for a contributing guide.

#### Want to work on a backlog issue?

We often have bugs or enhancements that need work. You can find these under our repo's [Issues tab](https://github.com/expressjs/expressjs.com/issues). Check out the tags to find something that's a good match for you.

#### Have an idea? Found a bug?

If you've found a bug or a typo, or if you have an idea for an enhancement, you can:
- Submit a [new issue](https://github.com/expressjs/expressjs.com/issues/new/choose) on our repo. Do this for larger proposals, or if you'd like to discuss or get feedback first.
- Make a [Github pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). If you have already done work and it's ready to go, feel free to send it our way.

## Getting Started

The steps below will guide you through the Expressjs.com contribution process.

#### Step 1: (OPTIONAL) Open a New Issue
So you've found a problem that you want to fix, or have a site enhancement you want to make.
1. If you want to get feedback or discuss, open a discussion [issue](https://github.com/expressjs/expressjs.com/issues/new/choose) prior to starting work. This is not required, but encouraged for larger proposals.
- While we highly encourage this step, it is only for submissions proposing significant change. It helps us to clarify and focus the work, and ensure it aligns with overall project priorities.
- For submissions proposing minor improvements or corrections, this is not needed. You can skip this step.
- When opening an issue please give it a title and fill in the description section. The more details you provide, the more feedback we can give.

2. After receiving your issue the Express JS documentation team will respond with feedback. We read every submission and always try to respond quickly with feedback.
- For submissions proposing significant change, we encourage you to follow the review process before starting work.

#### Step 2: Get the Application Code Base

Clone the repo and get the code:

git clone https://github.com/expressjs/expressjs.com.git

After you've got the code you're ready to start making your changes!

But just in case you need a little extra explanation, this section below outlines the main sections of the code base, where most changes are likely to be made.

**Markdown Page Files**:
- These files render to html and make up the individual pages of the site. Most of the site's documentation text content is written in `md` files.
- Change these to make changes to individual pages' content/text or markup.
- Each language has its own complete set of pages, located under their respective language directories - all the Spanish markdown content is found in the `es` directory, for example.

**Includes Partials and Layout Templates**
- `_includes` are partials that are imported and reused across multiple pages.
- These are used to import text content for reuse across pages, such as the API documentation, e.g., `_includes > api > en > 5x`, which is included in every language.
- These are used to include the page components that make up site-wide user interface and periphery structure, e.g., Header, Footer, etc.
- `_layouts` are the templates used to wrap the site's individual pages.
- These are used to display the structure of the site's periphery, such as the header and footer, and for injecting and displaying individual markdown pages inside the `content` tag.

**Blog Markdown Files**
- These files make up the individual blog posts. If you want to contribute a blog post please
follow the specific instructions for [How to write a blog post.](https://expressjs.com/en/blog/write-post.html)
- Located under the `_posts` directory.

**CSS or Javascript**
- All css and js files are kept in `css` and `js` folders on the project root.

The Express JS website is build using [Jeykyll](https://jekyllrb.com/) and is hosted on [Github Pages](https://pages.github.com/).

#### Step 3: Running the Application


Now you'll need a way to see your changes, which means you'll need a running version of the application. You have two options.
1. __Run Locally__: This gets the local version of the application up and running on your machine. Follow our [Local Setup Guide](https://github.com/expressjs/expressjs.com?tab=readme-ov-file#local-setup) to use this option.
- This is the recommended option for moderate to complex work.
2. __Run using Deploy Preview__: Use this option if you don't want to bother with a local installation. Part of our continuous integration pipeline includes [Netlify Deploy Preview](https://docs.netlify.com/site-deploys/deploy-previews/).
1. To use this you'll need to get your changes online - after you've made your first commit on your feature branch, make a *draft* pull request.
2. After the build steps are complete, you'll have access to a __Deploy Preview__ tab that will run your changes on the web, rebuilding after each commit is pushed.
3. After you are completely done your work and it's ready for review, remove the draft status on your pull request and submit your work.

## Contributing translations

#### Notice: We have paused all translation contributions.
> [!IMPORTANT]
> We are currently working toward a more streamlined translations workflow. As long as this notice is posted, we will _not_ be accepting any translation submissions.
chrisdel101 marked this conversation as resolved.
Show resolved Hide resolved

We highly encourage community translations! We no longer have professional translations, and we believe in the power of our community to provide accurate and helpful translations.

The documentation is translated into these languages:
Expand All @@ -29,27 +130,25 @@ The documentation is translated into these languages:
- Simplified Chinese (`zh-cn`)
- Traditional Chinese (`zh-tw`)

To find translations that need to be done, you can [filter for merged PRs](https://github.com/expressjs/expressjs.com/pulls?q=is%3Apr+is%3Aclosed+label%3Arequires-translation-es) that include the tag for your language, such as `requires-translation-es`.
### Adding New Full Site Translations

When you contribute a translation, please reference the original PR. This helps the person merging your translation to remove the `requires-translation-es` tag from the original PR.
If you find a translation is missing from the list you can create a new one.

To translate Expressjs.com into a new language, follow these steps:

### Adding new translations

To contribute a translation into another language, following the procedure below.

Follow these steps:

0. Clone the [`expressjs.com` repository](https://github.com/expressjs/expressjs.com)
1. Create a directory for the language of your choice using its [ISO 639-1 code](http://www.loc.gov/standards/iso639-2/php/code_list.php) as its name.
2. Copy `index.md`, `api.md`, `starter/`, `guide/`, `advanced/`, `resources/`, `4x/`, and `3x/`, to the language directory.
3. Remove the link to 2.x docs from the "API Reference" menu.
4. Update the `lang` variable in the copied markdown files.
5. Update the `title` variable in the copied markdown files.
6. Create the header, footer, notice, and announcement file for the language in the `_includes/` directory, in the respective directories, and make necessary edits to the contents.
7. Create the announcement file for the language in the `_includes/` directory.
1. Clone the [`expressjs.com`](https://github.com/expressjs/expressjs.com) repository.
2. Create a directory for the language of your choice using its [ISO 639-1 code](https://www.loc.gov/standards/iso639-2/php/code_list.php) as its name.
3. Copy `index.md`, `api.md`, `starter/`, `guide/`, `advanced/`, `resources/`, `4x/`, and `3x/`, to the language directory.
4. Remove the link to 2.x docs from the "API Reference" menu.
5. Update the `lang` variable in the copied markdown files.
6. Update the `title` variable in the copied markdown files.
7. Create the header, footer, notice, and announcement file for the language in the `_includes/` directory, in the respective directories, and make necessary edits to the contents.
8. Create the announcement file for the language in the `_includes/` directory.
9. Make sure to append `/{{ page.lang }}` to all the links within the site.
10. Update the `CONTRIBUTING.md` and the `.github/workflows/translation.yml` files with the new language
10. Update the [CONTRIBUTING.md](https://github.com/expressjs/expressjs.com/blob/gh-pages/CONTRIBUTING.md#contributing-translations) and the `.github/workflows/translation.yml` files with the new language.

### Adding Page and Section Translations

Many site translations are still missing pages. To find which ones we need help with, you can [filter for merged PRs](https://github.com/expressjs/expressjs.com/pulls?q=is%3Apr+is%3Aclosed+label%3Arequires-translation-es) that include the tag for your language, such as `requires-translation-es` for requires Spanish translation.

Thank you for your interest in contributing to expressjs.com. Your efforts help make our documentation accessible to everyone!
If you contribute a page or section translation, please reference the original PR. This helps the person merging your translation to remove the tag from the original PR.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ The default GitHub Pages syntax highlighting has been disabled in `_config.yml`

## Contributing

Feel free to make changes to the template files or the document files. The supporting docs are located in their respective directories, and the API docs are located under the `_includes` directory.

Please see the [Contributors' Guide](CONTRIBUTING.md) for more information on contributing to the documentation, including information on contributing translations.
Please see the [Contributors' Guide](CONTRIBUTING.md) for more information on contributing to the Express JS documentation, including information on contributing translations.

## Why use Jekyll instead of an Express-based solution?

Expand Down
7 changes: 6 additions & 1 deletion en/resources/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ redirect_from: "/resources/community.html"

# Contributing to Express

### Looking to contribute to Expressjs.com? Click [here](#expressjs-website-contributing).

chrisdel101 marked this conversation as resolved.
Show resolved Hide resolved
Express and the other projects in the [expressjs organization on GitHub](https://github.com/expressjs) are projects of the [OpenJs Foundation](https://openjsf.org/).
These projects are governed under the general policies and guidelines of the Node.js Foundation along with the additional guidelines below.

Expand Down Expand Up @@ -237,7 +239,6 @@ dissent. When the PR is merged, a TC member will add them to the proper GitHub/

```text
By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
Expand Down Expand Up @@ -374,3 +375,7 @@ We are currently working on a new version of the security model, the most update
If you have suggestions on how this process could be improved please submit a
pull request.

----
# Contributing to Expressjs.com {#expressjs-website-contributing}
chrisdel101 marked this conversation as resolved.
Show resolved Hide resolved

<!-- LOCAL: expressjs/expressjs.com ../../CONTRIBUTING.md -->