Comparing version 1.0.1 to 1.0.2
@@ -5,4 +5,4 @@ | ||
import{Box as Wo}from"ink";import c from"react";import{$ as u}from"execa";var T=(e=>(e.FOCUSED="green",e.UNFOCUSED="white",e))(T||{}),w=(n=>(n.QUIT="q",n.INSTALL="i",n.UNINSTALL="u",n.GLOBAL="g",n.TOGGLE="a",n))(w||{}),po=(t=>(t[t.PLUGINS=0]="PLUGINS",t[t.VERSIONS=1]="VERSIONS",t[t.GLOBAL=2]="GLOBAL",t))(po||{});var fo="[\u2191/\u2193] movement",co="[q]uit",x=o=>o?"green":"white";function h(o){return o.trim().split(` | ||
`)}function A(o){return o.map(r=>({label:r,value:r}))}function b(o,r,e){return e?`${o} (${r}/${e})`:`${o} (${r})`}function U(){return`${fo} | [i]nstall | [u]nintstall | [g]lobal | ${co}`}function E(){process.stdout.write("\x1B[2J\x1B[3J\x1B[H\x1Bc")}import uo from"node:fs";import go from"node:os";import xo from"node:readline";var k=async()=>{try{let{stdout:o}=await u`asdf plugin list`,r=h(o);return A(r)}catch{return[]}},H=async o=>{try{let{stdout:r}=await u`asdf list all ${o}`,e=h(r);return A(e).reverse()}catch{return[]}},z=async({name:o,version:r})=>{try{return await u`asdf install ${o} ${r}`,!0}catch{return!1}},q=async({name:o,version:r})=>{try{return await u`asdf uninstall ${o} ${r.replace("\u{1F30E}","").trim()}`,!0}catch{return!1}},J=async()=>{try{let{stdout:o}=await u`asdf current`,r=o.trim();return h(r).map(i=>{let n=i.trim().split(/\s+/);return{name:n[0],version:n[1]}})}catch{return[]}},Q=async({name:o,version:r})=>{try{return await u`asdf global ${o} ${r}`,!0}catch{return!1}},W=async o=>{if(o==="")return[];try{let{stdout:r}=await u`asdf list ${o}`;if(r==="")return[];let e=h(r);return A(e.map(i=>(i=i.trim(),i.startsWith("*")&&(i=i.replace("*","")+" \u{1F30E}"),i))).reverse()}catch{return[]}};async function ir(o){let r=`${go.homedir()}/.tool-versions`;return new Promise((e,t)=>{let i,n=xo.createInterface({input:uo.createReadStream(r)});n.on("line",function(a){a.includes(o)&&(i=a.split(" ")[1])}),n.on("close",()=>e(i)),n.on("error",t)})}import{Box as bo,Text as Lo}from"ink";import Y from"react";function j(){return Y.createElement(bo,{width:"100%",minHeight:5,marginTop:1,justifyContent:"center",flexWrap:"wrap"},Y.createElement(Lo,{color:"blue",bold:!0},U()))}import{Box as Io,useApp as Vo,useInput as Po}from"ink";import vo from"react";var X=({children:o,borderColor:r})=>{let{exit:e}=Vo();return Po(t=>{t==="q"&&e()}),vo.createElement(Io,{width:"100%",borderColor:r,minHeight:20,gap:1,marginTop:2},o)};import{Spinner as So}from"@inkjs/ui";import{Box as ho}from"ink";import M from"react";var L=({label:o})=>M.createElement(ho,{padding:2},M.createElement(So,{type:"dots",label:o}));import{Box as yo,Text as Co}from"ink";import Z from"react";function I({label:o,color:r}){return Z.createElement(yo,{alignSelf:"center",marginTop:-1},Z.createElement(Co,{bold:!0,color:r},o))}import{Box as To,Text as _}from"ink";import F from"react";function K({label:o}){let[r,e]=o.split(" ");return F.createElement(To,{gap:1},F.createElement(_,null,r),F.createElement(_,{color:"green",bold:!0},e))}import{Alert as Ao}from"@inkjs/ui";import{Box as Bo}from"ink";import R from"react";var g=o=>{let r={variant:"info",...o};return R.createElement(Bo,{marginTop:1,marginRight:4},R.createElement(Ao,{variant:r.variant},r.label))};import Do from"ink-select-input";import{Box as $o,useFocus as Go}from"ink";import y,{useEffect as No}from"react";import{create as wo}from"zustand";var oo={value:"",label:""},d=wo()(o=>({plugins:[],isLoading:!1,currentlySelected:oo,selectPlugin:r=>o({currentlySelected:r}),getAllLocalPlugins:async()=>{o(e=>({isLoading:!e.isLoading}));let r=await k();o({plugins:r}),o({currentlySelected:r.length>0?r[0]:oo}),o(e=>({isLoading:!e.isLoading}))}}));import{create as Fo}from"zustand";var V=Fo()(o=>({availableVersions:[],installedVersions:[],isLoading:!1,getAvailabeVersions:async r=>{o(t=>({isLoading:!t.isLoading}));let e=await H(r);o({availableVersions:e}),o(t=>({isLoading:!t.isLoading}))},getInstalledVersions:async r=>{o(t=>({isLoading:!t.isLoading}));let e=await W(r);o({installedVersions:e}),o(t=>({isLoading:!t.isLoading}))}}));import{create as Oo}from"zustand";var P=Oo()(o=>({isLoading:!1,versions:[],getAllInfo:async()=>{o(e=>({isLoading:!e.isLoading}));let r=await J();o({versions:r}),o(e=>({isLoading:!e.isLoading}))}}));function ro(){let{isFocused:o}=Go({id:"plugins",autoFocus:!0}),r=d(a=>a.getAllLocalPlugins),e=d(a=>a.selectPlugin),t=d(a=>a.plugins),i=d(a=>a.isLoading),n=a=>{e({value:a.value,label:a.label})};return No(()=>{r()},[]),y.createElement($o,{borderStyle:"double",borderColor:x(o),flexDirection:"column",minHeight:20,paddingLeft:2},y.createElement(I,{label:b("Plugins",t.length),color:x(o)}),i&&y.createElement(L,{label:"Fetching installed asdf plugins"}),!i&&y.createElement(Do,{limit:10,items:t,isFocused:o,onHighlight:n}),!i&&t.length===0&&y.createElement(g,{label:"No installed plugins found"}))}import{Box as Eo,useFocus as ko,useInput as Ho}from"ink";import O,{useEffect as zo,useState as D}from"react";import Uo from"ink-select-input";import v from"react";var eo=({isFocused:o,isOnline:r,isLocal:e,isLoading:t,pluginName:i,versions:n,setSelectedVersion:a})=>v.createElement(v.Fragment,null,!e&&r&&t&&v.createElement(L,{label:`Fetching available ${i} versions`}),r&&!t&&n.length>0&&v.createElement(Uo,{limit:38,isFocused:o,items:n,onHighlight:a,itemComponent:K}),!t&&n.length===0&&v.createElement(g,{label:`No versions found for plugin ${i}`}),!r&&!t&&v.createElement(g,{label:"No internet",variant:"error"}));import qo from"is-online";function to(){let{isFocused:o}=ko({id:"versions"}),[r,e]=D(),[t,i]=D(!0),[n,a]=D(!0),p=d(m=>m.currentlySelected),so=V(m=>m.getAvailabeVersions),C=V(m=>m.getInstalledVersions),B=P(m=>m.getAllInfo);function lo(m){e(m)}let ao=V(m=>m.isLoading),S=V(m=>m.availableVersions),N=V(m=>m.installedVersions);return zo(()=>{n?(async()=>{C(p.label),e(S[0]??void 0)})():(async()=>{let mo=await qo();i(mo),so(p.label),e(S[0]??void 0)})()},[p.label,n]),Ho(async m=>{if(o)switch(m){case"i":{await z({name:p.label,version:r.value}).then(async()=>{await Promise.all([B(),C(p.label)]),a(!0)});break}case"u":{await q({name:p.label,version:r.value}).then(async()=>{await Promise.all([B(),C(p.label)])});break}case"g":{await Q({name:p.label,version:r.value}).then(async()=>{await Promise.all([B(),C(p.label)])});break}case"a":{a(!n);break}default:}}),O.createElement(Eo,{borderStyle:"double",borderColor:x(o),flexDirection:"column",width:"70%",minHeight:20,paddingLeft:4},O.createElement(I,{label:b("Versions",N.length,S.length>0?S.length:"-"),color:x(o)}),O.createElement(eo,{setSelectedVersion:lo,isOnline:t,isFocused:o,isLoading:ao,isLocal:n,versions:n?N:S,pluginName:p.label}))}import{Box as $,Spacer as Jo,Text as no}from"ink";import f,{useEffect as Qo}from"react";function io(){let o=P(t=>t.getAllInfo),r=P(t=>t.versions),e=P(t=>t.isLoading);return Qo(()=>{o()},[]),f.createElement($,{borderStyle:"double",borderColor:"white",flexDirection:"column",minHeight:20,paddingLeft:2},f.createElement(I,{label:b("Info",r.length),color:"white"}),e&&f.createElement(L,{label:"Fetching info"}),f.createElement($,{paddingY:2,paddingX:4,flexDirection:"column"},r.map((t,i)=>f.createElement($,{marginY:.5,key:i},f.createElement(no,null,t.name),f.createElement(Jo,null),f.createElement(no,null,t.version)))),!e&&r.length===0&&f.createElement(g,{label:"No versions found"}))}function G(){return c.createElement(c.Fragment,null,c.createElement(X,{borderColor:"white"},c.createElement(Wo,{flexDirection:"column",width:"50%"},c.createElement(io,null),c.createElement(ro,null)),c.createElement(to,null)),c.createElement(j,null))}import Yo from"react";import{render as jo}from"ink";E();jo(Yo.createElement(G,null));export{T as BorderColor,j as CommandInfo,g as CustomAlert,K as CustomItem,io as Info,w as Keys,L as Loader,X as PanesContainer,ro as Plugins,po as TabName,I as Title,to as Versions,E as clearConsole,A as formatPluginData,x as getBorderColorOnFocus,U as getCommandInfo,ir as getGlobalVersionForTool,J as getInfo,z as installToolVersion,k as listAllPlugins,W as listInstalledToolsVersions,H as listToolsVersions,h as sanitizeData,Q as setVersionGlobal,b as totalNumber,q as uninstallToolVersion,P as useInfosStore,d as usePluginsStore,V as useVersionsStore}; | ||
import{Box as Wo}from"ink";import c from"react";import{$ as u}from"execa";var T=(r=>(r.FOCUSED="green",r.UNFOCUSED="white",r))(T||{}),w=(n=>(n.QUIT="q",n.INSTALL="i",n.UNINSTALL="u",n.GLOBAL="g",n.TOGGLE="a",n))(w||{}),po=(t=>(t[t.PLUGINS=0]="PLUGINS",t[t.VERSIONS=1]="VERSIONS",t[t.GLOBAL=2]="GLOBAL",t))(po||{});var fo="[\u2191/\u2193] movement",co="[q]uit",x=o=>o?"green":"white";function h(o){return o.trim().split(` | ||
`)}function A(o){return o.map(e=>({label:e,value:e}))}function b(o,e,r){return r?`${o} (${e}/${r})`:`${o} (${e})`}function U(){return`${fo} | [i]nstall | [u]nintstall | [g]lobal | ${co}`}function E(){process.stdout.write("\x1B[2J\x1B[3J\x1B[H\x1Bc")}import uo from"node:fs";import go from"node:os";import xo from"node:readline";var k=async()=>{try{let{stdout:o}=await u`asdf plugin list`,e=h(o);return A(e)}catch{return[]}},H=async o=>{try{let{stdout:e}=await u`asdf list all ${o}`,r=h(e);return A(r).reverse()}catch{return[]}},z=async({name:o,version:e})=>{try{return await u`asdf install ${o} ${e}`,!0}catch{return!1}},q=async({name:o,version:e})=>{try{return await u`asdf uninstall ${o} ${e.replace("\u{1F30E}","").trim()}`,!0}catch{return!1}},J=async()=>{try{let{stdout:o}=await u`asdf current`,e=o.trim();return h(e).map(i=>{let n=i.trim().split(/\s+/);return{name:n[0],version:n[1]}})}catch{return[]}},Q=async({name:o,version:e})=>{try{return await u`asdf global ${o} ${e}`,!0}catch{return!1}},W=async o=>{if(o==="")return[];try{let{stdout:e}=await u`asdf list ${o}`;if(e==="")return[];let r=h(e);return A(r.map(i=>(i=i.trim(),i.startsWith("*")&&(i=i.replace("*","")+" \u{1F30E}"),i))).reverse()}catch{return[]}};async function ie(o){let e=`${go.homedir()}/.tool-versions`;return new Promise((r,t)=>{let i,n=xo.createInterface({input:uo.createReadStream(e)});n.on("line",function(a){a.includes(o)&&(i=a.split(" ")[1])}),n.on("close",()=>r(i)),n.on("error",t)})}import{Box as bo,Text as Lo}from"ink";import Y from"react";function j(){return Y.createElement(bo,{width:"100%",minHeight:5,marginTop:1,justifyContent:"center",flexWrap:"wrap"},Y.createElement(Lo,{color:"blue",bold:!0},U()))}import{Alert as Io}from"@inkjs/ui";import{Box as Vo}from"ink";import X from"react";var g=o=>{let e={variant:"info",...o};return X.createElement(Vo,{marginTop:1,marginRight:4},X.createElement(Io,{variant:e.variant},e.label))};import{Box as Po,Text as M}from"ink";import F from"react";function Z({label:o}){let[e,r]=o.split(" ");return F.createElement(Po,{gap:1},F.createElement(M,null,e),F.createElement(M,{color:"green",bold:!0},r))}import{Spinner as vo}from"@inkjs/ui";import{Box as So}from"ink";import _ from"react";var L=({label:o})=>_.createElement(So,{padding:2},_.createElement(vo,{type:"dots",label:o}));import{Box as ho,useApp as yo,useInput as Co}from"ink";import To from"react";var K=({children:o,borderColor:e})=>{let{exit:r}=yo();return Co(t=>{t==="q"&&r()}),To.createElement(ho,{width:"100%",borderColor:e,minHeight:20,gap:1,marginTop:2},o)};import{Box as Ao,Text as Bo}from"ink";import R from"react";function I({label:o,color:e}){return R.createElement(Ao,{alignSelf:"center",marginTop:-1},R.createElement(Bo,{bold:!0,color:e},o))}import wo from"ink-select-input";import V from"react";var oo=({isFocused:o,isOnline:e,isLocal:r,isLoading:t,pluginName:i,versions:n,setSelectedVersion:a})=>V.createElement(V.Fragment,null,!r&&e&&t&&V.createElement(L,{label:`Fetching available ${i} versions`}),e&&!t&&n.length>0&&V.createElement(wo,{limit:38,isFocused:o,items:n,onHighlight:a,itemComponent:Z}),!t&&n.length===0&&V.createElement(g,{label:`No versions found for plugin ${i}`}),!e&&!t&&V.createElement(g,{label:"No internet",variant:"error"}));import $o from"ink-select-input";import{Box as Go,useFocus as No}from"ink";import y,{useEffect as Uo}from"react";import{create as Fo}from"zustand";var eo={value:"",label:""},d=Fo()(o=>({plugins:[],isLoading:!1,currentlySelected:eo,selectPlugin:e=>o({currentlySelected:e}),getAllLocalPlugins:async()=>{o(r=>({isLoading:!r.isLoading}));let e=await k();o({plugins:e}),o({currentlySelected:e.length>0?e[0]:eo}),o(r=>({isLoading:!r.isLoading}))}}));import{create as Oo}from"zustand";var P=Oo()(o=>({availableVersions:[],installedVersions:[],isLoading:!1,getAvailabeVersions:async e=>{o(t=>({isLoading:!t.isLoading}));let r=await H(e);o({availableVersions:r}),o(t=>({isLoading:!t.isLoading}))},getInstalledVersions:async e=>{o(t=>({isLoading:!t.isLoading}));let r=await W(e);o({installedVersions:r}),o(t=>({isLoading:!t.isLoading}))}}));import{create as Do}from"zustand";var v=Do()(o=>({isLoading:!1,versions:[],getAllInfo:async()=>{o(r=>({isLoading:!r.isLoading}));let e=await J();o({versions:e}),o(r=>({isLoading:!r.isLoading}))}}));function ro(){let{isFocused:o}=No({id:"plugins",autoFocus:!0}),e=d(a=>a.getAllLocalPlugins),r=d(a=>a.selectPlugin),t=d(a=>a.plugins),i=d(a=>a.isLoading),n=a=>{r({value:a.value,label:a.label})};return Uo(()=>{e()},[]),y.createElement(Go,{borderStyle:"double",borderColor:x(o),flexDirection:"column",minHeight:20,paddingLeft:2},y.createElement(I,{label:b("Plugins",t.length),color:x(o)}),i&&y.createElement(L,{label:"Fetching installed asdf plugins"}),!i&&y.createElement($o,{limit:10,items:t,isFocused:o,onHighlight:n}),!i&&t.length===0&&y.createElement(g,{label:"No installed plugins found"}))}import{Box as Eo,useFocus as ko,useInput as Ho}from"ink";import O,{useEffect as zo,useState as D}from"react";import qo from"is-online";function to(){let{isFocused:o}=ko({id:"versions"}),[e,r]=D(),[t,i]=D(!0),[n,a]=D(!0),p=d(m=>m.currentlySelected),so=P(m=>m.getAvailabeVersions),C=P(m=>m.getInstalledVersions),B=v(m=>m.getAllInfo);function lo(m){r(m)}let ao=P(m=>m.isLoading),S=P(m=>m.availableVersions),N=P(m=>m.installedVersions);return zo(()=>{n?(async()=>{C(p.label),r(S[0]??void 0)})():(async()=>{let mo=await qo();i(mo),so(p.label),r(S[0]??void 0)})()},[p.label,n]),Ho(async m=>{if(o)switch(m){case"i":{await z({name:p.label,version:e.value}).then(async()=>{await Promise.all([B(),C(p.label)]),a(!0)});break}case"u":{await q({name:p.label,version:e.value}).then(async()=>{await Promise.all([B(),C(p.label)])});break}case"g":{await Q({name:p.label,version:e.value}).then(async()=>{await Promise.all([B(),C(p.label)])});break}case"a":{a(!n);break}default:}}),O.createElement(Eo,{borderStyle:"double",borderColor:x(o),flexDirection:"column",width:"70%",minHeight:20,paddingLeft:4},O.createElement(I,{label:b("Versions",N.length,S.length>0?S.length:"-"),color:x(o)}),O.createElement(oo,{setSelectedVersion:lo,isOnline:t,isFocused:o,isLoading:ao,isLocal:n,versions:n?N:S,pluginName:p.label}))}import{Box as $,Spacer as Jo,Text as no}from"ink";import f,{useEffect as Qo}from"react";function io(){let o=v(t=>t.getAllInfo),e=v(t=>t.versions),r=v(t=>t.isLoading);return Qo(()=>{o()},[]),f.createElement($,{borderStyle:"double",borderColor:"white",flexDirection:"column",minHeight:20,paddingLeft:2},f.createElement(I,{label:b("Info",e.length),color:"white"}),r&&f.createElement(L,{label:"Fetching info"}),f.createElement($,{paddingY:2,paddingX:4,flexDirection:"column"},e.map((t,i)=>f.createElement($,{marginY:.5,key:i},f.createElement(no,null,t.name),f.createElement(Jo,null),f.createElement(no,null,t.version)))),!r&&e.length===0&&f.createElement(g,{label:"No versions found"}))}function G(){return c.createElement(c.Fragment,null,c.createElement(K,{borderColor:"white"},c.createElement(Wo,{flexDirection:"column",width:"50%"},c.createElement(io,null),c.createElement(ro,null)),c.createElement(to,null)),c.createElement(j,null))}import Yo from"react";import{render as jo}from"ink";E();jo(Yo.createElement(G,null));export{T as BorderColor,j as CommandInfo,g as CustomAlert,Z as CustomItem,io as Info,w as Keys,L as Loader,K as PanesContainer,ro as Plugins,po as TabName,I as Title,to as Versions,oo as VersionsDisplay,E as clearConsole,A as formatPluginData,x as getBorderColorOnFocus,U as getCommandInfo,ie as getGlobalVersionForTool,J as getInfo,z as installToolVersion,k as listAllPlugins,W as listInstalledToolsVersions,H as listToolsVersions,h as sanitizeData,Q as setVersionGlobal,b as totalNumber,q as uninstallToolVersion,v as useInfosStore,d as usePluginsStore,P as useVersionsStore}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "asdfui", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"bin": "dist/cli.js", | ||
@@ -48,18 +48,19 @@ "type": "module", | ||
"react": "^18.2.0", | ||
"tsup": "^7.2.0", | ||
"tsup": "^7.3.0", | ||
"zustand": "^4.4.6" | ||
}, | ||
"devDependencies": { | ||
"@rubiin/eslint-config": "^1.9.6", | ||
"@rubiin/eslint-config": "^1.9.15", | ||
"@sindresorhus/tsconfig": "^5.0.0", | ||
"@types/react": "^18.2.37", | ||
"@types/node": "^20.9.4", | ||
"@types/react": "^18.2.38", | ||
"bumpp": "^9.2.0", | ||
"chalk": "^5.3.0", | ||
"concurrently": "^8.2.2", | ||
"eslint": "^8.53.0", | ||
"prettier": "^3.0.3", | ||
"eslint": "^8.54.0", | ||
"prettier": "^3.1.0", | ||
"react-devtools-core": "^4.28.5", | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.3.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
41418
12
4
34
Updatedtsup@^7.3.0