Socket
Socket
Sign inDemoInstall

asdfui

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asdfui - npm Package Compare versions

Comparing version 0.1.14 to 0.1.15

3

dist/App.js
import { Box } from "ink";
import React from "react";
import { CommandInfo, Header, PanesContainer } from "./components/index.js";
import { CommandInfo, PanesContainer } from "./components/index.js";
import { BorderColor } from "./types.js";

@@ -8,3 +8,2 @@ import { Versions, Info, Plugins } from "./panes/index.js";

return (React.createElement(React.Fragment, null,
React.createElement(Header, null),
React.createElement(PanesContainer, { borderColor: BorderColor.UNFOCUSED },

@@ -11,0 +10,0 @@ React.createElement(Box, { flexDirection: "column", width: "50%" },

@@ -10,3 +10,3 @@ import { Alert } from "@inkjs/ui";

return (React.createElement(Box, { marginTop: 1, marginRight: 4 },
React.createElement(Alert, { variant: options.variant }, options.text)));
React.createElement(Alert, { variant: options.variant }, options.label)));
};
export * from "./CommandInfo.js";
export * from "./PanesContainer.js";
export * from "./Loader.js";
export * from "./Header.js";
export * from "./Title.js";
export * from "./CustomSelectItem.js";
export * from "./CustomAlert.js";
import { Spinner } from "@inkjs/ui";
import { Box } from "ink";
import React from "react";
export const Loader = ({ text }) => {
export const Loader = ({ label }) => {
return (React.createElement(Box, { padding: 2 },
React.createElement(Spinner, { type: "dots", label: text })));
React.createElement(Spinner, { type: "dots", label: label })));
};
import { Box, useApp, useInput } from "ink";
import React from "react";
import { Keys } from "../types.js";
export const PanesContainer = ({ children, borderColor }) => {
const { exit } = useApp();
useInput((input) => {
if (input === "q") {
if (input === Keys.QUIT) {
exit();
}
});
return (React.createElement(Box, { width: "100%", borderColor: borderColor, minHeight: 20, gap: 1 }, children));
return (React.createElement(Box, { width: "100%", borderColor: borderColor, minHeight: 20, gap: 1, marginTop: 2 }, children));
};
import { Box, Text } from "ink";
import React from "react";
export function Title({ title, color }) {
export function Title({ label, color }) {
return (React.createElement(Box, { alignSelf: "center", marginTop: -1 },
React.createElement(Text, { bold: true, color: color }, title)));
React.createElement(Text, { bold: true, color: color }, label)));
}

@@ -8,7 +8,6 @@ import Select from "ink-select-input";

return (React.createElement(React.Fragment, null,
!isLocal && isOnline && isLoading && React.createElement(Loader, { text: `Fetching available ${pluginName} versions` }),
isOnline && !isLoading && versions.length > 0 &&
React.createElement(Select, { limit: 38, isFocused: isFocused, items: versions, onHighlight: setSelectedVersion, itemComponent: CustomItem }),
!isLoading && versions.length === 0 && React.createElement(CustomAlert, { text: `No versions found for plugin ${pluginName}` }),
!isOnline && !isLoading && React.createElement(CustomAlert, { text: "No internet", variant: "error" })));
!isLocal && isOnline && isLoading && React.createElement(Loader, { label: `Fetching available ${pluginName} versions` }),
isOnline && !isLoading && versions.length > 0 && (React.createElement(Select, { limit: 38, isFocused: isFocused, items: versions, onHighlight: setSelectedVersion, itemComponent: CustomItem })),
!isLoading && versions.length === 0 && React.createElement(CustomAlert, { label: `No versions found for plugin ${pluginName}` }),
!isOnline && !isLoading && React.createElement(CustomAlert, { label: "No internet", variant: "error" })));
};

@@ -12,10 +12,7 @@ import { Box, Spacer, Text } from "ink";

