Skip to content
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
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ system:
- changed-files:
- any-glob-to-any-file:
- package.json
- yarn.lock
- package-lock.json
- .github/**
- .vscode/**
- .*
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/auto-cleanup-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ jobs:
node-version-file: mdn/content/.nvmrc
package-manager-cache: false

- name: Install all yarn packages
run: |
yarn --frozen-lockfile
- name: Install
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install all yarn packages for mdn/content
- name: Install for mdn/content
working-directory: ${{ github.workspace }}/mdn/content
run: yarn --frozen-lockfile
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -68,15 +67,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/mdn/content
run: |
yarn content fix-flaws --locale "${{ matrix.lang }}"
npm run content fix-flaws -- --locale "${{ matrix.lang }}"

- name: Lint Markdown files
run: |
yarn markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md"
npx markdownlint-cli2 --fix "**/${{ matrix.lang }}/**/*.md"
node ./scripts/check-url-locale.js --fix "files/${{ matrix.lang }}"
ls -d 2>/dev/null "files/${{ matrix.lang }}" "docs/${{ matrix.lang }}" | xargs yarn autocorrect --fix
yarn prettier -w "**/${{ matrix.lang }}/**/*.md"
cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/.front-matter-config.json "${{ github.workspace }}/files/${{ matrix.lang }}"
ls -d 2>/dev/null "files/${{ matrix.lang }}" "docs/${{ matrix.lang }}" | xargs npx autocorrect --fix
npx prettier -w "**/${{ matrix.lang }}/**/*.md"
cd ${{ github.workspace }}/mdn/content && npm run fix:fm -- --config-file ${{ github.workspace }}/.front-matter-config.json "${{ github.workspace }}/files/${{ matrix.lang }}"

- name: Create PR with only fixable issues
if: success()
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- .markdownlint-cli2.jsonc
- "**/.markdownlint.jsonc"
- package.json
- yarn.lock
- package-lock.json
- .github/workflows/markdown-lint.yml
- .github/workflows/markdownlint-problem-matcher.json

Expand All @@ -31,16 +31,15 @@ jobs:
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm

- name: Install all yarn packages
run: |
yarn --frozen-lockfile
- name: Install
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint markdown files
run: |
echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
yarn lint:md
npm run lint:md
24 changes: 12 additions & 12 deletions .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ jobs:
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: mdn/content/.nvmrc
cache: yarn
cache: npm
cache-dependency-path: |
mdn/content/yarn.lock
yarn.lock
mdn/content/package-lock.json
package-lock.json

- name: Install all yarn packages for mdn/translated-content
- name: Install for mdn/translated-content
if: steps.check.outputs.HAS_FILES == 'true'
run: yarn --frozen-lockfile
run: npm ci

- name: Install all yarn packages for mdn/content
- name: Install for mdn/content
if: steps.check.outputs.HAS_FILES == 'true'
working-directory: ${{ github.workspace }}/mdn/content
run: yarn --frozen-lockfile
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:

echo "Running markdownlint --fix"
MD_LINT_FAILED=false
MD_LINT_LOG=$(yarn markdownlint-cli2 --fix "${files_to_lint[@]}" 2>&1) || MD_LINT_FAILED=true
MD_LINT_LOG=$(npx markdownlint-cli2 --fix "${files_to_lint[@]}" 2>&1) || MD_LINT_FAILED=true
echo "MD_LINT_LOG<<${EOF}" >> "$GITHUB_OUTPUT"
echo "${MD_LINT_LOG}" >> "$GITHUB_OUTPUT"
echo "${EOF}" >> "$GITHUB_OUTPUT"
Expand All @@ -149,7 +149,7 @@ jobs:
for file in "${files_to_lint[@]}"; do
absolute_paths+=("$(realpath -e "$file")")
done
FM_LINT_LOG=$(cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/.front-matter-config.json "${absolute_paths[@]}" 2>&1) || FM_LINT_FAILED=true
FM_LINT_LOG=$(cd ${{ github.workspace }}/mdn/content && npm run fix:fm -- --config-file ${{ github.workspace }}/.front-matter-config.json "${absolute_paths[@]}" 2>&1) || FM_LINT_FAILED=true
echo "FM_LINT_LOG<<${EOF}" >> "$GITHUB_OUTPUT"
echo "${FM_LINT_LOG}" >> "$GITHUB_OUTPUT"
echo "${EOF}" >> "$GITHUB_OUTPUT"
Expand All @@ -159,16 +159,16 @@ jobs:
node ./scripts/check-url-locale.js --fix "${files_to_lint[@]}"

