@swirls/cli 0.0.3 → 0.0.5

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.
@@ -0,0 +1 @@
1
+ import*as o from"zod";async function l(t,r){await t.fsPromise.stat(r).then(()=>!0).catch(()=>!1)||await t.fsPromise.mkdir(r,{recursive:!0})}function a(t){if(!t.path)throw new Error("No `path` found in context.");if(!t.os)throw new Error("No `os` found in context.");let r=t.os.homedir();return t.path.join(r,".swirls")}var d=o.object({idToken:o.string(),jwt:o.string(),sessionId:o.string()});function c(t){return`${a(t)}/credentials`}async function R(t){let r=c(t);await t.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await t.fsPromise.unlink(r)}async function f(t){let r=c(t),n=await t.fsPromise.readFile(r,"utf8");return o.parse(d,JSON.parse(n))}async function U(t,r,n,e){let s=c(t);await l(t,a(t)),await t.fsPromise.writeFile(s,JSON.stringify({idToken:r,jwt:n,sessionId:e}))}import*as i from"zod";var w=i.object({API_URL:i.string(),OAUTH_AUTHORIZE_URL:i.string()}),C={API_URL:"https://api.swirls.local",OAUTH_AUTHORIZE_URL:"https://cool-haddock-93.clerk.accounts.dev/oauth/authorize"},m=i.parse(w,C);import{withResult as h}from"@byteslice/result";import{createORPCClient as x,onError as y}from"@orpc/client";import{RPCLink as L}from"@orpc/client/fetch";async function I(t){let r=new L({url:`${m.API_URL}/rpc`,headers:async()=>{let e=await h(()=>f(t),u=>new Error("Failed to read credentials file",{cause:u.message}));if(e.failure)return{};let{idToken:s,jwt:p}=e.data;return{Authorization:`Bearer ${p||s}`}},interceptors:[y(e=>{e instanceof Error&&e.name==="AbortError"||console.error(e)})]});return x(r)}export{a,R as b,f as c,U as d,m as e,I as f};
@@ -0,0 +1,2 @@
1
+ import g from"path";import{z as o}from"zod";var a="swirls.config.ts",r="@swirls/sdk/config",s="swirls.gen.ts",d=o.object({projectId:o.uuid(),genPath:o.string().min(1)});function m(t){return[`import { defineConfig } from '${r}'`,"","export default defineConfig({"," // swirls project identifier",` projectId: '${t||""}',`," // path to generated code",` genPath: 'src/${s}',`,"})",""].join(`
2
+ `)}import n from"fs/promises";import c from"path";async function l(t,e){let i=c.dirname(t);await n.mkdir(i,{recursive:!0}),await n.writeFile(t,e,"utf-8")}export{a,d as b,m as c,l as d};
@@ -0,0 +1 @@
1
+ import{Box as t,Text as o}from"ink";import{jsx as s,jsxs as r}from"react/jsx-runtime";function l(e){return r(t,{flexDirection:"column",children:[s(o,{color:"red",children:e.message}),s(o,{children:"If this issue persists, send us an email at help@byteslice.co, and we can help you out."})]})}import{Text as n}from"ink";import{jsx as i}from"react/jsx-runtime";function x(e){return i(n,{color:"green",children:e.message})}export{l as a,x as b};
@@ -0,0 +1 @@
1
+ import{buildInstallCommand as y,buildUninstallCommand as v}from"@stricli/auto-complete";import{buildApplication as w,buildRouteMap as x}from"@stricli/core";import{buildCommand as o,buildRouteMap as p}from"@stricli/core";var m=o({loader:async()=>{let{login:e}=await import("./implementation-QPK3NH6Y.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),u=o({loader:async()=>{let{logout:e}=await import("./implementation-QPK3NH6Y.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),i=p({routes:{login:m,logout:u},docs:{brief:"Auth commands"}});import{buildCommand as r,buildRouteMap as d}from"@stricli/core";var f=r({loader:async()=>{let{generateCode:e}=await import("./generate-code-2LPT3ZI6.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),b=r({loader:async()=>{let{initializeConfig:e}=await import("./initialize-config-CQ27WZUI.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),s=d({routes:{gen:f,init:b},docs:{brief:"Developer commands"}});import{buildCommand as g,buildRouteMap as h}from"@stricli/core";var C=g({loader:async()=>{let{createProject:e}=await import("./create-project-ELA4VHQG.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),n=h({routes:{create:C},docs:{brief:"Project commands"}});var a="@swirls/cli",c="0.0.5",l="Swirls command line application";var k=x({routes:{auth:i,dev:s,project:n,install:y("cli",{bash:"__cli_bash_complete"}),uninstall:v("cli",{bash:!0})},docs:{brief:l,hideRoute:{install:!0,uninstall:!0}}}),q=w(k,{name:a,versionInfo:{currentVersion:c}});import j from"fs";import R from"fs/promises";import P from"os";import S from"path";function Q(e){return{fs:j,fsPromise:R,os:P,path:S,process:e}}export{q as a,Q as b};