Git Product home page Git Product logo

fornax's People

Contributors

baronfel avatar bigjonroberts avatar christianwittig avatar drewknab avatar drk-mtr avatar fbehrens avatar freymaurer avatar grishace avatar jbeeko avatar jeremyabbott avatar kmutagene avatar krzysztof-cieslak avatar laenas avatar mangelmaxime avatar natelkins avatar neftedollar avatar nojaf avatar onurgumus avatar pblasucci avatar rdipardo avatar remmah avatar robertpi avatar sasmithjr avatar scitesy avatar slang25 avatar theangrybyrd avatar toburger avatar walternative avatar whitetigle avatar zaymonfc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fornax's Issues

.NET 5 Support

Is your feature request related to a problem? Please describe.
Not specifically.

Describe the solution you'd like
.NET 5 support, and the ability to reference Nuget packages from script files. I also think this is one way to handle themes (just package it up as a Nuget package).

Describe alternatives you've considered

Additional context

I'm mostly just creating this issue to track. I'll try and find some time to take a crack at some point.

Unable to run 'fornax build' or 'fornax watch' - seemingly due to error "Could not locate the assembly "FSharp.Core..."

Firstly, huge thanks for sharing your software in the public domain - incredibly generous.

Unfortunately I was unable to get this working on a Windows PC or a Mac. I suspect this may be due to it not being able to find the correct F# version, but I'm too new to coding to know whether this is actually the case.

Here are the errors I get with a 'build':

C:\Projects\FornaxTrial
> fornax build
Error: System.Exception: Error creating evaluation session: StopProcessingExn null
   at Microsoft.FSharp.Compiler.Interactive.Shell.-ctor@2571-142.Invoke(String message)
   at Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession..ctor(FsiEvaluationSessionHostConfig fsi, String[] argv, TextReader inReader, TextWriter outWriter, TextWriter errorWriter, Boolean fsiCollectible, Boolean msbuildEnabled)
   at Microsoft.FSharp.Compiler.Interactive.Shell.FsiEvaluationSession.Create(FsiEvaluationSessionHostConfig fsiConfig, String[] argv, TextReader inReader, TextWriter outWriter, TextWriter errorWriter, FSharpOption`1 collectible, FSharpOption`1 msbuildEnabled)
   at <StartupCode$Fornax>.$Generator..cctor()
Inner: <null>
ErrorStream:

error FS0082: Could not resolve this reference. Could not locate the assembly "FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. (Code=MSB3245)


error FS0073: internal error: BuildFrameworkTcImports: no resolution of 'FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'


