Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power proposals from Dataset API fixes #290 #292

Merged
merged 9 commits into from
Jul 30, 2022
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
_site
_site/
.cache/
47 changes: 30 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
name: Deploy site
name: Deploy static content to Pages

on:
push:
branches:
- master
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-20.04
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup NodeJS
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies & build
run: |
npm ci
npm run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- run: npm ci
- run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
publish_dir: ./_site
github_token: ${{ secrets.GITHUB_TOKEN }}
cname: tc39.es
path: _site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ _site
node_modules
.bundle
vendor
.cache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
_site/
.cache/
assets/css/
2 changes: 2 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
_site/
.cache/
assets/css/
18 changes: 5 additions & 13 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"plugins": ["stylelint-order"],
"rules": {
"at-rule-empty-line-before": null,
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["else", "extends", "if", "include", "mixin", "use"]
}
],
"declaration-empty-line-before": null,
"order/properties-alphabetical-order": true
}
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-prettier-scss",
"stylelint-config-recess-order"
]
}
25 changes: 25 additions & 0 deletions _data/stages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const EleventyFetch = require('@11ty/eleventy-fetch');

function arrayEquals(a, b) {
return (
Array.isArray(a) &&
Array.isArray(b) &&
a.length === b.length &&
a.every((val, index) => val === b[index])
);
}

module.exports = async function () {
let json = await EleventyFetch('https://tc39.es/dataset/proposals.json', {
duration: '1h', // 1 day
type: 'json', // also supports "text" or "buffer"
});

const stage3 = json.filter((v) => v.stage === 3);
return stage3.map((v) => {
v.authorsAndChampions = arrayEquals(v.authors, v.champions)
? v.authors
: false;
return v;
});
};
57 changes: 23 additions & 34 deletions _includes/proposals.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ <h3>{{ proposals["title"] }}</h3>
<li>
{{ proposals["how-to-read"]["tags"]["last-presented"] }}:
<div class="featurelist__item__presented featurelist__item__tag">
<a
href="{{ presentation.url }}"
jasonwilliams marked this conversation as resolved.
Show resolved Hide resolved
title='{{ proposals["last-presented-alt"] }}'
<a title='{{ proposals["last-presented-alt"] }}'
>{{ proposals["how-to-read"]["tags"]["last-presented-fake-date"]
}}</a
>
Expand All @@ -48,27 +46,16 @@ <h3>{{ proposals["title"] }}</h3>
</div>
</article>

{% for proposal in stage3 %}
{% for proposal in stages %}
<article class="featurelist__item">
<div class="featurelist__item__intro">
<header class="g-row">
<h4 class="featurelist__item__title flex-grow">
<a href="https://github.com/tc39/{{ proposal[0] }}"
>{{ proposal[1].title }}</a
>
<a href="{{ proposal.url }}">{{ proposal.name }}</a>
jasonwilliams marked this conversation as resolved.
Show resolved Hide resolved
</h4>
<div class="featurelist__item__tags">
<ul class="featurelist__item__status featurelist__item__tags">
{% unless proposal[1].description %}
<li class="featurelist__item__translation featurelist__item__tag">
<a
href="{{ proposals.needs_translation_url }}"
title="{{ proposals.needs_translation }}"
>
{{ proposals.needs_translation }}</a
>
</li>
{% endunless %} {% if proposal[1].presented | size %} {% for
<!-- {% if proposal[1].presented | size %} {% for
presentation in proposal[1].presented %}
<li class="featurelist__item__presented featurelist__item__tag">
{%- if presentation.url -%}
Expand All @@ -85,17 +72,17 @@ <h4 class="featurelist__item__title flex-grow">
>
{%- endif -%}
</li>
{% endfor %} {% endif %} {% if proposal[1].tests | size %} {% for url
in proposal[1].tests %}
{% endfor %} {% endif %} -->
{% if proposal.tests | size %} {% for url in proposal.tests %}
<li class="featurelist__item__tests featurelist__item__tag">
<a href="{{ url }}" title='{{ proposals["test-alt"] }}'>
{{ proposals["tests"] }}
</a>
</li>
{% endfor %} {% endif %} {% if proposal[1].has_specification %}
{% endfor %} {% endif %} {% if proposal['has-specification'] %}
<li class="featurelist__item__spec featurelist__item__tag">
<a
href="https://tc39.es/{{ proposal[1].id }}"
href="https://tc39.es/{{ proposal.id }}"
title='{{ proposals["specification-alt"] }}'
>
{{ proposals["specification"] }}
Expand All @@ -106,20 +93,22 @@ <h4 class="featurelist__item__title flex-grow">
</div>
</header>
<div class="featurelist__item__author">
{% if proposal[1].authors == proposal[1].champions %} {{
proposals["authors-and-champions"] }}: {{ proposal[1].authors }} {% else
%} {% if proposal[1].authors | size %} {% if proposal[1].authors.size > 1
%} {{ proposals["authors"] }}: {% else %} {{ proposals["author"] }}: {%
endif %} {{ proposal[1].authors | join: ", " }} {% endif %} {% if
proposal[1].champions | size %} | {% if proposal[1].champions.size > 1 %}
{{ proposals["champions"] }}: {% else %} {{ proposals["champion"] }} {%
endif %} {{ proposal[1].champions | join: ", " }} {% endif %} {% endif %}
{% if proposal.authorsAndChampions %} {{
proposals["authors-and-champions"] }}: {{ proposal.authorsAndChampions |
join: ", " }} {% else %} {% if proposal.authors | size %} {% if
proposal.authors.size > 1 %} {{ proposals["authors"] }}: {% else %} {{
proposals["author"] }}: {% endif %} {{ proposal.authors | join: ", " }} {%
endif %} {% if proposal.champions | size %} | {% if
proposal.champions.size > 1 %} {{ proposals["champions"] }}: {% else %} {{
proposals["champion"] }} {% endif %} {{ proposal.champions | join: ", " }}
{% endif %} {% endif %}
</div>
{% if proposal[1].description %}
<div class="featurelist__item__desc">{{ proposal[1].description }}</div>
{% if proposal.description %}
<div class="featurelist__item__desc">{{ proposal.description }}</div>
{% else %}
<div class="featurelist__item__desc">{{ proposal[1].description }}</div>
{% endif %} {% if proposal[1].example %}
<div class="featurelist__item__desc">{{ proposal.description }}</div>
{% endif %}
<!-- {% if proposal[1].example %}
<div
class="featurelist__item__example"
aria-controls="example-{{ proposal[1].id }}"
Expand All @@ -138,7 +127,7 @@ <h4 class="featurelist__item__title flex-grow">
>
<pre><code class="js" tabindex="-1">{{ proposal[1].example }}</code></pre>
</section>
{% endif %}
{% endif %} -->
</div>
</article>
{% endfor %}
Expand Down
12 changes: 6 additions & 6 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<link rel="icon" type="image/png" href="favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png" sizes="16x16" />
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://tc39.es",
"logo": "https://tc39.es/assets/img/logo.svg"
}
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://tc39.es",
"logo": "https://tc39.es/assets/img/logo.svg"
}
</script>
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&family=Source+Sans+Pro:wght@300;400;600&display=swap"
Expand Down
13 changes: 6 additions & 7 deletions _sass/_a11y.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
.sr-only {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(100%);
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(100%);
white-space: nowrap;
width: 1px;
}

:focus {
outline-offset: 0.125rem;
outline-style: solid;
outline-width: 0.125rem;
outline-style: solid;
outline-offset: 0.125rem;
}

.logo-box a:focus {
outline-color: $color-nav;
}

.featurelist__item__tag,
.submenu {
:focus {
outline: 0;
Expand Down
25 changes: 15 additions & 10 deletions _sass/_content.scss
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
.main-content {
font-size: 1rem;
padding: 50px 0;
font-size: 1rem;

h1,
h2,
h3,
h4,
h5,
h6 {
color: $color-text;
font-weight: $font-weight-semi-bold;
color: $color-text;
}

h3 {
background-color: $color-primary;
color: white;
margin-left: -15px;
margin-right: -15px;
padding: 10px 15px;
margin-right: -15px;
margin-left: -15px;
color: white;
background-color: $color-primary;
}

.section-headline {
margin-top: 0;
font-size: 2rem;
font-weight: $font-weight-semi-bold;
margin-top: 0;
}

p {
margin: 0 0 $spacing-paragraph;
}
Expand All @@ -33,19 +37,20 @@
}

h3 {
margin-left: -40px;
margin-right: -40px;
padding: 10px 40px;
margin-right: -40px;
margin-left: -40px;
}

.intro {
text-align: center;
}
}
}

a {
color: $color-link;
font-weight: $font-weight-semi-bold;
color: $color-link;
}

.text-end {
Expand Down
Loading