Unverified Commit 46f77429 authored by Hong Minhee's avatar Hong Minhee
Browse files

Add type decls to npm and update docs

parent 1538bfda
Loading
Loading
Loading
Loading
+48 −3
Original line number Diff line number Diff line
@@ -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
@@ -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 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ await build({
    ],
  },
  typeCheck: "both",
  declaration: "separate",
  declarationMap: true,
  compilerOptions: {
    target: "ES2022",
  },
+54 −3
Original line number Diff line number Diff line
@@ -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
@@ -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";
~~~~
+11 −8
Original line number Diff line number Diff line
@@ -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
@@ -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: