Skip to content

Commit

Permalink
Prettier (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomayac authored Jan 13, 2025
1 parent 2f9051e commit 3368566
Show file tree
Hide file tree
Showing 28 changed files with 3,123 additions and 2,412 deletions.
76 changes: 39 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
test:
Expand All @@ -13,21 +13,23 @@ jobs:
permissions: {}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: false # Currently not necessary
- name: Checkout
uses: actions/checkout@v3
with:
submodules: false # Currently not necessary

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install JSON validator
run: npm install -g ajv-cli@5 ajv-formats@2
- name: Install JSON validator
run: npm install -g ajv-cli@5 ajv-formats@2

- name: Validate features table
run: ajv -c ajv-formats -s features.schema.json -d features.json --strict=true --errors=text
- name: Validate features table
run:
ajv -c ajv-formats -s features.schema.json -d features.json
--strict=true --errors=text

build:
name: Build & Deploy
Expand All @@ -36,26 +38,26 @@ jobs:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Build
run: bundle exec jekyll build

- name: Deploy
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
exclude_assets: ''
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Build
run: bundle exec jekyll build

- name: Deploy
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
exclude_assets: ''
1 change: 0 additions & 1 deletion .github/workflows/purge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: page_build

jobs:
purge:

runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_includes/
18 changes: 18 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"bracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "always",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,42 @@ $ bundle exec jekyll build
$ bundle exec jekyll serve
```

> You must run `bundle exec jekyll build` after every change and include the `docs` directory in your commit!
> You must run `bundle exec jekyll build` after every change and include the
> `docs` directory in your commit!
## Publishing

This site uses Jekyll plugins, so GitHub Pages will not build it automatically. To publish, check in manually built static site files to the `docs` directory.
This site uses Jekyll plugins, so GitHub Pages will not build it automatically.
To publish, check in manually built static site files to the `docs` directory.

The static site should be configured to build to the `docs` directory. The `docs` directory is a special directory from which GitHub pages can publish directly. The naming convention is unfortunate given the confusing overlap with the site's own `docs` pages (output to `docs/docs`) which are themselves generated from the design docs submodule located at `design`.
The static site should be configured to build to the `docs` directory. The
`docs` directory is a special directory from which GitHub pages can publish
directly. The naming convention is unfortunate given the confusing overlap with
the site's own `docs` pages (output to `docs/docs`) which are themselves
generated from the design docs submodule located at `design`.

## What is the role of `_config.yml` and the custom Jekyll plugins?

> Note: the following plugins are all hacks to make the workflow of generating website docs from the `design` repo work without updating the sources in the design repo.
- `gem 'jekyll-optional-front-matter'` loaded directly in the `Gemfile` allows markdown files without YAML frontmatter to be consumed directly. This is included to allow `design` repo `.md` files to be used as pages without modifying their source to add frontmatter.
- `gem 'jemoji'` loaded directly in the `Gemfile` replaces GitHub-style emoji markdown (e.g. `:+1:`) with images for compat.
- The `defaults` section of `_config.yml` adds default values to the YAML frontmatter of documents from the `design` repo. In particular, it specifies that all `.md` files in the design submodule should be labelled as type `doc` and given layout `doc.html`. It also manually moves a few docs into the `community` tree where they fit the site organization better.
- `auto_titles.rb` adds a `title` value to YAML frontmatter by looking for the first header tag in the source files. It also orders the design docs based on a hardcoded list.
- `link_converter.rb` turns the `design` repo's links (e.g. `[threads](FutureFeatures.md#threads)`) into their respective locations on this website (e.g. `[threads](/docs/future-features/#threads)`).
- `underscore_paths.rb` rewrites Jekyll page permalinks to convert `/design/FutureFeatures/` to `/docs/future-features/`.
> Note: the following plugins are all hacks to make the workflow of generating
> website docs from the `design` repo work without updating the sources in the
> design repo.
- `gem 'jekyll-optional-front-matter'` loaded directly in the `Gemfile` allows
markdown files without YAML frontmatter to be consumed directly. This is
included to allow `design` repo `.md` files to be used as pages without
modifying their source to add frontmatter.
- `gem 'jemoji'` loaded directly in the `Gemfile` replaces GitHub-style emoji
markdown (e.g. `:+1:`) with images for compat.
- The `defaults` section of `_config.yml` adds default values to the YAML
frontmatter of documents from the `design` repo. In particular, it specifies
that all `.md` files in the design submodule should be labelled as type `doc`
and given layout `doc.html`. It also manually moves a few docs into the
`community` tree where they fit the site organization better.
- `auto_titles.rb` adds a `title` value to YAML frontmatter by looking for the
first header tag in the source files. It also orders the design docs based on
a hardcoded list.
- `link_converter.rb` turns the `design` repo's links (e.g.
`[threads](FutureFeatures.md#threads)`) into their respective locations on
this website (e.g. `[threads](/docs/future-features/#threads)`).
- `underscore_paths.rb` rewrites Jekyll page permalinks to convert
`/design/FutureFeatures/` to `/docs/future-features/`.
86 changes: 41 additions & 45 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,53 @@
name: WebAssembly

include: [
.github
]
include: [.github]

exclude: [
README.md,
LICENSE,
Gemfile,
Gemfile.lock,
design/LICENSE,
design/Contributing.md,
design/README.md,
design/tools,
design/JS.md,
design/BinaryEncoding.md,
design/TextFormat.md,
design/Semantics.md,
design/Nondeterminism.md,
design/Rationale.md,
design/MVP.md,
design/Modules.md,
design/FutureFeatures.md,
design/FeatureTest.md,
design/JITLibrary.md,
design/DynamicLinking.md,
design/CAndC++.md,
docs,
vendor
]
exclude:
[
README.md,
LICENSE,
Gemfile,
Gemfile.lock,
design/LICENSE,
design/Contributing.md,
design/README.md,
design/tools,
design/JS.md,
design/BinaryEncoding.md,
design/TextFormat.md,
design/Semantics.md,
design/Nondeterminism.md,
design/Rationale.md,
design/MVP.md,
design/Modules.md,
design/FutureFeatures.md,
design/FeatureTest.md,
design/JITLibrary.md,
design/DynamicLinking.md,
design/CAndC++.md,
docs,
vendor,
]

destination: docs

permalink: pretty

defaults:
-
scope:
path: "design"
- scope:
path: 'design'
values:
layout: "doc"
type: "doc"
-
scope:
path: "design/CodeOfConduct.md"
layout: 'doc'
type: 'doc'
- scope:
path: 'design/CodeOfConduct.md'
values:
layout: "community"
type: "community"
permalink: "/community/code-of-conduct/"
-
scope:
path: "design/Events.md"
layout: 'community'
type: 'community'
permalink: '/community/code-of-conduct/'
- scope:
path: 'design/Events.md'
values:
layout: "community"
type: "community"
permalink: "/community/events/"
layout: 'community'
type: 'community'
permalink: '/community/events/'
2 changes: 1 addition & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
</body>
</body>
</html>
72 changes: 41 additions & 31 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<meta name="color-scheme" content="dark light">
<title>{% if page.url == "/" %}WebAssembly{% else %}{{ page.title }} - WebAssembly{% endif %}</title>
<link rel="stylesheet" type="text/css" href="/css/custom.css">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
</head>
<body>
<header class="page-section">
<div class="container-narrow">
<a class="site-logo" href="/" title="WebAssembly"></a>
<nav class="site-nav">
<a class="site-nav-item btn" href="/">Overview</a>
<a class="site-nav-item btn" href="/getting-started/developers-guide/">Getting Started</a>
<a class="site-nav-item btn" href="/specs">Specs</a>
<a class="site-nav-item btn" href="/docs/faq/">Docs</a>
<a class="site-nav-item btn" href="/features/">Feature Extensions</a>
<a class="site-nav-item btn" href="/community/resources/">Community</a>
</nav>
</div>
</header>
{% if page.lead %}
<section class="page-section-spacious flush-bottom">
<div class="container-narrow">
<p class="lead">{{page.lead}}</p>
</div>
</section>
{% endif %}
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"
/>
<meta name="color-scheme" content="dark light" />
<title>
{% if page.url == "/" %}WebAssembly{% else %}{{ page.title }} -
WebAssembly{% endif %}
</title>
<link rel="stylesheet" type="text/css" href="/css/custom.css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
</head>
<body>
<header class="page-section">
<div class="container-narrow">
<a class="site-logo" href="/" title="WebAssembly"></a>
<nav class="site-nav">
<a class="site-nav-item btn" href="/">Overview</a>
<a class="site-nav-item btn" href="/getting-started/developers-guide/"
>Getting Started</a
>
<a class="site-nav-item btn" href="/specs">Specs</a>
<a class="site-nav-item btn" href="/docs/faq/">Docs</a>
<a class="site-nav-item btn" href="/features/">Feature Extensions</a>
<a class="site-nav-item btn" href="/community/resources/"
>Community</a
>
</nav>
</div>
</header>
{% if page.lead %}
<section class="page-section-spacious flush-bottom">
<div class="container-narrow">
<p class="lead">{{page.lead}}</p>
</div>
</section>
{% endif %}
20 changes: 13 additions & 7 deletions _layouts/community.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
<section>
<div class="container">
<div class="row">
<div class="col-xs-12 col-lg-9 col-pop">
{{content}}
</div>
<div class="col-xs-12 col-lg-9 col-pop">{{content}}</div>
<div class="col-xs-12 col-lg-3">
<h6 class="side-title">Community</h6>
<nav class="side-nav">
<a class="side-nav-item" href="/community/resources/">Resources</a>
<a class="side-nav-item" href="/community/feedback/">Feedback</a>
<a class="side-nav-item" href="/community/contributing/">Contributing</a>
<a class="side-nav-item" href="/community/code-of-conduct/">Code of Conduct</a>
<a class="side-nav-item" href="https://www.w3.org/community/webassembly/">W3C Community Group</a>
<a class="side-nav-item" href="/community/contributing/"
>Contributing</a
>
<a class="side-nav-item" href="/community/code-of-conduct/"
>Code of Conduct</a
>
<a
class="side-nav-item"
href="https://www.w3.org/community/webassembly/"
>W3C Community Group</a
>
</nav>
</div>
</div>
</div>
</section>
{% include footer.html %}
{% include footer.html %}
Loading

0 comments on commit 3368566

Please sign in to comment.