Unhandled Exception: System.TypeInitializationException: The type initializer for '<StartupCode$Fornax>.$Generator' threw an exception. ---> System.Exception: Error creating evaluation session: StopProcessingExn null
   at <StartupCode$Fornax>.$Generator..cctor()
   --- End of inner exception stack trace ---
   at Generator.f@1(String n)
   at Generator.getPosts(String projectRoot)
   at Generator.generateFolder(String projectRoot)
   at Fornax.main$cont@57(String[] argv, ArgumentParser`1 parser, Unit unitVar)
   at Fornax.main(String[] argv)

The error is essentially the same for a 'watch'.

As I say, this may well be me misunderstanding where F# should be installed (in which case I apologise for recording this as an issue with Fornax!), however I can successfully run F# code on both computers and can use FSI successfully from the command line.

On the Windows PC, I have the following folders on this PC which suggest F# is installed:

C:\Program Files (x86)\Microsoft SDKs\F#\4.1
C:\Program Files (x86)\Microsoft SDKs\F#\10.1

Under both of these there is a 'Framework\v4.0' folder, the contents appear to be the same in each.

When starting FSI on the PC I get:

Microsoft (R) F# Interactive version 4.1

I have various dotnet framework version installed (including 4.6.2 and 4.7) and plenty of dotnet core versions - please let me know if you need any further info in this respect.

dotnet fornax build unable to find config.fsx on CI servers

Describe the bug
Installing fornax as a local tool on a CI server and trying to build a site throws an error "Couldn't find or load config".

To Reproduce

  1. Create a fornax site (e.g. using fornax new)
  2. Add a dotnet-tools.json with instructions to install fornax locally
  3. Add a config file for your chosen CI platform which runs dotnet tool restore and dotnet fornax build
  4. Push your site to a git repo and build using the CI service of your choice (e.g. TravisCI, Netlify, Azure Pipelines, etc.)
  5. Watch the build fail and observe the printed error Couldn't find or load config.

Expected behaviour
The site should build.

Build Output
Below is the output from TravisCI. The same problem occurs on Azure Pipelines as well as Netlify.

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7
Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.201/
Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8
.NET Core SDKs installed:
  3.1.201 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
$ dotnet tool restore
$ pwd
/home/travis/build/LukeBurgessYeo/fsharp-tutorial
The command "pwd" exited with 0.
$ ls
config.fsx  images  _lib     loaders  README.md   style
generators  js	    LICENSE  posts    Script.fsx
The command "ls" exited with 0.
$ dotnet fornax build
Couldn't find or load config
The command "dotnet fornax build" exited with 1.

Notice that the working directory contains a config.fsx.

Additional Thoughts
Fornax works as expected locally with the globally installed dotnet tool, as well as with the locally installed dotnet tool. It seems that on these CI servers, the directory which dotnet fornax build is being run from is not the same as the directory which is being passed into the build process (i.e. this path from Directory.GetCurrentDirectory()).

Adjust path to better develop fornax project for gh-pages.

Is your feature request related to a problem? Please describe.
I am currently working on a fornax project to build gh-pages as docs for other repositories. The default gh-pages link is created somewhat like the following

https://{user_name}.github.io/{repo_name}/

After which the fornax structure is appended. This leads to the problem, that relative links, which work fine in dev (exmaple: /content/content.md) will not resolve to the correct page in gh-pages (/{repo_name}/content/content.md).

Describe the solution you'd like
Maybe give fornax watch not only an option to user an alternative port, but also to adjust the dev url.

Cannot build fornax repo for PR

Describe the bug
Hey i am currently working on a PR to fix #104 but i can't build fornax following the steps in the README.md:

To Reproduce

Build process

  • You need .NET Core 5.0 SDK
  • Run dotnet tool restore to restore the .NET 5 local tools defined at .config/dotnet-tools.json
  • To build the project run dotnet fake build

Error:

There was a problem while setting up the environment:
-> Could not find referenced assemblies in path: 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.0\ref\net6.0', please check installed SDK and runtime versions

Expected behaviour
Fornax builds.

Environment (please complete the following information):

dotnet --list-sdks

3.1.413 [C:\Program Files\dotnet\sdk]
5.0.406 [C:\Program Files\dotnet\sdk]
6.0.101 [C:\Program Files\dotnet\sdk]
6.0.201 [C:\Program Files\dotnet\sdk]

dotnet --info

.NET SDK (reflecting any global.json):
 Version:   6.0.101
 Commit:    ef49f6213a

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.101\

Host (useful for support):
  Version: 6.0.3
  Commit:  c24d9a9c91

.NET SDKs installed:
  3.1.413 [C:\Program Files\dotnet\sdk]
  5.0.406 [C:\Program Files\dotnet\sdk]
  6.0.101 [C:\Program Files\dotnet\sdk]
  6.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Seems to be an issue with the build.fsx, but i have no idea how to adress this.

Pretty sure i encountered it already in other projects which i then upgraded to use a build.fsproj to circumvent this.

@baronfel

dotnet tool install fornax -g -> forex new -> fornex watch Fails

The instructions to create a sample website fail during the invocation of fornax watch. I tried fornax build as well, with the same result.

jbeeko-MBP:~ joergbeekmann$ dotnet tool install fornax -g
You can invoke the tool using the following command: fornax
Tool 'fornax' (version '0.10.0') was successfully installed.

jbeeko-MBP:Documents joergbeekmann$ fornax new
New project successfully created.

jbeeko-MBP:Documents joergbeekmann$ fornax watch
[14:27:35] '/Users/joergbeekmann/Documents/_public/index.html' generated in 436ms
[14:27:35] '/Users/joergbeekmann/Documents/_public/about.html' generated in 164ms
[14:27:35] '/Users/joergbeekmann/Documents/_public/contact.html' generated in 101ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/.DS_Store' generated in 54ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/.localized' generated in 50ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/~$ndom-Thoughts.docx' generated in 34ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/FsAutoComplete.sln' generated in 35ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/LICENSE.md' generated in 35ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/build.cmd' generated in 33ms
[14:27:37] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/Directory.Build.props' generated in 35ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/paket.lock' generated in 34ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/azure-pipelines.yml' generated in 38ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/README.md' generated in 33ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/appveyor.yml' generated in 34ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/build.sh' generated in 33ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/RELEASE_NOTES.md' generated in 35ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/global.json' generated in 37ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/FsAutoComplete/paket.dependencies' generated in 78ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/Personal/.DS_Store' generated in 42ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/posts/post2.html' generated in 214ms
[14:27:38] '/Users/joergbeekmann/Documents/_public/posts/post.html' generated in 206ms
An unexpected error happend: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Generator.EvaluatorHelpers.helper@51(Object next, FSharpList`1 args) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 61
   at Generator.EvaluatorHelpers.invokeFunction(Object f, IEnumerable`1 args) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 65
   at [email protected](FsiValue ft) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 174
   at Microsoft.FSharp.Core.ResultModule.Bind[T,TResult,TError](FSharpFunc`2 binder, FSharpResult`2 result) in E:\A\_work\130\s\src\fsharp\FSharp.Core\result.fs:line 15
   at Generator.GeneratorEvaluator.evaluate(FsiEvaluationSession fsi, SiteContents siteContent, String generatorPath, String projectRoot, String page) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 171
   at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 276
   at Generator.action@1(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 390
   at Generator.generateFolder(String projectRoot) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 389
   at Fornax.guardedGenerate@144(String cwd, Unit unitVar0) in D:\Programowanie\Projekty\Fornax\src\Fornax\Fornax.fs:line 146

SiteContents are not reset when md parsing and loader type are in library.

Is your feature request related to a problem? Please describe.
Hello I am writing a class library for my markdig extensions, markdown parsing and core generator components. Everything is in this project and i noticed some strange behavior I don't really understand.

The hot reload triggers and markdown parsing happens and everything gets added to SiteContents on the loader level, but when i check the number of values of that specific type i see, that everytime i trigger the hot reload it just adds the new version to the existing values. And because i use Seq.find to find the correct html for my generator it returns the first fitting value, which is the old and not updated one.

So my question is: How does this happen? Can i somehow avoid this behavior?

Describe the solution you'd like
It works exactly the same way it works without using a library.

Describe alternatives you've considered
I started using Seq.findBack to always return the newest addition, but this will lead to problems if i hot reload to often as the values will not get dumped this way.
I could also initiate a new SiteContext in my loader, some very superficial testing showed that this could work, but there might be issues i am not aware of.

Additional context

Package restore fails after upgrade to .NET SDK 5.0.300

Describe the bug

The installed version of MSBuild.StructuredLogger is incompatible with .NET SDK version 5.0.300 (and probably later); package restore fails with the error message:

NotSupportedException: Unsupported log file format. Latest supported version is 9, the log file has version 13.

To Reproduce

  1. Update your SDK to 5.0.300 (or newer):
$ dotnet --list-sdks
3.1.409 [/usr/share/dotnet/sdk]
5.0.300 [/usr/share/dotnet/sdk]
  1. Apply the upgrades proposed in #86
$ curl https://github.com/ionide/Fornax/commit/7e28242e21101ea471241f93b56434660960c58d.diff | git apply -v
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   592  100   592    0     0   2114      0 --:--:-- --:--:-- --:--:--  2106
Checking patch .config/dotnet-tools.json...
Checking patch global.json...
Applied patch .config/dotnet-tools.json cleanly.
Applied patch global.json cleanly.
  1. Try to build
dotnet fake build -> "BuildFailedException: Target 'Restore' failed."
$ dotnet tool restore
Tool 'fake-cli' (version '5.20.4') was restored. Available commands: fake
Tool 'paket' (version '5.257.0') was restored. Available commands: paket

Restore was successful.

$ dotnet fake build
Starting full restore process.
run Pack
Building project with version: LocalBuild
Shortened DependencyGraph for Target Pack:
<== Pack
<== Default
<== Test
<== Publish
<== Build
<== Restore
<== AssemblyInfo
<== Clean

The running order is:
Group - 1

  • Clean
    Group - 2
  • AssemblyInfo
    Group - 3
  • Restore
    Group - 4
  • Build
    Group - 5
  • Publish
    Group - 6
  • Test
    Group - 7
  • Default
    Group - 8
  • Pack
    Starting target 'Clean'
    Finished (Success) 'Clean' in 00:00:00.0201291
    Starting target 'AssemblyInfo'
    Finished (Success) 'AssemblyInfo' in 00:00:00.0799084
    Starting target 'Restore'
    Starting task 'DotNet:restore'

"/usr/bin/mono" --version (In: false, Out: true, Err: true)
/home/rob/dev/Fornax> "dotnet" msbuild /version /nologo (In: false, Out: true, Err: true)
16.10.0.26302
/home/rob/dev/Fornax> "dotnet" restore "" /bl:/tmp/tmp22hDDJ.tmp.binlog (In: false, Out: false, Err: false)
/usr/share/dotnet/sdk/5.0.300/MSBuild.dll -nologo -maxcpucount -target:Restore -verbosity:m /bl:/tmp/tmp22hDDJ.tmp.binlog ./Fornax.sln
Determining projects to restore...
Paket version 5.257.0
Starting restore process.
Performance:

  • Runtime: 5 seconds
    Restored /home/rob/dev/Fornax/src/Fornax.Core/Fornax.Core.fsproj (in 1.06 sec).
    Restored /home/rob/dev/Fornax/test/Fornax.Core.UnitTests/Fornax.Core.UnitTests.fsproj (in 1.06 sec).
    Restored /home/rob/dev/Fornax/src/Fornax/Fornax.fsproj (in 1.59 sec).
    Finished (Failed) 'DotNet:restore' in 00:00:15.0830548
    Finished (Failed) 'Restore' in 00:00:15.0975829

Build Time Report

Target Duration


Clean 00:00:00.0048055
AssemblyInfo 00:00:00.0796770
Restore 00:00:15.0970538 (Unsupported log file format. Latest supported version is 9, the log file has version 13.)
Build 00:00:00 (skipped)
Publish 00:00:00 (skipped)
Test 00:00:00 (skipped)
Default 00:00:00 (skipped)
Pack 00:00:00 (skipped)
Total: 00:00:15.6136692
Status: Failure

Script reported an error:
-> BuildFailedException: Target 'Restore' failed.
-> One or more errors occurred. (Unsupported log file format. Latest supported version is 9, the log file has version 13.)
-> NotSupportedException: Unsupported log file format. Latest supported version is 9, the log file has version 13.
Hint: To further diagnose the problem you can run fake in verbose mode fake -v run ... or set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'
Performance:

  • Cli parsing: 795 milliseconds
  • Packages: 7 seconds
    • Creating Runtime Graph: 216 milliseconds
    • Retrieve Assembly List: 3 seconds
  • Script compiling: 19 seconds
  • Script analyzing: 988 milliseconds
  • Script running: 16 seconds
  • Script cleanup: 121 milliseconds
  • Runtime: 54 seconds

Expected behaviour

The restore target should succeed without having to downgrade the SDK

Environment

  • OS: Debian 10.5
  • Ionide version: 5.5.5
  • VSCode version: 1.56.2
  • dotnet SDK version: 5.0.300
  • mono / .Net Framework version: Mono JIT compiler version 5.18.0.240

Additional context

Bumping MSBuild.StructuredLogger to a newer version seems to resolve this issue:

diff --git a/paket.lock b/paket.lock
index c0b4fff..032a2e0 100644
--- a/paket.lock
+++ b/paket.lock
@@ -761,7 +761,7 @@ NUGET
       System.Security.AccessControl (>= 4.7) - restriction: || (&& (>= monoandroid) (< netstandard2.0)) (>= monotouch) (&& (< net46) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.0) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos)
       System.Security.Principal.Windows (>= 4.7) - restriction: || (&& (>= monoandroid) (< netstandard2.0)) (>= monotouch) (&& (< net46) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.0) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos)
     Mono.Posix.NETStandard (1.0) - restriction: || (>= net462) (>= netstandard2.0)
-    MSBuild.StructuredLogger (2.1.117) - restriction: || (>= net462) (>= netstandard2.0)
+    MSBuild.StructuredLogger (2.1.507) - restriction: || (>= net462) (>= netstandard2.0)
       Microsoft.Build (>= 16.4) - restriction: >= netstandard2.0
       Microsoft.Build.Framework (>= 16.4) - restriction: >= netstandard2.0
       Microsoft.Build.Tasks.Core (>= 16.4) - restriction: >= netstandard2.0

File watcher not triggering recompilation when a folder does contain specific characters

Describe the bug
When the path of a folder containing a fornax site contains multiple dots (.), the watch command will not trigger recompilation via any generator triggers. I encountered this in a repository with a name like this: RepoName.github.io

To Reproduce
Steps to reproduce the behaviour:

  • create a folder called reproFornax.github.io
  • initialize fornax (run dotnet new tool-manifest, dotnet tool install fornax, dotnet fornax new)
  • run dotnet fornax watch
  • change some text in a post markdown

Expected behaviour
content is recompiled and refreshed in the client due to the watch command.

Actual behavior
No recompilation is triggered. This can be circumvented by removing one of the dots in the folder name.

Environment (please complete the following information):

  • OS: Win 10 Version 10.0.19042 Build 19042
  • Ionide version: 5.3.2
  • VSCode version: VSCode Insiders February 2021 (version 1.54)
  • dotnet SDK version: 5.0.103

Release new version on Nuget?

Just reinstalled .NET SDKs on a new machine. When I try to install Fornax as a global tool. I get the following:

nathaniel@nelknet-linux:~$ Fornax
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
  - The following frameworks were found:
      3.0.1 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download
nathaniel@nelknet-linux:~$ dotnet tool list -g
Package Id      Version      Commands
-------------------------------------
fornax          0.2.0        Fornax  
nathaniel@nelknet-linux:~$ 

Two things:

  1. It doesn't work
  2. The command requires Fornax to be capitalized.

Is this something that can be fixed with a new release of the global tool?

Support .NET SDK 5.0.202 and later

The current global.json is locked at 5.0.102.

This release is critically flawed on some Linux hosts, where recent versions of nss or ca-certificates can cause package verification to fail during dotnet restore.

After the recommended upgrade to 5.0.202, the build workflow is broken:

$ dotnet tool restore
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
  * You intended to execute a .NET program:
      The application 'tool' does not exist.
  * You intended to execute a .NET SDK command:
      A compatible installed .NET SDK for global.json version [5.0.102] from [/home/rob/dev/git/Fornax/global.json] was not found.
      Install the [5.0.102] .NET SDK or update [/home/rob/dev/git/Fornax/global.json] with an installed .NET SDK:
        3.1.407 [/usr/share/dotnet/sdk]
        5.0.202 [/usr/share/dotnet/sdk]

I can resolve this locally by editing global.json to choose the highest installed feature band:

diff --git a/global.json b/global.json
index 12cb7ff..3ca4dc8 100644
--- a/global.json
+++ b/global.json
@@ -1,5 +1,6 @@
 {
   "sdk": {
-    "version": "5.0.102"
+    "version": "5.0.102",
+    "rollForward": "latestFeature"
   }
 }

Environment

.NET SDK (reflecting any global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Runtime Environment:
 OS Name:     bunsenlabs
 OS Version:  10.5
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.202/

Host (useful for support):
  Version: 5.0.5
  Commit:  2f740adc14

.NET SDKs installed:
  3.1.407 [/usr/share/dotnet/sdk]
  5.0.202 [/usr/share/dotnet/sdk]

Additional context

Rename templates to layouts, or vice versa

Right now Fornax looks at the layout property in the md file to find the corresponding fsx file in the templates folder. I think that for consistency, we should either rename that property to template, or rename the templates directory to layouts.

SiteContents not being persisted to the generator?

Describe the bug

First off, sorry if this isn't the correct place for this. I have a strong feeling it's more PICNIC than an actual bug, but perhaps shedding a bit of light on this might be valuable for anyone in the same position. I also tried casting my hook into the Slack, but didn't get any bites.

I've restructured the basic example a little and was just toying with Fornax generally, but I'm finding that whatever I put in to my SiteContents within my loaders is not then available in my generators. I'm not sure if I'm missing something super basic, but I was hoping I could get a little bit of guidance. If it's something that perhaps needs clearing up in the docs for clueless people like me, I'm happy to help with that.

I've tried a number of dfferent types, and I've also been able to confirm that the record goes in to the DI container (as I can get it back out within the loader), but once I come to the generator stage, I can't seem to retrieve them. I know it's something obvious I'm missing...

I've created a dump of the repo I was working on here here.

To Reproduce
Steps to reproduce the behaviour:

  1. Clone the example
  2. fornax watch
  3. Observe the exception that the Site record couldn't be pulled from the DI container, despite being added in the globalloader.fsx

Environment (please complete the following information):

  • OS: macOS Mojave
  • Ionide version:
  • VSCode version: 1.50.0
  • dotnet SDK version:
  • mono / .Net Framework version: 5.0 RC1

Can the errors be reported in red?

It would be a must if the error were reported in red making it easier to spot.

When you have a block of text it is not always easy to sport / focus on the error section.

image

Make generated link relative

Moved from https://gitlab.com/Krzysztof-Cieslak/Fornax/issues/6


In order to deploy Fable.Powerpack doc site I needed to cheat on the links generated by Fornax.

// Toggle this lines when testing locally
// let host = "/"
let host = "http://fable.io/fable-powerpack/"

let defaultPage (siteModel : SiteModel) pageTitle (posts: Post list) content =
    let postsTabs =
        posts
        |> List.map (fun p ->
            li [ Id ("tab-" + p.title.ToLower()) ]
               [ a [ Href (host + (p.link.Substring(1))) ] [ !!p.title ] ]

     //...
)

I would like to make the generated links by Fornax relative and not absolute. I think the changes needed are located here

`fornax new` generates project that fails to build

Describe the bug
The project generated with fornax new fails to build.

$ fornax build
Load Errors: [|/home/rb/source/fornax-playground/generators/layout.fsx (67,53)-(67,59) typecheck error The union cases or fields of the type 'HtmlElement' are not accessible from this code location;
  /home/rb/source/fornax-playground/generators/layout.fsx (67,53)-(67,89) typecheck error All elements of a list must be implicitly convertible to the type of the first element, which here is 'HtmlProperties'. This element has type 'HtmlElement'.|]
Open Errors: [|input.fsx (1,6)-(1,11) typecheck error The namespace or module 'Index' is not defined.|]
Get generator Errors: [|input.fsx (1,16)-(1,24) typecheck error The value or constructor 'generate' is not defined. Maybe you want one of the following:
   Generating
   GenerationPhase
   GeneratorConfig
   GeneratorOutput
   GeneratorTrigger|]
[16:40:49] multiple files generation failed

To Reproduce
Steps to reproduce the behaviour:

  1. Create a new project using fornax new
  2. Try to build it using fornax build or fornax watch
  3. See error

Expected behaviour
The project should build without any problems

Environment (please complete the following information):

  • OS: Linux 5.18.11_1
  • Ionide version: N/A
  • VSCode version: N/A
  • dotnet SDK version: 6.0.301
  • mono / .Net Framework version: none

Author section is not rendered

I've add
author: Neftedollar
to the index file's metadata but it not rendered.
Also if I use link author: [Link text](http://example.com) parser fails

fornax_try fornax watch
[00:46:28] '/Users/neftedollar/dev/fornax_try/_public/archive.html' generated in 152ms
[00:46:28] '/Users/neftedollar/dev/fornax_try/_public/index.html' generated in 144ms

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> YamlDotNet.Core.SemanticErrorException: (Line: 3, Col: 25, Idx: 95) - (Line: 3, Col: 44, Idx: 114): While parsing a block mapping, did not find expected key.
   at YamlDotNet.Core.Parser.ParseBlockMappingKey(Boolean isFirst)
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.Core.ParserExtensions.SkipThisAndNestedEvents(IParser parser)
   at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize[T](String input)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Generator.ContentParser.parse(String fileContent, Type modelType) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 214
   at [email protected](String x, Type y) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 27
   at Generator.Evaluator.evaluate[a](a posts, String templatePath, FSharpFunc`2 getSiteModel, FSharpFunc`2 getContentModel) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 170
   at Generator.generate[a](a posts, String projectRoot, String page) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 353
   at Generator.generateFolder(String projectRoot) in D:\Programowanie\Projekty\Fornax\src\Fornax\Generator.fs:line 446
   at Fornax.main$cont@77(String[] argv, ArgumentParser`1 parser, Unit unitVar) in D:\Programowanie\Projekty\Fornax\src\Fornax\Fornax.fs:line 112
   at Fornax.main(String[] argv) in D:\Programowanie\Projekty\Fornax\src\Fornax\Fornax.fs:line 72
[1]    8400 abort      fornax watch

should I split this issue?

Fornax can't support files with non url safe characters

Describe the bug
Fornax can't support files with non url safe characters. If a mark down file in the posts directory contains a space in the file name, it will break the default template.

To Reproduce
Add a file named 'post with spaces.md' to the post directory
Test the template, it will fail to load.

Expected behaviour
The template should load

Environment (please complete the following information):

  • OS: Windows 10
  • Fornex version: build from latest master
  • dotnet SDK version: 3.1.101

Additional context
The url encoding seems to come from this method:

    let relative toPath fromPath =
        let toUri = Uri(toPath)
        let fromUri = Uri(fromPath)
        toUri.MakeRelativeUri(fromUri).OriginalString

Building the site will fail with this error:

An unexpected error happend: System.IO.FileNotFoundException: Could not find file 'C:\code\Fornax\src\Fornax.Template\posts\post%20with%20spaces.md'.
File name: 'C:\code\Fornax\src\Fornax.Template\posts\post%20with%20spaces.md'
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at FSI_0001.Config.postPredicate(String projectRoot, String page)
   at [email protected](Tuple`2 tupledArg)
   at Microsoft.FSharp.Collections.ListModule.TryFind[T](FSharpFunc`2 predicate, FSharpList`1 list) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\list.fs:line 389
   at Generator.pickGenerator(Config cfg, SiteContents siteContent, String projectRoot, String page) in C:\code\Fornax\src\Fornax\Generator.fs:line 284
   at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in C:\code\Fornax\src\Fornax\Generator.fs:line 315
   at Generator.action@1(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in C:\code\Fornax\src\Fornax\Generator.fs:line 483
   at Generator.generateFolder(String projectRoot) in C:\code\Fornax\src\Fornax\Generator.fs:line 482
   at Fornax.guardedGenerate@168(String cwd, Unit unitVar0) in C:\code\Fornax\src\Fornax\Fornax.fs:line 170
Finished (Failed) 'TestTemplate' in 00:00:07.9363273

We could fix this by calling System.Web.HttpUtility.UrlDecode, but that results in the following error:

An unexpected error happend: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: An index satisfying the predicate was not found in the collection.
   at Microsoft.FSharp.Collections.SeqModule.Find[T](FSharpFunc`2 predicate, IEnumerable`1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 677
   at FSI_0034.Post.generate'(SiteContents ctx, String page)
   at lambda_method(Closure , Unit , SiteContents , String , String )
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Generator.EvaluatorHelpers.helper@53(Object next, FSharpList`1 args) in C:\code\Fornax\src\Fornax\Generator.fs:line 63
   at Generator.EvaluatorHelpers.invokeFunction(Object f, IEnumerable`1 args) in C:\code\Fornax\src\Fornax\Generator.fs:line 67
   at [email protected](FsiValue ft) in C:\code\Fornax\src\Fornax\Generator.fs:line 177
   at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in C:\code\Fornax\src\Fornax\Generator.fs:line 322
   at Generator.action@1(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in C:\code\Fornax\src\Fornax\Generator.fs:line 483
   at Generator.generateFolder(String projectRoot) in C:\code\Fornax\src\Fornax\Generator.fs:line 482
   at Fornax.guardedGenerate@168(String cwd, Unit unitVar0) in C:\code\Fornax\src\Fornax\Fornax.fs:line 170

Again, we could fix this by calling System.Web.HttpUtility.UrlDecode, but means the generated Url for the page is incorrect because it has not been correctly url encoded. This is harder to do, as we need to encode the file and directory names but the directory separator characters.

Only capitalise the Module name instead of changing its case completely

Describe the bug

Right now when loading a generator/loader Fornax transform the name of the file using textInfo.ToTitleCase meaning that if the user write postLoader.fsx it will be transformed into Postloader for the open instruction.

From what I see, when using #load "postLoader.fsx" the name of the module generated by the F# compiler is PostLoader meaning that it only capitalise the name of the file.

Can we change

let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    let textInfo = (CultureInfo("en-US", false)).TextInfo
    textInfo.ToTitleCase filename

to

let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    let textInfo = (CultureInfo("en-US", false)).TextInfo
    string (textInfo.ToUpper filename[0]) + filename[1..]

// or this one as I am not sure if the CultureInfo is required
let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    (string filename[0]).ToUpperInvariant() + filename[1..]

Doing this change would allow the user have better naming for its files.

When adding an error to the context the Message is not logged in the console

This generator always add an error into the context.

let generate (ctx: SiteContents) (_projectRoot: string) (page: string) =

        let error =
            {
                Path = page
                Message = $"Post %s{page} not found in the context"
                Phase = Generating
            }

        ctx.AddError error

        Layout.generationErrorPage ctx

The only log we get back is:

BAD FILE: posts/first.md

I think it would make sense to also log the message so the user understand the reason of the error.

fornax watch throws InvalidOperationException

Describe the bug
Running fornax watch on a fresh installation resulted in the following error:

$ fornax watch
[17:58:09] 'D:\Documents\Programming\Fsharp\Fornax\_public\index.html' generated in 406ms
[17:58:09] 'D:\Documents\Programming\Fsharp\Fornax\_public\about.html' generated in 259ms
[17:58:09] 'D:\Documents\Programming\Fsharp\Fornax\_public\contact.html' generated in 241ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\images/avatar.jpg' generated in 37ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\images/bulma.png' generated in 34ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\images/favicon.png' generated in 38ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\js/sampleJsFile.js' generated in 38ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\posts/post.html' generated in 239ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\posts/post2.html' generated in 253ms
[17:58:10] 'D:\Documents\Programming\Fsharp\Fornax\_public\style/style.css' generated in 41ms
[17:58:10] Watch mode started. Press any key to exit.
Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
   at System.ConsolePal.ReadKey(Boolean intercept)
   at System.Console.ReadKey()
   at Fornax.main$cont@123(ArgumentParser`1 parser, FSharpList`1 results, Unit unitVar) in D:\Programowanie\Projekty\Ionide\Fornax\src\Fornax\Fornax.fs:line 194
   at Fornax.main(String[] argv) in D:\Programowanie\Projekty\Ionide\Fornax\src\Fornax\Fornax.fs:line 118

To Reproduce
Steps to reproduce the behaviour:

  1. fornax new
  2. fornax watch

Expected behaviour
Watch mode runs without throwing an exception

Environment (please complete the following information):

  • OS: Windows 10
  • Ionide version: 5.5.5
  • VSCode version: 1.56.2
  • dotnet SDK version: 5

I probably did something wrong, but I cannot figure out what. Any suggestions are highly welcome!

Cheers,

Stefan

Fornax Scripts/Extensions

Is your feature request related to a problem? Please describe.
I would like to be able to extend fornax functionality with my owns scripts that are sort of meta generators, so I can do stuff like fornax newpost posts/hello and have the script make a the file filled with a basic front matter or fornax check to verify that configured generator and loader scripts actually have the appropriate functions without having Fornax build files halfway.

Describe the solution you'd like
Config is extended to have a ScriptConfig list (ScriptConfig contains a command and script filename) .

The actual script would need to have a function with signature run (projectRoot : string ) (config : Config) (args : string list ??) (result : Result<string, ScriptError> )

So say we have a ScriptConfig {command="newpost"; script="newpost.script"} and run fornax newpost posts/hello Fornax would evaluate the script (located in the scripts directory) passing along the appropriate arguments.

Describe alternatives you've considered
Running dotnet fsi check.fsx but using this would a be lot more work for the script to be aware of Fornax stuff.

Additional context
Got the idea while looking through #67 and thought that having Fornax as an extensible engine would be nice.

Add --port argument for the watch command

The port 8080 is used by a lot of other dev servers and this can lead to port conflicts.
It would be handy to have a port argument to manually specify the desired port for the dev server.

Update projects to use SDK based format

Background

I'd like to convert fornax to a dotnet cli tool because I think that the target audience would be happy to consume it this way (it also appears to be more practical to deploy it using the dotnet/nuget infrastructure). To do this there are a couple of steps I'd need to tackle:

  • Update proj format (no dotnet standard and netcore with the old proj format 🙁)
  • Use netstandard conform dependencies (FsYaml still forces full framework on the project)
  • Update build tooling to leverage dotnet sdk (not strictly necessary but if we're already touching stuff it would be an obvious target)
  • Switch to netcore (this would make sense in the mentioned scenario - it is debatable though)

Does this sound like a good idea - would you wish to see the project go in another direction?

WIP

I created a pull request which implements the needed changes to use the new project formats. I'd open other issues to address the other topics in a more focused manner. The PR is #7.

Fornax generates a ghost file

Describe the bug
Fornax is generating output for a generator with no generate function.

To Reproduce
Steps to reproduce the behaviour:

  1. fornax new
  2. Delete everything in contact.fsx
  3. fornax build
  4. See contact.html generated with content in it.

Expected behaviour
An error occurs, like say "Fornax couldn't detect a generator in this file" or something to that effect.

Environment (please complete the following information):

  • OS: Windows 10 / Ubuntu 20.4
  • Ionide version: 5.5.5
  • VSCode version: 1.56.1
  • dotnet SDK version: 5.0.203

Hugo like archetypes

Is your feature request related to a problem? Please describe.
In Hugo archetypes are templates for .md files that will be created in the posts directory. They make it easy not new post, for example helping to structure the url consistently.

Describe the solution you'd like
Command line something like:

fornax newpost "Some thing very interesting" 

template would be kept in "archetypes"

I would be will to implement this, but wanted discuss the solution before starting.

Uninitialized SiteContents being passed to post generator in watch mode

Describe the bug

Changing a Markdown file in watch mode makes the generators/post.fsx script throw an unhandled KeyNotFoundException.

The reason seems to be that an empty instance of SiteContents is being passed to the script.
Strangely, the first generation cycle runs to completion without a problem.

To Reproduce

  1. Clone the source tree
  2. Add a debug message showing the value of the SiteContents argument before Seq.find gets called in generators/post.fsx, e.g.:
let generate' (ctx : SiteContents) (page: string) =
    let allPosts =
        ctx.TryGetValues<Postloader.Post> ()
        |> Option.defaultValue Seq.empty

    eprintfn "%O has %d posts" ctx (Seq.length allPosts)

    let post =
        allPosts
        |> Seq.find (fun n -> n.file = page)
  1. Build the demo project:

     dotnet tool restore
     dotnet fake build -t TestTemplate
    
  2. The initial build finishes with output like this:

Starting target 'TestTemplate'
[...snip...]
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/posts/post3.html' generated in 1ms
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/js/sampleJsFile.js' generated in 106ms
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/images/avatar.jpg' generated in 1ms
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/images/bulma.png' generated in 1ms
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/images/favicon.png' generated in 0ms
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/style/style.css' generated in 1ms
Model+SiteContents has 7 posts
[23:09:34] '/home/rob/dev/Fornax/src/Fornax.Template/_public/posts/subdir/post3.html' generated in 2ms
Generation time: 00:00:23.1454396
[23:09:35] Watch mode started. Press any key to exit.
[23:09:35 INF] Smooth! Suave listener started in 138.573ms with binding 127.0.0.1:8080
  1. With watch mode running, edit a Markdown file, e.g.:
echo -e "\n\n### More\n" >> src/Fornax.Template/posts/post.md
  1. Notice that the SiteContents argument now contains no post data, crashing the build:
[23:09:45] Changes detected: /home/rob/dev/Fornax/src/Fornax.Template/posts/post.md
[23:09:48] multiple files generated in 638ms
[23:09:48] '/home/rob/dev/Fornax/src/Fornax.Template/_public/about.html' generated in 1ms
[23:09:48] '/home/rob/dev/Fornax/src/Fornax.Template/_public/contact.html' generated in 1ms
Model+SiteContents has 0 posts
An unexpected error happend: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: An index satisfying the predicate was not found in the collection.
   at Microsoft.FSharp.Collections.SeqModule.Find[T](FSharpFunc`2 predicate, IEnumerable`1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 677
   at FSI_0022.Post.generate'(SiteContents ctx, String page)
   at lambda_method21(Closure , Unit , SiteContents , String , String )
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Generator.EvaluatorHelpers.helper@56(Object next, FSharpList`1 args) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 66
   at Generator.EvaluatorHelpers.invokeFunction(Object f, IEnumerable`1 args) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 70
   at [email protected](Object generator) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 195
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr callersRetAddrSlot, IntPtr callTarget, IntPtr retVal)
   at Generator.GeneratorEvaluator.evaluate(FsiEvaluationSession fsi, SiteContents siteContent, String generatorPath, String projectRoot, String page) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 190
   at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 333
   at Generator.action@1-3(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 496
   at Generator.generateFolder(String projectRoot, Boolean isWatch) in /home/rob/dev/Fornax/src/Fornax/Generator.fs:line 495
   at Fornax.guardedGenerate@226(String cwd, Unit unitVar0) in /home/rob/dev/Fornax/src/Fornax/Fornax.fs:line 228
Finished (Failed) 'TestTemplate' in 00:00:38.2120491

Expected behaviour

Watch mode should work.

Environment (please complete the following information):

  • OS: Debian 10.5
  • Ionide version: 5.5.7
  • VSCode version: 1.57.1
  • dotnet SDK version: 5.0.301
  • mono / .Net Framework version: Mono JIT compiler version 5.18.0.240 (Debian 5.18.0.240+dfsg-3)

Additional context

This issue probably has the same underlying cause as #84

Does Fornax support incremental builds?

Is your feature request related to a problem? Please describe.
I would like to host Fornax in an Azure Function and have it re-generate new content when requested, but I would want this to be fast and only generate the new content.

Describe the solution you'd like
Support incremental content generation.

Describe alternatives you've considered
Accept what exists or use Gatsby, which does support incremental builds.

Additional context
I assumed this might already exist for watch but didn’t see it listed.

fornax watch does not update _public files

Describe the bug
Changes to posts .md files are not reflected in _public/posts HTML files when running fornax watch. fornax build does update the HTML.

To Reproduce
Steps to reproduce the behaviour:

  1. fornax new
  2. fornax watch
  3. Open post.md, change title to Cat, save file
  4. Open post.html and see that the title is still Some nice post title

Expected behaviour
Title in post.html changes to Cat and is shown on page served by Suave.

Environment (please complete the following information):

  • OS: macOS 10.15.5
  • Ionide version: 4.14.0
  • VSCode version: 1.46.0
  • dotnet SDK version: 3.1.301
  • mono / .Net Framework version: 5.18.1.3
  • fornax version: 0.13.1

Add a configuration file

Moved from: https://gitlab.com/Krzysztof-Cieslak/Fornax/issues/4


It's could be interesting to add config file to Fornax. I propose to use Toml over yaml because I got a lot of exception when using FsYaml (still trying to understand the reasons). Also, Toml seems better for this kind of usage.

Example of config file:

Exclude = [
  "node_modules/",
  "packages/"
]

[Style]
type = "sass" # Could by less, css
entry = "main.sass"
output = "bundle.css"

Exclude

Array of path to ignore during Fornax build.

Why ?

Useful when people want to include CSS frameworks (via npm for example).

Current behavior

Read all the folders and build all the files fornax understand (less, sass, etc.)

Compatibility

If the option is not set, we keep the current behavior of Fornax.


Style

  • Type: Type of the preprocessor to use
    • sass
    • less
    • css # Should probably not exist see "Compatibility" section
  • Entry: Name of the entry file
  • Output: Name of the output file
Why ?

In general, when using a preprocessor we have a bunch of files and only one entry point referencing the others. This setting allow this behavior and will improve the build time by fornax. Indeed, fornax will call the preprocessor only for the entry file and not all the files (who are useless).

Current behavior

Call the preprocessor depending on the file extension, and build each of the file found.
Take more time than needed, because it's process files that should be processed.

Compatibility

If the option is not set, we keep the current behavior of Fornax.

When people use css we could forgive to use this settings, as no processor is call. And let the current Fornax behavior.


The config file is optional, and if it does not exist then we keep the current behavior of fornax. Like so, we avoid breaking changes.

I can try to implement this features if you are ok with them.

Add capability to have custom generators

Rationale

#3 states the need to generate RSS feeds for Fornax sites. I can think about also adding atom feeds, sitemaps and other files that basically have a custom format and need information from the site model as well as the available posts.

Maintaining all these different generators within the main project could induce a lot of friction. Having the possibility to ad-hoc generate files based on the specific site configuration (as well as needs of the site creator) seems to be a good idea.

Implementation

I built a working version with #34. It works the same way the HTML version of posts are generated only that it would execute at the end of the site generation process and produce a single file per generator.

I specified the folder in which generators live as _generators in the root directory. A custom generator only has to be called cenerate and be of the type CustomGenerator<'a> where 'a is the SiteModel.

The simplest possible custom generator could look like this

#load "../siteModel.fsx"

open SiteModel

let generate : CustomGenerator<SiteModel> =
    fun siteModel posts ->
        "Hello world", "/path/hello.txt"

The type CustomGenerator<'a> boils down to these types in the Fornax model

type FileContent = string
type VirtualFilePath = string
type CustomGeneratorResult = FileContent * VirtualFilePath

type CustomGenerator<'a> = 'a -> Post list -> CustomGeneratorResult

This would mean you only have to produce some string content (in any way you wish) and provide a path (like /feed/feed.xml) and you're good.

What do you all think about this? Would be glad to have your feedback on this to make this work 😊

Non Zero code on error

Folowing log shows that there are errors, biut fornax ended with 0 code. Most CI servers will continue to deploy errored build and it can be bad

$ Fornax build
[ERROR 1] Load Errors : [|/home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (13,18)-(13,19) parse error Unexpected symbol '[' in expression. Expected '.' or other token.;
  /home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (8,17)-(8,18) parse error Unmatched '[';
  /home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (29,5)-(29,6) parse error Unexpected symbol ']' in binding. Expected incomplete structured construct at or before this point or other token.|]
[ERROR 2] Open Errors : [|input.fsx (1,6)-(1,13) typecheck error The namespace or module 'Archive' is not defined.|]
[ERROR 3] Get model Errors : [|input.fsx (1,8)-(1,13) typecheck error The type 'Model' is not defined.|]
[ERROR 4] Get site model Errors : [|input.fsx (1,8)-(1,17) typecheck error The namespace or module 'SiteModel' is not defined. Maybe you want one of the following:
   SetModule|]
[ERROR 5] Get template Errors : [|input.fsx (1,21)-(1,29) typecheck error The value or constructor 'generate' is not defined.;
  input.fsx (1,59)-(1,70) typecheck error The value, namespace, type or module 'HtmlElement' is not defined.|]
[22:45:51] '/home/travis/build/fsharplang-ru/temp_site/_public/archive.html' generation failed
[ERROR 1] Load Errors : [|/home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (13,18)-(13,19) parse error Unexpected symbol '[' in expression. Expected '.' or other token.;
  /home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (8,17)-(8,18) parse error Unmatched '[';
  /home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (29,5)-(29,6) parse error Unexpected symbol ']' in binding. Expected incomplete structured construct at or before this point or other token.|]
[ERROR 2] Open Errors : [|input.fsx (1,6)-(1,11) typecheck error The namespace or module 'Index' is not defined.|]
[ERROR 3] Get model Errors : [|input.fsx (1,8)-(1,13) typecheck error The type 'Model' is not defined.|]
[ERROR 4] Get site model Errors : [|input.fsx (1,8)-(1,17) typecheck error The namespace or module 'SiteModel' is not defined. Maybe you want one of the following:
   SetModule|]
[ERROR 5] Get template Errors : [|input.fsx (1,21)-(1,29) typecheck error The value or constructor 'generate' is not defined.;
  input.fsx (1,59)-(1,70) typecheck error The value, namespace, type or module 'HtmlElement' is not defined.|]
[22:45:51] '/home/travis/build/fsharplang-ru/temp_site/_public/index.html' generation failed
[ERROR 1] Load Errors : [|/home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (13,18)-(13,19) parse error Unexpected symbol '[' in expression. Expected '.' or other token.;
  /home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (8,17)-(8,18) parse error Unmatched '[';
  /home/travis/build/fsharplang-ru/temp_site/templates/default.fsx (29,5)-(29,6) parse error Unexpected symbol ']' in binding. Expected incomplete structured construct at or before this point or other token.|]
[ERROR 2] Open Errors : [|input.fsx (1,6)-(1,10) typecheck error The namespace or module 'Post' is not defined.|]
[ERROR 3] Get model Errors : [|input.fsx (1,8)-(1,13) typecheck error The type 'Model' is not defined.|]
[ERROR 4] Get site model Errors : [|input.fsx (1,8)-(1,17) typecheck error The namespace or module 'SiteModel' is not defined. Maybe you want one of the following:
   SetModule|]
[ERROR 5] Get template Errors : [|input.fsx (1,21)-(1,29) typecheck error The value or constructor 'generate' is not defined.;
  input.fsx (1,59)-(1,70) typecheck error The value, namespace, type or module 'HtmlElement' is not defined.|]

Fornax crashes on build

Describe the bug
Fornax crashes when attempting to build a project with error:

An unexpected error happend: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Collections.Generic.KeyNotFoundException: An index satisfying the predicate was not found in the collection.
   at Microsoft.FSharp.Collections.SeqModule.Find[T](FSharpFunc`2 predicate, IEnumerable`1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 677
   at FSI_0016.Post.generate'(SiteContents ctx, String page)
   at lambda_method17(Closure , Unit , SiteContents , String , String )
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Generator.EvaluatorHelpers.helper@56(Object next, FSharpList`1 args) in repos/Fornax/src/Fornax/Generator.fs:line 66
   at Generator.EvaluatorHelpers.invokeFunction(Object f, IEnumerable`1 args) in repos/Fornax/src/Fornax/Generator.fs:line 70
   at [email protected](Object generator) in repos/Fornax/src/Fornax/Generator.fs:line 195
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr callersRetAddrSlot, IntPtr callTarget, IntPtr retVal)
   at Generator.GeneratorEvaluator.evaluate(FsiEvaluationSession fsi, SiteContents siteContent, String generatorPath, String projectRoot, String page) in repos/Fornax/src/Fornax/Generator.fs:line 190
   at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in repos/Fornax/src/Fornax/Generator.fs:line 333
   at Generator.action@1-3(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in repos/Fornax/src/Fornax/Generator.fs:line 496
   at Generator.generateFolder(String projectRoot, Boolean isWatch) in repos/Fornax/src/Fornax/Generator.fs:line 495
   at Fornax.main$cont@185(ArgumentParser`1 parser, FSharpList`1 results, Unit unitVar) in repos/Fornax/src/Fornax/Fornax.fs:line 213

To Reproduce
Steps to reproduce the behaviour:

  1. Clone the Fornax repo
  2. Apply the change described in #82
  3. Build the repo (dotnet tool restore, dotnet fake build, dotnet fake build -t Test)
  4. Create a new fornax project (fornax new)
  5. Attempt to build the project (fornax build)

Expected behaviour
Fornax builds the site.

Environment (please complete the following information):

  • OS: Ubuntu 20.04.2 LTS
  • Ionide version: 5.5.5
  • VSCode version: 1.56.1
  • dotnet SDK version: 5.0.203
  • mono / .Net Framework version:

HtmlElement.Custom

Is your feature request related to a problem? Please describe.
Hello, i am trying to use lit web-components in fornax and one problem i have is, that i cannot use custom html tags in fornax.

So i would really like to have a custom option in this discriminate union type.

Describe the solution you'd like

type HtmlElement =
        private
        | Custom of tagName: string * props: HtmlProperties list * children: HtmlElement list
// ...
and helper level tag =
    match tag with
    | Custom (name, props, children) -> format name props children level
module Html =
        let custom (tagName:string) (props : HtmlProperties list) (children: HtmlElement list) = HtmlElement.Custom(tagName, props,children)

Describe alternatives you've considered
I could propably use some js to replace an placeholder element with my custom html tag element, but thats seems not like a clean solution to me.

Additional context
What i want my Html to look like in the end:
image

Allow Generators specify their output path

Is your feature request related to a problem? Please describe.
Currently only MultipleId Generators are to be able to specify their output path while other generators have no idea where Fornax will actually put their output because the mapper is defined outside their scope.

Describe the solution you'd like
Add a new GeneratorOutput : GeneratorSpecified (or replace Custom with it) that allows use of generators with signature SiteContents -> string -> string -> string * string . Similar logic to MultipleFiles but with just one file.

Describe alternatives you've considered
Using MultipleFiles but with only one element.

Additional context
This issue came about when I wanted to add a bit of localization and discovered that I couldn't just add a file like say posts/post.md with a front matter containing lang : en and then have the generator output a file en/posts/post.html.
Sure I could just define a Custom mapper to do that but that's just duplicating loader logic into the config.

generate wrong path when a file within a folder with space

Describe the bug

A post folder path that contains a space character (or non-ascii char) will cause an error of System.Collections.Generic.KeyNotFoundException

To Reproduce
Steps to reproduce the behaviour:

  1. Run fornax new
  2. create a markdown file with path of "posts/subdir/a sub folder with space/post3 with space and 你好.md" :
├─ posts/
│  └─ subdir/
│      └─ a sub folder with space/
|               └─ post3 with space and 你好.md
  1. Run fornax watch. Now we get an error :

An unexpected error happend: System.IO.DirectoryNotFoundException: Could not find a part of the path 'F:\Playground\Fornax\posts\subdir\a%20sub%20folder%20with%20space\post3%20with%20space%20and%20%E4%BD%A0%E5%A5%BD.md'.
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
at System.IO.File.InternalReadAllText(String path, Encoding encoding)
at System.IO.File.ReadAllText(String path)
at FSI_0001.Config.postPredicate(String projectRoot, String page)
at [email protected](Tuple2 tupledArg) at Microsoft.FSharp.Collections.ListModule.TryFind[T](FSharpFunc2 predicate, FSharpList`1 list) in F:\workspace_work\1\s\src\fsharp\FSharp.Core\list.fs:line 391
at Generator.pickGenerator(Config cfg, SiteContents siteContent, String projectRoot, String page) in F:\Source Code Study\Fornax\src\Fornax\Generator.fs:line 302
at Generator.generate(FsiEvaluationSession fsi, Config cfg, SiteContents siteContent, String projectRoot, String page) in F:\Source Code Study\Fornax\src\Fornax\Generator.fs:line 333
at Generator.action@1-3(String projectRoot, FsiEvaluationSession fsi, Config config, SiteContents sc, String filePath) in F:\Source Code Study\Fornax\src\Fornax\Generator.fs:line 496
at Generator.generateFolder(String projectRoot, Boolean isWatch) in F:\Source Code Study\Fornax\src\Fornax\Generator.fs:line 495
at Fornax.guardedGenerate@226(String cwd, Unit unitVar0) in F:\Source Code Study\Fornax\src\Fornax\Fornax.fs:line 228

