@every-app/cli 0.0.9 → 0.0.10
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
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-QCW37DWS.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,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 v,buildUninstallCommand as D}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-
|
|
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 v,buildUninstallCommand as D}from"@stricli/auto-complete";var r="@every-app/cli";var n="Every App CLI - Deploy and manage apps.";var a="0.0.10";import{buildCommand as o,buildRouteMap as m}from"@stricli/core";var c=o({loader:async()=>import("./create-NSFBGITH.js"),parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Create a new app from the starter template",fullDescription:["Copies the simple-todo starter template and configures your local development environment.","","The command will:"," 1. Prompt for app ID (kebab-case) and package manager"," 2. Copy the template to a new directory"," 3. Create Cloudflare D1 database and KV namespace"," 4. Configure wrangler.jsonc, package.json, and .env files"," 5. Install dependencies and run local migrations","","After creation, run 'npm run dev' to start developing."].join(`
|
|
2
|
+
`)}}),u=o({loader:async()=>{let{deploy:e}=await import("./deploy-YNE66BHZ.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
3
|
`)}}),y=o({loader:async()=>{let{remoteD1Shell:e}=await import("./remoteD1Shell-KTDD4RTN.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: every app remote-d1-shell -- npx drizzle-kit migrate"," - Opening Drizzle Studio: every app remote-d1-shell -- npx drizzle-kit studio"," - Pushing schema changes: every 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
4
|
`)}}),s=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-OU5FTS67.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}}},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
|
`)}}),i=b({routes:{deploy:h},docs:{brief:"Gateway management commands"}});var w=C({routes:{app:s,gateway:i,install:v("every",{bash:"__every_bash_complete"}),uninstall:D("every",{bash:!0})},docs:{brief:n,hideRoute:{install:!0,uninstall:!0}}}),G=g(w,{name:r,versionInfo:{currentVersion:a},scanner:{allowArgumentEscapeSequence:!0}});export{A as a,G as b};
|
|
@@ -20,16 +20,16 @@ D1 Query Error:`)),console.error(n.dim(`SQL: ${a}`)),console.error(n.dim(`Error:
|
|
|
20
20
|
D1 Query Error:`)),console.error(n.dim(`SQL: ${a}`))),r}}async function M(o,t,a,r){console.log(n.bold(`
|
|
21
21
|
Setting up UserApp records...
|
|
22
22
|
`));try{let e=await $(),s=(await v()).find(l=>l.name==="every-app-gateway");if(!s){console.warn(n.yellow(`every-app-gateway database not found. Skipping UserApp record creation.
|
|
23
|
-
`));return}let c=s.uuid,d=await f(e,c,"SELECT id, name, email FROM users");if(d.length===0)throw new Error("No users found in the database. Please create a user first before deploying apps.");let p=a||o,
|
|
23
|
+
`));return}let c=s.uuid,d=await f(e,c,"SELECT id, name, email FROM users");if(d.length===0)throw new Error("No users found in the database. Please create a user first before deploying apps.");let p=a||o,m=r||o;if(d.length===1){let l=d[0],u=Math.floor(Date.now()/1e3);if((await f(e,c,`SELECT id FROM user_apps WHERE user_id = '${l.id}' AND app_id = '${o}'`)).length>0)console.log(n.yellow(`UserApp record already exists for user ${l.name} (${l.email}), skipping...
|
|
24
24
|
`));else{let w=`
|
|
25
|
-
INSERT INTO user_apps (id, user_id, app_id, name, description, app_url,
|
|
26
|
-
VALUES ('${A()}', '${l.id}', '${o}', '${p}', '${
|
|
25
|
+
INSERT INTO user_apps (id, user_id, app_id, name, description, app_url, created_at, updated_at)
|
|
26
|
+
VALUES ('${A()}', '${l.id}', '${o}', '${p}', '${m}', '${t}', ${u}, ${u})
|
|
27
27
|
`;await f(e,c,w),console.log(n.green(`UserApp record created for user ${l.name} (${l.email})
|
|
28
28
|
`))}}else{console.log(n.yellow(`Multiple users found (${d.length}). Adding app to all users...
|
|
29
|
-
`));for(let l of d){let
|
|
29
|
+
`));for(let l of d){let u=Math.floor(Date.now()/1e3);if((await f(e,c,`SELECT id FROM user_apps WHERE user_id = '${l.id}' AND app_id = '${o}'`)).length>0)console.log(n.dim(` App already exists for user ${l.name} (${l.email}), skipping...
|
|
30
30
|
`));else{let w=`
|
|
31
|
-
INSERT INTO user_apps (id, user_id, app_id, name, description, app_url,
|
|
32
|
-
VALUES ('${A()}', '${l.id}', '${o}', '${p}', '${
|
|
31
|
+
INSERT INTO user_apps (id, user_id, app_id, name, description, app_url, created_at, updated_at)
|
|
32
|
+
VALUES ('${A()}', '${l.id}', '${o}', '${p}', '${m}', '${t}', ${u}, ${u})
|
|
33
33
|
`;await f(e,c,w),console.log(n.dim(` Added app for user ${l.name} (${l.email})
|
|
34
34
|
`))}}console.log(n.green(`UserApp records processed for ${d.length} users
|
|
35
35
|
`))}}catch(e){throw console.error(n.red("Failed to insert UserApp records:"),e instanceof Error?e.message:e),e}}async function O(o,t=!1,a=!1){try{console.log(n.bold(`
|
|
@@ -37,7 +37,7 @@ Reading project configuration...
|
|
|
37
37
|
`));let r=await E(o);if(!r.name)throw new Error("Worker name not found in wrangler.jsonc. Please add a 'name' field.");let e=r.name;if(console.log(n.dim(`Project name: ${e}
|
|
38
38
|
`)),!t&&!await C("Do you want to deploy this app to Cloudflare?")){console.log(n.red(`
|
|
39
39
|
Deployment cancelled by user
|
|
40
|
-
`));return}let{d1Updates:i,kvUpdates:s}=await T(r,e),c=await b("every-app-gateway");await S(o,i,s,c),await D(o,a),await j(o,r),await x(o,c,e,a);let d=await b(r.name),p,
|
|
40
|
+
`));return}let{d1Updates:i,kvUpdates:s}=await T(r,e),c=await b("every-app-gateway");await S(o,i,s,c),await D(o,a),await j(o,r),await x(o,c,e,a);let d=await b(r.name),p,m;r.name==="every-todo-app"&&(p="Todos",m="Minimal todo list"),await M(r.name,d,p,m),console.log(n.bold.green(`\u{1F389} Deployment successful!
|
|
41
41
|
`)),console.log(n.bold(`Your app is now live at: ${n.cyan(d)}
|
|
42
42
|
`)),console.log(n.dim(`Try it out by visiting the URL above in your browser.
|
|
43
43
|
`))}catch(r){throw console.error(n.red(`
|
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-QCW37DWS.js";import{run as i}from"@stricli/core";await i(o,process.argv.slice(2),r(process));
|