echo "Running autocorrect"
yarn autocorrect --fix "${files_to_lint[@]}"
npx autocorrect --fix "${files_to_lint[@]}"

echo "Running Prettier"
PRETTIER_FAILED=false
PRETTIER_LOG=$(yarn prettier --check "${files_to_lint[@]}" 2>&1) || PRETTIER_FAILED=true
PRETTIER_LOG=$(npx prettier --check "${files_to_lint[@]}" 2>&1) || PRETTIER_FAILED=true
echo "PRETTIER_LOG<<${EOF}" >> "$GITHUB_OUTPUT"
echo "${PRETTIER_LOG}" >> "$GITHUB_OUTPUT"
echo "${EOF}" >> "$GITHUB_OUTPUT"
echo "PRETTIER_FAILED=${PRETTIER_FAILED}" >> "$GITHUB_OUTPUT"
yarn prettier -w "${files_to_lint[@]}"
npx prettier -w "${files_to_lint[@]}"

if [[ -n $(git diff) ]]; then
echo "FILES_MODIFIED=true" >> "$GITHUB_OUTPUT"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-check_json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint JSON files
run: yarn lint:json
run: npm run lint:json
11 changes: 5 additions & 6 deletions .github/workflows/pr-check_redirects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ jobs:
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: mdn/content/.nvmrc
cache: "yarn"
cache-dependency-path: mdn/content/yarn.lock
cache: npm
cache-dependency-path: mdn/content/package-lock.json

- name: Install all yarn packages
- name: Install
if: steps.filter.outputs.required_files == 'true'
working-directory: ${{ github.workspace }}/mdn/content
run: |
yarn --frozen-lockfile
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -67,4 +66,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/mdn/content
run: |
yarn content validate-redirects
npm run content validate-redirects
10 changes: 5 additions & 5 deletions .github/workflows/pr-check_yml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
paths:
- .nvmrc
- yarn.lock
- package-lock.json
- "**/*.yml"
- .github/workflows/pr-check_yml.yml

Expand All @@ -28,13 +28,13 @@ jobs:
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: ".nvmrc"
cache: yarn
cache: npm

- name: Install all yarn packages
run: yarn --frozen-lockfile
- name: Install
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint markdown files
run: yarn lint:yml
run: npm run lint:yml
2 changes: 1 addition & 1 deletion .github/workflows/pr-review-companion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: content
run: yarn --frozen-lockfile
run: npm ci

- name: Analyze PR build
if: steps.check.outputs.HAS_ARTIFACT
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ jobs:
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version-file: mdn/content/.nvmrc
cache: yarn
cache-dependency-path: mdn/content/yarn.lock
cache: npm
cache-dependency-path: mdn/content/package-lock.json

- name: Install all yarn packages
- name: Install
if: steps.check.outputs.HAS_FILES == 'true'
working-directory: ${{ github.workspace }}/mdn/content
run: yarn --frozen-lockfile
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -150,12 +150,12 @@ jobs:
ARGS+=("-f" "$CONTENT_TRANSLATED_ROOT/$file_without_prefix")
done

yarn rari build --no-basic --json-issues --data-issues "${ARGS[@]}"
npx rari build --no-basic --json-issues --data-issues "${ARGS[@]}"

# Workaround, as fred-ssr doesn't copy assets.
cp -vR node_modules/@mdn/fred/out/. "$BUILD_OUT_ROOT"

yarn fred-ssr
npm run fred-ssr

echo "Disk usage size of the build"
du -sh $BUILD_OUT_ROOT
Expand Down Expand Up @@ -196,4 +196,4 @@ jobs:
ARGS+=("$CONTENT_TRANSLATED_ROOT/$file_without_prefix")
done

yarn filecheck "${ARGS[@]}"
npm run filecheck "${ARGS[@]}"
6 changes: 3 additions & 3 deletions .github/workflows/sync-translated-content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
node-version-file: mdn/content/.nvmrc
package-manager-cache: false

- name: Install all yarn packages
- name: Install
working-directory: ${{ github.workspace }}/mdn/content
run: yarn --frozen-lockfile
run: npm ci
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -67,7 +67,7 @@ jobs:
# when fetching the latest releases info from the GitHub API.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/mdn/content
run: yarn content sync-translated-content ${{ matrix.lang }}
run: npm run content sync-translated-content ${{ matrix.lang }}

- name: Gather related upstream commits
id: gather
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/system-file-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
paths:
- ".github/**"
- package.json
- yarn.lock
- package-lock.json

# No GITHUB_TOKEN permissions, as we don't use it.
permissions: {}
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:

