@every-app/cli 0.0.27 → 0.0.28
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/dist/bash-complete.js +1 -1
- package/dist/{chunk-I3P42HBM.js → chunk-EV6OC476.js} +1 -1
- package/dist/{chunk-2EXYUIS2.js → chunk-HNMMJLMB.js} +1 -1
- package/dist/{chunk-PSFV2MPZ.js → chunk-OD7IDDKP.js} +1 -1
- package/dist/{chunk-E4VJXOSC.js → chunk-PTPKLIYD.js} +1 -1
- package/dist/{chunk-JR73IRPQ.js → chunk-YNDW3QZD.js} +4 -4
- package/dist/{create-POBKGWFU.js → create-JUYTUKQY.js} +1 -1
- package/dist/{deploy-KTJOIPGV.js → deploy-MWNX3LCP.js} +1 -1
- package/dist/{deploy-ALWR56FX.js → deploy-OPZW6AWG.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{remoteD1Shell-TU73UDJ7.js → remoteD1Shell-MF6FYSNX.js} +1 -1
- package/package.json +1 -1
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-YNDW3QZD.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 D from"node:fs/promises";import l from"node:path";import _ from"node:os";import*as y from"smol-toml";import p from"chalk";function I(){let e=_.homedir(),t=_.platform(),n;return t==="win32"?n=l.join(process.env.LOCALAPPDATA||l.join(e,"AppData","Local"),".wrangler"):t==="darwin"?n=l.join(e,"Library","Preferences",".wrangler"):n=l.join(e,".wrangler"),l.join(n,"config","default.toml")}async function T(){let e=I();try{let t=await D.readFile(e,"utf-8"),n=y.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 N(e){let t=I(),n=l.dirname(t);await D.mkdir(n,{recursive:!0});let r=y.stringify(e);await D.writeFile(t,r,"utf-8")}function L(e){let t=new Date(e).getTime(),n=Date.now(),r=1*60*1e3;return t-n<r}async function F(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})});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 $(){let e=!!process.env.CLOUDFLARE_API_TOKEN,t=!!process.env.CLOUDFLARE_ACCOUNT_ID;if(e&&!t&&(console.log(p.yellow(`
|
|
1
|
+
import D from"node:fs/promises";import l from"node:path";import _ from"node:os";import*as y from"smol-toml";import p from"chalk";function I(){let e=_.homedir(),t=_.platform(),n;return t==="win32"?n=l.join(process.env.LOCALAPPDATA||l.join(e,"AppData","Local"),".wrangler"):t==="darwin"?n=l.join(e,"Library","Preferences",".wrangler"):n=l.join(e,".wrangler"),l.join(n,"config","default.toml")}async function T(){let e=I();try{let t=await D.readFile(e,"utf-8"),n=y.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 N(e){let t=I(),n=l.dirname(t);await D.mkdir(n,{recursive:!0});let r=y.stringify(e);await D.writeFile(t,r,"utf-8")}function L(e){let t=new Date(e).getTime(),n=Date.now(),r=1*60*1e3;return t-n<r}async function F(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 $(){let e=!!process.env.CLOUDFLARE_API_TOKEN,t=!!process.env.CLOUDFLARE_ACCOUNT_ID;if(e&&!t&&(console.log(p.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(p.dim(` export CLOUDFLARE_ACCOUNT_ID=<your_account_id>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as g,e as O,f as _,g as G}from"./chunk-
|
|
1
|
+
import{b as g,e as O,f as _,g as G}from"./chunk-PTPKLIYD.js";import{a as R,c as x,e as w,g as A,h as k,i as P,j as $,k as S,l as b,q as T,s as N}from"./chunk-EV6OC476.js";import V from"node:fs/promises";import j from"node:path";import*as B from"jsonc-parser";import{z as f}from"zod";var F="every-app.jsonc",Q=f.object({appId:f.string().min(1,"appId cannot be empty"),displayName:f.string().min(1,"displayName cannot be empty").optional(),description:f.string().optional()});async function C(t){let o=j.join(t,F);try{let e=await V.readFile(o,"utf-8"),r=B.parse(e);return Q.parse(r)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")throw new Error("every-app.jsonc not found. Make sure you're running this command from an Every App project directory.");if(e instanceof f.ZodError){let r=e.issues.map(n=>n.message).join(", ");throw new Error(`Invalid every-app.jsonc: ${r}`)}throw e}}function z(t){return t.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}async function pe(t,o){let e=j.join(t,F),r={...o,displayName:o.displayName??z(o.appId)},n=JSON.stringify(r,null,2)+`
|
|
2
2
|
`;await V.writeFile(e,n)}async function ce(t){return(await C(t)).appId}import{execa as Y}from"execa";async function J(){try{return await Y("pnpm",["--version"],{stdio:"pipe"}),!0}catch{return!1}}async function L({cwd:t,description:o,verbose:e=!1}){let r=await J();try{r?await g("pnpm",["install"],{cwd:t,verbose:e,description:o}):await g("npx",["pnpm","install"],{cwd:t,verbose:e,description:o})}catch(n){throw new Error(`Failed to install dependencies with pnpm: ${n instanceof Error?n.message:"Unknown error"}`)}}import c from"chalk";async function W({appId:t,needsR2Bucket:o=!1,verbose:e=!1}){console.log(`
|
|
3
3
|
Setting up your Cloudflare ${o?"D1 Database, KV Store, and R2 Bucket":"D1 Database and KV Store"}...
|
|
4
4
|
`);let n=await w(),s=R(t),i;o&&(i=await X(s,n,e));let a=await H(s,n,e),p=await Z(s,n,e);return{d1DatabaseId:a,kvNamespaceId:p,r2BucketName:i,resourceName:s}}async function H(t,o,e){e&&(console.log(c.bold(`Processing D1 database...
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as l}from"./chunk-
|
|
1
|
+
import{g as l}from"./chunk-EV6OC476.js";import r from"node:fs/promises";import n from"node:path";import f from"node:os";import p from"chalk";async function u(e,t,i={}){let a=i.exclude||[];await r.mkdir(t,{recursive:!0});let m=await r.readdir(e,{withFileTypes:!0});for(let o of m){let s=n.join(e,o.name),c=n.join(t,o.name);a.some(y=>o.name===y)||(o.isDirectory()?await u(s,c,i):await r.copyFile(s,c))}}async function P(e){try{return(await r.stat(e)).isDirectory()}catch{return!1}}async function x({targetDir:e,appId:t}){let i=await l("every-app-gateway"),a=`# Vite client-side secrets
|
|
2
2
|
VITE_APP_ID=${t}
|
|
3
3
|
VITE_GATEWAY_URL=${i}
|
|
4
4
|
# Set Cloudflare secrets locally
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as u,e as d,f as p,m as w,n as x,o as C,r as b,u as y}from"./chunk-
|
|
1
|
+
import{d as u,e as d,f as p,m as w,n as x,o as C,r as b,u as y}from"./chunk-EV6OC476.js";import D from"enquirer";import I from"chalk";async function E(){if(process.env.CLOUDFLARE_API_TOKEN){let n=process.env.CLOUDFLARE_ACCOUNT_ID;return n||(console.log(I.yellow(`
|
|
2
2
|
CLOUDFLARE_ACCOUNT_ID is required when using CLOUDFLARE_API_TOKEN
|
|
3
3
|
`)),process.exit(1)),p(n)}let e=await w(),{account:o,otherAccounts:t}=C(e);return x(o,t),{id:o.account.id,name:o.account.name}}async function z(e="this"){let o=await E();process.env.CLOUDFLARE_API_TOKEN&&(console.log(I.dim(` ${o.name} (${o.id})`)),console.log());let{confirm:t}=await D.prompt({type:"confirm",name:"confirm",message:`Do you want to deploy ${e} to ${o.name}?`,initial:!1});return t}import O from"chalk";import h from"chalk";function U(e,o){e&&console.log(h.dim(o))}function A(e,...o){e&&o.forEach(t=>console.log(h.dim(t)))}var $="npx",k=["drizzle-kit","migrate","--config=drizzle-prod.config.ts"];async function K({cwd:e,verbose:o=!1}){console.log(`
|
|
4
4
|
Running: ${$} ${k.join(" ")}`),console.log(O.dim(" Running database migrations...")),A(o," Running any pending migrations against your remote D1 Database..."),await y($,k,{cwd:e,verbose:o}),console.log(O.dim(` Migrations completed.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import p from"node:fs";import l from"node:os";import d from"node:path";function A(e){return{process:e,os:l,fs:p,path:d}}import{buildApplication as g,buildRouteMap as C}from"@stricli/core";import{buildInstallCommand as D,buildUninstallCommand as v}from"@stricli/auto-complete";var r="@every-app/cli";var n="Every App CLI - Deploy and manage apps.";var a="0.0.
|
|
2
|
-
`)}}),u=o({loader:async()=>{let{deploy:e}=await import("./deploy-
|
|
3
|
-
`)}}),y=o({loader:async()=>{let{remoteD1Shell:e}=await import("./remoteD1Shell-
|
|
4
|
-
`)}}),i=m({routes:{create:c,deploy:u,"remote-d1-shell":y},docs:{brief:"App management commands"}});import{buildCommand as f,buildRouteMap as b}from"@stricli/core";var h=f({loader:async()=>{let{deploy:e}=await import("./deploy-
|
|
1
|
+
import p from"node:fs";import l from"node:os";import d from"node:path";function A(e){return{process:e,os:l,fs:p,path:d}}import{buildApplication as g,buildRouteMap as C}from"@stricli/core";import{buildInstallCommand as D,buildUninstallCommand as v}from"@stricli/auto-complete";var r="@every-app/cli";var n="Every App CLI - Deploy and manage apps.";var a="0.0.28";import{buildCommand as o,buildRouteMap as m}from"@stricli/core";var c=o({loader:async()=>import("./create-JUYTUKQY.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}}},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 to Cloudflare (D1 database, KV namespace, Worker)"," 3. Configure wrangler.jsonc, package.json, and .env files"," 4. Install dependencies and run local migrations","","After creation, run 'pnpm run dev' to start developing."].join(`
|
|
2
|
+
`)}}),u=o({loader:async()=>{let{deploy:e}=await import("./deploy-OPZW6AWG.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{verbose:{kind:"boolean",brief:"Show detailed output during deployment",optional:!0}}},docs:{brief:"Deploy an app to Cloudflare",fullDescription:["Deploys the current app to Cloudflare Workers from the current directory.","The deployment process:"," 1. Reads wrangler.jsonc to determine required resources"," 2. Creates or links D1 databases and KV namespaces"," 3. Updates wrangler.jsonc with resource IDs"," 4. Installs dependencies if needed"," 5. Runs database migrations against production D1"," 6. Builds and deploys using wrangler deploy"].join(`
|
|
3
|
+
`)}}),y=o({loader:async()=>{let{remoteD1Shell:e}=await import("./remoteD1Shell-MF6FYSNX.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 database name in wrangler.jsonc"," 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 @every-app/cli app remote-d1-shell -- npx drizzle-kit migrate"," - Opening Drizzle Studio: npx @every-app/cli app remote-d1-shell -- npx drizzle-kit studio"," - Pushing schema changes: npx @every-app/cli 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(`
|
|
4
|
+
`)}}),i=m({routes:{create:c,deploy:u,"remote-d1-shell":y},docs:{brief:"App management commands"}});import{buildCommand as f,buildRouteMap as b}from"@stricli/core";var h=f({loader:async()=>{let{deploy:e}=await import("./deploy-MWNX3LCP.js");return e},parameters:{positional:{kind:"tuple",parameters:[]},flags:{repo:{kind:"parsed",parse:String,brief:"Git repository URL to deploy",optional:!0},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}}},docs:{brief:"Deploy the gateway application to Cloudflare",fullDescription:["Clones the gateway repository, installs dependencies, runs migrations, and deploys to Cloudflare Workers.","The deployment process:"," 1. Clones the repository to a temporary directory"," 2. Installs npm dependencies"," 3. Runs database migrations against production D1"," 4. Runs wrangler deploy"," 5. Cleans up temporary files"].join(`
|
|
5
5
|
`)}}),s=b({routes:{deploy:h},docs:{brief:"Gateway management commands"}});var w=C({routes:{app:i,gateway:s,install:D("every",{bash:"__every_bash_complete"}),uninstall:v("every",{bash:!0})},docs:{brief:n,hideRoute:{install:!0,uninstall:!0}}}),M=g(w,{name:r,versionInfo:{currentVersion:a},scanner:{allowArgumentEscapeSequence:!0}});export{A as a,M as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as C,c as b}from"./chunk-
|
|
1
|
+
import{a as C,c as b}from"./chunk-HNMMJLMB.js";import{a as d,b as f,c as u,d as y,e as w}from"./chunk-OD7IDDKP.js";import{a as h,b as a}from"./chunk-PTPKLIYD.js";import{b as g}from"./chunk-EV6OC476.js";import m from"chalk";async function k({url:o,targetDir:e,verbose:t=!1}){try{await a("git",["clone",o,e],{verbose:t,logCommandToConsole:!1})}catch(r){throw new Error(`Failed to clone repository from ${o}: ${r instanceof Error?r.message:"Unknown error"}`)}}async function x({targetDir:o,verbose:e=!1}){try{await a("git",["init"],{verbose:e,logCommandToConsole:!1,cwd:o}),await a("git",["add","."],{verbose:e,logCommandToConsole:!1,cwd:o}),await a("git",["commit","-m","Starter template"],{verbose:e,logCommandToConsole:!1,cwd:o})}catch(t){throw new Error(`Failed to initialize git repository: ${t instanceof Error?t.message:"Unknown error"}`)}}import P from"chalk";import{execa as U}from"execa";async function v(){try{await U("pnpm",["--version"],{stdio:"pipe"})}catch{console.error(P.red(`
|
|
2
2
|
Error: pnpm is required but not installed. Please install it first:`)),console.error(P.cyan(` npm i -g pnpm
|
|
3
3
|
`)),process.exit(1)}}import L from"enquirer";function j(o){return!o||o.trim().length===0?"App ID cannot be empty":o.length>64?"App ID must be 64 characters or less":/^[a-z][a-z0-9-]*$/.test(o)?!0:"App ID must be in kebab-case format (lowercase letters, numbers, and hyphens only, starting with a letter)"}async function T(o){console.log(`Project Configuration
|
|
4
4
|
`);let e=await L.prompt({type:"input",name:"appId",message:"Enter your app ID (kebab-case format)",initial:o,validate:j});return console.log(),{appId:e.appId}}import D from"node:path";import J from"chalk";var S="https://github.com/every-app/every-app.git",N="templates/simple-todo";async function E({appId:o,verbose:e=!1}){e&&console.log(`Cloning template repository...
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as S,e as b}from"./chunk-
|
|
1
|
+
import{d as S,e as b}from"./chunk-OD7IDDKP.js";import{a as R,b as D,c as u,d as w,e as $,f as m,g as d}from"./chunk-PTPKLIYD.js";import{b as E,e as h,g as C,i as T,j as k,l as x,p as A,q as _,r as K}from"./chunk-EV6OC476.js";import l from"chalk";import ne from"node:path";import c from"chalk";var J="every-app-gateway",Y="every-app-gateway";async function G({verbose:t=!1}={}){console.log(`
|
|
2
2
|
Setting up your Cloudflare D1 Database and KV Store...
|
|
3
3
|
`);let e=await h(),o=await B(J,e,t),r=await F(Y,e,t);return console.log(),{d1DatabaseId:o,kvNamespaceId:r,accountId:e}}async function B(t,e,o){o&&console.log(` Checking D1 database: ${t}`);let r=await T(t,e);return o?r.wasCreated?console.log(c.green(` Created D1 database: ${t} (${r.id})
|
|
4
4
|
`)):console.log(c.dim(` Linking to existing D1 database: ${t} (${r.id})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l,c}from"./chunk-
|
|
1
|
+
import{b as l,c}from"./chunk-HNMMJLMB.js";import{a as r}from"./chunk-PTPKLIYD.js";import{b as t}from"./chunk-EV6OC476.js";import o from"chalk";async function u(a){await t();let e=process.cwd(),p=a.verbose||!1,n=await l(e);if(console.log(o.bold(`
|
|
2
2
|
Project: ${n}
|
|
3
3
|
`)),!await r("this app")){console.log(o.red(`
|
|
4
4
|
Deployment cancelled by user
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r,b as o}from"./chunk-
|
|
2
|
+
import{a as r,b as o}from"./chunk-YNDW3QZD.js";import{run as i}from"@stricli/core";await i(o,process.argv.slice(2),r(process));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as i,t as c}from"./chunk-
|
|
1
|
+
import{b as i,t as c}from"./chunk-EV6OC476.js";import r from"chalk";import{execa as a}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 @every-app/cli app remote-d1-shell -- <command>
|
|
2
2
|
Example: npx @every-app/cli 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 l=await c(n);console.log(r.bold(`
|
|
3
3
|
Running: ${r.cyan([e,...t].join(" "))}
|
|
4
4
|
`)),await a(e,t,{cwd:n,stdio:"inherit",env:{...process.env,...l}}),console.log(`
|