@within-7/jetr 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# @within-7/jetr
|
|
2
|
+
|
|
3
|
+
Internal static site hosting CLI. Deploy static files to Cloudflare R2 and get a `{name}.jetr.within-7.com` subdomain.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g @within-7/jetr
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @within-7/jetr deploy my-site ./dist
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 1. Login with your JWT token (from auth-gateway)
|
|
21
|
+
jetr login <token>
|
|
22
|
+
|
|
23
|
+
# 2. Create a site
|
|
24
|
+
jetr create my-blog
|
|
25
|
+
|
|
26
|
+
# 3. Deploy
|
|
27
|
+
jetr deploy my-blog ./dist
|
|
28
|
+
# ✔ Deployed!
|
|
29
|
+
# URL: https://my-blog.jetr.within-7.com
|
|
30
|
+
# Uploaded: 12 files
|
|
31
|
+
# Size: 1.2 MB
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
### `jetr login <token>`
|
|
37
|
+
|
|
38
|
+
Save JWT token for authentication. Token is stored in `~/.jetr/config.json`.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
jetr login eyJhbGciOiJIUzI1NiJ9...
|
|
42
|
+
jetr login <token> --api-url https://custom-api.example.com
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `jetr create <name>`
|
|
46
|
+
|
|
47
|
+
Create a new site. Name becomes the subdomain: `{name}.jetr.within-7.com`.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
jetr create my-blog
|
|
51
|
+
jetr create preview-site --password secret123
|
|
52
|
+
jetr create temp-demo --expires 86400 # expires in 24h
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `jetr deploy <name> [directory]`
|
|
56
|
+
|
|
57
|
+
Deploy a directory to a site. Uses incremental upload — only changed files are uploaded.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
jetr deploy my-blog ./dist
|
|
61
|
+
jetr deploy my-blog . # deploy current directory
|
|
62
|
+
jetr deploy my-blog # defaults to current directory
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### `jetr list`
|
|
66
|
+
|
|
67
|
+
List your sites.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
jetr list
|
|
71
|
+
jetr ls
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `jetr info <name>`
|
|
75
|
+
|
|
76
|
+
Show site details including files and share tokens.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
jetr info my-blog
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `jetr delete <name>`
|
|
83
|
+
|
|
84
|
+
Delete a site and all its files.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
jetr delete my-blog
|
|
88
|
+
jetr rm my-blog
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `jetr password <name> [password]`
|
|
92
|
+
|
|
93
|
+
Set or remove site password.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
jetr password my-blog secret123 # set password
|
|
97
|
+
jetr password my-blog # remove password
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### `jetr token create <site>`
|
|
101
|
+
|
|
102
|
+
Create a share token for password-protected sites.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
jetr token create my-blog --note "For QA team"
|
|
106
|
+
jetr token create my-blog --expires 3600 # 1 hour
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `jetr token revoke <site> <id>`
|
|
110
|
+
|
|
111
|
+
Revoke a share token.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
jetr token revoke my-blog KTEaMnomEOPHlZizIvDNL
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### `jetr whoami`
|
|
118
|
+
|
|
119
|
+
Show current config (API URL and token).
|
|
120
|
+
|
|
121
|
+
## How It Works
|
|
122
|
+
|
|
123
|
+
1. **`jetr deploy`** scans the directory and computes SHA-256 hashes for each file
|
|
124
|
+
2. Sends the file manifest to the API, which diffs against the current state
|
|
125
|
+
3. Only uploads files that changed (incremental deploy)
|
|
126
|
+
4. Finalizes the deploy — old files are cleaned up, new files go live
|
|
127
|
+
|
|
128
|
+
This means re-deploying a large site with one changed file only uploads that one file.
|
|
129
|
+
|
|
130
|
+
## Config
|
|
131
|
+
|
|
132
|
+
Config is stored at `~/.jetr/config.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"apiUrl": "https://jetr-api.lixilei.workers.dev",
|
|
137
|
+
"token": "eyJhbG..."
|
|
138
|
+
}
|
|
139
|
+
```
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@within-7/jetr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "CLI for Jetr static site hosting",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"jetr": "./dist/cli.js"
|
|
8
8
|
},
|
|
9
|
-
"files": ["dist"],
|
|
9
|
+
"files": ["dist", "README.md"],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsup src/cli.ts --format esm --target node20 --clean",
|
|
12
12
|
"dev": "tsx src/cli.ts",
|