devflare 1.0.0-next.14 → 1.0.0-next.16
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/LLM.md +9360 -1784
- package/README.md +391 -32
- package/bin/devflare.js +17 -7
- package/dist/account-0w8wdzjv.js +475 -0
- package/dist/account-eygq6qx7.js +475 -0
- package/dist/account-fw8nafav.js +475 -0
- package/dist/account-pzq69nys.js +475 -0
- package/dist/account-s66jb15j.js +475 -0
- package/dist/api-d6ekexs5.js +25 -0
- package/dist/bridge/index.d.ts +1 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/protocol.d.ts +1 -1
- package/dist/bridge/protocol.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +0 -4
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/serialization.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +1 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/browser-shim/handler.d.ts +1 -1
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser.d.ts +1651 -34
- package/dist/browser.d.ts.map +1 -1
- package/dist/build-1kmkwqgh.js +53 -0
- package/dist/build-506kjhcm.js +53 -0
- package/dist/build-66866ahs.js +53 -0
- package/dist/build-g1adm3ww.js +53 -0
- package/dist/build-p3r3117t.js +53 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +24 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +0 -1
- package/dist/bundler/worker-bundler.d.ts.map +1 -1
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +1 -1
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +27 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +44 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +2 -1
- package/dist/cli/config-path.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/preview-bindings.d.ts +42 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +11 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +4 -0
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +57 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/kv-namespace.d.ts +3 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +61 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/tokens.d.ts +18 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +122 -5
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/compiler.d.ts +4 -0
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +5 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/preview-resources.d.ts +77 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +31 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +0 -22
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +1 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resource-resolution.d.ts +60 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +693 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +1341 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +64 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +230 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema.d.ts +640 -3669
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config-entry.d.ts +5 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-fjwke42y.js +59 -0
- package/dist/config-hwdqjse7.js +59 -0
- package/dist/config-pxvewrhv.js +59 -0
- package/dist/config-q0g5qdga.js +59 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/deploy-7nmzc9r8.js +609 -0
- package/dist/deploy-csfhdr64.js +691 -0
- package/dist/deploy-ex4g5avz.js +621 -0
- package/dist/deploy-jnb0bhka.js +609 -0
- package/dist/deploy-tp0g6qdp.js +609 -0
- package/dist/deploy-ykpcjkc2.js +690 -0
- package/dist/{dev-c1xc1gq9.js → dev-2pd33m28.js} +392 -348
- package/dist/dev-7ef5e2j1.js +2409 -0
- package/dist/dev-8nssqatr.js +2409 -0
- package/dist/dev-grznx8fn.js +2409 -0
- package/dist/dev-server/d1-migrations.d.ts +14 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +8 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +14 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +1 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +11 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/{doctor-z4ffybce.js → doctor-04ammrrh.js} +67 -31
- package/dist/doctor-fmjj65mc.js +245 -0
- package/dist/doctor-fzkznce1.js +245 -0
- package/dist/doctor-sa5xv1bz.js +245 -0
- package/dist/index-091sh1ma.js +1229 -0
- package/dist/index-0apbm26n.js +788 -0
- package/dist/index-0eqksag4.js +418 -0
- package/dist/{index-dr6sbp8d.js → index-0kfzdywd.js} +15 -2
- package/dist/index-0w826dsr.js +379 -0
- package/dist/{index-rfhx0yd5.js → index-11m5a8wd.js} +110 -32
- package/dist/{index-xxwbb2nt.js → index-1sp39f2f.js} +114 -58
- package/dist/index-2jnrqbny.js +1301 -0
- package/dist/index-2pb7b9mw.js +378 -0
- package/dist/{index-0kzg8wed.js → index-2x53aqjm.js} +1071 -890
- package/dist/index-3ke5d2vn.js +1229 -0
- package/dist/index-43dq8yx8.js +788 -0
- package/dist/index-4rrttqj5.js +378 -0
- package/dist/index-4v9bc2pc.js +1367 -0
- package/dist/index-61jsjnsv.js +280 -0
- package/dist/index-6jef5emv.js +176 -0
- package/dist/index-6psz1h4c.js +788 -0
- package/dist/index-72mve6vh.js +168 -0
- package/dist/{index-zbvmtcn2.js → index-74198nxd.js} +179 -77
- package/dist/index-7g8zyws4.js +192 -0
- package/dist/index-7kcxjhta.js +456 -0
- package/dist/index-7v583xan.js +418 -0
- package/dist/index-7x0ybbtx.js +133 -0
- package/dist/index-816krz9p.js +52 -0
- package/dist/index-82f1z98k.js +41 -0
- package/dist/index-8t5nb4qx.js +133 -0
- package/dist/index-9az6s7ad.js +52 -0
- package/dist/{index-59df49vn.js → index-9ba1etyz.js} +29 -51
- package/dist/{index-001mw014.js → index-9fbtk7gv.js} +134 -248
- package/dist/index-9n6djthj.js +490 -0
- package/dist/index-aabgympv.js +39 -0
- package/dist/index-b8m6883k.js +74 -0
- package/dist/{index-5yxg30va.js → index-cgbvmse6.js} +15 -6
- package/dist/index-d8etnfef.js +1229 -0
- package/dist/index-e9yw4d6y.js +133 -0
- package/dist/index-epw1jxz5.js +1204 -0
- package/dist/index-f85s8gj3.js +2649 -0
- package/dist/index-fe2ngvh7.js +1229 -0
- package/dist/index-fvsadj32.js +192 -0
- package/dist/index-gs4y9gdf.js +456 -0
- package/dist/{index-fef08w43.js → index-h18pxvzs.js} +7 -6
- package/dist/index-hfj1a2c4.js +2649 -0
- package/dist/{index-8gtqgb3q.js → index-hjy8ctpc.js} +14 -92
- package/dist/index-htzf0py1.js +1204 -0
- package/dist/index-j185x270.js +897 -0
- package/dist/index-jb75kwa4.js +519 -0
- package/dist/index-jwd8pcb2.js +897 -0
- package/dist/index-k29yjhv0.js +52 -0
- package/dist/index-k6vq6kkt.js +456 -0
- package/dist/{index-vky23txa.js → index-m3fmw6mx.js} +2 -2
- package/dist/index-maxpsfk8.js +402 -0
- package/dist/index-mbdmrner.js +402 -0
- package/dist/index-mea5bc45.js +418 -0
- package/dist/index-mqekt778.js +185 -0
- package/dist/index-na3mnm1k.js +74 -0
- package/dist/index-p03n4qet.js +1367 -0
- package/dist/index-p296ban8.js +191 -0
- package/dist/index-pnbs1b8k.js +280 -0
- package/dist/index-q4kaz181.js +1207 -0
- package/dist/index-ry131z23.js +378 -0
- package/dist/index-sgb7c8nm.js +402 -0
- package/dist/index-sqrksgb2.js +133 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/{index-v8vvsn9x.js → index-t08te69w.js} +1 -18
- package/dist/index-thna1tkd.js +280 -0
- package/dist/index-v5nmqthy.js +74 -0
- package/dist/{index-n932ytmq.js → index-vt4yxkmf.js} +2 -2
- package/dist/index-wyq6c6yj.js +402 -0
- package/dist/index-wztc9stx.js +418 -0
- package/dist/index-x9cwdxw5.js +456 -0
- package/dist/index-xk9djfjp.js +519 -0
- package/dist/index-yc0gcchc.js +418 -0
- package/dist/index-yqbxjysa.js +897 -0
- package/dist/index-yzddwp02.js +788 -0
- package/dist/index-zfhq6s96.js +74 -0
- package/dist/index-zt22fe2j.js +54 -0
- package/dist/index-zyt5byt6.js +2649 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/{init-na2atvz2.js → init-r4hnxan3.js} +24 -17
- package/dist/login-2hnz4m4n.js +77 -0
- package/dist/login-5bsxxpvc.js +77 -0
- package/dist/login-6tzvczw2.js +77 -0
- package/dist/login-bhaw72zc.js +77 -0
- package/dist/login-x8tgckqm.js +77 -0
- package/dist/previews-3rn8mz2c.js +1168 -0
- package/dist/previews-d487qde5.js +1200 -0
- package/dist/previews-gm3z0syj.js +1168 -0
- package/dist/previews-j9ymq4ys.js +1169 -0
- package/dist/previews-q031mx34.js +1168 -0
- package/dist/productions-120xg0aq.js +505 -0
- package/dist/productions-5ev5qweg.js +505 -0
- package/dist/productions-me3tdvr9.js +505 -0
- package/dist/productions-p5rbgp2f.js +505 -0
- package/dist/productions-x9p0pym1.js +505 -0
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +6 -267
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +3 -3
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/middleware.d.ts +8 -38
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/src/browser.js +23 -14
- package/dist/src/cli/index.js +3 -1
- package/dist/src/cloudflare/index.js +49 -2
- package/dist/src/config-entry.js +14 -0
- package/dist/src/index.js +33 -20
- package/dist/src/runtime/index.js +3 -9
- package/dist/src/sveltekit/index.js +10 -7
- package/dist/src/test/index.js +16 -18
- package/dist/src/vite/index.js +7 -4
- package/dist/sveltekit/platform.d.ts +1 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/cf.d.ts +10 -10
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +1 -6
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +0 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +1 -23
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/token-kedhcret.js +419 -0
- package/dist/token-m8jmnjwk.js +419 -0
- package/dist/{types-sffr9681.js → types-0sqwkp7x.js} +244 -139
- package/dist/types-1gwr2ex6.js +572 -0
- package/dist/types-6e5yx6km.js +572 -0
- package/dist/types-p0gckpn6.js +572 -0
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/vite/config-file.d.ts.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-0srh2jfr.js +513 -0
- package/dist/worker-4xrfd10a.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts +0 -7
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/surface-paths.d.ts +15 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-qtam8grz.js +513 -0
- package/dist/worker-qzm0b7br.js +513 -0
- package/dist/worker-y9ha6g44.js +513 -0
- package/package.json +17 -10
- package/R2.md +0 -200
- package/dist/account-8psavtg6.js +0 -420
- package/dist/build-n639efmn.js +0 -101
- package/dist/deploy-zvnq6xh7.js +0 -117
- package/dist/index-2q3pmzrx.js +0 -90
- package/dist/index-f4q0jbnj.js +0 -195
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-wyf3s77s.js +0 -343
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -22,20 +22,30 @@ For the deeper public contract, caveats, and current feature boundaries, see [`L
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Monorepo contributor workflow
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
When you are working on `packages/devflare` inside this monorepo, use the repo-root Turbo scripts instead of assembling ad-hoc commands by hand:
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
bun
|
|
31
|
-
|
|
29
|
+
- `bun run devflare:dev`
|
|
30
|
+
- `bun run devflare:test:watch`
|
|
31
|
+
- `bun run devflare:build`
|
|
32
|
+
- `bun run devflare:typecheck`
|
|
33
|
+
- `bun run devflare:test`
|
|
34
|
+
- `bun run devflare:types`
|
|
35
|
+
- `bun run devflare:check`
|
|
36
|
+
- `bun run devflare:ci`
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
These scripts intentionally keep the default shared lane focused on the parts of the workspace that are currently stable in local development and CI. In particular, the shared test lane excludes `@devflare/case5-multi-worker`, and the shared check lane stays centered on `apps/documentation` because `cases/case18` still expects Cloudflare-backed resource resolution outside the default contributor workflow.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
For a worker-only project, the smallest install is just Devflare:
|
|
34
45
|
|
|
35
46
|
```bash
|
|
36
|
-
bun add -d devflare
|
|
47
|
+
bun add -d devflare vite @cloudflare/vite-plugin
|
|
37
48
|
```
|
|
38
|
-
|
|
39
49
|
A local `vite.config.*` opts that package into Vite-backed flows. Without one, Devflare stays in worker-only mode.
|
|
40
50
|
|
|
41
51
|
---
|
|
@@ -46,7 +56,7 @@ A local `vite.config.*` opts that package into Vite-backed flows. Without one, D
|
|
|
46
56
|
|
|
47
57
|
```ts
|
|
48
58
|
// devflare.config.ts
|
|
49
|
-
import { defineConfig } from 'devflare'
|
|
59
|
+
import { defineConfig } from 'devflare/config'
|
|
50
60
|
|
|
51
61
|
export default defineConfig({
|
|
52
62
|
name: 'hello-worker',
|
|
@@ -57,30 +67,22 @@ export default defineConfig({
|
|
|
57
67
|
})
|
|
58
68
|
```
|
|
59
69
|
|
|
70
|
+
Use `devflare/config` for config files so Bun only loads the lightweight config helpers instead of the full Node-side Devflare barrel.
|
|
71
|
+
|
|
60
72
|
### 2. Add a fetch handler
|
|
61
73
|
|
|
62
74
|
```ts
|
|
63
75
|
// src/fetch.ts
|
|
64
76
|
import type { FetchEvent } from 'devflare/runtime'
|
|
65
77
|
|
|
66
|
-
export async function fetch({
|
|
67
|
-
const url = new URL(request.url)
|
|
78
|
+
export async function fetch({ url }: FetchEvent): Promise<Response> {
|
|
68
79
|
return new Response(
|
|
69
|
-
url.pathname === '/'
|
|
70
|
-
? 'Hello from Devflare'
|
|
71
80
|
: `Hello from Devflare: ${url.pathname}`
|
|
72
81
|
)
|
|
73
82
|
}
|
|
74
83
|
```
|
|
75
84
|
|
|
76
85
|
### 3. Generate types
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
bunx --bun devflare types
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
This generates `env.d.ts` so bindings, secrets, and discovered entrypoints stay typed.
|
|
83
|
-
|
|
84
86
|
### 4. Start development
|
|
85
87
|
|
|
86
88
|
```bash
|
|
@@ -193,8 +195,8 @@ async function corsHandle(event: FetchEvent, resolve: ResolveFetch): Promise<Res
|
|
|
193
195
|
return next
|
|
194
196
|
}
|
|
195
197
|
|
|
196
|
-
async function appFetch({
|
|
197
|
-
return Response.json({ path:
|
|
198
|
+
async function appFetch({ url }: FetchEvent): Promise<Response> {
|
|
199
|
+
return Response.json({ path: url.pathname })
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
export const handle = sequence(corsHandle, appFetch)
|
|
@@ -299,6 +301,7 @@ The most important top-level keys are:
|
|
|
299
301
|
- `accountId`
|
|
300
302
|
- `compatibilityDate`
|
|
301
303
|
- `compatibilityFlags`
|
|
304
|
+
- `previews`
|
|
302
305
|
- `files`
|
|
303
306
|
- `bindings`
|
|
304
307
|
- `triggers`
|
|
@@ -322,13 +325,14 @@ Keep these separate:
|
|
|
322
325
|
- `vars` are **string-valued config bindings** that compile into generated Wrangler config
|
|
323
326
|
- `secrets` are **declarations of expected runtime secret bindings**
|
|
324
327
|
|
|
325
|
-
`loadConfig()`
|
|
328
|
+
`loadConfig()` loads the nearest workspace-root `.env` before evaluating `devflare.config.*`.
|
|
326
329
|
|
|
327
|
-
When
|
|
330
|
+
When Devflare finds an ancestor `package.json` with `workspaces`, it uses that directory's `.env` file as the shared config-time source for nested packages. If no workspace root is found, it falls back to the nearest ancestor `.env`. Explicit process env values still win over `.env` entries.
|
|
328
331
|
|
|
329
332
|
Important boundary:
|
|
330
333
|
|
|
331
|
-
- `.env
|
|
334
|
+
- `.env` is treated as a config/build-time input for `devflare.config.*` evaluation
|
|
335
|
+
- Devflare does **not** currently provide first-class semantics for `.env.dev` or `.env.<name>`
|
|
332
336
|
- Devflare does **not** currently provide a first-class `.dev.vars*` loader for worker-only dev mode or `createTestContext()`
|
|
333
337
|
- example files like `.env.example` and `.dev.vars.example` are a team convention, not a Devflare feature
|
|
334
338
|
|
|
@@ -336,6 +340,7 @@ Practical convention:
|
|
|
336
340
|
|
|
337
341
|
- use `.env.example` for config-time/build-time variables read from `process.env`
|
|
338
342
|
- use `.dev.vars.example` only if your project intentionally relies on upstream `.dev.vars` local-runtime workflows
|
|
343
|
+
- keep non-secret infrastructure names such as R2 bucket names and D1 database names in `devflare.config.*`, not in `secrets` or ad-hoc CI env vars
|
|
339
344
|
|
|
340
345
|
### `config.env`
|
|
341
346
|
|
|
@@ -343,6 +348,72 @@ Practical convention:
|
|
|
343
348
|
|
|
344
349
|
When you select `--env name`, Devflare merges `config.env[name]` into the base config before compiling.
|
|
345
350
|
|
|
351
|
+
### D1 by name and resolved config reuse
|
|
352
|
+
|
|
353
|
+
`bindings.d1` accepts three shapes:
|
|
354
|
+
|
|
355
|
+
- `'database-name'`
|
|
356
|
+
- `{ id: 'database-id' }`
|
|
357
|
+
- `{ name: 'database-name' }`
|
|
358
|
+
|
|
359
|
+
String shorthand is the stable-name form, so `'database-name'` is equivalent to `{ name: 'database-name' }`.
|
|
360
|
+
|
|
361
|
+
Use string shorthand or `{ name }` when you want `devflare.config.*` to stay the source of truth for stable D1 naming.
|
|
362
|
+
|
|
363
|
+
- local dev and tests normalize string and `{ name }` bindings into a stable local identifier, so you do **not** need Cloudflare auth just to run locally
|
|
364
|
+
- `build`, `deploy`, `devflare/vite`, and `devflare config print` resolve string and `{ name }` bindings into a real Cloudflare D1 database id before they emit Wrangler-facing config
|
|
365
|
+
- `compileConfig()` can only emit Wrangler `d1_databases` from concrete ids, so Node-side automation should call `loadResolvedConfig()` or `resolveConfigResources()` first
|
|
366
|
+
|
|
367
|
+
That means stable names stay in config, while opaque Cloudflare ids are resolved only for the flows that actually need them.
|
|
368
|
+
|
|
369
|
+
If you want to inspect or reuse those resolved values in automation, use either:
|
|
370
|
+
|
|
371
|
+
- `bunx --bun devflare config print --json`
|
|
372
|
+
- `bunx --bun devflare config print --json --format wrangler`
|
|
373
|
+
- `loadResolvedConfig()` from Node-side tooling
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
import { loadResolvedConfig } from 'devflare'
|
|
377
|
+
|
|
378
|
+
const config = await loadResolvedConfig({
|
|
379
|
+
cwd: process.cwd(),
|
|
380
|
+
environment: 'production'
|
|
381
|
+
})
|
|
382
|
+
|
|
383
|
+
console.log(config.bindings?.r2?.ASSETS)
|
|
384
|
+
console.log(config.bindings?.d1?.DB)
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
If you need Cloudflare account/resource data while computing config, use an async config with `devflare/cloudflare` helpers:
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
import { defineConfig } from 'devflare/config'
|
|
391
|
+
import { account } from 'devflare/cloudflare'
|
|
392
|
+
|
|
393
|
+
export default defineConfig(async () => {
|
|
394
|
+
const primary = await account.getPrimaryAccount()
|
|
395
|
+
const buckets = await account.r2(primary.id)
|
|
396
|
+
|
|
397
|
+
if (!buckets.some((bucket) => bucket.name === 'app-assets')) {
|
|
398
|
+
throw new Error('Missing R2 bucket "app-assets" in the selected Cloudflare account')
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return {
|
|
402
|
+
accountId: primary.id,
|
|
403
|
+
name: 'app-worker',
|
|
404
|
+
compatibilityDate: '2026-03-17',
|
|
405
|
+
bindings: {
|
|
406
|
+
d1: {
|
|
407
|
+
DB: { name: 'app-db' }
|
|
408
|
+
},
|
|
409
|
+
r2: {
|
|
410
|
+
ASSETS: 'app-assets'
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
})
|
|
415
|
+
```
|
|
416
|
+
|
|
346
417
|
### Native config vs Wrangler coverage
|
|
347
418
|
|
|
348
419
|
Devflare natively models the Worker config it actively composes around:
|
|
@@ -404,10 +475,33 @@ Devflare natively models:
|
|
|
404
475
|
- KV, D1, R2, Durable Objects, queues, and the core test/runtime flow are the strongest surfaces
|
|
405
476
|
- AI and Vectorize are remote-oriented bindings
|
|
406
477
|
- named service entrypoints are modeled at the Devflare layer, but validate generated deployment output if they are critical to your app
|
|
478
|
+
- browser bindings use a named-map authoring shape such as `browser: { BROWSER: 'browser' }`, but current compile/deploy flows allow exactly one browser binding because Wrangler only supports one
|
|
407
479
|
- `sendEmail` is modeled through config compilation, generated env types, and local runtime/test flows
|
|
408
480
|
- R2 bindings are real in local dev/test/runtime flows, but Devflare does **not** publish a stable browser-facing local bucket URL contract; browser-visible local asset flows should go through your Worker routes
|
|
409
481
|
|
|
410
|
-
For R2 delivery strategy guidance,
|
|
482
|
+
For R2 delivery strategy guidance, use the `R2 uploads & delivery` page in the documentation site.
|
|
483
|
+
|
|
484
|
+
For D1 and Hyperdrive, prefer stable config names when you can:
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
export default {
|
|
488
|
+
bindings: {
|
|
489
|
+
d1: {
|
|
490
|
+
DB: { name: 'app-db' },
|
|
491
|
+
AUDIT: { id: 'existing-d1-id' }
|
|
492
|
+
},
|
|
493
|
+
hyperdrive: {
|
|
494
|
+
DB: 'app-postgres',
|
|
495
|
+
ANALYTICS_DB: { id: 'existing-hyperdrive-id' }
|
|
496
|
+
},
|
|
497
|
+
r2: {
|
|
498
|
+
ASSETS: 'app-assets'
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Use `.env*` and `secrets` for values that are actually secret or genuinely process-specific. Do **not** move stable bucket/database/Hyperdrive names into env vars just to make other tooling happy.
|
|
411
505
|
|
|
412
506
|
---
|
|
413
507
|
|
|
@@ -444,7 +538,226 @@ Short version:
|
|
|
444
538
|
- in worker-only mode, Devflare now bundles the composed main worker to `.devflare/worker-entrypoints/main.js` via Rolldown before handing it to Miniflare or Wrangler
|
|
445
539
|
- Rolldown still rebuilds Durable Object worker code in unified Vite dev flows where Vite hosts the outer app
|
|
446
540
|
|
|
447
|
-
For the full contract-level explanation and a concrete Rolldown + Svelte example, see [`LLM.md`](./LLM.md).
|
|
541
|
+
For the full contract-level explanation and a concrete Rolldown + Svelte example, see the generated [`LLM.md`](./LLM.md) handbook entries for workflow modes and Svelte in workers.
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## Deploys, previews, tokens, and GitHub Actions
|
|
546
|
+
|
|
547
|
+
### Production deploys vs same-Worker previews
|
|
548
|
+
|
|
549
|
+
`devflare deploy` publishes production the usual Wrangler way.
|
|
550
|
+
|
|
551
|
+
`devflare deploy --preview` is different: it uploads a **new version of the same Worker** with `wrangler versions upload` instead of creating a separate Worker environment.
|
|
552
|
+
|
|
553
|
+
Named preview deploys are now the primary preview model:
|
|
554
|
+
|
|
555
|
+
- each preview scope deploys its own dedicated Worker (or Worker family)
|
|
556
|
+
- preview-scoped bindings and resources can be assigned only to that scope
|
|
557
|
+
- feature branches and PRs get stable preview URLs from the scope name itself
|
|
558
|
+
|
|
559
|
+
Preview scope names should still be lowercase and dash-friendly so they map cleanly into Worker names and `workers.dev` URLs.
|
|
560
|
+
|
|
561
|
+
Useful preview examples:
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
bunx --bun devflare deploy --preview next
|
|
565
|
+
bunx --bun devflare deploy --preview pr-42
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
When available, Devflare prints the Worker version id and preview URL outputs after the deploy finishes.
|
|
569
|
+
|
|
570
|
+
### Login and preview scope helpers
|
|
571
|
+
|
|
572
|
+
`devflare login` is the thin authentication wrapper for Cloudflare.
|
|
573
|
+
|
|
574
|
+
- by default it reuses existing auth when Devflare can already resolve a Cloudflare API token
|
|
575
|
+
- `devflare login --force` opens `wrangler login` again even when auth is already present
|
|
576
|
+
- after login, Devflare prints the primary account when Cloudflare account discovery succeeds
|
|
577
|
+
|
|
578
|
+
`devflare previews` is the config-aware preview-scope surface for dedicated preview Workers.
|
|
579
|
+
|
|
580
|
+
Useful commands:
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
bunx --bun devflare previews
|
|
584
|
+
bunx --bun devflare previews bindings --scope next
|
|
585
|
+
bunx --bun devflare previews cleanup --scope next --apply
|
|
586
|
+
bunx --bun devflare previews cleanup --all --apply
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
Current behavior:
|
|
590
|
+
|
|
591
|
+
- `devflare previews` lists stable workers plus discovered dedicated preview scopes for the current worker family using live Cloudflare Worker names
|
|
592
|
+
- `devflare previews bindings` resolves preview-scoped resources for one scope and shows how many deployed workers reference them
|
|
593
|
+
- `devflare previews cleanup` deletes dedicated preview Workers plus preview-scoped KV, D1, R2, Queue, Vectorize, and reusable Hyperdrive resources for one scope or every discovered scope; it is a dry run unless `--apply` is present
|
|
594
|
+
- `devflare deploy` still performs best-effort internal preview metadata synchronization after successful deploys so cleanup flows can remove deleted preview workers cleanly without extra CI glue
|
|
595
|
+
|
|
596
|
+
### Manage Devflare tokens
|
|
597
|
+
|
|
598
|
+
`devflare tokens <bootstrap-token>` manages Devflare-owned account API tokens using a bootstrap token that already has Cloudflare API-token-management permission.
|
|
599
|
+
|
|
600
|
+
The command:
|
|
601
|
+
|
|
602
|
+
- resolves the effective account id from `--account`, workspace preference, or the bootstrap token's primary account
|
|
603
|
+
- normalizes managed token names to the `devflare-` prefix, so `preview` becomes `devflare-preview` while `devflare-preview` stays unchanged
|
|
604
|
+
- `--new [token-name]` prompts for a token name when it is omitted, then creates a new Devflare-managed account-owned token from the curated Devflare permission set
|
|
605
|
+
- `--new [token-name] --all-flags` uses every reusable account-scoped permission group visible to the bootstrap token except `Account API Tokens*`, because Cloudflare does not allow sub-tokens to inherit token-management permission and account-owned tokens skip incompatible zone/user-scoped groups automatically
|
|
606
|
+
- `--list` lists only the Devflare-managed tokens in the selected account
|
|
607
|
+
- `--delete [token-name]` deletes the matching Devflare-managed token after normalizing the name to the `devflare-` prefix
|
|
608
|
+
- `--delete-all` deletes every Devflare-managed token in the selected account while leaving non-Devflare account tokens untouched
|
|
609
|
+
- prints a new token value once, because Cloudflare only returns the secret a single time
|
|
610
|
+
|
|
611
|
+
Examples:
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
bunx --bun devflare tokens <bootstrap-token> --new preview
|
|
615
|
+
bunx --bun devflare tokens <bootstrap-token> --new preview --all-flags
|
|
616
|
+
bunx --bun devflare tokens <bootstrap-token> --list
|
|
617
|
+
bunx --bun devflare tokens <bootstrap-token> --delete preview
|
|
618
|
+
bunx --bun devflare tokens <bootstrap-token> --delete-all
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### Thin GitHub Action and caller workflows
|
|
622
|
+
|
|
623
|
+
The repo ships a reusable composite action at [`.github/actions/devflare-deploy`](../../.github/actions/devflare-deploy).
|
|
624
|
+
|
|
625
|
+
The repo also ships a shared workspace setup action at [`.github/actions/devflare-setup-workspace`](../../.github/actions/devflare-setup-workspace) so one workflow job can install dependencies once and then deploy multiple preview targets from the same checkout.
|
|
626
|
+
|
|
627
|
+
The repo also ships a GitHub-feedback action at [`.github/actions/devflare-github-feedback`](../../.github/actions/devflare-github-feedback) for publishing deployment results back into GitHub.
|
|
628
|
+
|
|
629
|
+
The action stays intentionally thin:
|
|
630
|
+
|
|
631
|
+
- the caller workflow owns the runner, triggers, permissions, and environments
|
|
632
|
+
- Cloudflare credentials must be passed in explicitly
|
|
633
|
+
- by default, the action asks `devflare deploy` to verify Cloudflare control-plane state before the step is considered successful
|
|
634
|
+
- the caller workflow should pass a deterministic `preview-scope`, such as the branch name or `pr-<number>`, for stable dedicated preview Worker naming across PR, push, and manual workflows
|
|
635
|
+
|
|
636
|
+
The reporting split is also intentional:
|
|
637
|
+
|
|
638
|
+
- GitHub PR feedback should use a stable PR comment because PRs are issue-backed conversations
|
|
639
|
+
- GitHub branch feedback should use Deployments + deployment statuses because GitHub does not provide first-class branch comments
|
|
640
|
+
- one preview workflow can publish both branch deployment feedback and the shared PR comment in the same run when a pushed branch already belongs to an open pull request
|
|
641
|
+
|
|
642
|
+
Current action inputs that matter most:
|
|
643
|
+
|
|
644
|
+
- `working-directory`
|
|
645
|
+
- `environment`
|
|
646
|
+
- `production`
|
|
647
|
+
- `preview-scope`
|
|
648
|
+
- `skip-setup`
|
|
649
|
+
- `skip-install`
|
|
650
|
+
- `verify-deployment` (defaults to `true`)
|
|
651
|
+
- `cloudflare-api-token`
|
|
652
|
+
- `cloudflare-account-id`
|
|
653
|
+
|
|
654
|
+
When `verify-deployment` is enabled, the action fails if Devflare cannot confirm the uploaded version in Cloudflare, or for non-preview deploys, cannot confirm that a live deployment now references that version.
|
|
655
|
+
|
|
656
|
+
Action outputs:
|
|
657
|
+
|
|
658
|
+
- `preview-url`
|
|
659
|
+
- `version-id`
|
|
660
|
+
- `status`
|
|
661
|
+
- `exit-code`
|
|
662
|
+
- `log-excerpt`
|
|
663
|
+
|
|
664
|
+
Those extra outputs are especially useful when the caller workflow uses `continue-on-error: true` on the deploy step so it can still post a failure comment or deployment status before failing the job.
|
|
665
|
+
|
|
666
|
+
Minimal preview step:
|
|
667
|
+
|
|
668
|
+
```yaml
|
|
669
|
+
- id: deploy
|
|
670
|
+
uses: ./.github/actions/devflare-deploy
|
|
671
|
+
with:
|
|
672
|
+
working-directory: apps/documentation
|
|
673
|
+
preview-scope: ${{ github.head_ref || github.ref_name }}
|
|
674
|
+
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
675
|
+
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
This repository now keeps preview delivery in one shared workflow plus one production workflow:
|
|
679
|
+
|
|
680
|
+
- [`.github/workflows/preview.yml`](../../.github/workflows/preview.yml) handles documentation + testing previews, push + PR lifecycle triggers, branch + PR targets, and cleanup flows from one place
|
|
681
|
+
- [`.github/workflows/documentation-production.yml`](../../.github/workflows/documentation-production.yml) handles production deploys from the repository default branch plus GitHub deployment statuses
|
|
682
|
+
- [`.github/workflow-examples/branch-preview-cleanup.example.yml`](../../.github/workflow-examples/branch-preview-cleanup.example.yml) remains as a copyable delete-triggered preview-scope cleanup template for downstream repos that want a smaller starting point
|
|
683
|
+
|
|
684
|
+
The live workflows now rely on the deploy action's control-plane verification for deploy success.
|
|
685
|
+
|
|
686
|
+
If you want other feedback modes in your own repo, the supported patterns are:
|
|
687
|
+
|
|
688
|
+
- PR-only preview feedback: `mode: comment`
|
|
689
|
+
- branch-only preview feedback: `mode: deployment`
|
|
690
|
+
- combined branch deployment + PR comment feedback: either `mode: both` with `resolve-pr-from-ref: 'true'`, or separate deployment/comment steps inside one shared preview workflow when you want finer control over grouped PR comments
|
|
691
|
+
|
|
692
|
+
Repository-specific runtime checks still exist where they are testing app
|
|
693
|
+
behavior rather than deploy success. For example,
|
|
694
|
+
[`preview.yml`](../../.github/workflows/preview.yml)
|
|
695
|
+
deploys testing previews for both branch and PR scopes from one prepared job
|
|
696
|
+
when a pushed branch already belongs to an open pull request, while still
|
|
697
|
+
keeping its deployed-binding verification because it is validating runtime
|
|
698
|
+
bindings and deployment-channel wiring rather than merely asking whether
|
|
699
|
+
Cloudflare accepted the upload.
|
|
700
|
+
|
|
701
|
+
For branch-scoped real preview deploys such as `apps/testing`, Devflare now
|
|
702
|
+
automatically omits shared queue consumers from the deployed Wrangler config,
|
|
703
|
+
and it omits cron triggers by default, when it detects the branch-preview
|
|
704
|
+
strategy (`--env preview` plus branch scope, without `--preview`). That keeps
|
|
705
|
+
previews from colliding on singleton Cloudflare resources while leaving the
|
|
706
|
+
authoring config itself fully exhaustive for local dev, tests, and production
|
|
707
|
+
deploys.
|
|
708
|
+
|
|
709
|
+
If a branch-scoped preview really should keep its cron schedule, opt in with:
|
|
710
|
+
|
|
711
|
+
```ts
|
|
712
|
+
export default defineConfig({
|
|
713
|
+
previews: {
|
|
714
|
+
includeCrons: true
|
|
715
|
+
}
|
|
716
|
+
})
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
If those previews also need preview-owned Cloudflare resources, use
|
|
720
|
+
`preview.scope()` in the config authoring layer:
|
|
721
|
+
|
|
722
|
+
```ts
|
|
723
|
+
import { defineConfig, preview } from 'devflare/config'
|
|
724
|
+
|
|
725
|
+
const pv = preview.scope()
|
|
726
|
+
|
|
727
|
+
export default defineConfig({
|
|
728
|
+
bindings: {
|
|
729
|
+
kv: {
|
|
730
|
+
CACHE: pv('my-cache-kv')
|
|
731
|
+
},
|
|
732
|
+
r2: {
|
|
733
|
+
ASSETS: pv('my-assets-bucket')
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
})
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
Devflare resolves those opaque markers to base names outside preview
|
|
740
|
+
environments, and to preview-scoped names such as `my-cache-kv-preview` (or a
|
|
741
|
+
branch-derived suffix when `DEVFLARE_PREVIEW_BRANCH`, `DEVFLARE_PREVIEW_PR`, or
|
|
742
|
+
`DEVFLARE_PREVIEW_IDENTIFIER` is present) for preview resolution and deploys.
|
|
743
|
+
During `devflare deploy --env preview`, Devflare also provisions missing
|
|
744
|
+
preview-scoped KV, D1, R2, Queue, and Vectorize resources automatically before
|
|
745
|
+
the Wrangler deploy runs. Preview-scoped Hyperdrive names are reused when the
|
|
746
|
+
matching preview config already exists, and otherwise Devflare falls back to the
|
|
747
|
+
base Hyperdrive config because Cloudflare does not expose stored Hyperdrive
|
|
748
|
+
credentials for cloning preview configs automatically. Use
|
|
749
|
+
`devflare previews cleanup --env preview --apply` during PR-close or
|
|
750
|
+
branch-delete cleanup to delete the preview-owned resources again.
|
|
751
|
+
Service bindings created through `ref()` still follow the referenced worker
|
|
752
|
+
names, so branch-scoped worker naming remains the way to isolate preview
|
|
753
|
+
service bindings.
|
|
754
|
+
|
|
755
|
+
---
|
|
756
|
+
|
|
757
|
+
## Repo examples
|
|
758
|
+
|
|
759
|
+
- [`apps/documentation/`](../../apps/documentation/) is the executable SvelteKit example for dev, build, preview deploys, production deploys, workflow automation, and browser validation
|
|
760
|
+
- [`apps/testing/`](../../apps/testing/) is the exhaustive binding-matrix example for the config contract itself, including `preview.scope()`-driven preview resource names, production overrides where bindings differ by deployment channel, and a tiny `src/fetch.ts` smoke Worker exercised by repository integration tests through `devflare/test`
|
|
448
761
|
|
|
449
762
|
---
|
|
450
763
|
|
|
@@ -484,26 +797,66 @@ It also auto-detects conventional `src/fetch.ts`, `src/queue.ts`, `src/scheduled
|
|
|
484
797
|
|
|
485
798
|
## CLI
|
|
486
799
|
|
|
800
|
+
Every top-level command supports `--help`, and nested command groups support both:
|
|
801
|
+
|
|
802
|
+
- `bunx --bun devflare <command> --help`
|
|
803
|
+
- `bunx --bun devflare <command> <subcommand> --help`
|
|
804
|
+
- `bunx --bun devflare help <command> [subcommand]`
|
|
805
|
+
|
|
487
806
|
| Command | What it does |
|
|
488
807
|
|---|---|
|
|
489
808
|
| `devflare init` | scaffold a project using `src/fetch.ts` and explicit `files.fetch` |
|
|
490
809
|
| `devflare dev` | start the worker-only dev server, enabling Vite only when the current package has a local `vite.config.*` |
|
|
491
|
-
| `devflare build` | resolve config, generate
|
|
492
|
-
| `devflare deploy` | build and deploy with Wrangler |
|
|
810
|
+
| `devflare build` | resolve config, generate Devflare/Wrangler build artifacts, and run `vite build` only for Vite-backed packages |
|
|
811
|
+
| `devflare deploy` | build and deploy with Wrangler, including same-Worker preview uploads via `--preview` |
|
|
493
812
|
| `devflare types` | generate `env.d.ts` |
|
|
494
|
-
| `devflare doctor` | check project configuration
|
|
813
|
+
| `devflare doctor` | check project configuration plus generated artifact locations such as `.devflare/wrangler.jsonc`, `.devflare/build/wrangler.jsonc`, and `.wrangler/deploy/config.json` |
|
|
814
|
+
| `devflare config` | print resolved Devflare config or resolved Wrangler JSON |
|
|
495
815
|
| `devflare account` | inspect accounts, resources, usage, and limits |
|
|
816
|
+
| `devflare login` | authenticate with Cloudflare via Wrangler, reusing existing auth unless `--force` is passed |
|
|
817
|
+
| `devflare previews` | inspect and clean dedicated preview Workers plus preview-owned scope resources |
|
|
818
|
+
| `devflare productions` | inspect live production Workers, list recent versions, roll back, or delete a live Worker script |
|
|
819
|
+
| `devflare worker` | run Worker control-plane actions such as remote renaming and local config sync |
|
|
820
|
+
| `devflare tokens` | create, list, and delete Devflare-managed account-owned tokens from a bootstrap token with API-token-management permission |
|
|
821
|
+
| `devflare help` | print the command overview or the detailed help page for a command path |
|
|
822
|
+
| `devflare version` | print the installed Devflare version |
|
|
496
823
|
| `devflare ai` | show Workers AI model pricing info |
|
|
497
824
|
| `devflare remote` | manage remote test mode |
|
|
498
825
|
|
|
826
|
+
Command defaults:
|
|
827
|
+
|
|
828
|
+
- `devflare config` defaults to `devflare config print`
|
|
829
|
+
- `devflare previews` defaults to `devflare previews list`
|
|
830
|
+
- `devflare productions` defaults to `devflare productions list`
|
|
831
|
+
|
|
832
|
+
### Command groups
|
|
833
|
+
|
|
834
|
+
| Group | Subcommands / operations |
|
|
835
|
+
|---|---|
|
|
836
|
+
| `account` | `info`, `workers`, `kv`, `d1`, `r2`, `vectorize`, `usage`, `limits`, `limits set`, `limits enable`, `limits disable`, `global`, `workspace` |
|
|
837
|
+
| `config` | `print` |
|
|
838
|
+
| `previews` | `list`, `bindings`, `cleanup` |
|
|
839
|
+
| `productions` | `list`, `versions`, `rollback`, `delete` |
|
|
840
|
+
| `remote` | `status`, `enable`, `disable` |
|
|
841
|
+
| `worker` | `rename` |
|
|
842
|
+
| `tokens` | `--list`, `--new`, `--roll`, `--delete`, `--delete-all` (flag-driven operations rather than subcommands) |
|
|
843
|
+
|
|
499
844
|
Useful flags:
|
|
500
845
|
|
|
501
846
|
- `build --env <name>`
|
|
502
847
|
- `deploy --env <name>`
|
|
503
848
|
- `deploy --dry-run`
|
|
849
|
+
- `deploy --preview <name>`
|
|
850
|
+
- `login --force`
|
|
851
|
+
- `previews`
|
|
852
|
+
- `previews cleanup --scope <name> --apply`
|
|
853
|
+
- `config print --json`
|
|
854
|
+
- `config print --format wrangler`
|
|
504
855
|
- `types --output <path>`
|
|
505
856
|
- `doctor --config <path>`
|
|
506
857
|
- `account --account <id>`
|
|
858
|
+
- `tokens <bootstrap-token> --new [name]`
|
|
859
|
+
- `tokens <bootstrap-token> --list`
|
|
507
860
|
|
|
508
861
|
Recommended invocation style:
|
|
509
862
|
|
|
@@ -511,6 +864,8 @@ Recommended invocation style:
|
|
|
511
864
|
bunx --bun devflare dev
|
|
512
865
|
bunx --bun devflare types
|
|
513
866
|
bunx --bun devflare build
|
|
867
|
+
bunx --bun devflare help account limits set
|
|
868
|
+
bunx --bun devflare previews cleanup --help
|
|
514
869
|
```
|
|
515
870
|
|
|
516
871
|
---
|
|
@@ -519,9 +874,13 @@ bunx --bun devflare build
|
|
|
519
874
|
|
|
520
875
|
Treat these as generated output, not source of truth:
|
|
521
876
|
|
|
522
|
-
- `.devflare
|
|
877
|
+
- `.devflare/wrangler.jsonc`
|
|
878
|
+
- `.devflare/build/wrangler.jsonc`
|
|
879
|
+
- `.devflare/worker-entrypoints/main.ts`
|
|
880
|
+
- `.devflare/worker-entrypoints/main.js`
|
|
881
|
+
- `.devflare/vite.config.mjs`
|
|
882
|
+
- `.wrangler/deploy/config.json`
|
|
523
883
|
- `env.d.ts`
|
|
524
|
-
- generated `wrangler.jsonc`
|
|
525
884
|
|
|
526
885
|
The source of truth is still:
|
|
527
886
|
|
package/bin/devflare.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
+
const currentDir = dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
const sourceCliEntryPath = resolve(currentDir, '../src/cli/index.ts')
|
|
8
|
+
const distCliEntryPath = resolve(currentDir, '../dist/src/cli/index.js')
|
|
9
|
+
const cliEntryPath = existsSync(sourceCliEntryPath)
|
|
10
|
+
? sourceCliEntryPath
|
|
11
|
+
: distCliEntryPath
|
|
12
|
+
|
|
13
|
+
const { runCli } = await import(pathToFileURL(cliEntryPath).href)
|
|
14
|
+
|
|
15
|
+
const args = process.argv.slice(2)
|
|
6
16
|
|
|
7
17
|
runCli(args)
|
|
8
18
|
.then((result) => {
|
|
9
|
-
process.exit(result.exitCode)
|
|
19
|
+
process.exit(result.exitCode)
|
|
10
20
|
})
|
|
11
21
|
.catch((error) => {
|
|
12
|
-
console.error(
|
|
13
|
-
process.exit(1)
|
|
14
|
-
})
|
|
22
|
+
console.error('CLI error:', error)
|
|
23
|
+
process.exit(1)
|
|
24
|
+
})
|