Giter VIP home page Giter VIP logo

Comments (9)

baronfel avatar baronfel commented on July 23, 2024

One thing to do might be to build the docs after you package the local copy. When you build the docs, you can use a nuget.config file that specifies the location of the built package as an additional package source. That would keep you from having to specify the local source in the documentation files themselves, which means that after you publish the package to NuGet.org users could just copy and paste directly.

from fsharp.formatting.

TheAngryByrd avatar TheAngryByrd commented on July 23, 2024

Yeah this seems to work somewhat. The problem here is once you reference a nuget package, you'd have to go clear out your local nuget cache if you have to regenerate the package for any reason. Is there some type of way to get FSI to force reinstall those local packages? (Or maybe not cache to begin with Looks like people have been asking for this for a while.)

Do you foresee any other issues with having some output package directory always in the NuGet.config file?

from fsharp.formatting.

baronfel avatar baronfel commented on July 23, 2024

If that directory doesn't exist then dotnet restore/FSI will report errors. To get around that I commit a dummy file to the folder, but I also put the folder under gitignore to prevent packages being checked in.

Another thing to do would be to set a different global packages dir to prevent corrupting your global cache. I forget the nuget.config setting for that, but I think it's the NUGET_PACKAGES env var.

from fsharp.formatting.

nhirschey avatar nhirschey commented on July 23, 2024

You can use a hidden (*** condition:prepare ***) section to reference the dlls explicitly.

https://github.com/fsprojects/FSharp.Data/blob/main/docs/library/CsvProvider.fsx

you can then fake a reference to the nuget within a markdown comment block. See also

https://github.com/DiffSharp/DiffSharp/blob/29af24ad69a96aace8a49420996861b2a3ca0fa9/docs/install.fsx#L49

If you use {{fsdocs-package-version}} you can automatically update to latest your nuget version on publication, see the diffsharp docs use of it. I think fsharp data uses that trick too.

Here’s a use of package version
https://github.com/fsprojects/FSharp.Data.Toolbox/blob/4cd853c39ffa2131976f9681b4837dd88731cb58/docs/TwitterProvider.fsx#L41

from fsharp.formatting.

TheAngryByrd avatar TheAngryByrd commented on July 23, 2024

Another thing to do would be to set a different global packages dir to prevent corrupting your global cache. I forget the nuget.config setting for that, but I think it's the NUGET_PACKAGES env var.

Yeah this is possible but it's a very weird experience making this work. If you don't set NUGET_PACKAGES before you open your editor, it won't pick up these changes.

If you only set it for the dotnet fsdocs command itself, it doesn't seem to pull from the new cache.

Content:
  generating model for C:\Users\jimmy\Repositories\public\TheAngryByrd\fsdocstster\docsSrc\Tutorials\Tutorial-3.fsx --> .\Tutorials\Tutorial-3.html
   C:\Users\jimmy\Repositories\public\TheAngryByrd\fsdocstster\docsSrc\Tutorials\Tutorial-3.fsx: error(20,17)-(20,20) The value, constructor, namespace or type 'Foo' is not defined.
   C:\Users\jimmy\Repositories\public\TheAngryByrd\fsdocstster\docsSrc\Tutorials\Tutorial-3.fsx: error(0,0)-(0,0) The module/namespace 'Project1.Say' from compilation unit 'Project1' did not contain the namespace, module or type 'Foo'

You can use a hidden (*** condition:prepare ***) section to reference the dlls explicitly.

https://github.com/fsprojects/FSharp.Data/blob/main/docs/library/CsvProvider.fsx

you can then fake a reference to the nuget within a markdown comment block. See also

This is good to know! Only problem I have here is it becomes difficult to reference a project if it has dependencies. Yeah, you can generate it load references in VSCode but in my experience, the load order isn't correct always.

f you use {{fsdocs-package-version}} you can automatically update to latest your nuget version on publication, see the diffsharp docs use of it. I think fsharp data uses that trick too.

This issue is more about before publication of the nuget package but still valuable to know. Thanks!

from fsharp.formatting.

TheAngryByrd avatar TheAngryByrd commented on July 23, 2024

The package caching wouldn't be so bad if NuGet locals command should allow deleting specific packages from NuGet global packages folder was available also. :(

from fsharp.formatting.

nhirschey avatar nhirschey commented on July 23, 2024

This issue is more about before publication of the nuget package.

Just fyi for future reference, fsdocs takes {{fsdocs-package-version}} from your project or directory build props, not nuget.org. There’s no nuget dependency. It’ll work pre-publication.

from fsharp.formatting.

nojaf avatar nojaf commented on July 23, 2024

Not sure if this helps but in Fantomas, we switched to local assemblies instead of #r "nuget::
https://github.com/fsprojects/fantomas/blob/v6.0/docs/docs/end-users/Configuration.fsx#L18-L19

from fsharp.formatting.

kMutagene avatar kMutagene commented on July 23, 2024

In Plotly.NET, we use local assembly references as well. If your project has external dependencies, they can be loaded via #r nuget:

https://github.com/plotly/Plotly.NET/blob/1e5fec1496e5b78dc4bb7cad7648a95cefdb975a/docs/02_0_line-scatter-plots.fsx#L12-L16

from fsharp.formatting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.