Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New project specific templates #283

Merged
merged 11 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Content/.template.config/ide.host.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"$schema": "https://json.schemastore.org/vs-2017.3.host",
"symbolInfo": [
{
"id": "githubUsername",
Expand All @@ -10,17 +10,17 @@
},
{
"id": "outputType",
"name" : {
"name": {
"id": "outputType",
"text": "Output Type"
}
},
{
"id": "releaseBranch",
"name" : {
"name": {
"id": "releaseBranch",
"text": "Release Branch"
}
}
]
}
}
39 changes: 34 additions & 5 deletions Content/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"$schema": "http://json.schemastore.org/template",
"$schema": "https://json.schemastore.org/template",
"author": "Jimmy Byrd",
"classifications": [
"Scaffold", "Console", "Library"
"Scaffold",
"Console",
"Library"
],
"description": "A full-featured template for creating console or library solutions with documentation and release workflows.",
"name": "MiniScaffold",
Expand All @@ -28,11 +30,23 @@
"choices": [
{
"choice": "library",
"description": "Creates a template for library projects"
"description": "Creates a template for library solutions."
},
{
"choice": "console",
"description": "Creates a template for console projects"
"description": "Creates a template for console solutions."
},
{
"choice": "projLib",
"description": "A project for creating a class library. Used for creating individual library projects for MiniScaffold."
},
{
"choice": "projConsole",
"description": "A project for creating a command-line application. Used for creating individual console projects for MiniScaffold."
},
{
"choice": "projTest",
"description": "A project for Expect tests. Used for creating individual test projects for MiniScaffold."
}
]
},
Expand All @@ -53,6 +67,21 @@
"source": "./Console/",
"target": "./",
"condition": "(outputType == \"console\")"
},
{
"source": "./ProjLib/",
"target": "./",
"condition": "(outputType == \"projLib\")"
},
{
"source": "./ProjConsole/",
"target": "./",
"condition": "(outputType == \"projConsole\")"
},
{
"source": "./ProjTest/",
"target": "./",
"condition": "(outputType == \"projTest\")"
}
],
"postActions": [
Expand All @@ -71,4 +100,4 @@
"continueOnError": true
}
]
}
}
8 changes: 6 additions & 2 deletions Content/Console/build/Changelog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ let isChangelogEmpty (latestEntry: Changelog.ChangelogEntry) =
let tagFromVersionNumber versionNumber = sprintf "%s" versionNumber


let mkLinkReference (newVersion: SemVerInfo) (changelog: Changelog.Changelog) gitHubRepoUrl =
let mkLinkReference
(newVersion: SemVerInfo)
(changelog: Changelog.Changelog)
(gitHubRepoUrl: string)
=
if
changelog.Entries
|> List.isEmpty
Expand All @@ -37,7 +41,7 @@ let mkLinkReference (newVersion: SemVerInfo) (changelog: Changelog.Changelog) gi
sprintf
"[%s]: %s/releases/tag/%s"
newVersion.AsString
gitHubRepoUrl
(gitHubRepoUrl.TrimEnd('/'))
(tagFromVersionNumber newVersion.AsString)
else
let versionTuple version =
Expand Down
2 changes: 1 addition & 1 deletion Content/Console/build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ let coverageReportDir =
let gitOwner = "MyGithubUsername"
let gitRepoName = "MyLib.1"

let gitHubRepoUrl = sprintf "https://github.com/%s/%s" gitOwner gitRepoName
let gitHubRepoUrl = sprintf "https://github.com/%s/%s/" gitOwner gitRepoName

let releaseBranch = "MyReleaseBranch"

Expand Down
8 changes: 6 additions & 2 deletions Content/Library/build/Changelog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ let failOnEmptyChangelog (latestEntry: Changelog.ChangelogEntry) =
failwith
"No changes in CHANGELOG. Please add your changes under a heading specified in https://keepachangelog.com/"

