cf-workers-native 0.1.3 → 0.1.4
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 +65 -41
- package/native/android/build.gradle +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -4,25 +4,45 @@
|
|
|
4
4
|
|
|
5
5
|
Reach people who prefer the browser and people who look for apps in the store. Offer a mobile app alongside your web app, so your users can choose the platform that works for them.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Your web app can have a mobile version
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
- **Create a new mobile app**
|
|
14
|
-
Use Capacitor to build an iOS and Android app for distribution through the App Store and Google Play. [Capacitor guide](docs/integration.md).
|
|
9
|
+
If you have a web app running on Cloudflare Workers, you can add an iOS and Android
|
|
10
|
+
app built around its existing pages and backend. For example, a Void app with
|
|
11
|
+
D1-backed forms can keep its loaders, actions and database on Workers while the
|
|
12
|
+
mobile app displays its pages and bundles its public JavaScript and CSS.
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
cf-workers-native connects your Workers application to a mobile app built with
|
|
15
|
+
Capacitor. Capacitor supplies the iOS and Android projects and access to native
|
|
16
|
+
plugins. You add a separate mobile build and test your application's flows; you
|
|
17
|
+
keep developing and deploying your web app to Cloudflare.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
**Start here: [Add a mobile version to your existing app](docs/integration.md).**
|
|
20
|
+
You do not need an existing native app. The guide takes you from choosing your
|
|
21
|
+
Worker entry to running your pages on a simulator or emulator.
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
- **Give your app a mobile home.** Create an iOS and Android app with Capacitor, or bring your Workers pages into a native app you already have.
|
|
22
|
-
- **Keep your backend on Workers.** D1, server secrets and cloud-dependent logic stay on the deployed Worker. The separate mobile build leaves your Cloudflare deployment inputs unchanged.
|
|
23
|
-
- **Choose what runs on the device.** Start with the default network execution. Where supported, explicitly select public routes for local execution and bundle client assets with the app.
|
|
23
|
+
## See an example close to your app
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
| What you have | What to try | What the example demonstrates |
|
|
26
|
+
| --------------------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------- |
|
|
27
|
+
| HTML pages served by a Worker | [Hono / Express pages](demo/rendering/README.md) | Page navigation, forms and redirects inside a mobile app. |
|
|
28
|
+
| A Void React Pages app using D1 | [Void + D1 sample](demo/void/README.md) | Server-rendered pages, React interaction and a form that writes to D1. |
|
|
29
|
+
| A Next.js app deployed through OpenNext | [OpenNext sample](demo/opennext/README.md) | Connecting generated pages and assets to a mobile build; see its version and feature limits. |
|
|
30
|
+
|
|
31
|
+
These are examples and test fixtures, not customer deployment stories. Each guide
|
|
32
|
+
states what has been verified. Start with the flow closest to yours, then try it
|
|
33
|
+
with your own app.
|
|
34
|
+
|
|
35
|
+
## What stays, what you add
|
|
36
|
+
|
|
37
|
+
- **Keep your pages and backend.** Reuse supported HTML, links, forms and client interactions. D1, server secrets and cloud-dependent logic stay on Workers.
|
|
38
|
+
- **Add a mobile build.** Connect your Worker and public assets to a Capacitor app with its own name and application ID.
|
|
39
|
+
- **Check the mobile experience.** Verify login, navigation, data changes, reopening and connection recovery in your application.
|
|
40
|
+
- **Prepare for distribution.** Configure signing and store information through the native application workflow. Store submission and review remain separate steps.
|
|
41
|
+
|
|
42
|
+
Start with requests running on your existing deployed Worker. Cloud-backed pages
|
|
43
|
+
need a connection. Bundled client assets do not make them offline applications.
|
|
44
|
+
Optional local execution is covered by the [execution guide](docs/cloudflare-bindings.md#choosing-execution)
|
|
45
|
+
and [compatibility limits](docs/compatibility.md).
|
|
26
46
|
|
|
27
47
|
## Start from your framework
|
|
28
48
|
|
|
@@ -35,47 +55,51 @@ Local execution has [compatibility limits](docs/compatibility.md). Cloud-backed
|
|
|
35
55
|
|
|
36
56
|
Each guide describes its tested versions and boundaries. Already have a separate frontend calling Worker APIs? Keep that frontend and use the [Fetch-only integration](docs/runtime.md#fetch-only-integration).
|
|
37
57
|
|
|
38
|
-
##
|
|
58
|
+
## Try it with your app
|
|
39
59
|
|
|
40
|
-
|
|
60
|
+
You need the application's source, its Worker build and a test Worker URL for
|
|
61
|
+
cloud-backed flows. Running iOS requires macOS and Xcode; Android requires the
|
|
62
|
+
Android development tools. The [setup guide](docs/integration.md#before-you-start)
|
|
63
|
+
links the platform prerequisites.
|
|
41
64
|
|
|
42
|
-
|
|
65
|
+
Install the package in your web project, then follow the
|
|
66
|
+
[complete mobile setup](docs/integration.md#workflow):
|
|
43
67
|
|
|
44
68
|
```sh
|
|
45
|
-
npm install --save-exact cf-workers-native@0.1.
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
The mobile entry selects the host. For example, an iOS web entry starts with:
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
import { workersIOS } from "cf-workers-native/ios";
|
|
52
|
-
|
|
53
|
-
const app = workersIOS({
|
|
54
|
-
baseURL: "https://your-worker.example.com/",
|
|
55
|
-
render: "/",
|
|
56
|
-
});
|
|
57
|
-
await app.ready;
|
|
69
|
+
npm install --save-exact cf-workers-native@0.1.4
|
|
58
70
|
```
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
Installation alone does not generate a mobile project. The guide covers adding
|
|
73
|
+
Capacitor, configuring the mobile build, and running it on iOS or Android. Your
|
|
74
|
+
first milestone is one existing page, a link to another page, and a working form
|
|
75
|
+
or data action on a simulator or emulator.
|
|
63
76
|
|
|
64
|
-
**All 0.x releases are Preview releases
|
|
77
|
+
**All 0.x releases are Preview releases**, including those on npm's `latest` tag.
|
|
78
|
+
APIs may change. Use your app's actual flows to evaluate the fit before distribution.
|
|
79
|
+
Upgrading from `workers-capacitor`? Follow the [migration steps](docs/integration.md#migrating-from-the-old-npm-package).
|
|
65
80
|
|
|
66
81
|
## Build with your AI assistant
|
|
67
82
|
|
|
68
|
-
Open your application repository and give your assistant this prompt
|
|
83
|
+
Open your application repository and give your assistant this prompt:
|
|
69
84
|
|
|
70
85
|
```text
|
|
71
|
-
Read https://github.com/rdlabo-dev/cf-workers-native/blob/main/
|
|
72
|
-
and
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
Read https://github.com/rdlabo-dev/cf-workers-native/blob/main/docs/integration.md.
|
|
87
|
+
Add an iOS and Android version of this Workers web app using cf-workers-native@0.1.4
|
|
88
|
+
and Capacitor. Preserve the existing pages, backend and Cloudflare deployment configuration.
|
|
89
|
+
Use an existing test Worker for cloud-backed requests; ask before any cloud deployment.
|
|
90
|
+
Start by verifying one page, navigation and a form or data action on a simulator/emulator.
|
|
91
|
+
Then verify the app's authentication and main user flow, and report remaining limits.
|
|
77
92
|
```
|
|
78
93
|
|
|
94
|
+
Provide your app name, application ID and test Worker URL if you have them.
|
|
95
|
+
|
|
96
|
+
## Already have a native app?
|
|
97
|
+
|
|
98
|
+
Embed a Workers-powered screen in your existing [UIKit / SwiftUI app](docs/native-embedding.md#ios)
|
|
99
|
+
or [Android app](docs/native-embedding.md#android). These integrations use the
|
|
100
|
+
native SDKs and a shared web build. Follow the [dependency setup](docs/native-embedding.md#dependency-setup)
|
|
101
|
+
for the matching npm, SwiftPM and Maven versions and Android WebView requirements.
|
|
102
|
+
|
|
79
103
|
## Make it ready for your users
|
|
80
104
|
|
|
81
105
|
Follow a real flow from launch to sign-out: load a page, navigate, submit a form, reopen the app and check what happens when the network is unavailable. Keep secrets on the Worker and enforce authentication and authorization there. The [integration checklist](docs/integration.md#6-verify-the-existing-application-in-capacitor) and [native embedding checks](docs/native-embedding.md#verification) explain what to verify.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cf-workers-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Bring Cloudflare Workers apps to iOS and Android.",
|
|
6
6
|
"repository": {
|
|
@@ -100,7 +100,8 @@
|
|
|
100
100
|
"format": "prettier --write .",
|
|
101
101
|
"format:check": "prettier --check .",
|
|
102
102
|
"prepack": "npm run build",
|
|
103
|
-
"release:prepare": "node scripts/prepare-local-release.mjs"
|
|
103
|
+
"release:prepare": "node scripts/prepare-local-release.mjs",
|
|
104
|
+
"release": "np --no-tests --no-publish --branch main"
|
|
104
105
|
},
|
|
105
106
|
"dependencies": {
|
|
106
107
|
"@babel/core": "^8.0.7",
|
|
@@ -125,6 +126,7 @@
|
|
|
125
126
|
"@playwright/test": "^1.64.1",
|
|
126
127
|
"@types/node": "^26.6.5",
|
|
127
128
|
"hono": "^4.13.13",
|
|
129
|
+
"np": "^12.1.1",
|
|
128
130
|
"prettier": "3.8.4",
|
|
129
131
|
"typescript": "^7.0.2",
|
|
130
132
|
"vite": "^7.3.7",
|