Expected behaviour

The static files will be generated and the HTTP server will run flawlessly.
Screenshots

image

Environment (please complete the following information):

  • OS: win10-x64, 10.0.19042
  • Ionide version: v5.7.3
  • VSCode version: 1.61.0
  • dotnet SDK version: 5.0.102
  • mono / .Net Framework version: -

Additional context

the relative function calculates the relative path by using the MakeRelativeUri method:

    let relative toPath fromPath =
        let toUri = Uri(toPath)
        let fromUri = Uri(fromPath)
        toUri.MakeRelativeUri(fromUri).OriginalString

However, when a directory path contains an space char, the result will not be decoded, and then causes an Exception of :

An unexpected error happend: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. System.Collections.Generic.KeyNotFoundException

Actually, this exception also occurs when having any directory that uses non-ascii encodings. For example, if we have a post with path of posts/subdir/中文 目录-带空格和非URL字符/post 带空格3.md, the relative funtion will return:

posts/subdir/%E4%B8%AD%E6%96%87%20%E7%9B%AE%E5%BD%95-%E5%B8%A6%E7%A9%BA%E6%A0%BC%E5%92%8C%E9%9D%9EURL%E5%AD%97%E7%AC%A6/post%20%E5%B8%A6%E7%A9%BA%E6%A0%BC3.md

