-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rari): use rari as default (#12322)
* feat(rari): use rari as default BREAKING CHANGE: rari is used by default use :legacy commands for yari
- Loading branch information
Showing
18 changed files
with
183 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ cloud-function/**/*.js | |
filecheck/*.js | ||
mdn/content/ | ||
tool/*.js | ||
bins/*.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,13 @@ jobs: | |
mv mdn/translated-content-de/files/de mdn/translated-content/files/ | ||
rm -rf mdn/translated-content-de | ||
- name: Clean and commit de | ||
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }} | ||
working-directory: mdn/translated-content | ||
run: | | ||
git add files/de | ||
git -c user.name='MDN' -c user.email='[email protected]' commit -m 'de' | ||
- uses: actions/checkout@v4 | ||
if: ${{ ! vars.SKIP_BUILD }} | ||
with: | ||
|
@@ -151,7 +158,8 @@ jobs: | |
if: ${{ ! vars.SKIP_BUILD }} | ||
run: yarn --frozen-lockfile | ||
env: | ||
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
# Use a GITHUB_TOKEN to bypass rate limiting for ripgrep and rari. | ||
# See https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Python | ||
|
@@ -198,6 +206,12 @@ jobs: | |
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files | ||
BASE_URL: "https://developer.mozilla.org" | ||
|
||
# rari | ||
BUILD_OUT_ROOT: "client/build" | ||
LIVE_SAMPLES_BASE_URL: https://live.mdnplay.dev | ||
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.mozilla.net | ||
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de | ||
|
||
# The default for this environment variable is geared for writers | ||
# (aka. local development). Usually defaults are supposed to be for | ||
# secure production but this is an exception and default | ||
|
@@ -285,32 +299,17 @@ jobs: | |
echo "CONTENT_ROOT=$CONTENT_ROOT" | ||
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT" | ||
yarn build:sw | ||
yarn build:prepare | ||
yarn build:client | ||
yarn build:ssr | ||
yarn tool build-robots-txt | ||
yarn tool sync-translated-content es fr ja ko pt-br ru zh-cn zh-tw | ||
yarn rari content sync-translated-content | ||
yarn rari git-history | ||
# Build using one process per locale. | ||
# Note: We have 4 cores, but 9 processes is a reasonable number. | ||
for locale in en-us de es fr ja ko pt-br ru zh-cn zh-tw; do | ||
yarn build:docs --locale $locale 2>&1 | sed "s/^/[$locale] /" & | ||
pids+=($!) | ||
done | ||
for pid in "${pids[@]}"; do | ||
wait $pid | ||
done | ||
yarn rari build --all --issues client/build/issues.json --templ-stats | ||
du -sh client/build | ||
# Build the blog | ||
yarn build:blog | ||
# Build the curriculum | ||
yarn build:curriculum | ||
# Generate sitemap index file | ||
yarn build --sitemap-index | ||
# SSR all pages | ||
yarn render:html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
server: yarn start:rari-server | ||
type-check: cd client && tsc --noEmit --watch | ||
web: yarn start:client | ||
ssr: yarn watch:ssr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env node | ||
import { rariBin } from "@mdn/rari"; | ||
import { spawn } from "cross-spawn"; | ||
import { config } from "dotenv"; | ||
import path from "node:path"; | ||
import { cwd } from "node:process"; | ||
|
||
import { BUILD_OUT_ROOT } from "../libs/env/index.js"; | ||
|
||
config({ | ||
path: path.join(cwd(), process.env.ENV_FILE || ".env"), | ||
}); | ||
|
||
process.env.BUILD_OUT_ROOT = process.env.BUILD_OUT_ROOT || BUILD_OUT_ROOT; | ||
|
||
spawn(rariBin, ["build", ...process.argv.slice(2)], { stdio: "inherit" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
import { concurrently } from "concurrently"; | ||
import { rariBin } from "@mdn/rari"; | ||
import { filename } from "../server/filename.js"; | ||
import { config } from "dotenv"; | ||
import path from "node:path"; | ||
import { cwd } from "node:process"; | ||
|
||
config({ | ||
path: path.join(cwd(), process.env.ENV_FILE || ".env"), | ||
}); | ||
|
||
const { commands, result } = concurrently( | ||
[ | ||
{ | ||
command: `node ${filename}`, | ||
name: "server", | ||
env: { | ||
RARI: true, | ||
}, | ||
prefixColor: "red", | ||
}, | ||
{ | ||
command: `${rariBin} serve -vv`, | ||
name: "rari", | ||
prefixColor: "blue", | ||
env: { | ||
...process.env, | ||
}, | ||
}, | ||
], | ||
{ | ||
killOthers: ["failure", "success"], | ||
restartTries: 0, | ||
handleInput: true, | ||
inputStream: process.stdin, | ||
} | ||
); | ||
|
||
const stop = new Promise((resolve, reject) => { | ||
process.on("SIGINT", () => { | ||
commands.forEach((cmd) => cmd.kill()); // Terminate all concurrently-run processes | ||
reject(); | ||
}); | ||
result.finally(() => resolve(null)); | ||
}); | ||
try { | ||
await stop; | ||
console.log("All tasks completed successfully."); | ||
} catch { | ||
console.log("Killed ☠️"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env node | ||
import { rariBin } from "@mdn/rari"; | ||
import { spawn } from "cross-spawn"; | ||
|
||
import { config } from "dotenv"; | ||
import path from "node:path"; | ||
import { cwd } from "node:process"; | ||
|
||
import { BUILD_OUT_ROOT } from "../libs/env/index.js"; | ||
|
||
config({ | ||
path: path.join(cwd(), process.env.ENV_FILE || ".env"), | ||
}); | ||
|
||
process.env.BUILD_OUT_ROOT = process.env.BUILD_OUT_ROOT || BUILD_OUT_ROOT; | ||
|
||
spawn(rariBin, ["content", ...process.argv.slice(2)], { stdio: "inherit" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.