@pathmx/cloudflare 0.5.0 → 0.5.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 +38 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@pathmx/cloudflare`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Publish a static PathMX build as a Cloudflare Worker with Static Assets.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun run pmx plugins add cloudflare
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Configure the publication in a repository Plugin:
|
|
5
12
|
|
|
6
13
|
```ts
|
|
7
14
|
// plugins/cloudflare.plugin.ts
|
|
8
15
|
import { CloudflarePlugin } from "@pathmx/cloudflare"
|
|
9
16
|
|
|
10
17
|
export default CloudflarePlugin({
|
|
11
|
-
accountId: "0123456789abcdef0123456789abcdef",
|
|
12
18
|
worker: "my-pathmx-site",
|
|
13
19
|
origin: "https://docs.example.com",
|
|
14
|
-
|
|
20
|
+
domain: "docs.example.com",
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Set `accountId` when local Cloudflare credentials can access more than one
|
|
25
|
+
account. Use `basePath` when PathMX should live below an origin prefix such as
|
|
26
|
+
`/course-guide`.
|
|
27
|
+
|
|
28
|
+
Custom Domains are the default. To attach an exact Worker route in an existing
|
|
29
|
+
zone instead:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
export default CloudflarePlugin({
|
|
33
|
+
worker: "my-pathmx-site",
|
|
34
|
+
origin: "https://docs.example.com",
|
|
15
35
|
domain: "docs.example.com",
|
|
16
36
|
routing: { type: "route", zone: "example.com" },
|
|
17
37
|
})
|
|
18
38
|
```
|
|
19
39
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
account. It is written to the generated Wrangler configuration so validation
|
|
27
|
-
and deployment select the same account.
|
|
28
|
-
|
|
29
|
-
Domains default to Cloudflare Custom Domains. Select zone-route routing when
|
|
30
|
-
an existing Worker route must run before the domain; PathMX emits the exact
|
|
31
|
-
`docs.example.com/*` route so it outranks broader wildcard routes in that zone.
|
|
32
|
-
|
|
33
|
-
For a sibling source checkout, keep both packages local and override peer
|
|
34
|
-
resolution until they are published:
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@pathmx/cloudflare": "file:../minipathmx/pathmx/cloudflare",
|
|
40
|
-
"pathmx": "file:../minipathmx/pathmx/core"
|
|
41
|
-
},
|
|
42
|
-
"overrides": {
|
|
43
|
-
"pathmx": "file:../minipathmx/pathmx/core"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
40
|
+
## Publish
|
|
41
|
+
|
|
42
|
+
Stage and validate without deploying:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
bun run pmx cloudflare publish
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
deployment is the only command that mutates Cloudflare state.
|
|
48
|
+
Preview the work without writing the managed stage:
|
|
50
49
|
|
|
51
50
|
```sh
|
|
52
|
-
pmx cloudflare publish
|
|
53
|
-
pmx cloudflare publish --dry-run
|
|
54
|
-
pmx cloudflare publish --deploy
|
|
51
|
+
bun run pmx cloudflare publish --dry-run
|
|
55
52
|
```
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
Deploy after validation succeeds:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
bun run pmx cloudflare publish --deploy
|
|
58
|
+
```
|