Consolidated the process of installing the library in the "add" command. Simplified the path handling by using the dirname function. Also, the shared-file version dependent part has been removed. Library installation is now based on a singular registry url path instead of component specific versions.
Three functions have been removed to simplify the `registry.ts` file in the CLI package. These functions are `getComponentName`, `getComponentLibVersion`, and `getLibURL`, which are no longer required. This commit contributes to making the codebase cleaner and more maintainable.
Removed the 'libVersion' field from the RegistryComponent interface and updated the 'lib' path in the DEFAULT_CONFIG and 'paths' field in Registry. The 'lib' path now includes the file extension '.tsx', aiming to improve clarity and accuracy.
The import statement in the add.tsx file of the CLI package has been updated to use the correct library name and version. This change ensures accurate reference to shared libraries, leading to better stability and interoperability.
The change includes an update to config.ts in CLI. The configuration paths for the shared module changed from 'shared' to 'lib'. Also, the import paths adjusted to reflect the path changes from 'shared' to 'lib'.
Import additional helper methods in add.tsx. Remove forceShared flag as it could potentially break components. Instead of planning for a shared module, this commit plans for version-specific libraries, which exist in a separate lib folder. This ensures that the right version of the library required by the component is installed. Also, handle potential errors related to absence of lib version in the registry. Fixed component installation path.
Modified the return type of the function getComponentLibVersion in registry.ts. Instead of returning a string or null, it now returns an object with a boolean type 'ok' status and 'libVersion'. The 'ok' attribute indicates whether the library version is included in the registry.
This commit introduces three new async functions in the registry.ts file to assist with CLI operations. These include methods to get component names, retrieve library versions, and fetch library URLs.
The Registry interface in the 'const.ts' file within the cli package has been updated. The 'components' property is now a record of RegistryComponent objects, which includes 'name' and 'libVersion' properties, previously it was a record of strings.
Update the functions `getComponentURL` and `getComponentRealname` in the CLI helper `registry.ts` to access the component name through the 'name' property of each component object in the registry, instead of directly accessing the component name.
This commit updates the registry helper in the CLI package. It now returns the full component name from the registry, instead of only returning the last part of the component's path.
Change the way the component URL is formed in the getComponentURL function in the registry helper. Now, it appends the path instead of replacing it directly in the registry base.
The Registry interface has been refactored to include "paths" field, which is an object containing "components" and "lib" paths. Also, "lib" field is now a string array instead of a record.
Changed the 'shared' property in the Registry interface to 'lib'. This update in 'packages/cli/src/const.ts' provides a more generic way to manage libraries with a key-value pair notation.
The commit includes an update in the cli package where we've changed the properties in paths and import objects from 'shared' to 'lib'. This refactoring also applies to the DEFAULT_CONFIG object and the configZod object, ensuring consistency across all configurations.
State setting logic for SearchBox in the CLI package has been streamlined. Redundant setState calls have been eliminated while others are more appropriately placed for better state management. This refactor focuses on the selected and queryMode states. Improved handling of selection state enhances component efficiency.
Refactored the 'cli add' command to streamline the process of component selection and the decision to overwrite an already installed one. The task has been split into two separate interactive choices to enhance the user experience and simplify the codebase. The force option is now also evaluated separately which results in cleaner code.
Renamed 'add.ts' to 'add.tsx' and converted it to a React component. This change includes implementing search functionality through installed components and handling the case if the component is already installed. Added search options and overwriting prompt in CLI interface.
This commit includes the addition of a new component, Choice, that presents two options yes or no to the user. The user can interact with this component using the up and down arrow keys. Based on this selection, different actions can be submitted. The feature also supports unicode if the environment supports it.
The onSubmit function typing in the SearchBox component was changed from handling a string to handling a generic T type object. Also, the onSubmit function now uses the found item in components based on the selected suggestion to submit instead of submitting directly.
The dependencies array in the useEffect hook within SearchBox.tsx has been updated. The 'suggestions' variable has been added to the dependencies to ensure the function updates accordingly when this state changes.
Added a new stateful variable, 'queryMode', to the 'SearchBox' component in the CLI to enhance its functionality. As a result, 'Input' and suggestion fetching are now conditioned by this mode, providing more controled user search management and interaction with the autocomplete feature.
Decreased the marginRight property from 2 to 1 in the SearchBox component of the CLI to improve layout. Also modified the placeholder text in the Input field for better readability.
This commit modifies a conditional statement in the SearchBox component to properly manage the selected index based on the length of search results. This ensures appropriate selection even when the result length is less than or equal to the selected index.
Removed the top 5 slicing constraint from the search helper function within the CLI package. This change allows to return all components whose score exceeds zero, instead of restricting it to the top 5.
In the SearchBox component, a new onSubmit prop has been added for user's search input handling. The UI has also been updated: changed border styles, introduced color changes based on selection and added placeholder for search input.
The SearchBox component in the CLI package now supports generic types, enhancing its flexibility. The onChange method now returns selected item details, instead of just returning the key. The SearchBox props have been modified to support the generic type T.
Changed the 'components' prop passed to 'SearchBox' in 'search.tsx' to have 'key' and 'displayName' properties instead of simple component names. This refactoring aims to better align with the expected prop structure.
Added 'onChange' prop to the SearchBox component for active response to selection changes. Also updated the 'components' prop type and handled the related changes in the 'getSuggestion' use case. This includes mapping the components to their keys, updating the display name and handling selected results.
The search command in the CLI is enhanced to recognize search queries as command arguments. An improved interaction with the search box is also introduced, including key event handlers for up and down arrows and escape key, allowing users to navigate more intuitively. keyboard-based selection of suggestions is now implemented and the helper message is updated to match these interaction changes.
The SearchBox component in the Command Line Interface (CLI) now accepts an optional initialQuery prop. This prop is used to set the initial state of the search box query, which enables prepopulating the search box with a specific string if desired.
A new command has been added to the CLI package to search for components. This command fetches the registry and lists accessible components through the SearchBox component. The SearchBox component has also been updated to show a helper text and a new styled border for better user interaction.
A Divider and a SearchBox component have been added to the CLI. The Divider is a simple component for displaying a horizontal line. The SearchBox takes a list of components as props and provides a live search functionality, showing suggestions for user inputs.
This commit introduces a new file "search.ts" in the CLI helpers. It adds the implementation of the Jaro-Winkler string comparison algorithm and a "getSuggestion" function. The getSuggestion function uses the Jaro-Winkler algorithm for comparing component names against an input string and providing suitable suggestions.
Imported the colorize method from '@oclif/core/ux' to add color to the log messages in the 'validateConfig' function within 'config.ts' for improved readability. The messages that detail installation paths and import shared details are now displayed in gray.
This change includes normalization of user input for component name by converting it to lowercase during the installation process. This is done to ensure that component names are not case sensitive and that any input will match the existing component names in the registry.
The shared file extension has been updated from .ts to .tsx in the path constants and the default configuration within the CLI package. This change aligns with our efforts to standardize the file types across the project.
The update enhances the CLI functionality by introducing the realname resolution for components. This is done in the 'list.ts' file, through a new helper function 'getComponentRealName' that is called whenever list of installed components is required. This ensures the correct identifiers are always considered, regardless of them being aliases or actual names.
The commit removes the default path for config in the CLI 'list' command. This change improves flexibility by allowing the user to define their own path without overriding the default one.
Modified the 'loadConfig' method to support '.cjs' and '.mjs' config files. Also, a 'changeExtension' function is added to helpers/path.ts to manipulate file extensions. An error will be thrown if a specified user config file is not found. The application defaults to the default config file if no user config file is provided.
Replaced direct log reference in validateConfig function calls with an anonymous function that logs a message. This change has been made in the add and list commands of the CLI package to ensure proper logging.
This commit introduces a new command 'add' to the CLI. The 'add' command allows users to add a component to the project with options for custom configurations, and it performs validation checks to ensure the component exists in the registry before installing.
The validateConfig function in the cli module has been updated to include logging. The logs show the locations where the component and shared module will be installed, as well as the import path for the shared module.