# Check actor.
if [ "$ACTOR" != "$AUTHOR" ]; then
ACTOR_PERMISSION=$(gh api https://api.github.com/repos/${{ github.repository }}/collaborators/$ACTOR/permission --jq .permission)
ACTOR_PERMISSION=$(gh api https://api.github.com/repos/${{ github.repository }}/collaborators/$ACTOR/permission --jq .permission)

if [ "$ACTOR_PERMISSION" != "admin" ]; then
echo "PR actor ($ACTOR) is not an admin, please ping someone for a review."
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ _githistory.json
.idea
.vscode
mdn/content
yarn-debug.log*
yarn-error.log*
*.log
14 changes: 7 additions & 7 deletions .lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ pre-commit:
jobs:
- name: Format non-markdown
glob: "*.{js,json,yml,yaml,css,html}"
run: yarn prettier --write --cache {staged_files}
run: npx prettier --write --cache {staged_files}
stage_fixed: true

- name: Autocorrect zh-cn
glob: "{docs,files}/zh-cn/*.md"
run: yarn autocorrect --fix {staged_files}
run: npx autocorrect --fix {staged_files}
stage_fixed: true

- name: Format markdown
Expand All @@ -17,21 +17,21 @@ pre-commit:
parallel: true
jobs:
- name: Markdownlint
run: yarn markdownlint-cli2 --fix {staged_files}
run: npx markdownlint-cli2 --fix {staged_files}
stage_fixed: true
- name: Check URLs per locale
run: yarn node ./scripts/check-url-locale.js --fix {staged_files}
run: node ./scripts/check-url-locale.js --fix {staged_files}
stage_fixed: true
- name: Prettier
run: yarn prettier --write --cache {staged_files}
run: npx prettier --write --cache {staged_files}
stage_fixed: true

post-merge:
only:
- ref: main
commands:
yarn-install:
run: yarn install
npm-install:
run: npm install

# For condensed output
output:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ Once that is done, you will also need to fork and clone this repository by follo

(the `.env` file will be created for you if it does not already exist.)

3. Run the command `yarn start` to start the local server at `localhost:5042`.
3. Run the command `npm start` to start the local server at `localhost:5042`.

#### Working in the translated-content repo

This repo has exactly the same folder structure and concepts as the [upstream content repo](https://github.com/mdn/content). The main difference is in the setup you need to do before you can start editing. It is mostly the same, but there is a little bit more to consider. Primarily, commands such as `yarn content` are only available from the upstream content repo; linting commands are available here, however, as they often use different configuration.
This repo has exactly the same folder structure and concepts as the [upstream content repo](https://github.com/mdn/content). The main difference is in the setup you need to do before you can start editing. It is mostly the same, but there is a little bit more to consider. Primarily, commands such as `npm run content` are only available from the upstream content repo; linting commands are available here, however, as they often use different configuration.

## Contributing to MDN translated content

Expand Down
2 changes: 1 addition & 1 deletion docs/es/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Digamos que desea traducir el contenido de la página que se observa en esta dir

## Arreglar "flaws" (defectos)

Al usar `yarn start` en localhost para el repositorio `mdn/content`, es posible ver una previsualización en tu servidor local de los cambios que has hecho y como lucirán. Esto también es posible creando un PR, el bot se encargará de generar una "preview URL" donde puedes observar el mismo resultado. En ambas pantallas, podrás, en la parte superior del documento, mostrar los "flaws" que el motor indique, y que contendrá aquellos defectos detectados de manera automática para ser corregidos, y, en algunos casos, la corrección disponible con un clic, o una sugerencia.
Al usar `npm start` en localhost para el repositorio `mdn/content`, es posible ver una previsualización en tu servidor local de los cambios que has hecho y como lucirán. Esto también es posible creando un PR, el bot se encargará de generar una "preview URL" donde puedes observar el mismo resultado. En ambas pantallas, podrás, en la parte superior del documento, mostrar los "flaws" que el motor indique, y que contendrá aquellos defectos detectados de manera automática para ser corregidos, y, en algunos casos, la corrección disponible con un clic, o una sugerencia.

## Convención en traducciones

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ MDN のページプレビューを伴ったドキュメントの編集方法は
必要なもの:

- GitHub アカウント
- [Node.js, Yarn の実行環境](https://mozilla-japan.github.io/mdn-translation-guide/translation/0_preparation.html)
- [Node.js, npm の実行環境](https://mozilla-japan.github.io/mdn-translation-guide/translation/0_preparation.html)

英語版リポジトリーとローカライズ版リポジトリーを `git clone` することで、MDN のページプレビューを伴った編集作業が行えます。

Expand Down
Loading
Loading