And the above path will be passed to the generate function as a file path. However, the encoded url is not the original path.

A quick fix is to use the Path.GetRelativePath as below :

    let relative toPath fromPath =
        Path.GetRelativePath(toPath, fromPath).Replace("\\","/")

Generation of 'css/style.css' failed, while sass has been installed

I've installed sass, but this message still provided and styles are not generated.

PS C:\Users\neftedollar\source\playground\fornax> fornax new
PS C:\Users\neftedollar\source\playground\fornax> fornax watch
[13:48:19] 'C:\Users\neftedollar\source\playground\fornax\_public\archive.html' generated in 120ms
[13:48:20] 'C:\Users\neftedollar\source\playground\fornax\_public\index.html' generated in 555ms
[13:48:20] Generation of 'css/style.css' failed. Please check you have installed the Sass compiler if you are going to be using files with extension .scss. https://sass-lang.com/install
[13:48:20] Generation of 'css/_settings.css' failed. Please check you have installed the Sass compiler if you are going to be using files with extension .scss. https://sass-lang.com/install
[13:48:21] 'C:\Users\neftedollar\source\playground\fornax\_public\posts/2017-05-30-welcome.html' generated in 553ms
[13:48:21] 'C:\Users\neftedollar\source\playground\fornax\_public\posts/2017-05-31-test-styles.html' generated in 5ms
[13:48:21] Watch mode started. Press any key to exit.
[13:48:21 INF] Smooth! Suave listener started in 57.38ms with binding 127.0.0.1:8080
 Exiting...
