Skip to content

Commit

Permalink
Add type decls to npm and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 31, 2024
1 parent 1538bfd commit 46f7742
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 14 deletions.
51 changes: 48 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,29 @@ join our [Matrix chat space][Matrix] or [GitHub Discussions].
Installation
------------

As a prerequisite, you need to have [Deno] 1.41.0 or later installed on your
system. Then you can install Fedify via the following command:
Fedify is available on [JSR] for [Deno] and on [npm] for [Node.js] and [Bun].
Although Fedify can be used in Node.js and Bun, it's primarily designed for
Deno. We recommend using Deno for the best experience, but you can use Node.js
or Bun if you prefer.

> [!TIP]
> If you are new to Deno, but already familiar with Node.js, you can think of
> Deno as a more modern version of Node.js created by the same person, Ryan
> Dahl. Deno has a lot of improvements over Node.js, such as better security,
> better TypeScript support, better ES module support, and built-in key-value
> store and message queue.
[JSR]: https://jsr.io/@fedify/fedify
[Deno]: https://deno.com/
[npm]: https://www.npmjs.com/package/@fedify/fedify
[Node.js]: https://nodejs.org/
[Bun]: https://bun.sh/

### Deno

[Deno] is the primary runtime for Fedify. As a prerequisite, you need to have
Deno 1.41.0 or later installed on your system. Then you can install Fedify
via the following command:

~~~~ sh
deno add @fedify/fedify
Expand All @@ -94,4 +115,28 @@ Or you can directly import it in your code using `jsr:` specifier:
import { Federation } from "jsr:@fedify/fedify";
~~~~

[Deno]: https://deno.com/
### Node.js

Fedify can also be used in Node.js. You can install it via the following
command:

~~~~ sh
npm add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
~~~~

### Bun

Fedify can also be used in Bun. You can install it via the following
command:

~~~~ sh
bun add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
~~~~
2 changes: 2 additions & 0 deletions dnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ await build({
],
},
typeCheck: "both",
declaration: "separate",
declarationMap: true,
compilerOptions: {
target: "ES2022",
},
Expand Down
57 changes: 54 additions & 3 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,31 @@ metas:
Installation
============

As a prerequisite, you need to have [Deno] 1.41.0 or later installed on your
system. Then you can install Fedify via the following command:
Fedify is available on [JSR] for [Deno] and on [npm] for [Node.js] and [Bun].
Although Fedify can be used in Node.js and Bun, it's primarily designed for
Deno. We recommend using Deno for the best experience, but you can use Node.js
or Bun if you prefer.

> [!TIP]
> If you are new to Deno, but already familiar with Node.js, you can think of
> Deno as a more modern version of Node.js created by the same person, Ryan
> Dahl. Deno has a lot of improvements over Node.js, such as better security,
> better TypeScript support, better ES module support, and built-in key-value
> store and message queue.
[JSR]: https://jsr.io/@fedify/fedify
[Deno]: https://deno.com/
[npm]: https://www.npmjs.com/package/@fedify/fedify
[Node.js]: https://nodejs.org/
[Bun]: https://bun.sh/


Deno
----

[Deno] is the primary runtime for Fedify. As a prerequisite, you need to have
Deno 1.41.0 or later installed on your system. Then you can install Fedify
via the following command:

~~~~ sh
deno add @fedify/fedify
Expand All @@ -23,4 +46,32 @@ Or you can directly import it in your code using `jsr:` specifier:
import { Federation } from "jsr:@fedify/fedify";
~~~~

[Deno]: https://deno.com/

Node.js
-------

Fedify can also be used in Node.js. You can install it via the following
command:

~~~~ sh
npm add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
~~~~


Bun
---

Fedify can also be used in Bun. You can install it via the following
command:

~~~~ sh
bun add @fedify/fedify
~~~~

~~~~ typescript
import { Federation } from "@fedify/fedify";
~~~~
19 changes: 11 additions & 8 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ receiving activities, and the inbox.
As prerequisite knowledge, you should have a basic understanding of
JavaScript/TypeScript, command-line interfaces, and minimum experience with
building web server apps. However, it's perfectly fine if you're not familiar
with the ActivityPub protocol or the Deno runtime;[^1] we will explain them as
with the ActivityPub protocol or the Deno runtime; we will explain them as
we go.

[^1]: The Deno runtime is a secure runtime for JavaScript and TypeScript. It is
similar to Node.js but has a few differences, such as a built-in
TypeScript compiler and a secure-by-default design. If you are already
familiar with Node.js, you can think of Deno as a more modern version of
Node.js. Fun fact: Deno is created by Ryan Dahl, the original creator of
Node.js.
> [!NOTE]
> The Deno runtime is a secure runtime for JavaScript and TypeScript. It is
> similar to Node.js but has a few differences, such as a built-in
> TypeScript compiler and a secure-by-default design. If you are already
> familiar with Node.js, you can think of Deno as a more modern version of
> Node.js created by the same person, Ryan Dahl.
>
> Although this tutorial is written for Deno, you can use the Fedify framework
> in Node.js as well. The API is the same in both Deno and Node.js.

What we will build
Expand Down Expand Up @@ -161,7 +164,7 @@ a key-value store.

> [!IMPORTANT]
> Since `MemoryKvStore` is for testing and development purposes, you should
> use a persistent key-value store like [`DenoKvStore`] for production use.
> use a persistent key-value store like `DenoKvStore` for production use.
Then, we pass the incoming `Request` to the `federation.handle()` method:

Expand Down

0 comments on commit 46f7742

Please sign in to comment.