Zaid-Ajaj / Femto

Femto is a CLI tool that automatically resolves npm packages used by Fable bindings
153 stars 13 forks source link

Femto doesn't work with dotnet SDK v7.x #98

Closed Zaid-Ajaj closed 1 year ago

Zaid-Ajaj commented 1 year ago

Reproducing #97 surfaced another issue which is that Femto doesn't know how to "crack" dotnet projects when using dotnet sdk v7.x

pinning the dotnet sdk to v6.x solves this issue temporarily:

{
    "sdk": {
        "version": "6.0.400"
    }
}
MangelMaxime commented 1 year ago

A less strict pinning strategy could be:

{
    "sdk": {
        "version": "6.0.0",
        "rollForward": "latestMinor"
    }
}
mrakgr commented 1 year ago

The issue I had with Femto silently not updating the packages seems to be exactly this. I can confirm that trying to resolve a project with the prerelease 4.0.0 Fable and the global.json deleted causes Femto to not resolve the NPM packages. As soon as I downgraded, it started working again.

Zaid-Ajaj commented 1 year ago

Fixed as of Femto v0.17.0 🚀 which now supports projects targeting net7.0

mrakgr commented 1 year ago

Nice. I'll give it a try tomorrow.

Edit: I gave it a try and it works. It is not a thorough test, but it is good that I can use .NET 7 issue now. Thanks.

mrakgr commented 1 year ago

I found an issue. Check out: https://github.com/mrakgr/SAFE-TodoList/tree/671b8bc4cd553aef7e7b329a5c0b4aa2b5b2cbd8

PS E:\Webdev\Fable\Safe Stack Examples\SAFE-TodoList> dotnet femto src/client --resolve                
[16:30:36 INF] Analyzing project E:/Webdev/Fable/Safe Stack Examples/SAFE-TodoList/src/client/Client.fsproj
[16:30:36 INF] Running dotnet restore against the project
[16:30:41 INF] Using npm for package management
[16:30:41 INF] Found package.json in E:\Webdev\Fable\Safe Stack Examples\SAFE-TodoList
[16:30:41 INF] Npm packages need to be restored first for project analysis
[16:30:41 INF] Restoring npm packages using 'npm install' inside E:\Webdev\Fable\Safe Stack Examples\SAFE-TodoList
[16:30:48 INF] ✔ Required packages are already resolved
PS E:\Webdev\Fable\Safe Stack Examples\SAFE-TodoList> 

When I run this, it looks like it finishes correctly, but it doesn't install react and react-dom properly. If I add the globals.json file it starts working again.

mrakgr commented 1 year ago

Also, Fable.Elmish.Debugger requires the remotedev package, but it doesn't get resolved even with globals.json. I wonder if it is missing in the package metadata?

MangelMaxime commented 1 year ago

@mrakgr For Fable.Elmish.Debugger, this is because the package doesn't have the Femto metadata.

This is because the project was created before Femto. In general, the remotedev package is injected by the browser extension or webpack I don't remember.

Zaid-Ajaj commented 1 year ago

@mrakgr does it work when you manually npm install?

mrakgr commented 1 year ago

@Zaid-Ajaj That wouldn't add the react and react-dom dependencies to package.json. I need Femto for that. But once they are there it would work.

Zaid-Ajaj commented 1 year ago

@mrakgr first npm install then femto --resolve should get you the right packages even after npm install is done but I agree, femto should do npm install on its own when needed

mrakgr commented 1 year ago

@Zaid-Ajaj I didn't realize that. With .NET 6 it works right away using just --resolve.

Zaid-Ajaj commented 1 year ago

@mrakgr yeah even if you mess up your npm package versions manually, femto --resolve will get the right versions back. I will see why femto isn't automatically executing npm install