Skip to content

Commit d585a01

Browse files
parloughschultek
andauthored
Migrate the site infrastructure to Jaspr and Jaspr Content (#12548)
**Staged:** https://flutter-docs-prod--pr12548-feat-jaspr-migration-kz7c0jfj.web.app/ Migrates the site from being built with JS/TS, Node, and 11ty to being built with purely Dart, [Jaspr](https://jaspr.site/), and [Jaspr Content](https://docs.jaspr.site/content). --- As part of this work, the `dash_site` bash script has been removed from the root of the repository. After the removal, you can access the site tooling, including building and staging with `dart run dash_site <command>` from anywhere within the repository workspace. If you still want a shorter command, you can add an alias for `dart run dash_site` in your shell, such as `dst`. --- **Staged:** https://flutter-docs-prod--pr12548-feat-jaspr-migration-kz7c0jfj.web.app/ Resolves #12405 Fixes #12590 --------- Co-authored-by: Kilian Schulte <[email protected]> Co-authored-by: Kilian Schulte <[email protected]>
1 parent 4cd2cf9 commit d585a01

File tree

1,739 files changed

+13943
-14138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,739 files changed

+13943
-14138
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,11 @@ updates:
1111
- "auto.dependencies"
1212
- "auto.github-action"
1313
- "lang.yaml"
14-
- package-ecosystem: "npm"
15-
directory: "/"
16-
schedule:
17-
interval: "daily"
18-
allow:
19-
- dependency-type: "production"
20-
labels:
21-
- "auto.dependencies"
22-
- "auto.npm"
23-
- "lang.javascript"
2414
- package-ecosystem: "pub"
2515
versioning-strategy: "increase-if-necessary"
2616
directories:
2717
- "/"
28-
- "/tool/flutter_site"
18+
- "/tool/dash_site"
2919
schedule:
3020
interval: "daily"
3121
labels:

.github/workflows/test.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ on:
1313
# Declare default permissions as read only.
1414
permissions: read-all
1515

16-
env:
17-
NODE_VERSION: 22
18-
1916
jobs:
2017
test:
2118
name: Analyze and test code examples
@@ -41,13 +38,13 @@ jobs:
4138
run: dart pub get
4239
continue-on-error: ${{ matrix.experimental }}
4340
- name: Check Dart code formatting
44-
run: dart run flutter_site format-dart --check
41+
run: dart run dash_site format-dart --check
4542
continue-on-error: ${{ matrix.experimental }}
4643
- name: Analyze Dart code
47-
run: dart run flutter_site analyze-dart
44+
run: dart run dash_site analyze-dart
4845
continue-on-error: ${{ matrix.experimental }}
4946
- name: Run Dart tests
50-
run: dart run flutter_site test-dart
47+
run: dart run dash_site test-dart
5148
continue-on-error: ${{ matrix.experimental }}
5249

5350
excerpts:
@@ -62,24 +59,15 @@ jobs:
6259
- name: Fetch Dart dependencies
6360
run: dart pub get
6461
- name: Check if excerpts are up to date
65-
run: dart run flutter_site refresh-excerpts --fail-on-update --dry-run
62+
run: dart run dash_site refresh-excerpts --fail-on-update --dry-run
6663
continue-on-error: ${{ matrix.experimental }}
6764

6865
linkcheck:
6966
name: Build site and check links
7067
runs-on: ubuntu-latest
68+
timeout-minutes: 30
7169
steps:
7270
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
73-
- name: Enable Corepack
74-
run: npm i -g corepack@latest && corepack enable
75-
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903
76-
with:
77-
node-version: ${{ env.NODE_VERSION }}
78-
cache: 'pnpm'
79-
- name: Setup pnpm
80-
run: corepack install
81-
- name: Install node dependencies
82-
run: pnpm install --frozen-lockfile
8371
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
8472
with:
8573
sdk: beta
@@ -88,11 +76,11 @@ jobs:
8876
- name: Install firebase-tools
8977
run: curl -sL https://firebase.tools | bash
9078
- name: Build site
91-
run: dart run flutter_site build
79+
run: dart run dash_site build
9280
- name: Check for broken Markdown link references
93-
run: dart run flutter_site check-link-references
81+
run: dart run dash_site check-link-references
9482
- name: Check for broken internal links
95-
run: dart run flutter_site check-links
83+
run: dart run dash_site check-links
9684

9785
firebase-validate:
9886
name: Validate Firebase configuration
@@ -106,4 +94,4 @@ jobs:
10694
- name: Fetch Dart dependencies
10795
run: dart pub get
10896
- name: Validate the firebase.json file
109-
run: dart run flutter_site verify-firebase-json
97+
run: dart run dash_site verify-firebase-json

.idx/dev.nix

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
# Use https://search.nixos.org/packages to find packages
88
packages = [
9-
pkgs.nodejs_22
10-
pkgs.pnpm
9+
# Node is included for deploying to Firebase.
10+
pkgs.nodejs_24
1111
];
1212

1313
# Sets environment variables in the workspace
@@ -24,7 +24,7 @@
2424
enable = true;
2525
previews = {
2626
web = {
27-
command = ["./dash_site" "serve"];
27+
command = ["dart" "run" "dash_site" "serve"];
2828
manager = "web";
2929
env = {
3030
# Environment variables to set for your server
@@ -38,12 +38,11 @@
3838
workspace = {
3939
# Runs when a workspace is first created
4040
onCreate = {
41-
pnpm-install = "pnpm install";
41+
dart-pub-get = "dart pub get";
4242
};
4343
# Runs when the workspace is (re)started
4444
onStart = {
45-
# Example: start a background task to watch and re-build backend code
46-
# watch-backend = "npm run watch-backend";
45+
dart-pub-get = "dart pub get";
4746
};
4847
};
4948
};

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 22 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# [Flutter][] documentation website
66

77
The [documentation site][Flutter] for the [Flutter framework][],
8-
built with [Eleventy][] and hosted on [Firebase][].
8+
built with [Jaspr][] and hosted on [Firebase][].
99

1010
[Flutter framework]: https://flutter.dev
11-
[Eleventy]: https://11ty.dev/
11+
[Jaspr]: https://jaspr.site
1212
[Firebase]: https://firebase.google.com/
1313

1414
[Build Status]: https://github.com/flutter/website/workflows/build/badge.svg
@@ -88,12 +88,9 @@ enable an edit-refresh cycle.
8888

8989
### Get the prerequisites
9090

91-
Install the following tools to build and develop the site:
91+
To build and develop the site, you'll need to
92+
install the latest stable release of Flutter, which includes Dart.
9293

93-
#### Flutter
94-
95-
The latest stable release of Flutter, which includes Dart,
96-
is required to build the site and run its tooling.
9794
If you don't have Flutter or need to update, follow the
9895
instructions at [Install Flutter][] or [Upgrading Flutter][].
9996

@@ -107,28 +104,6 @@ flutter --version
107104
[Install Flutter]: https://docs.flutter.dev/get-started
108105
[Upgrading Flutter]: https://docs.flutter.dev/release/upgrade
109106

110-
#### Node.js
111-
112-
The **latest** stable LTS release of Node.js is required to build the site.
113-
If you don't have Node.js or need to update, download your
114-
computer's corresponding version and follow the instructions
115-
from the [Node.js download archive][].
116-
If you prefer, you can use a version manager such as [nvm][],
117-
and run `nvm install` from the repository's root directory.
118-
119-
If you already have Node installed, verify it's available on your path
120-
and already the latest stable version _(currently `22.14` or later)_:
121-
122-
```console
123-
node --version
124-
```
125-
126-
If your version is out of date,
127-
follow the update instructions for how you originally installed it.
128-
129-
[Node.js download archive]: https://nodejs.org/en/download/
130-
[nvm]: https://github.com/nvm-sh/nvm
131-
132107
### Clone this repo
133108

134109
If you're not a member of the Flutter organization,
@@ -164,103 +139,53 @@ following the instructions in [Get the prerequisites](#get-the-prerequisites).
164139
dart pub get
165140
```
166141

167-
3. _Optional:_ We recommend you use `pnpm`, but you can also use `npm`.
168-
Install `pnpm`, an alternative, efficient package manager for
169-
npm packages. If you already have `pnpm`, verify you have the
170-
latest stable version.
171-
172-
```console
173-
node --version
174-
```
175-
176-
If you don't already have `pnpm` installed, we recommend
177-
using [`corepack`][] to install and manage `pnpm` versions,
178-
since `corepack` is bundled with most installations of
179-
Node. If you installed `node` using Homebrew, you'll need
180-
to install corepack separately:
181-
182-
```console
183-
brew install corepack
184-
```
185-
186-
If you haven't used `corepack` before, you'll need to
187-
first enable it with `corepack enable`.
188-
Then, to install the correct `pnpm` version, from the
189-
root directory of the repository, run `corepack install`:
190-
191-
```console
192-
corepack enable;
193-
corepack install
194-
```
195-
196-
To install [`pnpm`][] without using `corepack`, you
197-
can use your preferred [installation method][pnpm-install].
198-
199-
5. _(optional)_ Once you have `pnpm` installed and setup,
200-
fetch the site's npm dependencies using `pnpm install`.
201-
We highly recommend you use `pnpm`, but you can also use `npm`.
202-
203-
```console
204-
pnpm install
205-
```
206-
207-
Rerun `pnpm install` whenever you incorporate the
208-
latest changes to the `main` branch or if you
209-
experience dependency or import errors when building the site.
210-
211-
6. From the root directory, run the `dash_site` tool to
142+
3. From the root directory, run the `dash_site` tool to
212143
validate your setup and learn about the available commands.
213144

214-
```console
215-
./dash_site --help
145+
```terminal
146+
dart run dash_site --help
216147
```
217148

218-
7. From the root directory, serve the site locally.
149+
4. From the root directory, serve the site locally.
219150

220-
```console
221-
./dash_site serve
151+
```terminal
152+
dart run dash_site serve
222153
```
223154

224155
This command generates and serves the site on a
225156
local port that's printed to your terminal.
226157

227-
8. View your changes in the browser by navigating to <http://localhost:4000>.
158+
5. View your changes in the browser by navigating to <http://localhost:8080>.
228159

229-
Note the port might be different if `4000` is taken.
160+
Note the port might be different if `8080` is taken.
230161

231-
If you want to check the raw, generated HTML output and structure,
232-
view the `_site` directory in a file explorer or an IDE.
233-
234-
9. Make your changes to the local repo.
162+
6. Make your changes to the local repo.
235163

164+
To view your changes in the browser,
165+
you'll need to refresh the page.
236166
The site should automatically rebuild on most changes, but if
237167
something doesn't update, exit the process and rerun the command.
238-
Improvements to this functionality are planned.
239-
Please open a new issue to track the issue if this occurs.
240168

241-
10. Commit your changes to the branch and submit your PR.
169+
7. Commit your changes to the branch and submit your PR.
242170

243171
If your change is large, or you'd like to test it,
244172
consider [validating your changes](#validate-your-changes).
245173

246174
> [!TIP]
247175
> To find additional commands that you can run,
248-
> run `./dash_site --help` from the repository's root directory.
249-
250-
[`corepack`]: https://nodejs.org/api/corepack.html
251-
[`pnpm`]: https://pnpm.io/
252-
[pnpm-install]: https://pnpm.io/installation
176+
> run `dart run dash_site --help` from the repository's root directory.
253177
254178
## Validate your changes
255179

256180
### Check documentation and example code
257181

258-
If you've made changes to the code in the `/examples` or `/tool` directories,
182+
If you've made changes to the code in
183+
the `/examples`, `/site`, or `/tool` directories,
259184
commit your work, then run the following command to
260185
verify it is up to date and matches the site standards.
261186

262-
```console
263-
./dash_site check-all
187+
```terminal
188+
dart run dash_site check-all
264189
```
265190

266191
If this script reports any errors or warnings,
@@ -286,53 +211,9 @@ how the snippets are copied from the `.dart` files.
286211

287212
To resolve this error and update the Markdown snippets to match,
288213
from the root of the `website` directory,
289-
run `./dash_site refresh-excerpts`.
214+
run `dart run dash_site refresh-excerpts`.
290215

291216
To learn more about creating, editing, and using code excerpts,
292217
check out the [excerpt updater package documentation][].
293218

294219
[excerpt updater package documentation]: https://github.com/dart-lang/site-shared/tree/main/pkgs/excerpter#readme
295-
296-
## [Optional] Deploy to a staging site
297-
298-
Submitted pull requests can be automatically staged
299-
by a site maintainer.
300-
If you'd like to stage the site yourself though,
301-
you can build a full version and upload it to Firebase.
302-
303-
1. If you don't already have a Firebase project,
304-
305-
- Navigate to the [Firebase Console](https://console.firebase.google.com)
306-
and create your own Firebase project (for example, `flutter-dev-staging`).
307-
308-
- Head back to your local terminal and verify that you're logged in.
309-
310-
```console
311-
npm exec -- firebase-tools login
312-
```
313-
314-
- Ensure that your project exists and activate that project:
315-
316-
```console
317-
npm exec -- firebase-tools projects:list
318-
npm exec -- firebase-tools use <your-project>
319-
```
320-
321-
2. From the root directory of the repository, build the site:
322-
323-
```console
324-
./dash_site build
325-
```
326-
327-
This builds the site and copies it to your local `_site` directory.
328-
If that directory previously existed, it will be replaced.
329-
330-
3. Deploy to your activated Firebase project's default hosting site:
331-
332-
```console
333-
npm exec -- firebase-tools deploy --only hosting
334-
```
335-
336-
4. Navigate to your PR on GitHub and include the link of the staged version.
337-
Do consider adding a reference to the commit you staged,
338-
so that reviewers know if any further changes have been made.

cloud_build/deploy.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ steps:
22
- name: gcr.io/cloud-builders/git
33
args: ['fetch', '--unshallow']
44
- name: gcr.io/flutter-dev-230821/firebase-ghcli
5-
# Set up, build, then deploy site to production
5+
# Build the site, then deploy it to production.
66
entrypoint: '/bin/bash'
77
args:
88
- '-c'
99
- |-
1010
set -e
1111
12-
npm install
13-
npm run build-site-for-production
12+
dart pub get
13+
dart run dash_site build --release
1414
1515
firebase deploy --project=flutter-docs-prod --only=hosting
1616
options:

cloud_build/stage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ steps:
77
- |-
88
set -e
99
10-
npm install
11-
npm run build-site-for-staging
10+
dart pub get
11+
dart run dash_site build
1212
1313
cloud_build/scripts/stage_site_and_comment_on_github.sh
1414
secretEnv: ['GH_PAT_TOKEN']

0 commit comments

Comments
 (0)