Repository navigation
Add LibMan as a new manager #45069
Replies: 2 comments
|
Decided to go ahead with a PR that only adds libman with cdnjs support for now. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Tell us more.
I've been working on adding support for libman (Draft PR: #45160) and wanted to open this discussion to provide the "New Package Manager Questionnaire" as well as a clean slate for discussion.
LibMan uses a straight-forward file-format and the manager can be kept quite simple. I have a working version running locally against our ADO environment.
The biggest blocker for its implementation are the two new datasources we need:
dep.skipReason = 'local-dependency';.Other discussions / issues tracking LibMan support
Support for LibMan has been discussed in several places. Apologies if I should've continued one of those:
New package manager questionnaire
Did you read our documentation on adding a package manager?
Basics
What's the name of the package manager?
LibMan(Library Manager for ASP.NET Core,Microsoft.Web.LibraryManager)What language(s) does this package manager support?
LibMan isn't tied to a package language. Instead it fetches static client-side assets (JS, CSS, web fonts, source maps, etc.) as opaque files.
LibMan itself (CLI, MSBuild targets, Visual Studio integration) is part of the .NET ecosystem, and
libman.jsonis what a .NET web project uses to declare which client-side libraries it wants to pull into the project files.How popular is this package manager?
Moderately popular, specifically within the .NET/ASP.NET Core world:
Microsoft.Web.LibraryManager.Cli(the standalone CLI): ~1.7 million downloads total / 560 per day (source)Microsoft.Web.LibraryManager.Build(the MSBuild integration): ~11.3 million downloads / 3700 per day (source)Does this language have other (competing?) package managers?
LibMan explicitly positions itself as not a package manager and not a competitor to npm/yarn/pnpm.
See aspnet/LibraryManager wiki:
What are the big selling points for this package manager?
LibMan is a client-side library acquisition tool. Libraries are pulled from CDNs (or the filesystem) to be used in projects directly.
In other words it's a nicer way of manually copying client-side library into your project, with the (big) added bonus of helping you keep track of versions and updates. The biggest selling point is that you don't have to set up a full client-side library ecosystem, if you just want to enrich your server-side applications with a bit of client-side code / libraries.
Detecting package files
What kind of package files, and names, does this package manager use?
The package file is a
jsonfile with a well-defined schema (https://json.schemastore.org/libman) and must be namedlibman.json, located at the project root (sibling to the.csproj).Which
managerFilePatternspattern(s) should Renovate use?This matches a
libman.jsonfile at the repo root or in any subdirectory (multi-project repos commonly have one per web project).Do many users need to extend the
managerFilePatternspattern for custom file names?The filename
libman.jsonis fixed by the tooling itself.Is the
managerFilePatternspattern going to get many "false hits" for files that have nothing to do with package management?No.
libman.jsonis a distinctive filename and (imo) very unlikely to collide with unrelated files.Parsing and Extraction
Can package files have "local" links to each other that need to be resolved?
No. Each
libman.jsonis self-contained.Package file parsing method
The package files should be:
Not sure if I understand this section correctly, but libman works on a "single-file-per-project" basis. No cross-project references. So we only need to parse one file per project.
Which format/syntax does the package file use?
Strictly speaking it's JSON (validated against the libman JSON schema. But afaict Visual Studio's editor also tolerates
//comments (JSONC) despite that not being in the schema, so the extractor should probably parse it as JSONC to avoid extraction failures for users who've added comments.{ "version": "1.0", "defaultProvider": "jsdelivr", "libraries": [ { "library": "@fortawesome/fontawesome-free@6.7.2", "destination": "wwwroot/lib/fortawesome/fontawesome-free/", "files": [ "css/fontawesome.min.css", "css/solid.min.css", "webfonts/fa-solid-900.ttf", "webfonts/fa-solid-900.woff2" ] }, { // Example comment that isn't supported by schema // but doesn't seem to break libman. "library": "htmlhint@1.5.1", "destination": "wwwroot/lib/codemirror/htmlhint/" }, { "provider": "cdnjs", "library": "codemirror@6.65.7", "destination": "wwwroot/lib/codemirror/" }, { "provider": "jsdelivr", "library": "tom-select@2.4.3", "destination": "wwwroot/lib/tom-select/", "files": [ "dist/css/tom-select.min.css", "dist/js/tom-select.complete.min.js" ] } ] }How should we parse the package files?
JSONC is already supported by Renovate.
Does the package file have different "types" of dependencies?
List all the sources/syntaxes of dependencies that can be extracted
Each entry in the top-level
librariesarray has alibraryfield of the form:Example:
{ "library": "htmlhint@1.5.1", "destination": "wwwroot/lib/codemirror/htmlhint/" },This is true for all supported providers, except
filesystem, which points to a local path and therefore shouldn't / can't be supported by renovate.Scoped/namespaced names are supported and contain their own
@:Extraction must split on the last
@, not the first.If
provideris omitted on an entry, it falls back to the file's top-leveldefaultProvider.Describe which types of dependencies above are supported and which will be implemented in future
I assume this means supported by libman, not renovate:
cdnjsjsdelivrunpkgfilesystemThere doesn't seem to be any active development for other implementations at the moment.
Versioning
What versioning scheme does the package file(s) use?
semverDoes this versioning scheme support range constraints, like
^1.0.0or1.x?^1.0.0or1.x), provide details.Lookup
Is a new datasource required?
cdnjs: supported already. Renovate already has a datasource.jsdelivr: unsupported, but already trackedunpkg: unsupported, but already trackedfilesystem: unsupported / no support needed: I don't think it's realistic to support this via Renovate, as a local file store won't have a proper / common registry behind it.Will users want (or need to) set a custom host or custom registry for Renovate's lookup?
Where can Renovate find the custom host/registry?
Are there any constraints in the package files that Renovate should use in the lookup procedure?
v3.x), provide details.Will users need the ability to configure language or other constraints using Renovate config?
Artifacts
Does the package manager use a lock file or checksum file?
libman.jsonis both the manifest and the "lock file" in one. It always records an exact, pinned version per library, so there's no separate lock file.Is the locksum or checksum mandatory?
If lockfiles or checksums are used: what tool and exact commands should Renovate use to update one (or more) package versions in a dependency file?
N/A (see above)
Package manager cache
Does the package manager use a cache?
The LibMan CLI does maintain a local disk cache of previously-downloaded library files, but this is purely a CLI-side performance cache for the
restore/installcommands.I don't think, that this is relevant for Renovate.
If the package manager uses a cache, how can Renovate control the cache?
libman cache list/libman cache cleanShould Renovate keep a cache?
Generating a lockfile from scratch
Renovate can perform "lock file maintenance" by getting the package manager to generate a lockfile from scratch.
Can the package manager generate a lockfile from scratch?
Other
What else should we know about this package manager?
htmlmanagerAll reactions