New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: LibMan CLI #77
Comments
Little late to the party here @justcla but just spent a good amount of time looking at this and it looks great! I'm a libman user, it fits my use cases great and have been wanting a cli for it. One suggestion, how about the "-pre" switch on install? Use case is if a developer is installing packages through the cli and wants the pre-release from the start. |
Excuse me, how do I search for packages from the command line? Do I actually need to visit the provider website? Maybe it could work like
|
Also this part seems to be incorrect:
In fact, if I just type: I'd like to see a command that just states which updates are available without actually updating anything, so I can build a LibMan extension for Visual Studio Code that periodically checks if newer versions are available and notifies them to the developer. |
Closing this item as the CLI package has long since shipped: https://www.nuget.org/packages/Microsoft.Web.LibraryManager.Cli/ |
We are producing a CLI for LibMan. This is the current design for the v1 prototype.
Does this capture your needs?
Please respond with any suggestions or other relevant feedback.
If parameter supplied, will print the full details of the supplied verb. (maybe not)
Libman -h
Interactive:
If the user calls “libman init” with no parameters, LibMan will enter interactive mode and prompt the user to supply a defaultProvider and defaultDestination.
The default presented to the user for defaultProvider will be “cdnjs”.
The default presented to the user for defaultDestination will be “libman”.
If the user specifies either defaultProvider or defaultDestination, there will be no interactive prompting for the other default option.
Flow:
User calls init, then edits the content in an editor.
User calls init, then calls install to add library definitions to the libman.json.
o (Note: “jquery@[version]") is a cdnjs-specific identifier)
Another flow:
- Libman init –defaultDestination scripts
- Libman install jquery@3.2.1
- User is prompted for provider (default “cdnjs”). After entering provider, user is prompted to save this as the defaultProvider.
Error if libman.json already exists.(interactive: will prompt for default provider and default destination)
libman init --defaultProvider "cdnjs"
(non-interactive: will not specify default destination)
libman init --defaultProvider cdnjs --defaultDestination script\libman
(non-interactive)
Files attribute must always be last.
Will initialize a libman.json if one does not exist.
Will error if provider is not specified and no default provider exists.
Will error if destination is not specified and no default destination exists.
If no files are specified, the entire library is included.
For CDNJS libraries, if no version is specified with the library ID, the highest version available is used.
Install can be used to upgrade or downgrade a given library.
If a version of the library being installed already exists, fail – unless “Force” flag specified. Then will update the specified library, removing any redundant files from the previous version.
(error if no default provider or destination)
libman install jquery@3.2.1jquery@3.2.1
(this assumes jquery@version is a valid identifier for the defaultProvider, or else will throw an error)
libman install jquery --provider cdnjs
libman install jquery --files "jquery.min.js" "jquery.min.js.map"
libman install jquery --destination "scripts/jquery"
libman install jquery --provider cdnjs --destination "scripts/jquery" --files "jquery.min.js"
libman install jquery@1.1.1 -f
Error if not exactly one library found.
libman uninstall jquery@3.2.1
libman uninstall jquery --provider cdnjs
Error if no libman.json in folder.
"-pre" flag used to fetch latest pre-release version
Will fail if specified library doesn't exist.
Note: To specify a specific version, use Install.
libman update jquery
libman update --provider cdnjs
libman update jquery@3.2.1
libman update jquery --provider cdnjs
libman update jquery -pre
Delete any folders that become empty after this operation.
Switches available on all commands
libman restore -h
libman cache -h
Other root options to consider
--force
--non-interactive
LibMan Cache
LibMan will maintain a cache of all libraries downloaded in the user’s home directory (ie. C:\Users[username].libman\cache)
The libraries will be organized in folders by Provider, then provider-specific library ID.
The root of the LibMan cache can contain a settings file where machine-global settings can be defined.
Here’s an example:
The text was updated successfully, but these errors were encountered: