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

Add support for non-browser specs #496

Merged
merged 7 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 24 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,44 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Setup environment
run: |
echo "${{ secrets.CONFIG_JSON }}" | base64 --decode > config.json
npm ci

- name: Build new index file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run build

- name: Test new index file
env:
CONFIG_JSON: ${{ secrets.CONFIG_JSON }}
run: |
echo "${{ secrets.CONFIG_JSON }}" | base64 --decode > config.json
npm run test

- name: Bump minor version of packages if needed
run: node src/bump-packages-minor.js

- name: Commit updates
run: |
git config user.name "fetch-info bot"
git config user.email "<>"
git commit -m "[data] Update spec info" -a || true

- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main

- name: Prepare packages data
run: node src/prepare-packages.js

- name: Create/Update pre-release PR for web-specs
run: node src/prepare-release.js web-specs

- name: Create/Update pre-release PR for browser-specs
run: node src/prepare-release.js browser-specs
40 changes: 40 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Publish a new package when a pre-release PR is merged.
#
# Job does nothing if PR that was merged is not a pre-release PR.

name: "Publish NPM package if needed"

on:
pull_request:
branches:
- main
types:
- closed

jobs:
release:
if: startsWith(github.head_ref, 'release-') && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Setup node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Checkout latest version of release script
uses: actions/checkout@v2
with:
ref: main

- name: Install dependencies
run: |
npm install --no-save @octokit/rest
npm install --no-save @octokit/plugin-throttling
npm install --no-save rimraf
npm install --no-save @jsdevtools/npm-publish

- name: Release package if needed
run: node src/release-package.js ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/request-pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "@webref release: Request review of pre-release PR"
dontcallmedom marked this conversation as resolved.
Show resolved Hide resolved

on:
schedule:
- cron: '0 5 * * 4'
workflow_dispatch:

jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Setup node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Checkout webref
uses: actions/checkout@v2

- name: Install dependencies
run: |
npm install --no-save @octokit/rest
npm install --no-save @octokit/plugin-throttling

- name: Request review of pre-release PR
run: node src/request-pr-review.js
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.cache
node_modules/
config.json
packages/**/index.json
16 changes: 0 additions & 16 deletions .release-it.json

This file was deleted.

4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ as the current spec in the series. The property must only be set when value is
- `multipage`: a boolean flag to identify the spec as a multipage spec. This
instructs the code to extract the list of pages from the index page and fill
out the `release.pages` and `nightly.pages` properties in the list.
- `categories`: an array that is treated as incremental update to adjust the
list of [`categories`](README.md#categories) that the spec belongs to. Values
may be one of `"reset"` to start from an empty list, `"+browser"` to add
`"browser"` to the list, and `"-browser"` to remove `"browser"` from the list.

You should **only** set these properties when they are required to generate the
right info. For instance, some of these properties are needed for Media Queries
Expand Down
72 changes: 34 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ cross-references, WebIDL, quality, etc.
## Table of Contents

- [Installation and usage](#installation-and-usage)
- [Spec object](#spec-object)
<!-- COMMON-TOC: start -->- [Spec object](#spec-object)
- [`url`](#url)
- [`shortname`](#shortname)
- [`title`](#title)
- [`shortTitle`](#shorttitle)
- [`categories`](#categories)
- [`series`](#series)
- [`series.shortname`](#seriesshortname)
- [`series.currentSpecification`](#seriescurrentspecification)
Expand Down Expand Up @@ -46,8 +47,8 @@ cross-references, WebIDL, quality, etc.
- [`tests.excludePaths`](#testsexcludepaths)
- [`source`](#source)
- [How to add/update/delete a spec](#how-to-addupdatedelete-a-spec)
- [Versioning](#versioning)<!-- COMMON-TOC: end -->
- [Spec selection criteria](#spec-selection-criteria)
- [Versioning](#versioning)
- [Development notes](#development-notes)
- [How to generate `index.json` manually](#how-to-generate-indexjson-manually)
- [Debugging tool](#debugging-tool)
Expand All @@ -57,29 +58,26 @@ cross-references, WebIDL, quality, etc.

## Installation and usage

The list is distributed as an NPM package. To incorporate it to your project,
The whole list is distributed as an NPM package called [web-specs](https://www.npmjs.com/package/web-specs). To incorporate it to your project,
run:

```bash
npm install browser-specs
npm install web-specs
```

You can then retrieve the list from your Node.js program:

```js
const specs = require("browser-specs");
const specs = require("web-specs");
console.log(JSON.stringify(specs, null, 2));
```

Alternatively, you can either retrieve the [latest
release](https://github.com/w3c/browser-specs/releases/latest) or fetch
[`index.json`](https://w3c.github.io/browser-specs/index.json).

**Note:** If you choose to fetch the `index.json` file directly, keep in mind
that it may contain (possibly incorrect) updates that have not yet been included
in the NPM package and the latest GitHub release (see also #38).
Alternatively, you can fetch [`index.json`](https://w3c.github.io/browser-specs/index.json)
or retrieve the list from the [`web-specs@latest` branch](https://github.com/w3c/browser-specs/tree/web-specs%40latest).

The subset of specs that target web browsers is published in a separate [`browser-specs`](https://www.npmjs.com/package/browser-specs) package. You may retrieve that filtered list from the [`browser-specs@latest` branch](https://github.com/w3c/browser-specs/tree/browser-specs%40latest)

<!-- COMMON-BODY: start -->
## Spec object

Each specification in the list comes with the following properties:
Expand Down Expand Up @@ -119,6 +117,7 @@ Each specification in the list comes with the following properties:
"title": "CSS Color Module Level 4",
"source": "w3c",
"shortTitle": "CSS Color 4",
"categories": ["browser"],
"tests": {
"repository": "https://github.com/web-platform-tests/wpt",
"testPaths": [
Expand Down Expand Up @@ -170,6 +169,17 @@ The `shortTitle` property is always set. When there is no meaningful short
title, the property is set to the actual (possibly long) title of the spec.


### `categories`

An array that contains the list of categories that the spec belongs to. The only
possible value so far is `"browser"`, which means that the spec targets web
browsers.

The `categories` property is always set. Value may be an empty array for some of
the specs in the `web-specs` package. Value always contains `"browser"` for
specs in the `browser-specs` package.


### `series`

An object that describes the series that the spec is part of. A series includes
Expand Down Expand Up @@ -471,10 +481,9 @@ or if you would like to otherwise contribute to this project, please check
## Spec selection criteria

This repository contains a curated list of technical Web specifications that are
deemed relevant for Web browsers. Roughly speaking, this list should match the
list of specs that appear in projects such as [Web Platform
Tests](https://github.com/web-platform-tests/wpt) or
[MDN](https://developer.mozilla.org/).
deemed relevant for the Web platform. Roughly speaking, this list should match
the list of web specs actively developed by W3C, the WHATWG and a few other
organizations.

To try to make things more concrete, the following criteria are used to assess
whether a spec should a priori appear in the list:
Expand All @@ -484,9 +493,7 @@ appear in the list. For instance, the list contains the HTML LS spec, but not
HTML 4.01 or HTML 5).
2. The spec is being developed by a well-known standardization or
pre-standardization group. Today, this means a W3C Working Group or Community
Group, the WHATWG, or the Khronos Group.
3. Web browsers expressed some level of support for the spec, e.g. through a
public intent to implement.
Group, the WHATWG, the IETF, the TC39 group or the Khronos Group.
4. The spec sits at the application layer or is "close to it". For instance,
most IETF specs are likely out of scope, but some that are exposed to Web developers are in scope.
5. The spec defines normative content (terms, CSS, IDL), or it contains
Expand Down Expand Up @@ -516,7 +523,7 @@ removal of a spec should rather trigger a `major` update, please
how it affects your project.
- `patch`: Info about one or more specs changed. Minor updates were made to the
code that don't affect the list.

<!-- COMMON-BODY: end -->

## Development notes

Expand All @@ -531,7 +538,7 @@ npm run build
**Important:** The generation process will try to retrieve information about W3C
specification from the W3C API. For that to work, the code requires the presence
of a `config.json` file in the root folder with a `w3cApiKey` field set to a
valid [W3C API key](https://w3c.github.io/w3c-api/) and a `githubToken` field
valid [W3C API key](https://w3c.github.io/w3c-api/) and a `GH_TOKEN` field
set to a valid [GitHub Personal Token](https://github.com/settings/tokens)
(default read permissions are enough).

Expand Down Expand Up @@ -566,24 +573,13 @@ node index.js delta
node index.js https://w3c.github.io/presentation-api/
```

**Note:** The `index.js` CLI is not part of the released package, which only
contains the actual list of specifications.
**Note:** The `index.js` CLI is not part of released packages, which only
contain the actual list of specifications.


### How to release a new version

Provided that you have the appropriate admin rights and that a `GITHUB_TOKEN`
environment variable is set to a [GitHub Personal
Token](https://github.com/settings/tokens) with `repo` rights, you may release a
new version through the following command, to be run from an up-to-date local
`main` branch:

```bash
npm run release
```

The release command should take care of everything including incrementing the
version number, updating the [changelog](CHANGELOG.md), creating a GitHub
Release, and publishing a new NPM package. The command is interactive and will
ask you to confirm the different steps. Please check the [versioning
rules](#versioning) to select the right version part to increment!
Releases are semi-automated through GitHub workflows. Whenever the list of specs
is updated on the main branch, pre-release pull requests are created with the
diff to release as description. Merging these pull requests releases the new
version of NPM packages.
Loading