useEffect(() => {
const fetchInfoData = () => {
getAllInfo();
};
fetchInfoData();
getAllInfo();
}, []);
return (React.createElement(Box, { borderStyle: "double", borderColor: BorderColor.UNFOCUSED, flexDirection: "column", minHeight: 20, paddingLeft: 2 },
React.createElement(Title, { title: totalNumber("Info", versions.length), color: BorderColor.UNFOCUSED }),
isLoading && React.createElement(Loader, { text: "Fetching info" }),
React.createElement(Title, { label: totalNumber("Info", versions.length), color: BorderColor.UNFOCUSED }),
isLoading && React.createElement(Loader, { label: "Fetching info" }),
React.createElement(Box, { paddingY: 2, paddingX: 4, flexDirection: "column" }, versions.map((element, index) => {

@@ -27,3 +24,3 @@ return (React.createElement(Box, { marginY: 0.5, key: index },

})),
!isLoading && versions.length === 0 && React.createElement(CustomAlert, { text: "No versions found" })));
!isLoading && versions.length === 0 && React.createElement(CustomAlert, { label: "No versions found" })));
}

@@ -20,14 +20,9 @@ import Select from "ink-select-input";

useEffect(() => {
// declare the data fetching function
const fetchPluginsData = () => {
getAllLocalPlugins();
};
// call the function
fetchPluginsData();
getAllLocalPlugins();
}, []);
return (React.createElement(Box, { borderStyle: "double", borderColor: getBorderColorOnFocus(isFocused), flexDirection: "column", minHeight: 20, paddingLeft: 2 },
React.createElement(Title, { title: totalNumber("Plugins", plugins.length), color: getBorderColorOnFocus(isFocused) }),
loading && React.createElement(Loader, { text: "Fetching installed asdf plugins" }),
React.createElement(Title, { label: totalNumber("Plugins", plugins.length), color: getBorderColorOnFocus(isFocused) }),
loading && React.createElement(Loader, { label: "Fetching installed asdf plugins" }),
!loading && React.createElement(Select, { limit: 10, items: plugins, isFocused: isFocused, onHighlight: handleSelect }),
!loading && plugins.length === 0 && React.createElement(CustomAlert, { text: "No installed plugins found" })));
!loading && plugins.length === 0 && React.createElement(CustomAlert, { label: "No installed plugins found" })));
}

@@ -8,2 +8,3 @@ import { Title } from "../components/index.js";

import isInternetAvailable from "is-online";
import { Keys } from "../types.js";
export function Versions() {

@@ -21,3 +22,2 @@ const { isFocused } = useFocus({ id: "versions" });

}
// for loader
const isLoading = useVersionsStore((state) => state.isLoading);

@@ -30,5 +30,7 @@ const versions = useVersionsStore((state) => state.versions);

getAvailabeVersions(currentlySelected.label);
setSelectedVersion(versions[0] ?? undefined);
};
const fetchLocalToolsVersionsData = async () => {
getInstalledVersions(currentlySelected.label);
setSelectedVersion(versions[0] ?? undefined);
};

