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
4 changes: 4 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ jobs:

for _ in {1..15}; do
if curl --max-time 2 --fail --silent http://127.0.0.1:8789/ > /dev/null; then
curl --max-time 2 --fail --silent http://127.0.0.1:8789/robots.txt | cmp public/robots.txt -
for guide_icon in build/client/assets/*.avif; do
curl --max-time 2 --fail --silent "http://127.0.0.1:8789/${guide_icon#build/client/}" | cmp "$guide_icon" -
done
exit 0
fi
sleep 1
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ node_modules/
.next/
out/
apps/docs/out/
apps/guide/out/
index_data/*.json
apps/docs/index_data/*.json

Expand Down
1 change: 1 addition & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"*.swo",
"*.swp",
"apps/docs/app/**/*.mjs",
"apps/guide/app/**/*.jsx",
"build",
"data/api/**/*.json",
"apps/docs/data/api/**/*.json",
Expand Down
17 changes: 11 additions & 6 deletions apps/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract only. Lesson copy belongs to the guide author.
| `app/GuideHome.res` | Guide workspace UI |
| `app/GuideCompilerBridgeHook.res` | Browser compiler and execution integration |
| `styles/main.css` | Guide-only visual system and responsive behavior |
| `public/` | Guide static assets, including `robots.txt` |
| `__tests__/` | Browser and unit coverage for the guide |

## Lesson Contract
Expand Down Expand Up @@ -71,9 +72,12 @@ yarn build:guide
yarn workspace @rescript-lang/guide ci:test
```

`yarn build:guide` compiles ReScript, pre-renders `/`, and copies the client
assets to `apps/guide/out/` for Wrangler. The guide fetches available compiler
versions from `https://cdn.rescript-lang.org` during pre-rendering; the
`yarn build:guide` compiles ReScript and pre-renders `/` into
`apps/guide/build/client/`, the assets directory configured in `wrangler.toml`.
Vite serves and copies the guide's `public/` directory, including `robots.txt`.
The root route imports the shared docs favicons so Vite emits them with the
guide's other assets. The guide fetches available compiler versions from
`https://cdn.rescript-lang.org` during pre-rendering; the
interactive compiler and runtime then run in the learner's browser.

## Current Capability
Expand All @@ -92,7 +96,7 @@ show a stop screen rather than a usable guide.

## Production Checklist

Before launch, complete and verify the following:
Track outstanding guide launch work in this checklist:

- [ ] Author, review, and run every lesson using its real expected output.
- [ ] Add a content-validation test for the complete lesson set, including
Expand All @@ -108,6 +112,7 @@ Before launch, complete and verify the following:
compiler and checkpoint changes.
- [ ] Choose mobile support or explicitly publish the desktop-only constraint
with an alternate learning path.
- [ ] Define the supported browsers and initial page-load performance budget.
- [ ] Split or defer the initial compiler/editor code so the initial route is
within the agreed performance budget.
- [ ] Replace the deprecated Vite `envFile` configuration and resolve the
Expand All @@ -121,6 +126,6 @@ Before launch, complete and verify the following:
## Deployment

The `deploy-guide` job in `.github/workflows/deploy.yml` builds the guide and
deploys it with Wrangler. Pushes to `master` deploy the production Worker;
non-Dependabot pull requests from this repository receive a preview Worker
deploys its `build/client/` assets with Wrangler. Pushes to `master` deploy the
production Worker; non-Dependabot pull requests from this repository receive a preview Worker
version and a link in the pull request.
73 changes: 0 additions & 73 deletions apps/guide/TODO.md

This file was deleted.

112 changes: 68 additions & 44 deletions apps/guide/app/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,80 @@
import * as ReactRouter from "react-router";
import * as JsxRuntime from "react/jsx-runtime";
import MainCssurl from "../styles/main.css?url";
import FaviconX16AvifurlnoInline from "../../docs/public/favicon/favicon-16x16.avif?url&no-inline";
import FaviconX32AvifurlnoInline from "../../docs/public/favicon/favicon-32x32.avif?url&no-inline";
import AppleTouchIconAvifurlnoInline from "../../docs/public/favicon/apple-touch-icon.avif?url&no-inline";

let mainCss = MainCssurl;

let appleTouchIcon = AppleTouchIconAvifurlnoInline;

let favicon32 = FaviconX32AvifurlnoInline;

let favicon16 = FaviconX16AvifurlnoInline;

function Root$default(props) {
return (
<html lang={"en"}>
<head>
<link href={mainCss} rel={"stylesheet"} />
<ReactRouter.Links />
<ReactRouter.Meta />
<meta charSet={"UTF-8"} />
<meta
content={"width=device-width, initial-scale=1"}
name={"viewport"}
/>
<meta content={"ReScript Guide"} name={"application-name"} />
<meta
content={"An interactive guide to learning ReScript."}
name={"description"}
/>
<meta content={"#f6f4ef"} name={"theme-color"} />
<link
href={"/apple-touch-icon.avif"}
rel={"apple-touch-icon"}
sizes={"180x180"}
/>
<link
href={"/favicon-32x32.avif"}
rel={"icon"}
sizes={"32x32"}
type={"image/avif"}
/>
<link
href={"/favicon-16x16.avif"}
rel={"icon"}
sizes={"16x16"}
type={"image/avif"}
/>
<title>{"ReScript Guide"}</title>
</head>
<body>
<ReactRouter.Outlet />
<ReactRouter.ScrollRestoration />
<ReactRouter.Scripts />
</body>
</html>
);
return <html
lang={"en"}
>
<head>
<link
href={mainCss}
rel={"stylesheet"}
/>
<ReactRouter.Links />
<ReactRouter.Meta />
<meta
charSet={"UTF-8"}
/>
<meta
content={"width=device-width, initial-scale=1"}
name={"viewport"}
/>
<meta
content={"ReScript Guide"}
name={"application-name"}
/>
<meta
content={"An interactive guide to learning ReScript."}
name={"description"}
/>
<meta
content={"#f6f4ef"}
name={"theme-color"}
/>
<link
href={appleTouchIcon}
rel={"apple-touch-icon"}
sizes={"180x180"}
/>
<link
href={favicon32}
rel={"icon"}
sizes={"32x32"}
type={"image/avif"}
/>
<link
href={favicon16}
rel={"icon"}
sizes={"16x16"}
type={"image/avif"}
/>
<title>
{"ReScript Guide"}
</title>
</head>
<body>
<ReactRouter.Outlet />
<ReactRouter.ScrollRestoration />
<ReactRouter.Scripts />
</body>
</html>;
}

let $$default = Root$default;

export { $$default as default };
export {
$$default as default,
}
/* mainCss Not a pure module */
16 changes: 13 additions & 3 deletions apps/guide/app/root.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
@module("../styles/main.css?url")
external mainCss: string = "default"

// Share the official icons while keeping the guide's own public directory.
@module("../../docs/public/favicon/apple-touch-icon.avif?url&no-inline")
external appleTouchIcon: string = "default"

@module("../../docs/public/favicon/favicon-32x32.avif?url&no-inline")
external favicon32: string = "default"

@module("../../docs/public/favicon/favicon-16x16.avif?url&no-inline")
external favicon16: string = "default"

@react.component
let default = () => {
<html lang="en">
Expand All @@ -13,9 +23,9 @@ let default = () => {
<meta name="application-name" content="ReScript Guide" />
<meta name="description" content="An interactive guide to learning ReScript." />
<meta name="theme-color" content="#f6f4ef" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.avif" />
<link rel="icon" type_="image/avif" sizes="32x32" href="/favicon-32x32.avif" />
<link rel="icon" type_="image/avif" sizes="16x16" href="/favicon-16x16.avif" />
<link rel="apple-touch-icon" sizes="180x180" href=appleTouchIcon />
<link rel="icon" type_="image/avif" sizes="32x32" href=favicon32 />
<link rel="icon" type_="image/avif" sizes="16x16" href=favicon16 />
<title> {React.string("ReScript Guide")} </title>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions apps/guide/app/root.resi
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// Keep build asset bindings private; React Router consumes the root component.
@react.component
let default: unit => React.element
5 changes: 0 additions & 5 deletions apps/guide/react-router.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import * as fs from "node:fs";

export default {
ssr: false,
prerender: ["/"],
buildEnd: async () => {
fs.cpSync("./build/client", "./out", { recursive: true });
},
};
2 changes: 0 additions & 2 deletions apps/guide/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export default defineConfig(({ mode }) => {

return {
envDir: "../..",
// Reuse the official favicon set without duplicating branding assets.
publicDir: "../docs/public/favicon",
plugins: [
env({ prefix: "PUBLIC_" }),
...(isTest ? [] : [reactRouter()]),
Expand Down
Loading