Skip to content

Commit faa3ca3

Browse files
authored
Initial migration of site to 11ty (#5483)
I'm sorry that this ended up as such a large pull request, but that's mostly because it essentially touched every file with a small set of changes. See the different sections below for considerations for review or future reference. Please note that we'd like this to land despite it not being perfect, as then pain points can be identified and improved. Then I can also follow up with proper documentation as the implementation and syntax is stabilized. I'll be staying on top of any reported issue. If anything goes majorly wrong, we can always revert the change as well. Thanks for your time 💙 Resolves #5177 Resolves #3846 Resolves #5323 Fixes #4297 Fixes #4919 Closes #4631 Contributes to #4163 **Changes potentially worth reviewing from a technical perspective are:** - Implemented 11ty in `eleventy.config.js` with customizations in `/src/_11ty`. - `eleventy.config.js` configures the site build, enables used plugins, and connects the custom logic added in `/src/_11ty`. This will be greatly simplified and better documented in follow-up work. - Replaced prettify, rouge, and custom code excerpter logic with custom markdown plugin. - You can find this at `/src/_11ty/plugins/highlight.js` _(super messy for now)_. - New custom theme is at `/src/_11ty/syntax/dash-light.js`. - The implementation of this needs a lot of cleanup and will be simplified greatly in follow-up work to rely on recent improvements in underlying highlighting package. - Added a `build` and `serve` command to `dart run dart_site` (found in `/tool/dart_site/lib`). - The deploy configs in `/cloud_build` have been migrated from using Docker to use Node to build the site. I reused the Docker image we built for firebase_tools, as that already has Node. Let me know if I shouldn't though :) - Removed remnants of previous infra (Jekyll files, gem files, docker files, makefile, etc). - All written docs and assets have been moved into `/content` to enable a separation from site tooling and configuration. **Changes potentially worth reviewing or knowing about from a writer/contributor perspective:** - **Major:** All doc content has been moved into `/content`. This allows site implementation to be separate from content, potentially enabling easier downstream localization as well. - The pre-existing global variables are now defined in `/src/_data/site.yml`. - Alerts/asides use a new syntax and have a design closer to other doc sites, search for `:::` for examples. - Prettify doesn't exist anymore. Always use Markdown code blocks. They now always support highlighting with `[! !]`. - Terminal code blocks now use `console` instead of `terminal`. Just textual ones use `plaintext` instead of `nocode`. - Markdown code blocks now support specifying a title/filename with syntax like `title="main.dart"`. Various code blocks have been updated to use it instead of one-off solutions. - Code blocks have a new design, with slightly bigger text, new colors, reduced padding, a more defined border, and a tag with the code block's language. - The README is updated with the core setup requirements. Note that more comprehensive docs will come. - To change the anchor of a header, a slightly modified `{:#new-id}` syntax is now used. - The include syntax is slightly different, put quotes around the include filename and define arguments with colons: `{% include 'linter-rule-mention.md', rule:'unnecessary_getters_setters' %}`. **Current issues:** The following are some issues or regressions that I plan to accept in the short term to get this landed. - Terminal/console code blocks do not have their formatted black background yet. They appear as normal code blocks. - Incremental rebuild is slower than it should be due to a new bug in 11ty. **Follow-up work:** The following are some remaining tasks and improvements that I'd like to complete in follow-up so this can land and stretch its feet. These improvements can then be reviewed in isolation and incorporate what I've learned from deploying. - Incorporate fix for 11ty's current incremental rebuild issue. - Add back external link icons where it makes sense during static build. - Reintroduce terminal code block's having a custom style. - Standardize old and new liquid functions and filters to modern 11ty suggestions for consistent experience. - Document the 11ty, liquid, and custom features we use that are relevant to site writers and contributors. - Speed up sidenav and TOC generation. Potentially reduce needed dependencies while doing so. - Clean up implementation of custom 11ty and Markdown plugins. Rely on new features in underlying syntax highlighting plugin rather than implementing our own form. - Automate image optimization in production builds. - Use TypeScript for custom 11ty functionality to avoid painfully adding JSDocs everywhere. - Add back a devcontainer setup for users who want to a functioning workflow in the browser. - Add skippable setup checks to `dart_site` tool - Move the Cloud Build commands to `dart_site` tool
1 parent aa13f62 commit faa3ca3

File tree

464 files changed

+14678
-9066
lines changed

Some content is hidden

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

464 files changed

+14678
-9066
lines changed

.devcontainer/devcontainer.json

-7
This file was deleted.

.dockerignore

-6
This file was deleted.

.github/dependabot.yml

-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33

44
version: 2
55
updates:
6-
- package-ecosystem: "bundler"
7-
directory: "/"
8-
schedule:
9-
interval: "daily"
10-
labels:
11-
- "auto.dependencies"
12-
- "auto.bundler"
13-
- "lang.ruby"
146
- package-ecosystem: "docker"
157
directory: "/"
168
schedule:

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
language: [ 'javascript', 'ruby' ]
26+
language: [ 'javascript' ]
2727
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
2828
# Learn more about CodeQL language support at https://git.io/codeql-language-support
2929

.github/workflows/test.yml

+28-11
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
4444
with:
4545
sdk: ${{ matrix.sdk }}
46-
- name: Fetch packages
46+
- name: Fetch Dart packages
4747
run: dart pub get
4848
- name: Check Dart code formatting
4949
run: dart run dart_site format-dart --check
@@ -57,25 +57,42 @@ jobs:
5757
linkcheck:
5858
name: Build site and check links
5959
runs-on: ubuntu-latest
60-
strategy:
61-
fail-fast: false
6260
steps:
6361
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
6462
with:
6563
submodules: recursive
66-
- run: make build
6764
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
6865
with:
6966
sdk: stable
70-
- name: Fetch packages
67+
- name: Fetch Dart packages
7168
run: dart pub get
72-
- name: Check for broken Markdown links
73-
run: dart run dart_site check-link-references
74-
- name: Validate the firebase.json file
75-
run: dart run dart_site verify-firebase-json
76-
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
69+
- uses: pnpm/action-setup@ebcfd6995dade4b0104ac774445cef8b3b4635b0
70+
with:
71+
version: 8
72+
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
7773
with:
7874
node-version: ${{ env.NODE_VERSION }}
79-
- run: npm install -g firebase-tools@13.0.2
75+
cache: 'pnpm'
76+
- name: Install node dependencies
77+
run: pnpm install
78+
- name: Build site
79+
run: dart run dart_site build
80+
- name: Check for broken Markdown links
81+
run: dart run dart_site check-link-references
8082
- name: Check internal site links are functional
8183
run: dart run dart_site check-links
84+
85+
firebase-validate:
86+
name: Validate Firebase configuration
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
90+
with:
91+
submodules: recursive
92+
- uses: dart-lang/setup-dart@ca7e6fee45ffbd82b555a7ebfc236d2c86439f5b
93+
with:
94+
sdk: stable
95+
- name: Fetch Dart packages
96+
run: dart pub get
97+
- name: Validate the firebase.json file
98+
run: dart run dart_site verify-firebase-json

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
_asset_bundler_cache
2-
_bookhtml
31
_cache/
42
_site/
53
.*-cache
@@ -10,8 +8,6 @@ _site/
108
.env*
119
.firebase
1210
.idea
13-
.packages
14-
.pub
1511
.spelling
1612
.vscode
1713
*.cache
@@ -25,6 +21,7 @@ build
2521
firebase-debug.log
2622
node_modules
2723
pubspec.lock
24+
package-lock.json
2825
tmp
2926

3027
# Misc

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/*

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Chris Buckett <chrisbuckett@gmail.com>
1313
Michael Haubenwallner <michael.haubenwallner@gmail.com>
1414
Victor Berchet <victor.berchet@gmail.com>
1515
Pradumna Saraf <pradumnasaraf@gmail.com>
16+
Parker Lougheed <parlough@gmail.com>

CONTRIBUTING.md

+16-13
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ You can contribute in a few ways.
1818

1919
* **[Report issues][].**
2020

21-
* **Fix known issues** (especially ones with the label **[help wanted][]** or
22-
**[beginner][]**). These issues may or may not be easy to fix. Sometimes
21+
* **Fix known issues.** These issues may or may not be easy to fix. Sometimes
2322
they're issues that we don't have the expertise to fix, and we'd love to
2423
work with a contributor who has the right skills.
2524

@@ -37,11 +36,9 @@ More info:
3736
* For more ways to contribute to Dart, see the
3837
[dart-lang/sdk Contributing page][].
3938

40-
[beginner]: https://github.com/dart-lang/site-www/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3A%22help%20wanted%22%20label%3Abeginner%20
4139
[dart-lang/sdk Contributing page]: https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md
42-
[GitHub pull request]: https://docs.github.com/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
40+
[GitHub pull request]: https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
4341
[Google Developer Documentation Style Guide]: https://developers.google.com/style/
44-
[help wanted]: https://github.com/dart-lang/site-www/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22help%20wanted%22%20
4542
[in the site-shared repo]: https://github.com/dart-lang/site-shared/blob/main/doc
4643
[issue tracker]: https://github.com/dart-lang/site-www/issues
4744
[on Flutter's Discord server]: https://github.com/flutter/flutter/wiki/Chat
@@ -62,29 +59,35 @@ you'll probably need to change the code in two places:
6259
For example, say you want to change the following code in the
6360
[Variables documentation](https://dart.dev/language/variables):
6461

65-
```
62+
````
6663
<?code-excerpt "misc/lib/language_tour/variables.dart (var-decl)"?>
67-
{% prettify dart tag=pre+code %}
64+
```dart
6865
var name = 'Bob';
69-
{% endprettify %}
7066
```
67+
````
7168

7269
Besides editing
73-
[/src/language/variables.md][]
70+
[`/src/language/variables.md`][]
7471
(which you can find by clicking the GitHub icon at the top right of the page),
7572
you'll also need to edit the `var-decl` region of
76-
[/examples/misc/lib/language_tour/variables.dart][].
73+
[`/examples/misc/lib/language_tour/variables.dart`][].
7774

7875
If you create a PR but forget to edit the Dart file,
7976
or if your changes don't analyze/test cleanly,
8077
the [GitHub Actions][] CI build will fail.
8178
Just update the PR, and GitHub Actions will run again.
8279

80+
If you followed the setup in the README,
81+
you can instead run `dart run dart_site refresh-excerpts`
82+
from the root directory of the repository to update the Markdown files.
83+
8384
[GitHub Actions]: https://docs.github.com/actions/learn-github-actions/understanding-github-actions
84-
[/src/language/variables.md]: https://github.com/dart-lang/site-www/blob/main/src/language/variables.md
85-
[/examples/misc/lib/language_tour/variables.dart]: https://github.com/dart-lang/site-www/blob/main/examples/misc/lib/language_tour/variables.dart
85+
[`/src/language/variables.md`]: https://github.com/dart-lang/site-www/blob/main/src/language/variables.md
86+
[`/examples/misc/lib/language_tour/variables.dart`]: https://github.com/dart-lang/site-www/blob/main/examples/misc/lib/language_tour/variables.dart
8687

8788
## A word about conduct
8889

8990
We pledge to maintain an open and welcoming environment.
90-
For details, see our [code of conduct](https://dart.dev/community/code-of-conduct).
91+
For details, see our [code of conduct][].
92+
93+
[code of conduct]: https://dart.dev/community/code-of-conduct

Dockerfile

-154
This file was deleted.

Gemfile

-12
This file was deleted.

0 commit comments

Comments
 (0)