Skip to content

Commit

Permalink
Merge pull request #111 from lowercasename/rk/typescript
Browse files Browse the repository at this point in the history
Typescript migration
  • Loading branch information
lowercasename authored Oct 6, 2023
2 parents f390b1d + 722d54e commit a14afed
Show file tree
Hide file tree
Showing 34 changed files with 4,947 additions and 4,668 deletions.
30 changes: 15 additions & 15 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {}
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {}
}
113 changes: 60 additions & 53 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,74 @@
name: CI / Build and test
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
pull_request:
workflow_dispatch:
push:
branches:
- main

jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up config files
run: cp config/config.example.toml config/config.toml
- name: Set up config files
run: cp config/config.example.toml config/config.toml

- name: Cypress install
uses: cypress-io/github-action@v6
with:
# Disable running of tests within install job
runTests: false
build: pnpm run build
continue-on-error: true
- name: Cypress install
uses: cypress-io/github-action@v6
with:
# Disable running of tests within install job
runTests: false
build: pnpm run build
continue-on-error: true

- name: Save build folder
uses: actions/upload-artifact@v3
with:
name: dist
if-no-files-found: error
path: dist
- name: Save build folder
uses: actions/upload-artifact@v3
with:
name: dist
if-no-files-found: error
path: dist

cypress-run:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4
cypress-run:
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up config files
run: cp config/config.example.toml config/config.toml
- name: Set up config files
run: cp config/config.example.toml config/config.toml

- name: Download the build folder
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Download the build folder
uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Start MongoDB
uses: supercharge/[email protected]
- name: Start MongoDB
uses: supercharge/[email protected]

- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: pnpm start
browser: chrome
- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: pnpm start
browser: chrome

- name: Upload screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"tabWidth": 4
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: shell
os: linux

services:
- docker
- docker

script:
- ./test.sh
- ./test.sh
60 changes: 30 additions & 30 deletions FEDERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ This document is meant to be a reference for all the ActivityPub federation-rela

To keep things simple, sometimes you will see things formatted like `Create/Note` or `Delete/Event` or `Undo/Follow`. The thing before the slash is the Activity, and the thing after the slash is the Object inside the Activity, in an `object` property. So these are to be read as follows:

- `Create/Note`: a `Create` activity containing a `Note` in the `object` field
- `Delete/Event`: a `Delete` activity containing an `Event` in the `object` field
- `Undo/Follow`: an `Undo` activity containing a `Follow` in the `object` field
- `Create/Note`: a `Create` activity containing a `Note` in the `object` field
- `Delete/Event`: a `Delete` activity containing an `Event` in the `object` field
- `Undo/Follow`: an `Undo` activity containing a `Follow` in the `object` field

When the word "broadcast" is used in this document, it means to send an Activity to individual inbox of each of the followers of a given Actor.

This document has four main sections:

- **Federation philosophy** lays out the general model of how this is intended to federate
- **General Actor information** contains the basics of what to expect from our `Actor` objects
- **Inbox behavior** lists every incoming ActivityPub activity that the server recognizes, and tells you what it does in response to that activity, including any other ActivityPub activities it sends back out.
- **Activities triggered from the web app** tells you what circumstances on the web application cause the server to emit ActivityPub activities. (For example, when an event is updated via the web application, it lets all the ActivityPub followers know that the event has been updated.)
- **Federation philosophy** lays out the general model of how this is intended to federate
- **General Actor information** contains the basics of what to expect from our `Actor` objects
- **Inbox behavior** lists every incoming ActivityPub activity that the server recognizes, and tells you what it does in response to that activity, including any other ActivityPub activities it sends back out.
- **Activities triggered from the web app** tells you what circumstances on the web application cause the server to emit ActivityPub activities. (For example, when an event is updated via the web application, it lets all the ActivityPub followers know that the event has been updated.)

Please note: there is an unfortunate collision between the English language and the ActivityPub spec that can make this document confusing. When this document uses the word 'event' with a lowercase-e and not in monospace, it refers to the thing that is being tracked in gathio: events that are being organized. When this document uses the word `Event` with a capital E and in monospace, it refers to the [`Event` object defined in the ActivityStreams Vocabulary spec](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event).

Expand All @@ -37,29 +37,29 @@ Every event has an Actor. The Actor looks like this:

```json
{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1"
],
"id": "https://DOMAIN/EVENTID",
"type": "Person",
"preferredUsername": "EVENTID",
"inbox": "https://DOMAIN/activitypub/inbox",
"outbox": "https://DOMAIN/EVENTID/outbox",
"followers": "https://DOMAIN/EVENTID/followers",
"summary": "<p><p>DESCRIPTION</p>\n</p><p>Location: LOCATION.</p><p>Starting DATETIME (human readable).</p>",
"name": "EVENTNAME",
"featured": "https://DOMAIN/EVENTID/featured",
"publicKey": {
"id": "https://DOMAIN/EVENTID#main-key",
"owner": "https://DOMAIN/EVENTID",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nOURPUBLICKEY\n-----END PUBLIC KEY-----\n"
},
"icon": {
"type": "Image",
"mediaType": "image/jpg",
"url": "https://DOMAIN/events/EVENTID.jpg"
}
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1"
],
"id": "https://DOMAIN/EVENTID",
"type": "Person",
"preferredUsername": "EVENTID",
"inbox": "https://DOMAIN/activitypub/inbox",
"outbox": "https://DOMAIN/EVENTID/outbox",
"followers": "https://DOMAIN/EVENTID/followers",
"summary": "<p><p>DESCRIPTION</p>\n</p><p>Location: LOCATION.</p><p>Starting DATETIME (human readable).</p>",
"name": "EVENTNAME",
"featured": "https://DOMAIN/EVENTID/featured",
"publicKey": {
"id": "https://DOMAIN/EVENTID#main-key",
"owner": "https://DOMAIN/EVENTID",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nOURPUBLICKEY\n-----END PUBLIC KEY-----\n"
},
"icon": {
"type": "Image",
"mediaType": "image/jpg",
"url": "https://DOMAIN/events/EVENTID.jpg"
}
}
```

Expand Down
10 changes: 5 additions & 5 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
baseUrl: "http://localhost:3000",
setupNodeEvents(on, config) {
// implement node event listeners here
e2e: {
baseUrl: "http://localhost:3000",
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
},
});
Loading

0 comments on commit a14afed

Please sign in to comment.