Skip to content

Commit 3ca21c8

Browse files
committed
Add information about testing the template locally
1 parent 596d1c6 commit 3ca21c8

File tree

1 file changed

+67
-23
lines changed

1 file changed

+67
-23
lines changed

README.md

Lines changed: 67 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,32 @@ Giraffe web application template for the `dotnet new` command.
1010

1111
## Table of contents
1212

13-
- [Installation](#installation)
14-
- [Updating the template](#updating-the-template)
15-
- [Basics](#basics)
16-
- [Template Options](#template-options)
13+
- [Giraffe Template](#giraffe-template)
14+
- [Table of contents](#table-of-contents)
15+
- [Installation](#installation)
16+
- [Updating the template](#updating-the-template)
17+
- [Basics](#basics)
18+
- [Template Options](#template-options)
1719
- [ViewEngine](#viewengine)
1820
- [Solution](#solution)
1921
- [ExcludeTests](#excludetests)
2022
- [Paket](#paket)
21-
- [Known Issues](#known-issues)
23+
- [Known Issues](#known-issues)
2224
- [Cyclic reference](#cyclic-reference)
2325
- [.NET Core 2.0 issues](#net-core-20-issues)
2426
- [Using Visual Studio](#using-visual-studio)
25-
- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)
26-
- [Contributing](#contributing)
27-
- [More information](#more-information)
28-
- [License](#license)
27+
- [Example:](#example)
28+
- [Nightly builds and NuGet feed](#nightly-builds-and-nuget-feed)
29+
- [Contributing](#contributing)
30+
- [Examples](#examples)
31+
- [Default](#default)
32+
- [Installing the new template](#installing-the-new-template)
33+
- [Creating a test project for each permutation](#creating-a-test-project-for-each-permutation)
34+
- [Creating and testing all test projects for all permutations](#creating-and-testing-all-test-projects-for-all-permutations)
35+
- [Creating and testing all permutations and updating the `paket.lock` file afterwards](#creating-and-testing-all-permutations-and-updating-the-paketlock-file-afterwards)
36+
- [Testling the template locally](#testling-the-template-locally)
37+
- [More information](#more-information)
38+
- [License](#license)
2939

3040
## Installation
3141

@@ -43,21 +53,21 @@ Whenever there is a new version of the Giraffe template you can update it by re-
4353

4454
You can also explicitly set the version when installing the template:
4555

46-
```
56+
```console
4757
dotnet new install "giraffe-template::1.4.0"
4858
```
4959

5060
## Basics
5161

5262
After the template has been installed you can create a new Giraffe web application by simply running `dotnet new giraffe` in your terminal:
5363

54-
```
64+
```console
5565
dotnet new giraffe
5666
```
5767

5868
If you wish to use [Paket](https://fsprojects.github.io/Paket/) for your dependency management use the `--Paket` or `-P` parameter when creating a new application:
5969

60-
```
70+
```console
6171
dotnet new giraffe --Paket
6272
```
6373

@@ -80,13 +90,13 @@ The Giraffe template supports four project templates, three different view engin
8090

8191
Use the `--ViewEngine` parameter (short `-V`) to set one of the supported values from above:
8292

83-
```
93+
```console
8494
dotnet new giraffe --ViewEngine razor
8595
```
8696

8797
The same command can be abbreviated using the `-V` parameter:
8898

89-
```
99+
```console
90100
dotnet new giraffe -V razor
91101
```
92102

@@ -96,13 +106,13 @@ If you do not specify the `--ViewEngine` parameter then the `dotnet new giraffe`
96106

97107
When running `dotnet new giraffe` the created project will only be a single Giraffe project which can be added to an existing .NET Core solution. However, when generating a new Giraffe project from a blank sheet then the `--Solution` (or short `-S`) parameter can simplify the generation of an entire solution, including a `.sln` file and accompanied test projects:
98108

99-
```
109+
```console
100110
dotnet new giraffe --Solution
101111
```
102112

103113
This will create the following structure:
104114

105-
```
115+
```text
106116
src/
107117
- AppName/
108118
- Views/
@@ -158,7 +168,7 @@ The affected SDKs are `2.1.x` where `x < 300`. The issue has been fixed in the S
158168

159169
If you do run into this issue the workaround is to explicitly specify the language:
160170

161-
```
171+
```console
162172
dotnet new giraffe -lang F#
163173
```
164174

@@ -176,7 +186,7 @@ All official Giraffe packages are published to the official and public NuGet fee
176186

177187
Unofficial builds (such as pre-release builds from the `develop` branch and pull requests) produce unofficial pre-release NuGet packages which can be pulled from the project's public NuGet feed on AppVeyor:
178188

179-
```
189+
```url
180190
https://ci.appveyor.com/nuget/giraffe-template
181191
```
182192

@@ -198,7 +208,7 @@ The `./build.ps1` PowerShell script comes with the following feature switches:
198208

199209
### Examples
200210

201-
#### Default:
211+
#### Default
202212

203213
Windows:
204214

@@ -212,7 +222,7 @@ macOS and Linux:
212222
$ pwsh ./build.ps1
213223
```
214224

215-
#### Installing the new template:
225+
#### Installing the new template
216226

217227
Windows:
218228

@@ -226,7 +236,7 @@ macOS and Linux:
226236
$ pwsh ./build.ps1 -InstallTemplate
227237
```
228238

229-
#### Creating a test project for each permutation:
239+
#### Creating a test project for each permutation
230240

231241
Windows:
232242

@@ -240,7 +250,7 @@ macOS and Linux:
240250
$ pwsh ./build.ps1 -CreatePermutations
241251
```
242252

243-
#### Creating and testing all test projects for all permutations:
253+
#### Creating and testing all test projects for all permutations
244254

245255
Windows:
246256

@@ -254,7 +264,7 @@ macOS and Linux:
254264
$ pwsh ./build.ps1 -TestPermutations
255265
```
256266

257-
#### Creating and testing all permutations and updating the `paket.lock` file afterwards:
267+
#### Creating and testing all permutations and updating the `paket.lock` file afterwards
258268

259269
Windows:
260270

@@ -268,6 +278,40 @@ macOS and Linux:
268278
$ pwsh ./build.ps1 -UpdatePaketDependencies
269279
```
270280

281+
#### Testling the template locally
282+
283+
If you already have giraffe-template installed, then
284+
285+
```console
286+
$ dotnet new uninstall giraffe-template
287+
```
288+
289+
This will install from the local file system
290+
291+
```console
292+
dotnet new install ./src/ --force
293+
```
294+
295+
To uninstall later:
296+
297+
```console
298+
$ dotnet new uninstall <some-path>/giraffe-template/src
299+
```
300+
301+
To use the template:
302+
303+
```console
304+
dotnet new giraffe
305+
```
306+
307+
Test it locally:
308+
309+
```console
310+
dotnet run --project giraffe-template.fsproj
311+
```
312+
313+
Remember to remove the template generated files
314+
271315
## More information
272316

273317
For more information about Giraffe, how to set up a development environment, contribution guidelines and more please visit the [main documentation](https://github.com/giraffe-fsharp/Giraffe#table-of-contents) page.

0 commit comments

Comments
 (0)