PS C:\Users\neftedollar\source\playground\fornax> sass
Compile Sass to CSS.

Usage: sass <input.scss> [output.css]
       sass <input.scss>:<output.css> <input/>:<output/> <dir/>

Themes?

One thing that made Jekyll (and then Hugo) so popular was that you could just get a theme from a website, and there are lot of themes available: https://themes.gohugo.io/

I select a theme meant for a blog, I get out-of-the-box:

  • Rss and sitemap generators
  • Google analytics component
  • Disqus component
  • Sidebar menu component
  • SEO-optimised site (e.g. meta-header-tags, social media share tags, etc.)

The reason people sharing these is, that the static site (/blog) is not core business (/subject of the main interest for the user). For example, Google Analytics script is same for everyone and if Google changes the script version, then who actually wants to maintain that by themselves...

What is the goal of Fornax, will it be an alternative for HUGO?
How does it help users to share these kind of higher-abstraction components like themes?

Fornax watch exits after file generation

Describe the bug
Running dotnet fornax watch generated files as expected, but exited immediately after generation without further input.

To Reproduce
Steps to reproduce the behaviour:

  1. Run the commands specified here: https://github.com/ionide/ionide.github.io/blob/dev/README.md
  2. Wait for file generation to complete
  3. The command exits

Expected behaviour
The watch command should still be running after generation for inspection of the generated site.