let mkLinkReference (newVersion: SemVerInfo) (changelog: Changelog.Changelog) gitHubRepoUrl =
let mkLinkReference
(newVersion: SemVerInfo)
(changelog: Changelog.Changelog)
(gitHubRepoUrl: string)
=
if
changelog.Entries
|> List.isEmpty
Expand All @@ -36,7 +40,7 @@ let mkLinkReference (newVersion: SemVerInfo) (changelog: Changelog.Changelog) gi
sprintf
"[%s]: %s/releases/tag/%s"
newVersion.AsString
gitHubRepoUrl
(gitHubRepoUrl.TrimEnd('/'))
(tagFromVersionNumber newVersion.AsString)
else
let versionTuple version =
Expand Down
2 changes: 1 addition & 1 deletion Content/Library/build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ let watchDocsDir =
let gitOwner = "MyGithubUsername"
let gitRepoName = "MyLib.1"

let gitHubRepoUrl = sprintf "https://github.com/%s/%s" gitOwner gitRepoName
let gitHubRepoUrl = sprintf "https://github.com/%s/%s/" gitOwner gitRepoName

let documentationRootUrl = sprintf "https://%s.github.io/%s/" gitOwner gitRepoName

Expand Down
23 changes: 23 additions & 0 deletions Content/ProjConsole/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Auto-Generated by FAKE; do not edit
namespace System
open System.Reflection

