@flaredev/cli 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flaredev/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The flare command-line tool: create, generate, migrate, and deploy Flare apps",
5
5
  "license": "MIT",
6
6
  "author": "Muke Johnbaptist",
@@ -40,7 +40,7 @@
40
40
  "jiti": "^2.7.0",
41
41
  "jsonc-parser": "^3.3.1",
42
42
  "picocolors": "^1.1.1",
43
- "@flaredev/core": "0.1.0"
43
+ "@flaredev/core": "0.1.1"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=22"
@@ -1,9 +1,12 @@
1
1
  # __APP_NAME__
2
2
 
3
- A [Flare](https://github.com/) app running on Cloudflare Workers via vinext.
3
+ A [Flare](https://flare-docs.codetotech.com) app running on Cloudflare Workers via vinext.
4
4
 
5
5
  ```bash
6
- __PM__ run dev # start the dev server
7
- __PM__ run build # production build
8
- __PM__ run deploy # build and deploy to Cloudflare Workers
6
+ __PM__ run dev # start the dev server
7
+ npx flare dev --tunnel # ...and share it on a public https://*.trycloudflare.com URL
8
+ __PM__ run build # production build
9
+ __PM__ run deploy # build and deploy to Cloudflare Workers
9
10
  ```
11
+
12
+ Docs: https://flare-docs.codetotech.com
@@ -1,44 +1,45 @@
1
- import { env, waitUntil } from "cloudflare:workers";
2
- import { betterAuth } from "better-auth";
3
- import { drizzleAdapter } from "@better-auth/drizzle-adapter";
4
- import { nextCookies } from "better-auth/next-js";
5
- import { admin } from "better-auth/plugins/admin";
6
- import { hashPassword, verifyPassword } from "@flaredev/core";
7
- import { getDb, schema } from "@/db";
8
-
9
- /** Optional: set when serving from a custom domain (e.g. https://example.com). */
10
- const configuredURL = (env as { BETTER_AUTH_URL?: string }).BETTER_AUTH_URL;
11
-
12
- export const auth = betterAuth({
13
- appName: "__APP_NAME__",
14
- secret: env.BETTER_AUTH_SECRET,
15
- // Without BETTER_AUTH_URL, accept local dev on any port and this app's workers.dev
16
- // host. Cloudflare only routes hosts this Worker serves, so the allowlist can't be spoofed.
17
- baseURL: configuredURL || {
18
- allowedHosts: ["localhost:*", "127.0.0.1:*", "__APP_NAME__.*.workers.dev"],
19
- },
20
- database: drizzleAdapter(getDb(), { provider: "sqlite", schema }),
21
- socialProviders: __SOCIAL_PROVIDERS__,
22
- emailAndPassword: {
23
- enabled: true,
24
- // PBKDF2 via WebCrypto: the default scrypt exceeds Workers CPU limits.
25
- password: { hash: hashPassword, verify: verifyPassword },
26
- },
27
- advanced: {
28
- // Let emails and other deferred work finish after the response is sent.
29
- backgroundTasks: { handler: waitUntil },
30
- },
31
- plugins: [
32
- // Adds user.role (default "user") and admin APIs. The /admin area allows ADMIN_ROLES (lib/admin.ts).
33
- admin({ defaultRole: "user", adminRoles: ["admin"] }),
34
- // Must stay last: lets server actions set auth cookies.
35
- nextCookies(),
36
- ],
37
- });
38
-
39
- export type Session = typeof auth.$Infer.Session;
40
-
41
- /** OAuth providers with credentials configured, e.g. ["github"]. */
42
- export function enabledSocialProviders(): string[] {
43
- return Object.keys(auth.options.socialProviders ?? {});
44
- }
1
+ import { env, waitUntil } from "cloudflare:workers";
2
+ import { betterAuth } from "better-auth";
3
+ import { drizzleAdapter } from "@better-auth/drizzle-adapter";
4
+ import { nextCookies } from "better-auth/next-js";
5
+ import { admin } from "better-auth/plugins/admin";
6
+ import { hashPassword, verifyPassword } from "@flaredev/core";
7
+ import { getDb, schema } from "@/db";
8
+
9
+ /** Optional: set when serving from a custom domain (e.g. https://example.com). */
10
+ const configuredURL = (env as { BETTER_AUTH_URL?: string }).BETTER_AUTH_URL;
11
+
12
+ export const auth = betterAuth({
13
+ appName: "__APP_NAME__",
14
+ secret: env.BETTER_AUTH_SECRET,
15
+ // Without BETTER_AUTH_URL, accept local dev on any port, a `flare dev --tunnel` URL and
16
+ // this app's workers.dev host. Cloudflare only routes hosts this Worker serves, so a
17
+ // deployed app never sees a trycloudflare.com host and the allowlist can't be spoofed.
18
+ baseURL: configuredURL || {
19
+ allowedHosts: ["localhost:*", "127.0.0.1:*", "*.trycloudflare.com", "__APP_NAME__.*.workers.dev"],
20
+ },
21
+ database: drizzleAdapter(getDb(), { provider: "sqlite", schema }),
22
+ socialProviders: __SOCIAL_PROVIDERS__,
23
+ emailAndPassword: {
24
+ enabled: true,
25
+ // PBKDF2 via WebCrypto: the default scrypt exceeds Workers CPU limits.
26
+ password: { hash: hashPassword, verify: verifyPassword },
27
+ },
28
+ advanced: {
29
+ // Let emails and other deferred work finish after the response is sent.
30
+ backgroundTasks: { handler: waitUntil },
31
+ },
32
+ plugins: [
33
+ // Adds user.role (default "user") and admin APIs. The /admin area allows ADMIN_ROLES (lib/admin.ts).
34
+ admin({ defaultRole: "user", adminRoles: ["admin"] }),
35
+ // Must stay last: lets server actions set auth cookies.
36
+ nextCookies(),
37
+ ],
38
+ });
39
+
40
+ export type Session = typeof auth.$Infer.Session;
41
+
42
+ /** OAuth providers with credentials configured, e.g. ["github"]. */
43
+ export function enabledSocialProviders(): string[] {
44
+ return Object.keys(auth.options.socialProviders ?? {});
45
+ }
@@ -1,27 +1,29 @@
1
- import { defineConfig } from "vite";
2
- import vinext from "vinext";
3
- import { cloudflare } from "@cloudflare/vite-plugin";
4
- import { kvDataAdapter } from "@vinext/cloudflare/cache/kv-data-adapter";
5
-
6
- export default defineConfig({
7
- plugins: [
8
- vinext({
9
- cache: {
10
- // Data cache (`cached()`, fetch, "use cache") in Workers KV, shared by every colo.
11
- // Entries live a day unless a tag revalidates them first; a colo may reuse its own
12
- // copy for a minute after a write elsewhere.
13
- data: kvDataAdapter({ ttlSeconds: 86_400, entryCacheTtlSeconds: 60 }),
14
- // No `cdn` adapter yet. vinext's Workers Cache adapter (cdnAdapter) is experimental
15
- // in the 1.0 beta: behind it, any page that redirects fails with "Too many
16
- // redirects", and nothing is cached without an experimental two-stage deploy.
17
- // See "Caching" in the Flare docs before turning it on.
18
- },
19
- }),
20
- cloudflare({
21
- viteEnvironment: {
22
- name: "rsc",
23
- childEnvironments: ["ssr"],
24
- },
25
- }),
26
- ],
27
- });
1
+ import { defineConfig } from "vite";
2
+ import vinext from "vinext";
3
+ import { cloudflare } from "@cloudflare/vite-plugin";
4
+ import { kvDataAdapter } from "@vinext/cloudflare/cache/kv-data-adapter";
5
+
6
+ export default defineConfig({
7
+ // `flare dev --tunnel` serves the dev server on a https://*.trycloudflare.com URL.
8
+ server: { allowedHosts: [".trycloudflare.com"] },
9
+ plugins: [
10
+ vinext({
11
+ cache: {
12
+ // Data cache (`cached()`, fetch, "use cache") in Workers KV, shared by every colo.
13
+ // Entries live a day unless a tag revalidates them first; a colo may reuse its own
14
+ // copy for a minute after a write elsewhere.
15
+ data: kvDataAdapter({ ttlSeconds: 86_400, entryCacheTtlSeconds: 60 }),
16
+ // No `cdn` adapter yet. vinext's Workers Cache adapter (cdnAdapter) is experimental
17
+ // in the 1.0 beta: behind it, any page that redirects fails with "Too many
18
+ // redirects", and nothing is cached without an experimental two-stage deploy.
19
+ // See "Caching" in the Flare docs before turning it on.
20
+ },
21
+ }),
22
+ cloudflare({
23
+ viteEnvironment: {
24
+ name: "rsc",
25
+ childEnvironments: ["ssr"],
26
+ },
27
+ }),
28
+ ],
29
+ });