Skip to content

Unable to run prebuild events before libman restore triggers #642

@ItsKaleb

Description

@ItsKaleb

Describe the bug

I am attempting to use Libman.Build to copy certain components of client side libraries when building my application.
I am unable to use any of the providers available as I need to pull the Node modules from a Nexus Package Repository.
I was hoping to use npm to install the required packages to the node_modules folder and then allow libman to use the filesystem provider to pull the required files from the node_modules folder.
I have set a prebuild event in my project's settings to run 'npm install'. However, it appears as though libman is attempting to run before the install, meaning that the node_modules folder does not exist when it attempts to pull the files specified.

Should libman be running at a later stage in the build process such that prebuild events are able to complete first?
If not, please advise on an alternative solution for what I am trying to accomplish.

To Reproduce

Microsoft.Web.LibraryManager.Build version 2.1.113
package.json:
{
"name": "MyBlazorApplication",
"version": "1.0.0",
"private": true,
"devDependencies": {},
"dependencies": {
"font-awesome": "^4.7.0"
}
}

libman.json:
{
"version": "1.0",
"defaultProvider": "filesystem",
"defaultDestination": "wwwroot/lib",
"libraries": [
{
"library": "node_modules/font-awesome/",
"destination": "wwwroot/lib/font-awesome",
"files": [
"css/font-awesome.min.css",
"fonts/fontawesome-webfont.eot",
"fonts/fontawesome-webfont.svg",
"fonts/fontawesome-webfont.ttf",
"fonts/fontawesome-webfont.woff",
"fonts/fontawesome-webfont.woff2",
"fonts/FontAwesome.otf"
]
},
]
}

Pre-build event command line:
npm install

Expected behavior

I expect the prebuild event to run 'npm install', the dependencies specified in package.json are installed to the node_modules file, and then libman triggers it's build to copy the files specified in libman.json from node_modules to wwwroot/lib

Screenshots

Output from build:
1>------ Rebuild All started: Project: MyBlazorApplication, Configuration: Debug Any CPU ------
1>
1>Restore operation started...
1>libman.json : error LIB002: The "node_modules/font-awesome/" library could not be resolved by the "filesystem" provider
1>
1>One or more libraries failed to restore
1>Done building project "MyBlazorApplication" -- FAILED.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions