everyapp 0.2.1 → 0.2.2
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 +12 -12
- package/dist/bash-complete.js +1 -1
- package/dist/{chunk-JXZGJYRJ.js → chunk-7BOQJFI5.js} +1 -1
- package/dist/{chunk-PMLXP26K.js → chunk-7YVJFS4A.js} +1 -1
- package/dist/{chunk-7OLTQZZZ.js → chunk-DLGPLHBH.js} +1 -1
- package/dist/{chunk-4YDNA5LP.js → chunk-FD6K2YA7.js} +1 -1
- package/dist/{chunk-AEQXMWNU.js → chunk-GAJEQYJH.js} +1 -1
- package/dist/{chunk-3TJKOYE5.js → chunk-O2KDOP5R.js} +1 -1
- package/dist/{chunk-SGRMXPI7.js → chunk-OI2MBGBG.js} +1 -1
- package/dist/{chunk-HSYSKQ25.js → chunk-POSDLD3G.js} +7 -7
- package/dist/{chunk-E2N6VUZY.js → chunk-RB5D2R45.js} +1 -1
- package/dist/{chunk-YPYDHMNH.js → chunk-U4LIQ5VR.js} +1 -1
- package/dist/{chunk-GSP5Y7U6.js → chunk-VP6SKW44.js} +1 -1
- package/dist/{chunk-UHLZLYQP.js → chunk-XTO2VTPY.js} +1 -1
- package/dist/{create-KOQ2DWKU.js → create-DYQ3NBWJ.js} +1 -1
- package/dist/{deploy-YV2RWODJ.js → deploy-PYTCMDGV.js} +1 -1
- package/dist/{deploy-RFR6W22M.js → deploy-RMAHOA4Z.js} +1 -1
- package/dist/{dev-FPQWEHYM.js → dev-SAE237FS.js} +0 -0
- package/dist/index.js +1 -1
- package/dist/{login-ZFFQASKS.js → login-B6EF3SMX.js} +1 -1
- package/dist/{logout-AEE4AZ5D.js → logout-XMKZBLNV.js} +1 -1
- package/dist/{remoteD1Shell-CGFP46AW.js → remoteD1Shell-A67JMO3H.js} +1 -1
- package/dist/{setupLocal-PC6YBN2X.js → setupLocal-TZJUW5ES.js} +1 -1
- package/gateway/every-app-gateway-build.tar.gz +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,11 +5,8 @@ CLI for [Every App](https://everyapp.dev) - deploy and manage self-hosted apps o
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
# Run directly with npx
|
|
9
|
-
npx everyapp <command>
|
|
10
|
-
|
|
11
|
-
# Or install globally
|
|
12
|
-
npm install -g everyapp
|
|
8
|
+
# Run the latest CLI directly with npx
|
|
9
|
+
npx -y everyapp@latest <command>
|
|
13
10
|
```
|
|
14
11
|
|
|
15
12
|
## Commands
|
|
@@ -19,7 +16,7 @@ npm install -g everyapp
|
|
|
19
16
|
Deploy the Every App Gateway to your Cloudflare account:
|
|
20
17
|
|
|
21
18
|
```bash
|
|
22
|
-
npx everyapp gateway deploy
|
|
19
|
+
npx -y everyapp@latest gateway deploy
|
|
23
20
|
```
|
|
24
21
|
|
|
25
22
|
### Create a new app
|
|
@@ -27,10 +24,11 @@ npx everyapp gateway deploy
|
|
|
27
24
|
Create a new app from the starter template:
|
|
28
25
|
|
|
29
26
|
```bash
|
|
30
|
-
npx everyapp app create [name]
|
|
27
|
+
npx -y everyapp@latest app create [name]
|
|
31
28
|
```
|
|
32
29
|
|
|
33
30
|
This will:
|
|
31
|
+
|
|
34
32
|
1. Prompt for an app ID (or use the provided name)
|
|
35
33
|
2. Deploy to Cloudflare (D1 database, KV namespace, Worker)
|
|
36
34
|
3. Configure wrangler.jsonc, package.json, and .env files
|
|
@@ -41,7 +39,7 @@ This will:
|
|
|
41
39
|
Deploy your app to Cloudflare:
|
|
42
40
|
|
|
43
41
|
```bash
|
|
44
|
-
npx everyapp app deploy
|
|
42
|
+
npx -y everyapp@latest app deploy
|
|
45
43
|
```
|
|
46
44
|
|
|
47
45
|
Run this from your app directory to build and deploy updates.
|
|
@@ -51,10 +49,11 @@ Run this from your app directory to build and deploy updates.
|
|
|
51
49
|
Set up local development for an existing Every App app (for example, after cloning a repo):
|
|
52
50
|
|
|
53
51
|
```bash
|
|
54
|
-
npx everyapp app setup-local
|
|
52
|
+
npx -y everyapp@latest app setup-local
|
|
55
53
|
```
|
|
56
54
|
|
|
57
55
|
This will:
|
|
56
|
+
|
|
58
57
|
1. Verify Cloudflare and gateway setup
|
|
59
58
|
2. Install dependencies
|
|
60
59
|
3. Create or refresh `.env.local`
|
|
@@ -65,16 +64,17 @@ This will:
|
|
|
65
64
|
Run commands with access to your production D1 database:
|
|
66
65
|
|
|
67
66
|
```bash
|
|
68
|
-
npx everyapp app remote-d1-shell -- <command>
|
|
67
|
+
npx -y everyapp@latest app remote-d1-shell -- <command>
|
|
69
68
|
```
|
|
70
69
|
|
|
71
70
|
Examples:
|
|
71
|
+
|
|
72
72
|
```bash
|
|
73
73
|
# Run migrations
|
|
74
|
-
npx everyapp app remote-d1-shell -- npx drizzle-kit migrate
|
|
74
|
+
npx -y everyapp@latest app remote-d1-shell -- npx drizzle-kit migrate
|
|
75
75
|
|
|
76
76
|
# Open Drizzle Studio
|
|
77
|
-
npx everyapp app remote-d1-shell -- npx drizzle-kit studio
|
|
77
|
+
npx -y everyapp@latest app remote-d1-shell -- npx drizzle-kit studio
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
## Documentation
|
package/dist/bash-complete.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as o,b as s}from"./chunk-
|
|
2
|
+
import{a as o,b as s}from"./chunk-POSDLD3G.js";import"./chunk-RB5D2R45.js";import"./chunk-YJ2DKIZS.js";import{proposeCompletions as r}from"@stricli/core";var t=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&t.push("");await r(s,t,o(process));try{for(let{completion:p}of await r(s,t,o(process)))process.stdout.write(`${p}
|
|
3
3
|
`)}catch{}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as l,d as m,e as f,m as g,n as w,o as y}from"./chunk-
|
|
1
|
+
import{c as l,d as m,e as f,m as g,n as w,o as y}from"./chunk-DLGPLHBH.js";import{c as d}from"./chunk-U4LIQ5VR.js";import{c as h,d as k}from"./chunk-WO3NE7ZU.js";import I from"enquirer";import p from"chalk";async function x(){if(process.env.CLOUDFLARE_API_TOKEN){let r=process.env.CLOUDFLARE_ACCOUNT_ID;return r?f(r):(console.log(p.yellow(`
|
|
2
2
|
CLOUDFLARE_ACCOUNT_ID is required when using CLOUDFLARE_API_TOKEN
|
|
3
3
|
`)),d(1))}let e=await g(),{account:t,otherAccounts:o}=await y(e);return w(t,o),{id:t.account.id,name:t.account.name}}async function C(e="this",t=!1){let o=await x();if(process.env.CLOUDFLARE_API_TOKEN&&(console.log(p.dim(` ${o.name} (${o.id})`)),console.log()),t)return console.log(p.dim(`Skipping deployment confirmation due to -y flag.
|
|
4
4
|
`)),!0;let{confirm:r}=await I.prompt({type:"confirm",name:"confirm",message:`Do you want to deploy ${e} to ${o.name}?`,initial:!1});return r}function v({domain:e,accountId:t,mode:o,hostname:r}){let n=t?`https://dash.cloudflare.com/${t}/${e}/dns/records`:`https://dash.cloudflare.com -> ${e} -> DNS`,i=r??`todo.${e}`,s=o==="app-blocking"?[`Each app you deploy will live at [app].${e} - this app at`,`${i} - but that address does not resolve yet. To support`,"this, you must add the DNS record below:"]:[`Each app you deploy will live at [app].${e} - for example`,`todo.${e}. To support this, you must add the DNS record`,"below (the login this CLI uses isn't allowed to add it for you):"],a=o==="app-blocking"?["After DNS propagates, re-run everyapp app deploy.","If you know DNS is ready and this check is blocked locally, re-run with --skip-dns-check."]:["Continuing the deploy - once you add that record, apps at",`*.${e} will work properly. You only do this once.`];return["",...s,"",` Add record at: ${n}`," Type: CNAME"," Name: *",` Target: ${e}`," Proxy: ON (orange cloud)","","Here are the docs explaining how this works:"," https://developers.cloudflare.com/workers/configuration/routing/routes/"," https://github.com/cloudflare/workers-sdk/issues/5568","",...a,""].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as i,d,g as D}from"./chunk-
|
|
1
|
+
import{b as i,d,g as D}from"./chunk-DLGPLHBH.js";import{f}from"./chunk-WO3NE7ZU.js";import{execa as A}from"execa";async function E(s){let{config:t}=await f(s);if(!t.d1_databases||t.d1_databases.length===0)throw new Error("No D1 databases found in everyapp.config.ts. Please add a D1 resource declaration.");let a=t.d1_databases[0];if(!a)throw new Error("No D1 database configuration found.");let e=a.database_name;if(!e)throw new Error("No database_name found in generated D1 database configuration.");let[n,r]=await Promise.all([d(),i()]),o=(await D(n)).find(u=>u.name===e);if(!o)throw new Error(`Database "${e}" not found in your Cloudflare account. Have you run deployment to create the database?`);return{CLOUDFLARE_ACCOUNT_ID:n,CLOUDFLARE_DATABASE_ID:o.uuid,CLOUDFLARE_API_TOKEN:r}}async function O(s,t,a){let{cwd:e,env:n={},verbose:r=!1}=a,c=a.d1DatabaseId?{CLOUDFLARE_ACCOUNT_ID:await d(),CLOUDFLARE_DATABASE_ID:a.d1DatabaseId,CLOUDFLARE_API_TOKEN:await i()}:await E(e),o={cwd:e,stdio:r?"inherit":"pipe",env:{...process.env,...n,...c}};await A(s,t,o)}export{E as a,O as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as y}from"./chunk-
|
|
1
|
+
import{c as y}from"./chunk-U4LIQ5VR.js";import R from"node:fs/promises";import g from"node:path";import _ from"node:os";import*as A from"smol-toml";import c from"chalk";var l=class extends Error{status;codes;endpoint;constructor({message:t,status:n,codes:r,endpoint:o}){super(t),this.name="CloudflareAPIError",this.status=n,this.codes=r,this.endpoint=o}};function C(e){return e instanceof l&&(e.status===401||e.status===403||e.codes.includes(1e4))}function x(){let e=_.homedir(),t=_.platform(),n;return t==="win32"?n=g.join(process.env.LOCALAPPDATA||g.join(e,"AppData","Local"),".wrangler"):t==="darwin"?n=g.join(e,"Library","Preferences",".wrangler"):n=g.join(e,".wrangler"),g.join(n,"config","default.toml")}async function B(){let e=x();try{let t=await R.readFile(e,"utf-8"),n=A.parse(t);if(!n.oauth_token||!n.refresh_token)throw new Error("OAuth tokens not found in wrangler config");return n}catch(t){throw t.code==="ENOENT"?new Error("Wrangler config not found. Please run 'npx wrangler login' first."):t}}async function F(e){let t=x(),n=g.dirname(t);await R.mkdir(n,{recursive:!0});let r=A.stringify(e);await R.writeFile(t,r,"utf-8")}function M(e){let t=new Date(e).getTime(),n=Date.now(),r=1*60*1e3;return t-n<r}async function W(e){let t=await fetch("https://dash.cloudflare.com/oauth2/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:"54d11594-84e4-41aa-b438-e81b8fa78ee7"})});if(!t.ok)throw new Error(`Failed to refresh OAuth token: ${t.status} ${t.statusText}`);let n=await t.json();return{oauth_token:n.access_token,expiration_time:new Date(Date.now()+n.expires_in*1e3).toISOString(),refresh_token:n.refresh_token||e,scopes:n.scope?n.scope.split(" "):[]}}async function q(e={}){let{showNewUserHelp:t=!1}=e,n=!!process.env.CLOUDFLARE_API_TOKEN,r=!!process.env.CLOUDFLARE_ACCOUNT_ID;if(n&&!r&&(console.log(c.yellow(`
|
|
2
2
|
Missing CLOUDFLARE_ACCOUNT_ID
|
|
3
3
|
`)),console.log(`When using CLOUDFLARE_API_TOKEN, you must also set CLOUDFLARE_ACCOUNT_ID.
|
|
4
4
|
`),console.log(c.dim(` export CLOUDFLARE_ACCOUNT_ID=<your_account_id>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k as g}from"./chunk-
|
|
1
|
+
import{k as g}from"./chunk-DLGPLHBH.js";import a from"node:fs/promises";import p from"node:path";import h from"node:os";import y from"chalk";async function C(t,e,o={}){let n=o.exclude||[];await a.mkdir(e,{recursive:!0});let i=await a.readdir(t,{withFileTypes:!0});for(let s of i){let r=p.join(t,s.name),c=p.join(e,s.name);n.some(l=>s.name===l)||(s.isDirectory()?await C(r,c,o):await a.copyFile(r,c))}}async function T(t){try{return(await a.stat(t)).isDirectory()}catch{return!1}}async function D({targetDir:t,appId:e,gatewayUrl:o}){let n=o??await g(),i=`# Vite client-side secrets
|
|
2
2
|
VITE_APP_ID=${e}
|
|
3
3
|
VITE_GATEWAY_URL=${n}
|
|
4
4
|
# Set Cloudflare secrets locally
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as I,d as k,e as M}from"./chunk-
|
|
1
|
+
import{c as I,d as k,e as M}from"./chunk-7BOQJFI5.js";import{c as j,d as F}from"./chunk-XTO2VTPY.js";import{f as Y}from"./chunk-O2KDOP5R.js";import{f as v}from"./chunk-FD6K2YA7.js";import{a as B,b as U,c as O,d as w}from"./chunk-BIXKPCDH.js";import{d as h,h as N,i as $,j as _,k as x,l as A,p as V,r as W,u as T}from"./chunk-DLGPLHBH.js";import{c as d}from"./chunk-U4LIQ5VR.js";import{c as K,d as z,e as E,f as L}from"./chunk-WO3NE7ZU.js";import u from"chalk";import p from"chalk";async function H({appId:e,d1Bindings:o=["DB"],kvBindings:t=["KV"],needsR2Bucket:n=!1,verbose:i=!1}){let a=[o.length>0?"D1 Database":null,t.length>0?"KV Store":null,n?"R2 Bucket":null].filter(Boolean);a.length>0&&console.log(`
|
|
2
2
|
Setting up your Cloudflare ${a.join(", ")}...
|
|
3
3
|
`);let s=await h(),l=E(e),r;n&&(r=await ge(l,s,i));let g={};for(let c of o){let y=E(e,c);g[c]=await le(y,s,i)}let m={};for(let c of t){let y=E(e,c);m[c]=await ce(y,s,i)}return{d1DatabaseId:g.DB,kvNamespaceId:m.KV,d1DatabaseIds:g,kvNamespaceIds:m,r2BucketName:r,resourceName:l}}async function le(e,o,t){t&&(console.log(p.bold(`Processing D1 database...
|
|
4
4
|
`)),console.log(` Checking D1 database: ${e}`));let n=await N(e,o);return t?n.wasCreated?console.log(p.green(` Created D1 database: ${e} (${n.id})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as u}from"./chunk-
|
|
1
|
+
import{f as u}from"./chunk-FD6K2YA7.js";import{d}from"./chunk-BIXKPCDH.js";import{c as y,d as f,k as w}from"./chunk-DLGPLHBH.js";import{c as i}from"./chunk-U4LIQ5VR.js";import t from"chalk";var P="every-app-gateway",o=class extends Error{url;cause;constructor(n,a){super(`Could not reach your Gateway at ${n} (${k(a)})`),this.name="GatewayUnreachableError",this.url=n,this.cause=a}};function b(e){return`Could not reach your Gateway at ${e.url} (${k(e.cause)})`}async function R(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(5e3)}),!0}catch(n){let a=n instanceof Error?n.message.toLowerCase():"",r=n instanceof Error&&"cause"in n&&n.cause?.code?.toLowerCase()||"";if(["ssl","tls","certificate","cert","cipher","handshake","secure"].some(s=>a.includes(s)||r.includes(s)))return!1;throw new o(e,n)}}async function G(e){let n=new d({gatewayUrl:e,getAuthToken:async()=>""});try{return await n.hasOwner()}catch(a){throw new o(e,a)}}async function x(){try{let e=await f();return await y(`/accounts/${e}/workers/scripts/${P}/settings`),!0}catch{return!1}}async function h(){return w()}async function U(){if(!await x())return{isDeployed:!1,hasOwner:!1,gatewayUrl:await h()};let n=await h(),a;try{a=await G(n)}catch(r){throw r instanceof o&&(console.log(t.yellow(`
|
|
2
2
|
Gateway unreachable
|
|
3
3
|
`)),console.log(b(r)),console.log(t.dim(` Confirm the gateway URL is correct and reachable, then run this command again.
|
|
4
4
|
`)),await i(1)),r}return{isDeployed:!0,hasOwner:a,gatewayUrl:n}}async function W(){let{isDeployed:e,hasOwner:n,gatewayUrl:a}=await U();if(e||(console.log(t.yellow(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e}from"./chunk-
|
|
1
|
+
import{c as e}from"./chunk-U4LIQ5VR.js";import n from"node:fs/promises";import p from"node:path";import o from"chalk";var i=["everyapp.config.ts"];async function l(){let t=process.cwd();for(let c of i){let r=p.join(t,c);try{await n.access(r);return}catch{}}console.log(o.yellow(`
|
|
2
2
|
Not inside an Every App project`)),console.log(o.dim(` No everyapp.config.ts found
|
|
3
3
|
`)),console.log("To create a new app, run the below command from the directory where you store your projects:"),console.log(o.dim(` npx everyapp app create
|
|
4
4
|
`)),await e(1)}export{l as a};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as t,b as a,c as r}from"./chunk-
|
|
2
|
-
`)}}),f=o({loader:async()=>{let{deploy:e}=await import("./deploy-
|
|
1
|
+
import{a as t,b as a,c as r}from"./chunk-RB5D2R45.js";import l from"node:fs";import d from"node:os";import u from"node:path";function O(e){return{process:e,os:d,fs:l,path:u}}import{buildApplication as D,buildCommand as p,buildRouteMap as R}from"@stricli/core";import{buildInstallCommand as S,buildUninstallCommand as x}from"@stricli/auto-complete";import{buildCommand as o,buildRouteMap as m}from"@stricli/core";var c=o({loader:async()=>import("./create-DYQ3NBWJ.js"),parameters:{positional:{kind:"tuple",parameters:[{brief:"App ID (kebab-case format)",parse:String,optional:!0}]},flags:{verbose:{kind:"boolean",brief:"Show detailed output during creation",optional:!0},yes:{kind:"boolean",brief:"Skip deployment confirmation",optional:!0}},aliases:{y:"yes"}},docs:{brief:"Create a new app from the starter template",fullDescription:["Copies the simple-todo starter template, deploys to Cloudflare, and configures local development.","","Usage: every app create [name]","","The command will:"," 1. Prompt for app ID (or use provided name)"," 2. Deploy a private Cloudflare Worker from everyapp.config.ts"," 3. Configure package.json and local .env files"," 4. Install dependencies and run local migrations for the starter app","","After creation, run 'pnpm run dev' to start developing."].join(`
|
|
2
|
+
`)}}),f=o({loader:async()=>{let{deploy:e}=await import("./deploy-PYTCMDGV.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{verbose:{kind:"boolean",brief:"Show detailed output during deployment",optional:!0},yes:{kind:"boolean",brief:"Skip deployment confirmation",optional:!0},"skip-dns-check":{kind:"boolean",brief:"Skip app subdomain DNS preflight check",optional:!0},domain:{kind:"parsed",parse:String,brief:"Not for this command; configure the gateway domain instead",optional:!0,hidden:!0}},aliases:{y:"yes"}},docs:{brief:"Deploy an app to Cloudflare",fullDescription:["Deploys the current app as a private Cloudflare Worker from everyapp.config.ts.","The deployment process:"," 1. Loads and validates everyapp.config.ts"," 2. Verifies the app subdomain can resolve through Cloudflare DNS"," 3. Ensures the Cloudflare Workers account is initialized"," 4. Creates or links declared D1 databases and KV namespaces"," 5. Generates .everyapp/wrangler.json"," 6. Installs dependencies using the manifest install setting or package-manager auto-detection"," 7. Runs the configured database migration strategy against production D1"," 8. Runs the configured build, deploys, registers with the gateway, and ensures the service binding"].join(`
|
|
3
3
|
`)}}),g=o({loader:async()=>{let{generateConfig:e}=await import("./generateConfig-46Z3ERF3.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{verbose:{kind:"boolean",brief:"Show generated config details",optional:!0}}},docs:{brief:"Generate .everyapp/wrangler.json from everyapp.config.ts",fullDescription:["Loads everyapp.config.ts, validates it, and writes the generated Wrangler config consumed by Vite and Wrangler.","","Run this before invoking vite directly."].join(`
|
|
4
|
-
`)}}),y=o({loader:async()=>{let{setupLocal:e}=await import("./setupLocal-
|
|
5
|
-
`)}}),h=o({loader:async()=>{let{remoteD1Shell:e}=await import("./remoteD1Shell-
|
|
6
|
-
`)}}),n=m({routes:{create:c,deploy:f,"generate-config":g,"setup-local":y,"remote-d1-shell":h},docs:{brief:"App management commands"}});import{buildCommand as b,buildRouteMap as v}from"@stricli/core";var w=b({loader:async()=>{let{deploy:e}=await import("./deploy-
|
|
7
|
-
`)}}),i=v({routes:{deploy:w},docs:{brief:"Gateway management commands"}});import{buildCommand as C}from"@stricli/core";import{numberParser as k}from"@stricli/core";var s=C({loader:async()=>import("./dev-
|
|
8
|
-
`)}});var A=p({loader:async()=>{let{login:e}=await import("./login-
|
|
4
|
+
`)}}),y=o({loader:async()=>{let{setupLocal:e}=await import("./setupLocal-TZJUW5ES.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{verbose:{kind:"boolean",brief:"Show detailed output during local setup",optional:!0}}},docs:{brief:"Set up local development in an existing app",fullDescription:["Configures local development for an existing Every App project in the current directory.","","Usage: every app setup-local","","The command will:"," 1. Verify the current directory is an Every App project"," 2. Verify Cloudflare and gateway setup"," 3. Install dependencies using package-manager auto-detection"," 4. Create or refresh .env.local"," 5. Run local setup scripts for template-style apps","","This is useful after cloning an existing Every App repository."].join(`
|
|
5
|
+
`)}}),h=o({loader:async()=>{let{remoteD1Shell:e}=await import("./remoteD1Shell-A67JMO3H.js");return e},parameters:{flags:{},positional:{kind:"array",parameter:{brief:"Command and arguments to run with environment variables",parse:String}}},docs:{brief:"Run a command with Cloudflare D1 connection environment variables",fullDescription:["Sets environment variables needed to connect to remote Cloudflare D1 and runs any command that requires D1 access.","","The command will:"," 1. Get the Cloudflare account ID"," 2. Look up the database ID from the generated Wrangler database name"," 3. Get a valid OAuth token"," 4. Run the provided command with CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_DATABASE_ID, CLOUDFLARE_API_TOKEN, and MIGRATE_REMOTE set","","Common use cases:"," - Running Drizzle migrations: npx everyapp app remote-d1-shell -- npx drizzle-kit migrate"," - Opening Drizzle Studio: npx everyapp app remote-d1-shell -- npx drizzle-kit studio"," - Pushing schema changes: npx everyapp app remote-d1-shell -- npx drizzle-kit push","","This command is useful for any operation that needs direct access to your production D1 database."].join(`
|
|
6
|
+
`)}}),n=m({routes:{create:c,deploy:f,"generate-config":g,"setup-local":y,"remote-d1-shell":h},docs:{brief:"App management commands"}});import{buildCommand as b,buildRouteMap as v}from"@stricli/core";var w=b({loader:async()=>{let{deploy:e}=await import("./deploy-RMAHOA4Z.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{verbose:{kind:"boolean",brief:"Show detailed output during deployment",optional:!0},localGateway:{kind:"parsed",parse:String,brief:"Path to local gateway tarball (for testing)",optional:!0},domain:{kind:"parsed",parse:String,brief:"Custom apex domain for the gateway and app subdomains",optional:!0},yes:{kind:"boolean",brief:"Skip deployment confirmation",optional:!0}},aliases:{y:"yes"}},docs:{brief:"Deploy the gateway application to Cloudflare",fullDescription:["Downloads the gateway release, links Cloudflare resources, reconstructs app service bindings, and deploys to Cloudflare Workers.","The deployment process:"," 1. Downloads the gateway release to a temporary directory"," 2. Creates or links gateway D1/KV resources"," 3. Reconstructs service bindings from the registry"," 4. Optionally configures custom-domain routes with --domain"," 5. Runs wrangler deploy"," 6. Runs database migrations against production D1"," 7. Cleans up temporary files"].join(`
|
|
7
|
+
`)}}),i=v({routes:{deploy:w},docs:{brief:"Gateway management commands"}});import{buildCommand as C}from"@stricli/core";import{numberParser as k}from"@stricli/core";var s=C({loader:async()=>import("./dev-SAE237FS.js"),parameters:{flags:{port:{kind:"parsed",parse:k,brief:"Gateway port (defaults to $PORT, then 8787)",optional:!0},mode:{kind:"parsed",parse:String,brief:"stub (seeded dev user, default) | mirror (real login via local gateway)",optional:!0},gateway:{kind:"parsed",parse:String,brief:"mirror mode: URL of the separately-run local gateway (default http://localhost:3000)",optional:!0},baseHost:{kind:"parsed",parse:String,brief:"mirror mode: two-label base host for cookie scope (default everyapp.localhost)",optional:!0},"skip-migrations":{kind:"boolean",brief:"Start without applying local database migrations",optional:!0}}},docs:{brief:"Run the app behind a local gateway with the real perimeter",fullDescription:["Runs the app's configured dev server on an internal port and a gateway-lite","in front of it on $PORT (default 8787) \u2014 the REAL perimeter: public-route","policy, header strip/inject, a real RS256 identity JWT, and a seeded dev","user. Open http://<app-id>.localhost:8787 \u2014 the first Host label selects","the app, so portless per-worktree hosts work with no configuration.","","--mode stub (default): seeded dev user, zero setup.","--mode mirror: authenticate against a SEPARATELY-running local gateway"," (run `pnpm dev` in apps/every-app-gateway first). Real login/launcher"," are forwarded to it. Requires a two-label base host (e.g."," everyapp.localhost) so the session cookie crosses the subdomain"," boundary; the CLI prints setup guidance if the host is unusable."," Also settable via EVERYAPP_DEV_MODE; the flag wins."].join(`
|
|
8
|
+
`)}});var A=p({loader:async()=>{let{login:e}=await import("./login-B6EF3SMX.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{}},docs:{brief:"Store a gateway deploy token"}}),E=p({loader:async()=>{let{logout:e}=await import("./logout-XMKZBLNV.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{}},docs:{brief:"Remove a stored gateway deploy token"}}),L=R({routes:{app:n,dev:s,gateway:i,login:A,logout:E,install:S("everyapp",{bash:"__everyapp_bash_complete"}),uninstall:x("everyapp",{bash:!0})},docs:{brief:a,hideRoute:{install:!0,uninstall:!0}}}),Y=D(L,{name:t,versionInfo:{currentVersion:r},scanner:{allowArgumentEscapeSequence:!0}});export{O as a,Y as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var s="everyapp";var t="Every App CLI - Deploy and manage apps.";var i="0.2.
|
|
1
|
+
var s="everyapp";var t="Every App CLI - Deploy and manage apps.";var i="0.2.2";export{s as a,t as b,i as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as n}from"./chunk-
|
|
1
|
+
import{c as n}from"./chunk-RB5D2R45.js";import a from"chalk";var p="https://registry.npmjs.org/everyapp?fields=dist-tags",f=2e3,i=null;function y(){i||(i=d().then(t=>t&&t!==n&&g(n,t)?{updateAvailable:!0,latestVersion:t,currentVersion:n}:{updateAvailable:!1,currentVersion:n}))}var u=!1;async function m(){if(u||!i)return;u=!0;let t=await i;h(t)}async function V(t){await m(),process.exit(t)}async function d(){try{let t=new AbortController,o=setTimeout(()=>t.abort(),f),e=await fetch(p,{signal:t.signal});return clearTimeout(o),e.ok?(await e.json())["dist-tags"].latest:null}catch{return null}}function g(t,o){let e=t.split(".").map(Number),s=o.split(".").map(Number);for(let r=0;r<Math.max(e.length,s.length);r++){let l=e[r]??0,c=s[r]??0;if(l<c)return!0;if(l>c)return!1}return!1}function h(t){t.updateAvailable&&t.latestVersion&&(console.log(),console.log(a.yellow(` Update available: ${t.currentVersion} \u2192 ${t.latestVersion}`)),console.log(a.dim(` Run latest: ${a.cyan("npx -y everyapp@latest")}`)))}export{y as a,m as b,V as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as r}from"./chunk-
|
|
1
|
+
import{f as r}from"./chunk-O2KDOP5R.js";import{c as l,f as i}from"./chunk-FD6K2YA7.js";import c from"chalk";import a from"chalk";async function s({targetDir:n,verbose:o=!1}){try{o||console.log(`
|
|
2
2
|
Setting up Cloudflare for local dev...`),await i("pnpm",["run","cf-typegen"],{cwd:n,verbose:o,logCommandToConsole:!1}),await i("pnpm",["run","build"],{cwd:n,verbose:o,logCommandToConsole:!1}),o||console.log(a.dim(` Finished.
|
|
3
3
|
`)),await i("pnpm",["run","db:migrate:local"],{cwd:n,verbose:o}),console.log(`
|
|
4
4
|
Local database migrations complete.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as u,d as w,e as y,f as p}from"./chunk-
|
|
1
|
+
import{b as u,d as w,e as y,f as p}from"./chunk-FD6K2YA7.js";import{b}from"./chunk-7YVJFS4A.js";import z from"node:fs/promises";import m from"node:path";import l from"chalk";import h from"chalk";function O(n,i){n&&console.log(h.dim(i))}function v(n,...i){n&&i.forEach(r=>console.log(h.dim(r)))}import{execFileSync as j}from"node:child_process";import P from"node:fs/promises";import{createRequire as k}from"node:module";import c from"node:path";async function d(n,i,r){let t=c.resolve(n),e=M();try{let o=await x(t,i),a=JSON.parse(await P.readFile(o,"utf-8")),s=typeof a.bin=="string"?a.bin:a.bin?.[r];if(!s)throw new Error(`Package does not declare the "${r}" binary.`);return{command:e,argsPrefix:[c.resolve(c.dirname(o),s)]}}catch(o){throw new Error(`Could not resolve the project-local "${r}" binary from project root "${t}". Install the project's declared ${i} dependency and try again. (If the install skipped devDependencies, include them; Yarn Plug'n'Play projects are not supported \u2014 use nodeLinker: node-modules.)`,{cause:o})}}function M(){if(!process.versions.bun)return process.execPath;try{return j("node",["--version"],{stdio:"ignore"}),"node"}catch{throw new Error("Every App CLI must run project binaries under Node.js because Wrangler deploys silently no-op under Bun. Install Node.js and ensure `node` is available on PATH.")}}async function x(n,i){let r=n;for(;;){let e=c.join(r,"node_modules",...i.split("/"),"package.json");try{return await P.realpath(e)}catch{}let o=c.dirname(r);if(o===r)break;r=o}return k(c.join(n,"package.json")).resolve(`${i}/package.json`)}var D=["migrate","--config=drizzle-prod.config.ts"],E="drizzle";function R(n,i){let r=i?.binding??n[0];if(!n.includes(r))throw new Error(`Manifest migrations binding "${r}" is not declared in resources.d1.`);return r}async function Q({cwd:n,workerName:i,d1Bindings:r,d1DatabaseIds:t,migrations:e,verbose:o=!1}){if(r.length===0){o&&console.log(l.dim(`No D1 resources declared; skipping migrations.
|
|
2
2
|
`));return}let a=R(r,e),s=t[a];if(!s)throw new Error(`No provisioned D1 database ID found for binding "${a}".`);if(!e||e.engine==="drizzle"){await L({cwd:n,d1DatabaseId:s,verbose:o});return}if(!e.dir)throw new Error('migrations.dir is required when migrations.engine is "d1-sql".');await A({cwd:n,binding:a,databaseName:C(i,a),databaseId:s,migrationsDir:m.resolve(n,e.dir),verbose:o})}async function L({cwd:n,d1DatabaseId:i,verbose:r=!1}){let{command:t,argsPrefix:e}=await d(n,"drizzle-kit","drizzle-kit");console.log(`
|
|
3
3
|
Running: project-local drizzle-kit ${D.join(" ")}`),console.log(l.dim(" Running database migrations...")),v(r," Running any pending migrations against your remote D1 Database..."),await b(t,[...e,...D],{cwd:n,d1DatabaseId:i,verbose:r}),console.log(l.dim(` Migrations completed.
|
|
4
4
|
`))}async function V({cwd:n,d1Bindings:i,migrations:r,configPath:t,verbose:e=!1}){if(i.length===0)return;let o=R(i,r),a=m.resolve(n,r?.dir??E);if(!await u(a))return;if(console.log(l.dim(" Applying local database migrations...")),r?.engine==="d1-sql"){let{command:g,argsPrefix:f}=await d(n,"wrangler","wrangler");await p(g,[...f,"d1","migrations","apply",o,"--local","--persist-to",m.join(n,".wrangler","state"),"-c",t],{cwd:n,verbose:e,logCommandToConsole:!1}),console.log(l.dim(" Local migrations applied."));return}if(!await I(m.join(n,".wrangler","state","v3","d1"))){let g=await d(n,"wrangler","wrangler");await p(g.command,[...g.argsPrefix,"d1","execute",o,"--local","--persist-to",m.join(n,".wrangler","state"),"-c",t,"--command","SELECT 1;"],{cwd:n,verbose:e,logCommandToConsole:!1})}let s=await d(n,"drizzle-kit","drizzle-kit");await p(s.command,[...s.argsPrefix,"migrate"],{cwd:n,verbose:e,logCommandToConsole:!1}),console.log(l.dim(" Local migrations applied."))}async function A({cwd:n,binding:i,databaseName:r,databaseId:t,migrationsDir:e,verbose:o=!1}){let{command:a,argsPrefix:s}=await d(n,"wrangler","wrangler");console.log(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as x}from"./chunk-
|
|
1
|
+
import{a as x}from"./chunk-GAJEQYJH.js";import{a as C}from"./chunk-VP6SKW44.js";import{a as P}from"./chunk-7BOQJFI5.js";import"./chunk-XTO2VTPY.js";import{e as k}from"./chunk-O2KDOP5R.js";import{a as w,b as h,d as v,e as b,f as c}from"./chunk-FD6K2YA7.js";import"./chunk-BIXKPCDH.js";import"./chunk-VEYSNPDH.js";import"./chunk-7YVJFS4A.js";import{a as u}from"./chunk-DLGPLHBH.js";import{c as l}from"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import"./chunk-WO3NE7ZU.js";import"./chunk-YJ2DKIZS.js";import g from"chalk";async function E({url:e,targetDir:o,verbose:t=!1}){try{await c("git",["clone",e,o],{verbose:t,logCommandToConsole:!1})}catch(r){throw new Error(`Failed to clone repository from ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async function I({targetDir:e,verbose:o=!1}){try{await c("git",["init"],{verbose:o,logCommandToConsole:!1,cwd:e}),await c("git",["add","."],{verbose:o,logCommandToConsole:!1,cwd:e}),await c("git",["commit","-m","Starter template"],{verbose:o,logCommandToConsole:!1,cwd:e})}catch(t){throw new Error(`Failed to initialize git repository: ${t instanceof Error?t.message:"Unknown error"}`)}}import J from"node:fs/promises";import L from"node:path";import f from"chalk";var _=["everyapp.config.ts"];async function T(){let e=process.cwd();for(let o of _){let t=L.join(e,o);try{await J.access(t),console.log(f.yellow(`
|
|
2
2
|
Already inside an Every App project`)),console.log(f.dim(` Found ${o}
|
|
3
3
|
`)),console.log(`To create a new app, run app create from the directory where you store your projects.
|
|
4
4
|
`),console.log("If you meant to deploy this app, run:"),console.log(f.dim(` npx everyapp app deploy
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-GAJEQYJH.js";import{a as p}from"./chunk-OI2MBGBG.js";import{a as r}from"./chunk-7BOQJFI5.js";import"./chunk-XTO2VTPY.js";import{e as i}from"./chunk-O2KDOP5R.js";import"./chunk-FD6K2YA7.js";import"./chunk-BIXKPCDH.js";import"./chunk-VEYSNPDH.js";import"./chunk-7YVJFS4A.js";import{a}from"./chunk-DLGPLHBH.js";import"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import{d as s}from"./chunk-WO3NE7ZU.js";import"./chunk-YJ2DKIZS.js";import o from"chalk";async function x(e){if(e.domain!==void 0)throw new Error("apps derive their address from the gateway's domain automatically; configure the domain with `everyapp gateway deploy --domain <apex-domain>`.");await a(),await i();let n=process.cwd(),l=e.verbose||!1,m=e.yes||!1,d=e["skip-dns-check"]||!1;await p();let t=await s(n),y=t.id;if(console.log(o.bold(`
|
|
2
2
|
Project: ${y}
|
|
3
3
|
`)),!await r("this app",m)){console.log(o.red(`
|
|
4
4
|
Deployment cancelled by user
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as J,b as Z,d as h,e as Q}from"./chunk-
|
|
1
|
+
import{a as J,b as Z,d as h,e as Q}from"./chunk-7BOQJFI5.js";import{a as S,b as A,c as z,e as q}from"./chunk-XTO2VTPY.js";import{a as C,b as v,c as T,d as D,f as H}from"./chunk-O2KDOP5R.js";import{d as Y,e as F,f as M}from"./chunk-FD6K2YA7.js";import"./chunk-BIXKPCDH.js";import"./chunk-VEYSNPDH.js";import"./chunk-7YVJFS4A.js";import{a as G,d as L,f as $,h as P,i as N,l as O,p as K,q as j,s as B,t as V}from"./chunk-DLGPLHBH.js";import{c as R}from"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import"./chunk-WO3NE7ZU.js";import"./chunk-YJ2DKIZS.js";import g from"chalk";import Te from"node:path";import _ from"chalk";var de="every-app-gateway",ge={KV:"every-app-gateway",OAUTH_KV:"every-app-gateway-OAUTH_KV"};async function X({verbose:e=!1}={}){console.log(`
|
|
2
2
|
Setting up your Cloudflare D1 Database and KV Store...
|
|
3
3
|
`);let a=await L(),o=await fe(de,a,e),t={};for(let[n,i]of Object.entries(ge))t[n]=await me(i,a,e);return console.log(),{d1DatabaseId:o,kvNamespaceIds:t,accountId:a}}async function fe(e,a,o){o&&console.log(` Checking D1 database: ${e}`);let t=await P(e,a);return o?t.wasCreated?console.log(_.green(` Created D1 database: ${e} (${t.id})
|
|
4
4
|
`)):console.log(_.dim(` Linking to existing D1 database: ${e} (${t.id})
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as i,b as t}from"./chunk-
|
|
2
|
+
import{a as i,b as t}from"./chunk-POSDLD3G.js";import{a as r,b as o}from"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import"./chunk-YJ2DKIZS.js";import{run as e}from"@stricli/core";r();await e(t,process.argv.slice(2),i(process));await o();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as l}from"./chunk-BIXKPCDH.js";import{a as r,d as n}from"./chunk-VEYSNPDH.js";import{k as i}from"./chunk-
|
|
1
|
+
import{d as l}from"./chunk-BIXKPCDH.js";import{a as r,d as n}from"./chunk-VEYSNPDH.js";import{k as i}from"./chunk-DLGPLHBH.js";import"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import"./chunk-YJ2DKIZS.js";import g from"chalk";import m from"enquirer";async function c(){try{return await i()}catch{return""}}async function k(){let s=await c(),{gatewayUrl:w}=await m.prompt({type:"input",name:"gatewayUrl",message:"Gateway URL",initial:s,validate:e=>{try{return r(e.trim()),!0}catch{return"Enter a valid gateway URL"}}}),t=r(w.trim()),{token:o}=await m.prompt({type:"password",name:"token",message:"Deploy token",validate:e=>e.trim().startsWith("eak_")?!0:"Deploy tokens start with eak_"}),a=await new l({gatewayUrl:t,getAuthToken:async()=>o.trim()}).whoami();await n({gatewayUrl:t,token:o.trim(),organizationId:a.organizationId}),console.log(g.green(`Logged in to ${t} for ${a.organizationName} (${a.organizationId}).`))}export{k as login};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,e as r}from"./chunk-VEYSNPDH.js";import{k as a}from"./chunk-
|
|
1
|
+
import{a as e,e as r}from"./chunk-VEYSNPDH.js";import{k as a}from"./chunk-DLGPLHBH.js";import"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import"./chunk-YJ2DKIZS.js";import o from"chalk";import m from"enquirer";async function y(){try{return await a()}catch{return""}}async function f(){let i=await y(),{gatewayUrl:n}=await m.prompt({type:"input",name:"gatewayUrl",message:"Gateway URL",initial:i,validate:c=>{try{return e(c.trim()),!0}catch{return"Enter a valid gateway URL"}}}),t=e(n.trim()),l=await r(t);console.log(l?o.green(`Logged out of ${t}.`):o.yellow(`No stored credential found for ${t}.`))}export{f as logout};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-7YVJFS4A.js";import{a as i}from"./chunk-DLGPLHBH.js";import"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import"./chunk-WO3NE7ZU.js";import"./chunk-YJ2DKIZS.js";import r from"chalk";import{execa as l}from"execa";async function g(m,...o){await i();let n=process.cwd();try{if(!o||o.length===0)throw new Error(`No command provided. Usage: npx everyapp app remote-d1-shell -- <command>
|
|
2
2
|
Example: npx everyapp app remote-d1-shell -- npx drizzle-kit migrate`);let[e,...t]=o;if(!e)throw new Error("Invalid command");console.log("Retrieving shell info from Cloudflare...");let c=await a(n);console.log(r.bold(`
|
|
3
3
|
Running: ${r.cyan([e,...t].join(" "))}
|
|
4
4
|
`)),await l(e,t,{cwd:n,stdio:"inherit",env:{...process.env,...c}}),console.log(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-VP6SKW44.js";import{a as c}from"./chunk-OI2MBGBG.js";import{e as r}from"./chunk-O2KDOP5R.js";import"./chunk-FD6K2YA7.js";import"./chunk-BIXKPCDH.js";import"./chunk-VEYSNPDH.js";import{a as n}from"./chunk-DLGPLHBH.js";import"./chunk-U4LIQ5VR.js";import"./chunk-RB5D2R45.js";import{d as i,f as s}from"./chunk-WO3NE7ZU.js";import"./chunk-YJ2DKIZS.js";import o from"chalk";async function L(p){let e=process.cwd(),m=p.verbose||!1;await c(),await n();let u=await r(),t=await i(e),a=t.id;await s(e,{manifest:t}),console.log(o.bold(`
|
|
2
2
|
Setting up local environment for ${a}
|
|
3
3
|
`)),await l({targetDir:e,appId:a,gatewayUrl:u,verbose:m,installDeps:!0,migrations:t.migrations}),console.log(o.green(`Local setup complete!
|
|
4
4
|
`)),console.log(`Run the app locally:
|
|
Binary file
|