ripplo 0.1.5 → 0.1.6
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/index.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -238,7 +238,7 @@ ${n}`].join(`
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
`)});import{Box as Ts,Text as se}from"ink";import{jsx as Ae,jsxs as tt}from"react/jsx-runtime";function Or({config:e,error:t,selectProject:n,stage:r}){return tt(Ts,{flexDirection:"column",padding:1,children:[tt(se,{bold:!0,children:[" ","ripplo setup"]}),Ae(se,{children:""}),tt(se,{children:[Ae(se,{color:"green",children:" \u2713 "}),Ae(se,{children:"Authenticated"})]}),r==="scaffolding"?tt(se,{children:[Ae(se,{color:"yellow",children:" * "}),Ae(se,{children:"Setting up local environment..."})]}):Ae(Rs,{selectProject:n,serverUrl:e.ripploServerUrl}),t==null?null:Ae(Ts,{marginTop:1,children:tt(se,{color:"red",children:[" ","Error: ",t]})})]})}var bs=y(()=>{"use strict";Ns()});import{useEffect as Qm,useState as Ym}from"react";function Ue(){let[e,t]=Ym(Ls);return Qm(()=>{function n(){t(Ls())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Ls(){return{height:process.stdout.rows,width:process.stdout.columns}}var jt=y(()=>{"use strict"});import{useEffect as Zm,useRef as ef,useState as tf}from"react";function Cs({config:e,cwd:t}){let[n,r]=tf({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=ef(void 0);return Zm(()=>{function a({devSessionId:l}){r(s=>({...s,devSessionId:l,syncError:void 0,syncing:!1}))}function i(l){r(s=>({...s,syncError:l,syncing:!1}))}return Yi({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=wr({config:e,cwd:t,lastHash:s,onSyncError:i,onSyncSuccess:a})}).catch(l=>{let s=l instanceof Error?l.message:String(l);i(s),o.current=wr({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var vs=y(()=>{"use strict";Rr()});import rN from"chalk";import{z as xs}from"zod";async function Ps(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${nf}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return rf.parse(r).version}catch{return}finally{clearTimeout(t)}}var Ur,nf,rf,Es=y(()=>{"use strict";oe();Ur="0.1.5",nf="ripplo",rf=xs.object({version:xs.string()})});import{useEffect as of,useState as af}from"react";import{Text as we}from"ink";import{jsx as _e,jsxs as cf}from"react/jsx-runtime";function Os({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=df(),l=i!=null&&i!==Ur,s=sf({connected:n,syncError:o}),d=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${Ur}`,c=l?` \u2192 v${i}`:"",m="q to quit",g=` ripplo ${u}${c} | ${r} ${s}${d}${p}`,S=Math.max(0,a-g.length-m.length-1);return cf(we,{inverse:!0,children:[_e(we,{bold:!0,children:" ripplo "}),_e(we,{dimColor:!0,children:u}),l?_e(we,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,_e(we,{color:lf({connected:n,syncError:o}),children:s}),t?null:_e(we,{color:"yellow",children:d}),p," ".repeat(S),_e(we,{dimColor:!0,children:m})," "]})}function sf({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function lf({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function df(){let[e,t]=af();return of(()=>{Ps().then(n=>{n!=null&&t(n)})},[]),e}var Us=y(()=>{"use strict";Es()});import{Box as $t,Text as nt,useApp as pf,useInput as uf}from"ink";import{jsx as Ie,jsxs as Bt}from"react/jsx-runtime";function _s({config:e,cwd:t}){let n=pf(),{height:r,width:o}=Ue(),{config:a,devSessionId:i,syncError:l}=Cs({config:e,cwd:t}),{activeRunCount:s,browsersReady:d,connected:p}=ss({config:a,cwd:t,devSessionId:i});uf(c=>{c==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return Bt($t,{flexDirection:"column",height:r,width:o,children:[Ie(Os,{activeRunCount:s,browsersReady:d,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),Bt($t,{flexDirection:"column",flexGrow:1,padding:1,children:[Bt($t,{children:[Ie(nt,{children:"Developer dashboard: "}),Ie(nt,{color:"cyan",children:u})]}),Bt($t,{marginTop:1,children:[Ie(nt,{dimColor:!0,children:"Run "}),Ie(nt,{color:"yellow",children:"ripplo doctor"}),Ie(nt,{dimColor:!0,children:" for health checks"})]})]})]})}var Is=y(()=>{"use strict";jt();vs();Tr();Us()});import{Text as js}from"ink";import mf from"ink-spinner";import{jsx as $s,jsxs as yf}from"react/jsx-runtime";function Bs({loading:e}){return e?yf(js,{color:ff,children:[$s(mf,{type:"dots"})," Starting..."]}):$s(js,{children:""})}var ff,Ds=y(()=>{"use strict";ff="#24CFFF"});import{useEffect as gf,useState as rt}from"react";import{Box as Re,Text as _r,useInput as hf}from"ink";import{jsx as ye,jsxs as Ir}from"react/jsx-runtime";function Ws({onDismiss:e}){let{height:t,width:n}=Ue(),[r,o]=rt(0),[a,i]=rt(!1),[l,s]=rt(!1),[d,p]=rt(!1),[u,c]=rt(!1);hf(()=>{u&&e()}),gf(()=>{let S=80+Dt.length*70+80,h=[...Dt.map((A,k)=>setTimeout(()=>{o(k+1)},80+k*70)),setTimeout(()=>{i(!0)},S),setTimeout(()=>{s(!0)},S+200),setTimeout(()=>{p(!0)},S+400),setTimeout(()=>{p(!1),c(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{h.forEach(A=>{clearTimeout(A)})}},[e]);let m=Dt.length+5,g=Math.max(0,Math.floor((t-m)/2));return Ir(Re,{flexDirection:"column",height:t,width:n,children:[ye(Re,{height:g}),Ir(Re,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[ye(Re,{flexDirection:"column",children:Dt.map((S,h)=>ye(_r,{color:Vs,children:h<r?S:""},S))}),Ir(Re,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[ye(_r,{bold:!0,color:Vs,children:a?Sf:""}),ye(Re,{marginTop:1,children:ye(_r,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),ye(Re,{marginTop:2,children:ye(Bs,{loading:d})})]})]})]})}var Dt,Vs,Sf,qs=y(()=>{"use strict";jt();Ds();Dt=[" XXXX XXXXXXX "," XX XX X X "," XXX XX XX X X ","XXXXXX XX XX XXXXXXX ","XX XXX XX XX ","XX XXX XX XXXXXXXX "," XX XX XX XX "," XX XX XX XX "," XX XXXXX XX"," XX XX XX XX"," XX XX XXXX "," XXX XX "," XXXXXXXXX XX "," XXX XX "," XXXXXXX "],Vs="#24CFFF",Sf="ripplo"});import{createAuthClient as kf}from"better-auth/client";import{deviceAuthorizationClient as Af}from"better-auth/client/plugins";function Vt({baseURL:e}){return kf({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Af()]})}var jr=y(()=>{"use strict"});import{exec as wf}from"child_process";async function Ms({cwd:e,onDeviceCode:t,url:n}){let r=n??Ze().RIPPLO_SERVER_URL,o=Vt({baseURL:r}),a=await o.device.code({client_id:Fs});if(a.error!=null)throw new Error(`Failed to request device code: ${a.error.error_description}`);let{device_code:i,user_code:l,verification_uri_complete:s}=a.data;t({userCode:l,verificationUrl:s}),vf(s);let d=await Nf({authClient:o,deviceCode:i});return Un(e,d),d}async function Nf({authClient:e,deviceCode:t}){for(;;){await Lf(Rf);let n=await e.device.token({client_id:Fs,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return n.data.access_token;if(n.error==null)continue;if(!bf(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function bf(e){return Tf.has(e)}function Lf(e){return new Promise(t=>{setTimeout(t,e)})}function Cf(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function vf(e){let t=Cf();wf(`${t} "${e}"`,()=>{})}var Rf,Fs,Tf,Js=y(()=>{"use strict";oe();jr();Ct();Rf=5e3,Fs="ripplo-cli";Tf=new Set(["authorization_pending","slow_down"])});import{useCallback as $r,useEffect as xf,useState as je}from"react";import{execSync as Pf}from"child_process";import re from"fs";import ee from"path";function Xs({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=je(t==null?"login":"validating"),[a,i]=je(),[l,s]=je(),[d,p]=je(t),[u,c]=je(!1),[m,g]=je();xf(()=>{if(t==null)return;Vt({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(N=>{if(N.data==null){o("login");return}return Br({cwd:e,serverUrl:n,token:t})}).then(N=>{if(N==null){o("select-project");return}i(N),o("complete")}).catch(N=>{s(N instanceof Error?N.message:String(N)),o("login")})},[e,t,n]);let S=$r(()=>{u||(c(!0),s(void 0),Ms({cwd:e,onDeviceCode:g,url:n}).then(k=>(p(k),Br({cwd:e,serverUrl:n,token:k}))).then(k=>{k==null?o("select-project"):(i(k),o("complete"))}).catch(k=>{c(!1),g(void 0),s(k instanceof Error?k.message:String(k))}))},[e,u,n]),h=$r(k=>{let N=a?.token??d??t;if(N==null){s("No authentication token available");return}o("scaffolding"),s(void 0),Ef({cwd:e,projectId:k.id}).then(()=>Br({cwd:e,serverUrl:n,token:N})).then(C=>{i(C??{appUrl:"",preconditionsUrl:"",projectId:k.id,ripploServerUrl:n,token:N,webhookSecret:""}),o("complete")}).catch(C=>{s(C instanceof Error?C.message:String(C)),o("select-project")})},[a,e,t,n,d]),A=$r(()=>{i(void 0),o("login"),c(!1),g(void 0),s(void 0)},[]);return{config:a,deviceCodeInfo:m,error:l,loginStarted:u,resetToLogin:A,selectProject:h,setStage:o,stage:r,startLogin:S,token:d}}async function Br({cwd:e,serverUrl:t,token:n}){let r=await V(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Ef({cwd:e,projectId:t}){_f({cwd:e,projectId:t}),Vf(e),Of(e),await Sn()}function Of(e){let t=Uf(e),n=t==="yarn"?`yarn add -D ${zs.join(" ")}`:`${t} add -D ${zs.join(" ")}`;w.info("Installing dependencies: %s",n),Pf(n,{cwd:e,stdio:"pipe"})}function Uf(e){return re.existsSync(ee.join(e,"pnpm-lock.yaml"))?"pnpm":re.existsSync(ee.join(e,"yarn.lock"))?"yarn":re.existsSync(ee.join(e,"bun.lockb"))||re.existsSync(ee.join(e,"bun.lock"))?"bun":"npm"}function _f({cwd:e,projectId:t}){let n=ee.join(e,".ripplo"),r=ee.join(n,"tests"),o=ee.join(n,"preconditions");re.mkdirSync(r,{recursive:!0}),re.mkdirSync(o,{recursive:!0}),Wt(ee.join(n,"ripplo.ts"),If(t)),Wt(ee.join(n,"index.ts"),$f),Wt(ee.join(n,".env"),jf()),Wt(ee.join(n,"tsconfig.json"),Bf)}function Wt(e,t){re.existsSync(e)||re.writeFileSync(e,t)}function If(e){return`import { config } from "dotenv";
|
|
241
|
+
`)});import{Box as Ts,Text as se}from"ink";import{jsx as Ae,jsxs as tt}from"react/jsx-runtime";function Or({config:e,error:t,selectProject:n,stage:r}){return tt(Ts,{flexDirection:"column",padding:1,children:[tt(se,{bold:!0,children:[" ","ripplo setup"]}),Ae(se,{children:""}),tt(se,{children:[Ae(se,{color:"green",children:" \u2713 "}),Ae(se,{children:"Authenticated"})]}),r==="scaffolding"?tt(se,{children:[Ae(se,{color:"yellow",children:" * "}),Ae(se,{children:"Setting up local environment..."})]}):Ae(Rs,{selectProject:n,serverUrl:e.ripploServerUrl}),t==null?null:Ae(Ts,{marginTop:1,children:tt(se,{color:"red",children:[" ","Error: ",t]})})]})}var bs=y(()=>{"use strict";Ns()});import{useEffect as Qm,useState as Ym}from"react";function Ue(){let[e,t]=Ym(Ls);return Qm(()=>{function n(){t(Ls())}return process.stdout.on("resize",n),()=>{process.stdout.off("resize",n)}},[]),e}function Ls(){return{height:process.stdout.rows,width:process.stdout.columns}}var jt=y(()=>{"use strict"});import{useEffect as Zm,useRef as ef,useState as tf}from"react";function Cs({config:e,cwd:t}){let[n,r]=tf({config:e,devSessionId:void 0,syncError:void 0,syncing:!0}),o=ef(void 0);return Zm(()=>{function a({devSessionId:l}){r(s=>({...s,devSessionId:l,syncError:void 0,syncing:!1}))}function i(l){r(s=>({...s,syncError:l,syncing:!1}))}return Yi({config:e,cwd:t}).then(({devSessionId:l,hash:s})=>{a({devSessionId:l}),o.current=wr({config:e,cwd:t,lastHash:s,onSyncError:i,onSyncSuccess:a})}).catch(l=>{let s=l instanceof Error?l.message:String(l);i(s),o.current=wr({config:e,cwd:t,lastHash:"",onSyncError:i,onSyncSuccess:a})}),()=>{o.current?.()}},[e,t]),n}var vs=y(()=>{"use strict";Rr()});import rN from"chalk";import{z as xs}from"zod";async function Ps(){let e=new AbortController,t=setTimeout(()=>{e.abort()},3e3);try{let n=await fetch(`https://registry.npmjs.org/${nf}/latest`,{headers:{accept:"application/json"},signal:e.signal});if(!n.ok)return;let r=await n.json();return rf.parse(r).version}catch{return}finally{clearTimeout(t)}}var Ur,nf,rf,Es=y(()=>{"use strict";oe();Ur="0.1.6",nf="ripplo",rf=xs.object({version:xs.string()})});import{useEffect as of,useState as af}from"react";import{Text as we}from"ink";import{jsx as _e,jsxs as cf}from"react/jsx-runtime";function Os({activeRunCount:e,browsersReady:t,connected:n,ripploServerUrl:r,syncError:o,width:a}){let i=df(),l=i!=null&&i!==Ur,s=sf({connected:n,syncError:o}),d=t?"":" warming up browsers...",p=e>0?` ${String(e)} running`:"",u=`v${Ur}`,c=l?` \u2192 v${i}`:"",m="q to quit",g=` ripplo ${u}${c} | ${r} ${s}${d}${p}`,S=Math.max(0,a-g.length-m.length-1);return cf(we,{inverse:!0,children:[_e(we,{bold:!0,children:" ripplo "}),_e(we,{dimColor:!0,children:u}),l?_e(we,{color:"yellow",children:` \u2192 v${i}`}):null,` | ${r} `,_e(we,{color:lf({connected:n,syncError:o}),children:s}),t?null:_e(we,{color:"yellow",children:d}),p," ".repeat(S),_e(we,{dimColor:!0,children:m})," "]})}function sf({connected:e,syncError:t}){return t!=null?"sync failed":e?"connected":"connecting..."}function lf({connected:e,syncError:t}){return t!=null?"red":e?"green":"yellow"}function df(){let[e,t]=af();return of(()=>{Ps().then(n=>{n!=null&&t(n)})},[]),e}var Us=y(()=>{"use strict";Es()});import{Box as $t,Text as nt,useApp as pf,useInput as uf}from"ink";import{jsx as Ie,jsxs as Bt}from"react/jsx-runtime";function _s({config:e,cwd:t}){let n=pf(),{height:r,width:o}=Ue(),{config:a,devSessionId:i,syncError:l}=Cs({config:e,cwd:t}),{activeRunCount:s,browsersReady:d,connected:p}=ss({config:a,cwd:t,devSessionId:i});uf(c=>{c==="q"&&n.exit()});let u=`${a.ripploServerUrl}/projects/${a.projectId}/developer`;return Bt($t,{flexDirection:"column",height:r,width:o,children:[Ie(Os,{activeRunCount:s,browsersReady:d,connected:p,ripploServerUrl:a.ripploServerUrl,syncError:l,width:o}),Bt($t,{flexDirection:"column",flexGrow:1,padding:1,children:[Bt($t,{children:[Ie(nt,{children:"Developer dashboard: "}),Ie(nt,{color:"cyan",children:u})]}),Bt($t,{marginTop:1,children:[Ie(nt,{dimColor:!0,children:"Run "}),Ie(nt,{color:"yellow",children:"ripplo doctor"}),Ie(nt,{dimColor:!0,children:" for health checks"})]})]})]})}var Is=y(()=>{"use strict";jt();vs();Tr();Us()});import{Text as js}from"ink";import mf from"ink-spinner";import{jsx as $s,jsxs as yf}from"react/jsx-runtime";function Bs({loading:e}){return e?yf(js,{color:ff,children:[$s(mf,{type:"dots"})," Starting..."]}):$s(js,{children:""})}var ff,Ds=y(()=>{"use strict";ff="#24CFFF"});import{useEffect as gf,useState as rt}from"react";import{Box as Re,Text as _r,useInput as hf}from"ink";import{jsx as ye,jsxs as Ir}from"react/jsx-runtime";function Ws({onDismiss:e}){let{height:t,width:n}=Ue(),[r,o]=rt(0),[a,i]=rt(!1),[l,s]=rt(!1),[d,p]=rt(!1),[u,c]=rt(!1);hf(()=>{u&&e()}),gf(()=>{let S=80+Dt.length*70+80,h=[...Dt.map((A,k)=>setTimeout(()=>{o(k+1)},80+k*70)),setTimeout(()=>{i(!0)},S),setTimeout(()=>{s(!0)},S+200),setTimeout(()=>{p(!0)},S+400),setTimeout(()=>{p(!1),c(!0)},S+2e3),setTimeout(()=>{e()},S+2800)];return()=>{h.forEach(A=>{clearTimeout(A)})}},[e]);let m=Dt.length+5,g=Math.max(0,Math.floor((t-m)/2));return Ir(Re,{flexDirection:"column",height:t,width:n,children:[ye(Re,{height:g}),Ir(Re,{alignItems:"flex-start",flexDirection:"row",justifyContent:"center",children:[ye(Re,{flexDirection:"column",children:Dt.map((S,h)=>ye(_r,{color:Vs,children:h<r?S:""},S))}),Ir(Re,{flexDirection:"column",paddingLeft:4,paddingTop:5,children:[ye(_r,{bold:!0,color:Vs,children:a?Sf:""}),ye(Re,{marginTop:1,children:ye(_r,{color:"gray",dimColor:!0,children:l?"developer CLI":""})}),ye(Re,{marginTop:2,children:ye(Bs,{loading:d})})]})]})]})}var Dt,Vs,Sf,qs=y(()=>{"use strict";jt();Ds();Dt=[" XXXX XXXXXXX "," XX XX X X "," XXX XX XX X X ","XXXXXX XX XX XXXXXXX ","XX XXX XX XX ","XX XXX XX XXXXXXXX "," XX XX XX XX "," XX XX XX XX "," XX XXXXX XX"," XX XX XX XX"," XX XX XXXX "," XXX XX "," XXXXXXXXX XX "," XXX XX "," XXXXXXX "],Vs="#24CFFF",Sf="ripplo"});import{createAuthClient as kf}from"better-auth/client";import{deviceAuthorizationClient as Af}from"better-auth/client/plugins";function Vt({baseURL:e}){return kf({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[Af()]})}var jr=y(()=>{"use strict"});import{exec as wf}from"child_process";async function Ms({cwd:e,onDeviceCode:t,url:n}){let r=n??Ze().RIPPLO_SERVER_URL,o=Vt({baseURL:r}),a=await o.device.code({client_id:Fs});if(a.error!=null)throw new Error(`Failed to request device code: ${a.error.error_description}`);let{device_code:i,user_code:l,verification_uri_complete:s}=a.data;t({userCode:l,verificationUrl:s}),vf(s);let d=await Nf({authClient:o,deviceCode:i});return Un(e,d),d}async function Nf({authClient:e,deviceCode:t}){for(;;){await Lf(Rf);let n=await e.device.token({client_id:Fs,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(n.data?.access_token!=null)return n.data.access_token;if(n.error==null)continue;if(!bf(n.error.error))throw new Error(`Authorization failed: ${n.error.error_description}`)}}function bf(e){return Tf.has(e)}function Lf(e){return new Promise(t=>{setTimeout(t,e)})}function Cf(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function vf(e){let t=Cf();wf(`${t} "${e}"`,()=>{})}var Rf,Fs,Tf,Js=y(()=>{"use strict";oe();jr();Ct();Rf=5e3,Fs="ripplo-cli";Tf=new Set(["authorization_pending","slow_down"])});import{useCallback as $r,useEffect as xf,useState as je}from"react";import{execSync as Pf}from"child_process";import re from"fs";import ee from"path";function Xs({cwd:e,initialToken:t,serverUrl:n}){let[r,o]=je(t==null?"login":"validating"),[a,i]=je(),[l,s]=je(),[d,p]=je(t),[u,c]=je(!1),[m,g]=je();xf(()=>{if(t==null)return;Vt({baseURL:n}).getSession({fetchOptions:{headers:{Authorization:`Bearer ${t}`}}}).then(N=>{if(N.data==null){o("login");return}return Br({cwd:e,serverUrl:n,token:t})}).then(N=>{if(N==null){o("select-project");return}i(N),o("complete")}).catch(N=>{s(N instanceof Error?N.message:String(N)),o("login")})},[e,t,n]);let S=$r(()=>{u||(c(!0),s(void 0),Ms({cwd:e,onDeviceCode:g,url:n}).then(k=>(p(k),Br({cwd:e,serverUrl:n,token:k}))).then(k=>{k==null?o("select-project"):(i(k),o("complete"))}).catch(k=>{c(!1),g(void 0),s(k instanceof Error?k.message:String(k))}))},[e,u,n]),h=$r(k=>{let N=a?.token??d??t;if(N==null){s("No authentication token available");return}o("scaffolding"),s(void 0),Ef({cwd:e,projectId:k.id}).then(()=>Br({cwd:e,serverUrl:n,token:N})).then(C=>{i(C??{appUrl:"",preconditionsUrl:"",projectId:k.id,ripploServerUrl:n,token:N,webhookSecret:""}),o("complete")}).catch(C=>{s(C instanceof Error?C.message:String(C)),o("select-project")})},[a,e,t,n,d]),A=$r(()=>{i(void 0),o("login"),c(!1),g(void 0),s(void 0)},[]);return{config:a,deviceCodeInfo:m,error:l,loginStarted:u,resetToLogin:A,selectProject:h,setStage:o,stage:r,startLogin:S,token:d}}async function Br({cwd:e,serverUrl:t,token:n}){let r=await V(e);if(r.ok)return{...r.result.config,ripploServerUrl:t,token:n}}async function Ef({cwd:e,projectId:t}){_f({cwd:e,projectId:t}),Vf(e),Of(e),await Sn()}function Of(e){let t=Uf(e),n=t==="yarn"?`yarn add -D ${zs.join(" ")}`:`${t} add -D ${zs.join(" ")}`;w.info("Installing dependencies: %s",n),Pf(n,{cwd:e,stdio:"pipe"})}function Uf(e){return re.existsSync(ee.join(e,"pnpm-lock.yaml"))?"pnpm":re.existsSync(ee.join(e,"yarn.lock"))?"yarn":re.existsSync(ee.join(e,"bun.lockb"))||re.existsSync(ee.join(e,"bun.lock"))?"bun":"npm"}function _f({cwd:e,projectId:t}){let n=ee.join(e,".ripplo"),r=ee.join(n,"tests"),o=ee.join(n,"preconditions");re.mkdirSync(r,{recursive:!0}),re.mkdirSync(o,{recursive:!0}),Wt(ee.join(n,"ripplo.ts"),If(t)),Wt(ee.join(n,"index.ts"),$f),Wt(ee.join(n,".env"),jf()),Wt(ee.join(n,"tsconfig.json"),Bf)}function Wt(e,t){re.existsSync(e)||re.writeFileSync(e,t)}function If(e){return`import { config } from "dotenv";
|
|
242
242
|
import { createRipplo } from "@ripplo/testing";
|
|
243
243
|
import { z } from "zod";
|
|
244
244
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripplo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "CLI for Ripplo — AI-powered end-to-end testing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://ripplo.ai",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"tsup": "^8.5.1",
|
|
55
55
|
"typescript": "catalog:",
|
|
56
56
|
"@ripplo/eslint-config": "0.0.0",
|
|
57
|
-
"@ripplo/graphql": "^0.0.0",
|
|
58
|
-
"@ripplo/testing": "^0.0.4",
|
|
59
57
|
"@ripplo/runtime": "^0.0.0",
|
|
60
|
-
"@ripplo/spec": "^0.0.0"
|
|
58
|
+
"@ripplo/spec": "^0.0.0",
|
|
59
|
+
"@ripplo/graphql": "^0.0.0",
|
|
60
|
+
"@ripplo/testing": "^0.0.5"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "tsx watch src/index.ts",
|