N3developertoolkit / neo3-visual-tracker

Neo N3 blockchain explorer that is directly available within Visual Studio Code for developer usage and development scenarios.
https://marketplace.visualstudio.com/items?itemName=ngd-seattle.neo3-visual-tracker
MIT License
7 stars 11 forks source link

Remove NeoExpress from DevTracker extension package #157

Open devhawk opened 1 year ago

devhawk commented 1 year ago

Today, devtracker includes its own copy of Neo Express in the extension package. This is problematic for a few reasons

Instead of including neoxp inside the extension package, DevTracker should help the developer keep their global or local installation of Express up to date.

On activation in a workspace that contains one or more .neo-express files, check to see if Express is installed locally (dotnet tool list --local) or globally (dotnet tool list --global).

If not installed, give the user the option to install either globally or locally. Also, provide a mechanism to "learn more" that will open a documentation page that explains the difference. Note, if the user chooses local install, devtracker may also need to create a tool manifest (dotnet new tool-manifest)

If installed, check to see if there is an updated version of Neo.Express available from nuget.org and offer to update if available. Note, DevTracker and Express both track the Neo platform's major & minor version numbers, but will have different patch version. DevTracker should not install a version of Express that doesn't match its own major/minor version. For example. DevTracker v3.6.12 and Express 3.6.21 are both installed. DevTracker should offer to update to Express v3.6.28 but not Express v3.7.13. DevTracker v3.7 would offer to update Express 3.6.21 -> 3.7.13

Note, if possible, devtracker should have a setting to allow it to pull express builds from the build server package feed in addition to the main nuget.org package feed

ngdentdev commented 1 year ago

In the case of local installation, where should we place "neo.express"? In the extensions folder like the current implementation or the workspace folder?

ngdentdev commented 1 year ago

The dotnet-tools.json file is included in the extension package under the new-contract -> csharp folder. Is it ok to assume it will always be there for us to get the target neo.express version?

devhawk commented 1 year ago

In the case of local installation, where should we place "neo.express"? In the extensions folder like the current implementation or the workspace folder?

We should trigger installation and updates via the dotnet tool command line utility. So for install, if the user chooses local we should execute dotnet install neo.express --local (local is the default, but for automation like this I prefer to be explicit). Note, local tool installation requires a tool manifest, which may not already be present. dotnet new tool-manifest will create a new tool manifest in the right location.

The dotnet-tools.json file is included in the extension package under the new-contract -> csharp folder. Is it ok to assume it will always be there for us to get the target neo.express version?

I don't think the new contract template is a good source for this information. We can add baseline version information to the package.json file (which is available to the extension via the Extension.packageJSON property). But ideally we would get this information from the nuget.org API. The Package Content versions API is trivial to parse.

Current content of https://api.nuget.org/v3-flatcontainer/neo.express/index.json:

{
    "versions": [
        "0.8.11",
        "0.9.80",
        "0.9.82",
        "0.9.95",
        "1.0.7",
        "1.0.8",
        "1.1.28",
        "2.0.17-preview",
        "2.0.18-preview",
        "2.0.21-preview",
        "2.0.23-preview",
        "2.0.24-preview",
        "2.0.32-preview",
        "2.0.35-preview",
        "2.0.37-preview",
        "2.0.39-preview",
        "2.0.50-preview",
        "3.0.2",
        "3.0.5",
        "3.0.13",
        "3.0.21",
        "3.1.38",
        "3.1.46",
        "3.3.21",
        "3.3.27",
        "3.4.18",
        "3.5.20"
    ]
}
ngdentdev commented 1 year ago

dotnet new tool-manifest will create a new tool manifest in the right location.

dotnet new tool-manifest places a file in the current ./.config folder, so in this case, should the folder be the root of the workspace or the extensions' root folder?

devhawk commented 1 year ago

dotnet new tool-manifest places a file in the current ./.config folder, so in this case, should the folder be the root of the workspace or the extensions' root folder?

The tool config file is local to the workspace folder, not the extension folder. You can see an example in the Registrar Sample repo

Note, I think we need to fix the C# new contract template. It's putting the tool manifest in the project workspace root, not under .config folder as dotnet new tool-manifest does. I'll open a separate issue for that