[<assembly: AssemblyTitleAttribute("MyLib.1")>]
[<assembly: AssemblyProductAttribute("MyLib.1")>]
[<assembly: AssemblyVersionAttribute("0.1.0")>]
[<assembly: AssemblyMetadataAttribute("ReleaseDate","2017-03-17T00:00:00.0000000")>]
[<assembly: AssemblyFileVersionAttribute("0.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("0.1.0")>]
[<assembly: AssemblyMetadataAttribute("ReleaseChannel","release")>]
[<assembly: AssemblyMetadataAttribute("GitHash","b385af579477bb585016a6b5204121de4a485dac")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "MyLib.1"
let [<Literal>] AssemblyProduct = "MyLib.1"
let [<Literal>] AssemblyVersion = "0.1.0"
let [<Literal>] AssemblyMetadata_ReleaseDate = "2017-03-17T00:00:00.0000000"
let [<Literal>] AssemblyFileVersion = "0.1.0"
let [<Literal>] AssemblyInformationalVersion = "0.1.0"
let [<Literal>] AssemblyMetadata_ReleaseChannel = "release"
let [<Literal>] AssemblyMetadata_GitHash = "b385af579477bb585016a6b5204121de4a485dac"
14 changes: 14 additions & 0 deletions Content/ProjConsole/MyLib.1.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />

</Project>
2 changes: 2 additions & 0 deletions Content/ProjConsole/Program.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// For more information see https://aka.ms/fsharp-console-apps
printfn "Hello from F#"
2 changes: 2 additions & 0 deletions Content/ProjConsole/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FSharp.Core

23 changes: 23 additions & 0 deletions Content/ProjLib/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Auto-Generated by FAKE; do not edit
namespace System
open System.Reflection

[<assembly: AssemblyTitleAttribute("MyLib.1")>]
[<assembly: AssemblyProductAttribute("MyLib.1")>]
[<assembly: AssemblyVersionAttribute("0.1.0")>]
[<assembly: AssemblyMetadataAttribute("ReleaseDate","2017-03-17T00:00:00.0000000")>]
[<assembly: AssemblyFileVersionAttribute("0.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("0.1.0")>]
[<assembly: AssemblyMetadataAttribute("ReleaseChannel","release")>]
[<assembly: AssemblyMetadataAttribute("GitHash","bb8964b54bee133e9af64d316dc2cfee16df7f72")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "MyLib.1"
let [<Literal>] AssemblyProduct = "MyLib.1"
let [<Literal>] AssemblyVersion = "0.1.0"
let [<Literal>] AssemblyMetadata_ReleaseDate = "2017-03-17T00:00:00.0000000"
let [<Literal>] AssemblyFileVersion = "0.1.0"
let [<Literal>] AssemblyInformationalVersion = "0.1.0"
let [<Literal>] AssemblyMetadata_ReleaseChannel = "release"
let [<Literal>] AssemblyMetadata_GitHash = "bb8964b54bee133e9af64d316dc2cfee16df7f72"
56 changes: 56 additions & 0 deletions Content/ProjLib/Library.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace MyLib._1

open System
open System.Security.Cryptography
open System.Text

/// <summary> Initial module </summary>
module Say =

/// <summary> Finite list of Colors </summary>
type FavoriteColor =
| Red
| Yellow
| Blue

/// <summary> A person with many different field types </summary>
type Person = {
Name: string
FavoriteNumber: int
FavoriteColor: FavoriteColor
DateOfBirth: DateTimeOffset
}

/// <summary>Says hello to a specific person</summary>
let helloPerson (person: Person) =
sprintf
"Hello %s. You were born on %s and your favorite number is %d. You like %A."
person.Name
(person.DateOfBirth.ToString("yyyy/MM/dd", Globalization.CultureInfo.InvariantCulture))
person.FavoriteNumber
person.FavoriteColor

/// <summary>
/// Adds two integers <paramref name="a"/> and <paramref name="b"/> and returns the result.
/// </summary>
///
/// <remarks>
/// This usually contains some really important information that you'll miss if you don't read the docs.
/// </remarks>
///
/// <param name="a">An integer.</param>
/// <param name="b">An integer.</param>
///
/// <returns>
/// The sum of two integers.
/// </returns>
///
/// <exceptions cref="M:System.OverflowException">Thrown when one parameter is max
/// and the other is greater than 0.</exceptions>
let add a b = a + b


/// I do nothing
let nothing name =
name
|> ignore
22 changes: 22 additions & 0 deletions Content/ProjLib/MyLib.1.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<Title>MyLib.1</Title>
<Description>MyLib.1 does the thing!</Description>

</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>

</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Library.fs" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

3 changes: 3 additions & 0 deletions Content/ProjLib/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FSharp.Core
Microsoft.SourceLink.GitHub

9 changes: 9 additions & 0 deletions Content/ProjTest/Main.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace MyLib._1

module ExpectoTemplate =

open Expecto

[<EntryPoint>]
let main argv =
Tests.runTestsInAssembly defaultConfig argv
14 changes: 14 additions & 0 deletions Content/ProjTest/MyLib.1.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tests.fs" />
<Compile Include="Main.fs" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

15 changes: 15 additions & 0 deletions Content/ProjTest/Tests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace MyLib._1

open System
open Expecto


module SayTests =
[<Tests>]
let tests =
testList "samples" [
testCase "Add two integers"
<| fun _ ->
let result = 2 + 2
Expect.equal result 4 "Addition works"
]
5 changes: 5 additions & 0 deletions Content/ProjTest/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Expecto
FSharp.Core
Microsoft.NET.Test.Sdk
YoloDev.Expecto.TestSdk
altcover
2 changes: 2 additions & 0 deletions Content/paket.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# only here to stop paket from looking deeper into this folder
# https://github.com/fsprojects/Paket/issues/3444
8 changes: 6 additions & 2 deletions build/Changelog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ let failOnEmptyChangelog (latestEntry: Changelog.ChangelogEntry) =
failwith
"No changes in CHANGELOG. Please add your changes under a heading specified in https://keepachangelog.com/"

let mkLinkReference (newVersion: SemVerInfo) (changelog: Changelog.Changelog) gitHubRepoUrl =
let mkLinkReference
(newVersion: SemVerInfo)
(changelog: Changelog.Changelog)
(gitHubRepoUrl: string)
=
if
changelog.Entries
|> List.isEmpty
Expand All @@ -36,7 +40,7 @@ let mkLinkReference (newVersion: SemVerInfo) (changelog: Changelog.Changelog) gi
sprintf
"[%s]: %s/releases/tag/%s"
newVersion.AsString
gitHubRepoUrl
(gitHubRepoUrl.TrimEnd('/'))
(tagFromVersionNumber newVersion.AsString)
else
let versionTuple version =
Expand Down
Loading