Skip to content

Commit 241d563

Browse files
committed
Update for dual publishing to JSR and deno.land/x
- Updated egg.json with v3.0.0 and current description - Updated README to show both JSR and deno.land/x installation methods - Removed egg.json from JSR publish exclusions - Both registries now supported equally
1 parent 9dd13fd commit 241d563

3 files changed

Lines changed: 37 additions & 19 deletions

File tree

README.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
**Denoliver** is a small, zero config dev & static file server with live reloading written in TypeScript for Deno intended for prototyping and Single Page Applications.
1515

16+
> **Version 3.0+**: Now available on both [JSR](https://jsr.io/@joakimunge/denoliver) and [deno.land/x](https://deno.land/x/denoliver) with modern Deno APIs and improved TypeScript support!
17+
1618
## Prerequisites
1719

18-
### To run this you need to have [Deno](https://deno.land/) 1.19 or later installed.
20+
* [Deno 2.0+](https://deno.land/manual/getting_started/installation)
1921

2022
## Key Features
2123

@@ -28,27 +30,35 @@
2830
- Boilerplating for rapid prototyping.
2931
- Injectable HTTP request interceptors. (TS & JS)
3032

31-
## Getting started
33+
## Getting Started
3234

33-
Install as a Deno executable.
35+
### Installation
3436

35-
> NOTE: Deno is a secure runtime by default. You need to include the `--allow-net`, `--allow-read`, `--allow-write`, and `--allow-sys` flags to make sure Denoliver can serve your directory and display network addresses.
37+
```bash
38+
# Install from JSR (recommended)
39+
deno install --allow-net --allow-read --allow-write --allow-run jsr:@joakimunge/denoliver@3.0.0 --name denoliver
3640

41+
# Or install from deno.land/x
42+
deno install --allow-net --allow-read --allow-write --allow-run https://deno.land/x/denoliver@3.0.0/mod.ts --name denoliver
3743
```
38-
$ deno install --global --allow-net --allow-read --allow-write --allow-sys https://deno.land/x/denoliver/mod.ts
39-
```
44+
45+
### Usage
46+
47+
Running denoliver without any arguments will start a server on port `3000` and serve files from the current working directory.
48+
49+
> **Note**: Deno is a secure runtime by default. You need to include the `--allow-net`, `--allow-read`, `--allow-write`, and `--allow-run` flags to make sure Denoliver can serve your directory and display network addresses.
4050
4151
or if you're not happy with the name:
4252

43-
```
44-
$ deno install --global -n whateverNameYouWant --allow-net --allow-read --allow-write --allow-sys https://deno.land/x/denoliver/mod.ts
53+
```bash
54+
$ deno install --global -n whateverNameYouWant --allow-net --allow-read --allow-write --allow-run jsr:@joakimunge/denoliver@3.0.0
4555
```
4656

4757
## Why do I need the `--allow-sys` flag?
4858

4959
_You don't need it! You can still use Denoliver as normal without this flag._
5060

51-
Denoliver uses `Deno.networkInterfaces()` (available since Deno 1.19) to display your local network address. This API requires the `--allow-sys` permission. If you don't provide this flag, Denoliver will still work but won't be able to show the network address in the startup message.
61+
Denoliver uses `Deno.networkInterfaces()` to display your local network address. This API requires the `--allow-sys` permission. If you don't provide this flag, Denoliver will still work but won't be able to show the network address in the startup message.
5262

5363
## Running
5464

@@ -106,7 +116,7 @@ Interceptors can be a single function, for example:
106116
```typescript
107117
// before.ts
108118

109-
export default (req: ServerRequest) => {
119+
export default (req: Request) => {
110120
req.headers.set('Authorization', 'Bearer some-token')
111121
return req
112122
}
@@ -115,12 +125,12 @@ export default (req: ServerRequest) => {
115125
or an array of functions:
116126

117127
```typescript
118-
const setHeaders = (req: ServerRequest) => {
128+
const setHeaders = (req: Request) => {
119129
req.headers.set('Authorization', 'Bearer some-token')
120130
return req
121131
}
122132

123-
const logRequestUrl = (req: ServerRequest) => {
133+
const logRequestUrl = (req: Request) => {
124134
console.log(req.url)
125135
return req
126136
}
@@ -133,7 +143,7 @@ of course this can also be used when using Denoliver as a module:
133143
```typescript
134144
const server = denoliver({
135145
port: 6060,
136-
before: (req: ServerRequest) => {
146+
before: (req: Request) => {
137147
req.headers.set('Authorization', 'Bearer some-token')
138148
return req
139149
},
@@ -165,12 +175,16 @@ If you want, you can place a configuration file called `denoliver.json` in the f
165175
## API
166176

167177
Denoliver can also be used as a module in any Deno project.
168-
This exposes an instance of [Deno.Server](https://deno.land/std/http/server.ts#L125).
178+
This exposes an instance of [Deno.Server](https://docs.deno.com/api/deno/~/Deno.serve).
169179

170180
The main function accepts the same config object as specified in the config file above.
171181

172182
```typescript
173-
import denoliver from 'https://deno.land/x/denoliver/mod.ts'
183+
// Import from JSR (recommended)
184+
import denoliver from 'jsr:@joakimunge/denoliver@3.0.0'
185+
186+
// Or import from deno.land/x
187+
import denoliver from 'https://deno.land/x/denoliver@3.0.0/mod.ts'
174188

175189
const server = denoliver({ port: 6060, cors: true })
176190

deno.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
".vscode/",
1919
"demo/",
2020
"temp.ts",
21-
"egg.json",
2221
"Makefile",
2322
"denoliver.json",
2423
"denoliver.json.example",

egg.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"name": "denoliver",
3-
"description": "A simple, dependency free static file server for Deno with possibly the worst name ever.",
3+
"description": "A small, zero config dev & static file server with live reloading written in TypeScript for Deno intended for prototyping and Single Page Applications.",
44
"homepage": "https://github.com/joakimunge/denoliver",
5-
"files": ["./**/*.ts", "README.md"],
6-
"entry": "./mod.ts"
5+
"files": [
6+
"./**/*.ts",
7+
"README.md",
8+
"LICENSE"
9+
],
10+
"entry": "./mod.ts",
11+
"version": "3.0.0"
712
}

0 commit comments

Comments
 (0)