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

feat(scripts): migrate commands to new rari build system #37788

Merged
merged 4 commits into from
Jan 27, 2025

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Jan 24, 2025

Description

Migrates the following commands to the new rari build system:

  • yarn build
  • yarn content
  • yarn start ✱✱

Note

✱ The build command now implies the (now removed) -n parameter, and only builds index.json files.
To render index.html files, run yarn yari-render-html after the build.

✱✱ The start command is equivalent to the start:rari command, which is now deprecated.

The existing commands, using the old yari build system, are preserved with a :legacy suffix for now:

  • yarn build:legacy
  • yarn content:legacy
  • yarn start:legacy

Warning

These legacy commands are deprecated, and will be removed soon.

Motivation

MDN is already being deployed using rari since December 17, 2024, and this change makes sure every writer sees the content as it will appear on MDN.

Note

Rari only replaces the build parts of yari, namely the build, content, kumascript, markdown, and tool directories.
For now, yari still provides MDN's frontend code (client), and the filecheck (filecheck), which hasn't been ported yet.

The most important changes from a writer's perspective are:

  1. Sidebars are now authored in mdn/content: https://github.com/mdn/content/tree/main/files/sidebars
  2. The build system is more efficient and powerful, so builds are much faster. ✱

Tip

✱ Try running yarn build without any parameter. This should build all en-US pages in less than a minute (or in about 10 seconds on a Macbook Pro M1 or later).

Additional details

Running any of the migrated commands will print an informational message at the top:

% yarn start
yarn run v1.22.22
$ yarn -s info:rari && yarn up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true BUILD_OUT_ROOT=build rari-server

🐥 This command is now using rari: https://github.com/mdn/rari
🐞 Please report any issues here:  https://github.com/mdn/rari/issues/new?template=bug.yml

$ node scripts/up-to-date-check.js
...

Running any of the legacy commands will print a deprecation message at the top:

% yarn start:legacy
yarn run v1.22.22
$ yarn -s info:deprecated && yarn up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true BUILD_OUT_ROOT=build yari-server

🗑️  This command is deprecated, and will be removed soon.

$ node scripts/up-to-date-check.js
...

Related issues and pull requests

Part of MP-1856 (Mozilla-internal).

Adds `:legacy` suffix to deprecated scripts using yari build system.
Running a deprecated script will show a deprecation message at the top.
@caugner caugner requested a review from mdn-bot as a code owner January 24, 2025 15:08
@github-actions github-actions bot added system [PR only] Infrastructure and configuration for the project size/s [PR only] 6-50 LoC changed labels Jan 24, 2025
@caugner caugner requested a review from a team as a code owner January 24, 2025 15:20
Copy link
Contributor

@argl argl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@caugner
Copy link
Contributor Author

caugner commented Jan 27, 2025

Before merging, I'm testing the impact on the npm-published-simulation workflow in yari: https://github.com/mdn/yari/actions/runs/12986322616

Edit: All checks are passing, but it looks like they're actually testing yari, so we'll need to migrate the test next.

@caugner caugner merged commit 627b8fc into main Jan 27, 2025
17 of 18 checks passed
@caugner caugner deleted the MP-1856-make-rari-default branch January 27, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/s [PR only] 6-50 LoC changed system [PR only] Infrastructure and configuration for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants