Skip to content

Commit

Permalink
chore: apply prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Oct 23, 2024
1 parent 08aaab7 commit 78ed454
Show file tree
Hide file tree
Showing 39 changed files with 810 additions and 704 deletions.
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: 2
updates:
-
package-ecosystem: github-actions
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
Expand Down
14 changes: 7 additions & 7 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
###############
# Rules by id #
###############
MD004: false # Unordered list style
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
indent: 2 # Unordered list indentation
MD010:
ignore_code_languages: [caddyfile]
MD013: false
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading

#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines
blank_lines: false # Error on blank lines
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Examples:
docs: Add docs for X
spec: Z disambiguation
-->
-->
2 changes: 1 addition & 1 deletion .github/workflows/cd-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release Chart
on:
push:
tags:
- 'v*'
- "v*"

jobs:
release:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: "1.23"
cache-dependency-path: |
go.sum
caddy/go.sum
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/attest-build-provenance@v1
with:
subject-path: '${{ github.workspace }}/dist/**/mercure'
subject-path: "${{ github.workspace }}/dist/**/mercure"

- name: Display version
run: dist/caddy_linux_amd64_v1/mercure version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.10"

- name: Set up chart-testing
uses: helm/chart-testing-action@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- v*.*.*

env:
GO111MODULE: 'on'
GO111MODULE: "on"

jobs:
golangci:
Expand All @@ -23,7 +23,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: '1.23'
go-version: "1.23"
cache-dependency-path: |
go.sum
caddy/go.sum
Expand All @@ -37,7 +37,7 @@ jobs:
test:
strategy:
matrix:
go: [ '1.21', '1.22', '1.23' ]
go: ["1.21", "1.22", "1.23"]
fail-fast: false
name: Test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,8 +82,8 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
node-version: "16"
cache: "npm"
cache-dependency-path: conformance-tests/package-lock.json

- name: Install Playwrigth dependencies
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# We use standardjs for JavaScript and TypeScript files
**/*.js
**/*.ts

# The spec is in the IETF flavor of Markdown
spec/mercure.md
Expand Down
38 changes: 19 additions & 19 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch the hub",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/caddy/mercure",
"env": {
"MERCURE_PUBLISHER_JWT_KEY": "!ChangeThisMercureHubJWTSecretKey!",
"MERCURE_SUBSCRIBER_JWT_KEY": "!ChangeThisMercureHubJWTSecretKey!",
"MERCURE_EXTRA_DIRECTIVES": "anonymous\nwrite_timeout 10s",
"GLOBAL_OPTIONS": "debug",
"SERVER_NAME": "localhost, host.docker.internal",
"CADDY_SERVER_EXTRA_DIRECTIVES": "tls internal"
},
"args": ["run", "--config", "../../dev.Caddyfile"]
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Launch the hub",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/caddy/mercure",
"env": {
"MERCURE_PUBLISHER_JWT_KEY": "!ChangeThisMercureHubJWTSecretKey!",
"MERCURE_SUBSCRIBER_JWT_KEY": "!ChangeThisMercureHubJWTSecretKey!",
"MERCURE_EXTRA_DIRECTIVES": "anonymous\nwrite_timeout 10s",
"GLOBAL_OPTIONS": "debug",
"SERVER_NAME": "localhost, host.docker.internal",
"CADDY_SERVER_EXTRA_DIRECTIVES": "tls internal"
},
"args": ["run", "--config", "../../dev.Caddyfile"]
}
]
}
36 changes: 18 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ If you include code from another project, please mention it in the Pull Request
The commit message must follow the [Conventional Commits specification](https://www.conventionalcommits.org/).
The following types are allowed:

* `fix`: bugfix
* `feat`: new feature
* `docs`: change in the documentation
* `spec`: spec change
* `test`: test-related change
* `perf`: performance optimization
* `ci`: CI-related change
- `fix`: bugfix
- `feat`: new feature
- `docs`: change in the documentation
- `spec`: spec change
- `test`: test-related change
- `perf`: performance optimization
- `ci`: CI-related change

Examples:

Expand Down Expand Up @@ -61,10 +61,10 @@ Go to `http://localhost:3000` and enjoy!

When you send a PR, make sure that:

* You add valid test cases.
* Tests are green.
* You make a PR on the related documentation.
* You make the PR on the same branch you based your changes on. If you see commits
- You add valid test cases.
- Tests are green.
- You make a PR on the related documentation.
- You make the PR on the same branch you based your changes on. If you see commits
that you did not make in your PR, you're doing it wrong.

### Configuring Visual Studio Code
Expand All @@ -88,10 +88,10 @@ It is then converted in the [the "xml2rfc" Version 3 Vocabulary](https://tools.i

To contribute to the protocol itself:

* Make your changes
* [Download Mmark](https://github.com/mmarkdown/mmark/releases)
* [Download `xml2rfc` using pip](https://pypi.org/project/xml2rfc/): `pip install xml2rfc`
* Generate the XML file: `mmark spec/mercure.md > spec/mercure.xml`
* Validate the generated XML file and generate the text file: `xml2rfc --text --v3 spec/mercure.xml`
* Remove non-ASCII characters from the generated `mercure.txt` file (example: K**é**vin)
* If appropriate, be sure to update the reference implementation accordingly
- Make your changes
- [Download Mmark](https://github.com/mmarkdown/mmark/releases)
- [Download `xml2rfc` using pip](https://pypi.org/project/xml2rfc/): `pip install xml2rfc`
- Generate the XML file: `mmark spec/mercure.md > spec/mercure.xml`
- Validate the generated XML file and generate the text file: `xml2rfc --text --v3 spec/mercure.xml`
- Remove non-ASCII characters from the generated `mercure.txt` file (example: K**é**vin)
- If appropriate, be sure to update the reference implementation accordingly
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center"><a href="https://mercure.rocks"><img src="public/mercure.svg" alt="Mercure: Real-time Made Easy" title="Live Updates Made Easy"></a></h1>

*Protocol and Reference Implementation*
_Protocol and Reference Implementation_

Mercure is a protocol for pushing data updates to web browsers and other HTTP clients in a convenient, fast, reliable, and battery-efficient way.
It is especially useful to publish async and real-time updates of resources served through web APIs, to reactive web and mobile apps.
Expand All @@ -14,9 +14,9 @@ It is especially useful to publish async and real-time updates of resources serv

![Subscriptions Schema](spec/subscriptions.png)

* [Getting started](https://mercure.rocks/docs/getting-started)
* [Full documentation](https://mercure.rocks/docs)
* [Demo](https://demo.mercure.rocks/)
- [Getting started](https://mercure.rocks/docs/getting-started)
- [Full documentation](https://mercure.rocks/docs)
- [Demo](https://demo.mercure.rocks/)

[The protocol](https://mercure.rocks/spec) is maintained in this repository and is also available as [an Internet-Draft](https://datatracker.ietf.org/doc/draft-dunglas-mercure/).

Expand Down
18 changes: 15 additions & 3 deletions cmd/mercure/mercure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ debug: true
allow_anonymous: true
#cert_file: fixtures/tls/server.crt
#key_file: fixtures/tls/server.key
cors_allowed_origins: [http://localhost:3000, http://localhost:3001, http://localhost:5000, http://localhost:8000]
cors_allowed_origins:
[
http://localhost:3000,
http://localhost:3001,
http://localhost:5000,
http://localhost:8000,
]
transport_url: bolt://update.db
jwt_key: '!ChangeThisMercureHubJWTSecretKey!'
publish_allowed_origins: [http://localhost:3000, http://localhost:3001, http://localhost:5000, http://localhost:8000]
jwt_key: "!ChangeThisMercureHubJWTSecretKey!"
publish_allowed_origins:
[
http://localhost:3000,
http://localhost:3001,
http://localhost:5000,
http://localhost:8000,
]
subscriptions: true

metrics_enabled: false
Expand Down
44 changes: 22 additions & 22 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Mercure Documentation

* [Mercure in a Few Words](mercure.md)
* [Getting Started](getting-started.md)
- [Mercure in a Few Words](mercure.md)
- [Getting Started](getting-started.md)

## Protocol Specification

* [The Specification](../spec/mercure.md) (also available as an [IETF's Internet Draft](https://datatracker.ietf.org/doc/draft-dunglas-mercure/) designed to be published as an RFC)
* [Case studies and use cases](spec/use-cases.md)
* [Frequently Asked Questions](spec/faq.md)
* [OpenAPI spec](https://github.com/dunglas/mercure/blob/master/spec/openapi.yaml)
- [The Specification](../spec/mercure.md) (also available as an [IETF's Internet Draft](https://datatracker.ietf.org/doc/draft-dunglas-mercure/) designed to be published as an RFC)
- [Case studies and use cases](spec/use-cases.md)
- [Frequently Asked Questions](spec/faq.md)
- [OpenAPI spec](https://github.com/dunglas/mercure/blob/master/spec/openapi.yaml)

## Mercure.rocks Hub

* [Installing the Mercure.rocks Hub](hub/install.md)
* [Configuration](hub/config.md)
* [The Cloud version](hub/cloud.md)
* [Creating a cluster of hubs](hub/cluster.md)
* [Cookbooks](hub/cookbooks.md)
* [Running behind NGINX](hub/nginx.md)
* [Running behind Traefik Proxy](hub/traefik.md)
* [Troubleshooting](hub/troubleshooting.md)
* [Debug the Mercure.rocks Hub](hub/debug.md)
* [Upgrade to new versions](UPGRADE.md)
* [Load Testing](hub/load-test.md)
- [Installing the Mercure.rocks Hub](hub/install.md)
- [Configuration](hub/config.md)
- [The Cloud version](hub/cloud.md)
- [Creating a cluster of hubs](hub/cluster.md)
- [Cookbooks](hub/cookbooks.md)
- [Running behind NGINX](hub/nginx.md)
- [Running behind Traefik Proxy](hub/traefik.md)
- [Troubleshooting](hub/troubleshooting.md)
- [Debug the Mercure.rocks Hub](hub/debug.md)
- [Upgrade to new versions](UPGRADE.md)
- [Load Testing](hub/load-test.md)

## Ecosystem

* [Awesome Mercure: Libraries, Examples and Learning Resources](ecosystem/awesome.md)
* [Using a Mercure Service in Your GitHub Actions](ecosystem/github-actions.md)
* [Using Mercure and Hotwire to Stream Page Changes](ecosystem/hotwire.md)
* [Getting Help](ecosystem/help.md)
* [Conformance Tests](ecosystem/conformance-tests.md)
- [Awesome Mercure: Libraries, Examples and Learning Resources](ecosystem/awesome.md)
- [Using a Mercure Service in Your GitHub Actions](ecosystem/github-actions.md)
- [Using Mercure and Hotwire to Stream Page Changes](ecosystem/hotwire.md)
- [Getting Help](ecosystem/help.md)
- [Conformance Tests](ecosystem/conformance-tests.md)
24 changes: 12 additions & 12 deletions docs/UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Before:
```json
{
"mercure": {
"payload": {"foo": "bar"}
"payload": { "foo": "bar" }
}
}
```
Expand All @@ -22,7 +22,7 @@ After:
{
"mercure": {
"payloads": {
"*": {"foo": "bar"}
"*": { "foo": "bar" }
}
}
}
Expand Down Expand Up @@ -117,18 +117,18 @@ Before switching to the Caddy build, be sure to [migrate your configuration](hub

This version is in sync with the latest version of the specification, which changed a lot. Upgrading to 0.10 **requires to change your code**. Carefully read this guide before upgrading the hub.

* Private updates are now handled differently. *Targets* don't exist anymore. They have been superseded by the concept of *topic selectors*.
- Private updates are now handled differently. _Targets_ don't exist anymore. They have been superseded by the concept of _topic selectors_.
To send a private update, the publisher must now set the new `private` field to `on` when sending the `POST` request. The topics of the update must also match at least one selector (a URI Template, a raw string or `*` to match all topics) provided in the `mercure.publish` claim of the JWT.
To receive a private update, at least one topic of this update must match at least one selector provided in the `mercure.subscribe` claim of the JWT.
* The structure of the JSON-LD document included in subscription events changed. Especially, `"@type": "https://mercure.rocks/Subscription"` is now `"type": "Subscription"` and `"@id": "/.well-known/mercure/subscriptions/foo/bar"` is now `"id": "/.well-known/mercure/subscriptions/foo/bar"`.
* The `dispatch_subscriptions` config option has been renamed `subscriptions`.
* The `subscriptions_include_ip` config option doesn't exist anymore. To include the subscriber IP (or any other value) in subscription events, use the new `mercure.payload` property of the JWT.
* All IDs generated by the hub (updates ID, subscriptions IDs...) are now URN following the template `urn:uuid:{the-uuid}` (it was `{the-uuid}` before). You may need to update your code if you deal with these IDs.
* The topic `*` is now reserved and allows to subscribe to all topics.
- The structure of the JSON-LD document included in subscription events changed. Especially, `"@type": "https://mercure.rocks/Subscription"` is now `"type": "Subscription"` and `"@id": "/.well-known/mercure/subscriptions/foo/bar"` is now `"id": "/.well-known/mercure/subscriptions/foo/bar"`.
- The `dispatch_subscriptions` config option has been renamed `subscriptions`.
- The `subscriptions_include_ip` config option doesn't exist anymore. To include the subscriber IP (or any other value) in subscription events, use the new `mercure.payload` property of the JWT.
- All IDs generated by the hub (updates ID, subscriptions IDs...) are now URN following the template `urn:uuid:{the-uuid}` (it was `{the-uuid}` before). You may need to update your code if you deal with these IDs.
- The topic `*` is now reserved and allows to subscribe to all topics.

## 0.8

* According to the new version of the spec, the URL of the Hub changed moved from `/hub` to `/.well-known/mercure`
* `HISTORY_CLEANUP_FREQUENCY`, `HISTORY_SIZE` and `DB_PATH` environment variables have been replaced by the new `TRANSPORT_URL` environment variable
* Lists in `ACME_HOSTS`, `CORS_ALLOWED_ORIGINS`, `PUBLISH_ALLOWED_ORIGINS` must now be space separated
* The public API of the Go library has been totally revamped
- According to the new version of the spec, the URL of the Hub changed moved from `/hub` to `/.well-known/mercure`
- `HISTORY_CLEANUP_FREQUENCY`, `HISTORY_SIZE` and `DB_PATH` environment variables have been replaced by the new `TRANSPORT_URL` environment variable
- Lists in `ACME_HOSTS`, `CORS_ALLOWED_ORIGINS`, `PUBLISH_ALLOWED_ORIGINS` must now be space separated
- The public API of the Go library has been totally revamped
Loading

0 comments on commit 78ed454

Please sign in to comment.