@@ -44,24 +46,32 @@ if (!isLocal) {

if (isFocused) {
if (input === "i") {
await installToolVersion({ name: currentlySelected.label, version: selectedVersion.value }).then(() => {
switch (input) {
case Keys.INSTALL: {
await installToolVersion({ name: currentlySelected.label, version: selectedVersion.value }).then(() => {
getAllInfo();
getAvailabeVersions(currentlySelected.label);
});
break;
}
case Keys.UNINSTALL: {
await uninstallToolVersion({ name: currentlySelected.label, version: selectedVersion.value });
getAllInfo();
getAvailabeVersions(currentlySelected.label);
});
getInstalledVersions(currentlySelected.label);
break;
}
case Keys.GLOBAL: {
await setVersionGlobal({ name: currentlySelected.label, version: selectedVersion.value });
getAllInfo();
break;
}
case Keys.TOGGLE: {
setIsLocal(!isLocal);
break;
}
default:
}
if (input === "a") {
setIsLocal(!isLocal);
}
if (input === "u") {
await uninstallToolVersion({ name: currentlySelected.label, version: selectedVersion.value });
getAllInfo();
getAvailabeVersions(currentlySelected.label);
}
if (input === "g") {
await setVersionGlobal({ name: currentlySelected.label, version: selectedVersion.value });
}
}
});
return (React.createElement(Box, { borderStyle: "double", borderColor: getBorderColorOnFocus(isFocused), flexDirection: "column", width: "70%", minHeight: 20, paddingLeft: 4 },
React.createElement(Title, { title: totalNumber("Versions", versions.length), color: getBorderColorOnFocus(isFocused) }),
React.createElement(Title, { label: totalNumber("Versions", versions.length), color: getBorderColorOnFocus(isFocused) }),
React.createElement(VersionsDisplay, { setSelectedVersion: handleState, isOnline: isOnline, isFocused: isFocused, isLoading: isLoading, isLocal: isLocal, versions: versions, pluginName: currentlySelected.label })));
}
import { create } from "zustand";
import { listtAllPlugins } from "../utils/index.js";
import { listAllPlugins } from "../utils/index.js";
const emptySelection = {

@@ -14,3 +14,3 @@ value: "",

set((state) => ({ isLoading: !state.isLoading }));
const response = await listtAllPlugins();
const response = await listAllPlugins();
set({ plugins: response });

@@ -17,0 +17,0 @@ set({ currentlySelected: response.length > 0 ? response[0] : emptySelection });

@@ -6,2 +6,10 @@ export var BorderColor;

})(BorderColor || (BorderColor = {}));
export var Keys;
(function (Keys) {
Keys["QUIT"] = "q";
Keys["INSTALL"] = "i";
Keys["UNINSTALL"] = "u";
Keys["GLOBAL"] = "g";
Keys["TOGGLE"] = "a";
})(Keys || (Keys = {}));
export var TabName;

@@ -8,0 +16,0 @@ (function (TabName) {

import { $ } from "execa";
import { formatPluginData, sanitizeData } from "./helpers.js";
export const listtAllPlugins = async () => {
export const listAllPlugins = async () => {
try {

@@ -66,3 +66,2 @@ const { stdout } = await $ `asdf plugin list`;

export const listInstalledToolsVersions = async (name) => {
// otherwise asdf returns all plugins
if (name === "") {

@@ -76,3 +75,3 @@ return [];

const sanitizedData = sanitizeData(stdout);
return formatPluginData(sanitizedData.map((value) => value.trim().replace("*", "")));
return formatPluginData(sanitizedData.map((value) => value.trim().replace("*", ""))).reverse();
}

@@ -79,0 +78,0 @@ catch (error) {

import { BorderColor } from "../types.js";
const movementKeys = "[↑/↓] movement";
const quitKey = "[q]uit";
export const getBorderColorOnFocus = (isFocused) => (isFocused ? BorderColor.FOCUSED : BorderColor.UNFOCUSED);

@@ -12,4 +14,2 @@ export function sanitizeData(data) {

}
const movementKeys = "[↑/↓] movement";
const quitKey = "[q]uit";
export function totalNumber(start, total) {

@@ -16,0 +16,0 @@ return `${start} (${total})`;

{
"name": "asdfui",
"version": "0.1.14",
"version": "0.1.15",
"bin": "dist/cli.js",

@@ -30,3 +30,3 @@ "type": "module",

"scripts": {
"build": "tsc && tsc-alias",
"build": "rimraf dist && tsc && tsc-alias",
"dev": "tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")",

@@ -46,4 +46,2 @@ "lint": "ESLINT_USE_FLAT_CONFIG=true eslint '{src,test}/**/*.ts' --cache",

"ink": "^4.4.1",
"ink-big-text": "^2.0.0",
"ink-gradient": "^3.0.0",
"ink-link": "^3.0.0",

@@ -57,5 +55,5 @@ "ink-select-input": "^5.0.0",

"devDependencies": {
"@rubiin/eslint-config": "^1.9.4",
"@rubiin/eslint-config": "^1.9.6",
"@sindresorhus/tsconfig": "^5.0.0",
"@types/react": "^18.2.34",
"@types/react": "^18.2.36",
"bumpp": "^9.2.0",

@@ -67,2 +65,3 @@ "chalk": "^5.3.0",

"react-devtools-core": "^4.28.5",
"rimraf": "^5.0.5",
"ts-node": "^10.9.1",

@@ -69,0 +68,0 @@ "tsc-alias": "^1.8.8",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc