Repository navigation
New package manager: LibMan (libman.json) #46445
Closed
mu88
started this conversation in
Suggest an Idea
Replies: 1 comment 1 reply
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.
LibMan support (proposal + intent to implement)
Hi maintainers,
I'd like to propose adding support for Microsoft LibMan (
libman.jsonmanifests) as a new manager, and I'm willing to implement it myself. Filling out the questionnaire below as requested.Basics
What's the name of the package manager?
LibMan (Library Manager), a lightweight client-side library acquisition tool for .NET/ASP.NET Core projects, maintained by Microsoft (source).
What language(s) does this package manager support?
Primarily .NET/ASP.NET Core projects, but the manifest itself only fetches client-side (front-end) assets: JS/CSS libraries such as Bootstrap, jQuery, Leaflet, Font Awesome, etc. It's not tied to any specific application language beyond ASP.NET Core tooling integration.
How popular is this package manager?
It ships built-in with Visual Studio and the ASP.NET Core SDK templates as the default client-side library acquisition tool since .NET Core 2.x (previously bower/npm were common alternatives). Adoption is real but niche compared to npm - I don't have hard usage numbers, but it's a first-party Microsoft tool bundled with the .NET SDK/Visual Studio tooling for years.
Does this language have other (competing?) package managers?
What are the big selling points for this package manager?
No Node.js/npm toolchain dependency; integrated into the .NET SDK (
dotnet tool install -g Microsoft.Web.LibraryManager.Cli) and Visual Studio UI; simple, declarative manifest; supports restoring only specific files from a package rather than the whole distributable.Detecting package files
What kind of package files, and names, does this package manager use?
A single JSON manifest file, always named exactly
libman.json, typically at the project root but can be nested in any subdirectory (multiple manifests per repo are possible).Which
managerFilePatternspattern(s) should Renovate use?/(^|/)libman\.json$/Do many users need to extend the
managerFilePatternspattern for custom file names?Is the
managerFilePatternspattern going to get many "false hits" for files that have nothing to do with package management?No,
libman.jsonis a fixed, LibMan-specific filename with no other common use.Parsing and Extraction
Can package files have "local" links to each other that need to be resolved?
No, each
libman.jsonis fully self-contained.Package file parsing method
Which format/syntax does the package file use?
How should we parse the package files?
JSON.parse).Does the package file have different "types" of dependencies?
librariesarray, each entry is one client-side library/asset set).List all the sources/syntaxes of dependencies that can be extracted
Each entry in
libraries[]has alibraryfield encoded as"<name>@<version>"(single string), plus an optionalproviderfield (falls back to a root-leveldefaultProvider). Known providers:cdnjs,jsdelivr,unpkg,filesystem.cdnjs:libraryis a plain cdnjs library name, e.g.spin.js@1.2.5.unpkg:libraryis an npm package name (unpkg only mirrors npm).jsdelivr:libraryis normally an npm package name, but LibMan's own jsDelivr provider also supports a GitHub-hosted mode: if the name part contains a/(and doesn't start with@, which is reserved for npm scoped packages), it's treated asowner/repoand resolved against jsDelivr's GitHub-backed endpoint instead of its npm-backed one (confirmed by reading theIsGitHub()check inJsDelivrCatalog.cs). So ajsdelivrentry isn't reliably "just npm" - I initially missed this and want to flag it here.filesystem: references a local path instead of a versioned package and has no version to track.Describe which types of dependencies above are supported and which will be implemented in future
Initial implementation would support
cdnjs(via the existingCdnjsDatasource) and skipfilesystementries (no version). I would need guidance onjsdelivr/unpkg, both for the plain-npm case and especially the jsDelivr GitHub-hosted case, since no matching datasource currently exists in Renovate for either - see below.Versioning
What versioning scheme does the package file(s) use?
Semantic Versioning (semver) in practice, matching whatever the underlying provider serves. Correction to an earlier draft of this questionnaire: LibMan also supports the literal keyword
latestin place of a version (library@latest, seeManifestConstants.LatestVersionin the LibMan source), which always resolves to the newest available version atrestoretime rather than a pinned version. Renovate would presumably treat that the same way it treatslatest/*-style non-pinned values for other managers (i.e. nothing to bump, possibly worth a warning).Does this versioning scheme support range constraints, like
^1.0.0or1.x?latestkeyword above) are supported - no ranges like^1.0.0/1.x.Lookup
Is a new datasource required?
cdnjsprovider, the existingCdnjsDatasourceis a direct fit (confirmed by reading its source - it looks upapi.cdnjs.com/libraries/<name>by plain library name, matching LibMan'scdnjslibrary naming exactly). Forjsdelivrandunpkgproviders, no matching datasource currently exists in Renovate (lib/modules/datasource/has nojsdelivr/unpkgfolder). I'd like to discuss with maintainers whether (a) a newjsdelivr/unpkgdatasource should be built as part of this work - jsDelivr has a documented data API for both its npm-backed mode (https://data.jsdelivr.com/v1/package/npm/<name>) and its GitHub-backed mode (https://data.jsdelivr.com/v1/package/gh/<owner>/<repo>), while unpkg has no official metadata API and only mirrors npm - or (b) an initial version should only supportcdnjsand treatjsdelivr/unpkgas a known follow-up limitation.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?
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?
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 (no lockfile). The actual on-disk assets are not restored by Renovate itself; a separate CI step (
libman restore, via themicrosoft.web.librarymanager.cli.NET tool) fetches the files at build time based on the (updated)libman.json.Package manager cache
Does the package manager use a cache?
restoreinvocation; no local cache to manage).If the package manager uses a cache, how can Renovate control the cache?
Should Renovate keep a cache?
Generating a lockfile from scratch
Other
What else should we know about this package manager?
I currently work around the lack of native support with a
customManagersregex entry in my shared Renovate preset, targeting the"library": "name@version"string regardless of provider and mapping it to thenpmdatasource as an approximation (since most LibMan-tracked libraries I use are also published to npm under the same name). This is a known imprecise stopgap - it doesn't distinguishprovidervalues, socdnjs-provided entries (and any GitHub-hostedjsdelivrentries, see above) are also (inaccurately) resolved via npm, and I disable automerge for anything it produces as a mitigation. I'm opening this discussion because I'd rather contribute proper native support than rely on that workaround long-term, and I'm willing to do the implementation work (extraction logic, tests, docs) if maintainers are open to it. I'd appreciate early feedback on thejsdelivr/unpkgdatasource scope question above (including the GitHub-hosted jsDelivr case I initially overlooked) before I start implementation.All reactions