@package-broker/cloudflare 0.10.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 ADDED
@@ -0,0 +1,95 @@
1
+ # @package-broker/cloudflare
2
+
3
+ CLI tool for deploying PACKAGE.broker to Cloudflare Workers with one command. Supports both interactive and CI/CD modes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @package-broker/cloudflare @package-broker/main
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Interactive Mode (Default)
14
+
15
+ ```bash
16
+ npx package-broker-cloudflare init
17
+ ```
18
+
19
+ The CLI will:
20
+ - Prompt for tier selection (free/paid)
21
+ - Prompt for worker name
22
+ - Generate encryption key
23
+ - Create Cloudflare resources (D1, KV, R2, Queue if paid)
24
+ - Set encryption key as Cloudflare secret
25
+ - Generate `wrangler.toml` with all IDs populated
26
+ - Copy migration files
27
+ - Optionally deploy the Worker
28
+
29
+ ### CI/CD Mode
30
+
31
+ For non-interactive deployment in GitHub Actions or other CI environments:
32
+
33
+ ```bash
34
+ npx package-broker-cloudflare deploy --ci --json \
35
+ --worker-name my-worker \
36
+ --tier free \
37
+ --domain app.example.com
38
+ ```
39
+
40
+ **Required Environment Variables** (CI mode):
41
+ - `CLOUDFLARE_API_TOKEN` - Cloudflare API token with required permissions
42
+ - `CLOUDFLARE_ACCOUNT_ID` - Your Cloudflare account ID
43
+ - `ENCRYPTION_KEY` - Base64-encoded encryption key
44
+
45
+ **Optional Environment Variables**:
46
+ - `WORKER_NAME` - Worker name (overrides `--worker-name` flag)
47
+ - `CLOUDFLARE_TIER` - `free` or `paid` (overrides `--tier` flag)
48
+ - `DOMAIN` - Custom domain (overrides `--domain` flag)
49
+ - `SKIP_UI_BUILD` - Set to `true` to skip UI build step
50
+ - `SKIP_MIGRATIONS` - Set to `true` to skip migration application
51
+
52
+ **Flags**:
53
+ - `--ci` - Enable CI mode (non-interactive, no prompts)
54
+ - `--json` - Output JSON result for machine parsing
55
+ - `--worker-name <name>` - Worker name
56
+ - `--tier <free|paid>` - Cloudflare tier
57
+ - `--domain <domain>` - Custom domain (e.g., `app.example.com`)
58
+ - `--skip-ui-build` - Skip UI build step
59
+ - `--skip-migrations` - Skip migration application
60
+
61
+ **JSON Output** (when using `--json`):
62
+ ```json
63
+ {
64
+ "worker_url": "https://my-worker.workers.dev",
65
+ "database_id": "abc123...",
66
+ "kv_namespace_id": "def456...",
67
+ "r2_bucket_name": "my-worker-artifacts",
68
+ "queue_name": "my-worker-queue"
69
+ }
70
+ ```
71
+
72
+ ## Features
73
+
74
+ - **Interactive setup**: Guided prompts for configuration
75
+ - **CI/CD mode**: Non-interactive deployment with JSON output for automation
76
+ - **Idempotent**: Safe to re-run if resources already exist
77
+ - **Automatic resource creation**: D1, KV, R2, and Queue (paid tier)
78
+ - **Secret management**: Encryption key set as Cloudflare secret (not in wrangler.toml)
79
+ - **Migration handling**: Automatically copies and applies migrations
80
+ - **Tier-aware**: Different configuration for free vs paid tiers
81
+ - **Wrangler version pinning**: Enforces `wrangler@^4.54.0` as dependency
82
+
83
+ ## Requirements
84
+
85
+ - Node.js 18+
86
+ - Cloudflare account
87
+ - Authenticated with `wrangler login` (interactive mode) or `CLOUDFLARE_API_TOKEN` environment variable (CI mode)
88
+
89
+ ## See Also
90
+
91
+ - [Quickstart Guide](../../../docs/docs/getting-started/quickstart-cloudflare.md)
92
+ - [GitHub Template Repository](https://github.com/package-broker/cloudflare-template) (alternative deployment method)
93
+ - [GitHub Action](https://github.com/package-broker/cloudflare-deploy-action) (uses this CLI in CI mode)
94
+
95
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}