Screenshots

λ dotnet fornax watch
[13:12:38] 'C:\Alt\Git\ionide.github.io\_public\index.json' generated in 381ms
[13:12:42] 'C:\Alt\Git\ionide.github.io\_public\callToAction.html' generated in 994ms
[13:12:45] 'C:\Alt\Git\ionide.github.io\_public\index.html' generated in 617ms
[13:12:47] 'C:\Alt\Git\ionide.github.io\_public\sponsors.html' generated in 734ms
[13:12:50] 'C:\Alt\Git\ionide.github.io\_public\Editors/editoresOverview.html' generated in 535ms
[13:12:52] 'C:\Alt\Git\ionide.github.io\_public\Editors/index.html' generated in 567ms
[13:12:55] 'C:\Alt\Git\ionide.github.io\_public\Libraries/eventhorizon.html' generated in 995ms
[13:12:58] 'C:\Alt\Git\ionide.github.io\_public\Libraries/fsanalyzers.html' generated in 58ms
[13:13:01] 'C:\Alt\Git\ionide.github.io\_public\Libraries/waypoint.html' generated in 4ms
[13:13:04] 'C:\Alt\Git\ionide.github.io\_public\Tools/dpi.html' generated in 788ms
[13:13:07] 'C:\Alt\Git\ionide.github.io\_public\Tools/forge.html' generated in 809ms
[13:13:10] 'C:\Alt\Git\ionide.github.io\_public\Tools/fornax.html' generated in 535ms
[13:13:12] 'C:\Alt\Git\ionide.github.io\_public\Tools/fsac.html' generated in 636ms
[13:13:15] 'C:\Alt\Git\ionide.github.io\_public\Editors/Code/editing.html' generated in 854ms
[13:13:18] 'C:\Alt\Git\ionide.github.io\_public\Editors/Code/generalInfo.html' generated in 187ms
[13:13:22] 'C:\Alt\Git\ionide.github.io\_public\Editors/Code/getting_started.html' generated in 566ms
[13:13:26] 'C:\Alt\Git\ionide.github.io\_public\Editors/Code/options.html' generated in 915ms
[13:13:30] 'C:\Alt\Git\ionide.github.io\_public\Editors/Code/overview.html' generated in 258ms
[13:13:33] 'C:\Alt\Git\ionide.github.io\_public\Editors/Vim/getting_started.html' generated in 785ms
[13:13:35] 'C:\Alt\Git\ionide.github.io\_public\Editors/Vim/overview.html' generated in 711ms
[13:13:38] 'C:\Alt\Git\ionide.github.io\_public\Editors/Vim/usage.html' generated in 770ms
[13:13:38] Watch mode started. Press any key to exit.
 Exiting...

Environment (please complete the following information):

  • OS: Windows 10
  • Ionide version: 4.7.0
  • VSCode version: 1.43.0
  • dotnet SDK version: 3.1.102

Reporting Generator errors

While #46 added functionality for loader errors (which is nice but undocumented) I don't see a way to report errors from the generators.

Generators should be able to surface errors

Currently if a generator operates over invalid page data it is not able to express this in a nice way. For example if a post.md file is missing title in the top matter this is the result:

An unexpected error happend: Exception has been thrown by the target of an invocation.
... more useless logging which tells you nothing

My first thought was to catch the invocation exception and indicate which page is failing during the generation phase.

That results in this:

The expression for /Users/joergbeekmann/Documents/Fornax/FornaxDemo/generators/post.fsx either couldn't be compiled or experianced a runtime
[11:34:23] '/Users/joergbeekmann/Documents/Fornax/FornaxDemo/_public/posts/post2.html' generation failed

Better, at least you know which page it is. But there is no way for the generator to indicate what is wrong with the markdown on the page. In this case a missing title.

I propose the load/generate phases be changed to collect editing level errors and surface them in the console. See PR #46 for a proof of concept.

Fornax.Core dll not reference-able using '#r "nuget:Fornax"

Describe the bug
#r "nuget:Fornax" will download the package to the .nuget cache but the dll can't be found. This means in the F# 5.0 world it will not be possible to write loaders, etc with just nuget refs.

To Reproduce
Open the below as a .fsx file in Ionide on a system with .NET 5.0 installed. Note SiteContents is not not visible to compiler. Uncomment the direct reference and it becomes visible. I believe this is because the Fornax.Core.dll is in a non-standard location.

#r "nuget: Fornax"
//#r "/Users/joergbeekmann/.nuget/packages/fornax/0.13.1/tools/netcoreapp3.1/any/Fornax.Core.dll"

let x: SiteContents option = None

Expected behaviour
SiteContents should be resolved like it is if the direct reference is in place.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: MacOS
  • Ionide version: 4.11.1
  • VSCode version: latest
  • dotnet SDK version: 5.0
  • mono / .Net Framework version: N/A

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.