Skip to content

Commit

Permalink
Added fsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
1eyewonder committed Dec 29, 2024
1 parent f9db94f commit 90690c2
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 213 deletions.
7 changes: 7 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
"fsharp-analyzers"
],
"rollForward": false
},
"fsdocs-tool": {
"version": "20.0.1",
"commands": [
"fsdocs"
],
"rollForward": false
}
}
}
46 changes: 46 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Docs

# Trigger this Action when new code is pushed to the main branch
on:
push:
branches:
- main

# We need some permissions to publish to Github Pages
permissions:
contents: write
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the source code
- uses: actions/checkout@v4
# Setup dotnet, please use a global.json to ensure the right SDK is used!
- name: Setup .NET
uses: actions/setup-dotnet@v3
# Restore the local tools
- name: Restore tools
run: dotnet tool restore
# Build the code for the API documentation
- name: Build code
run: dotnet build -c Release Fs.Units.sln
# Generate the documentation files
- name: Generate the documentation'
run: dotnet fsdocs build --properties Configuration=Release
# Upload the static files
- name: Upload documentation
uses: actions/upload-pages-artifact@v2
with:
path: ./output

# GitHub Actions recommends deploying in a separate job.
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,9 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

# FSharp.Formatting
.fsdocs/
output/
tmp/
8 changes: 8 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<RepositoryUrl>https://github.com/1eyewonder/Fs.Units</RepositoryUrl>
<FsDocsLicenseLink>https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md</FsDocsLicenseLink>
<FsDocsReleaseNotesLink>https://github.com/1eyewonder/Fs.Units/blob/main/RELEASE_NOTES.md</FsDocsReleaseNotesLink>
<PackageProjectUrl>https://1eyewonder.github.io/Fs.Units</PackageProjectUrl>
</PropertyGroup>
</Project>
226 changes: 14 additions & 212 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,34 @@ The goal of this library is to assist developers with quick proof of concepts as

Feedback and assistance are welcome!

## Documentation

View our docs at https://1eyewonder.github.io/Fs.Units to see the full list of supported units of measure and how to use them.

## NuGet

| Package | Release | Pre-Release | License |
| ------- |--------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| Fs.Units | [![NuGet version (Fs.Units)](https://buildstats.info/nuget/Fs.Units)](https://www.nuget.org/packages/Fs.Units/) | [![NuGet](https://buildstats.info/nuget/Fs.Units?includePreReleases=true)](https://www.nuget.org/packages/Fs.Units/absoluteLatest) | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) |
| Fs.Units.CSharp | [![NuGet version (Fs.Units.CSharp)](https://buildstats.info/nuget/Fs.Units.CSharp)](https://www.nuget.org/packages/Fs.Units.CSharp/) | [![NuGet](https://buildstats.info/nuget/Fs.Units.CSharp?includePreReleases=true)](https://www.nuget.org/packages/Fs.Units.CSharp/absoluteLatest) | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) |
| Package | Release | Pre-Release | License |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| Fs.Units | [![NuGet version (Fs.Units)](https://buildstats.info/nuget/Fs.Units)](https://www.nuget.org/packages/Fs.Units/) | [![NuGet](https://buildstats.info/nuget/Fs.Units?includePreReleases=true)](https://www.nuget.org/packages/Fs.Units/absoluteLatest) | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) |
| Fs.Units.CSharp | [![NuGet version (Fs.Units.CSharp)](https://buildstats.info/nuget/Fs.Units.CSharp)](https://www.nuget.org/packages/Fs.Units.CSharp/) | [![NuGet](https://buildstats.info/nuget/Fs.Units.CSharp?includePreReleases=true)](https://www.nuget.org/packages/Fs.Units.CSharp/absoluteLatest) | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/1eyewonder/Fs.Units/blob/main/LICENSE.md) |

## Builds

| GitHub Actions |
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| [![GitHub Actions](https://github.com/1eyewonder/Fs.Units/workflows/Build%20main/badge.svg)](https://github.com/1eyewonder/Fs.Units/actions?query=branch%3Amain) |
| [![Build History](https://buildstats.info/github/chart/1eyewonder/Fs.Units?branch=main)](https://github.com/1eyewonder/Fs.Units/actions?query=branch%3Amain) |

## Table of Contents

- [Fs.Units](#fsunits)
- [NuGet](#nuget)
- [Builds](#builds)
- [Table of Contents](#table-of-contents)
- [Unit Types](#unit-types)
- [Examples](#examples)
- [F#](#f)
- [Explicit Conversion Example](#explicit-conversion-example)
- [Implicit Conversion Example](#implicit-conversion-example)
- [C#](#c)
- [Example](#example)
- [Supported Unit Categories](#supported-unit-categories)
- [Simple](#simple)
- [Length](#length)
- [Time](#time)
- [Mass](#mass)
- [Temperature](#temperature)
- [Angle](#angle)
- [DataStorage](#datastorage)
- [Frequency](#frequency)
- [Illuminance](#illuminance)
- [Current](#current)
- [Compound](#compound)
- [Area](#area)
- [Volume](#volume)
- [FuelEconomy](#fueleconomy)
- [Inertia](#inertia)
- [Speed](#speed)
- [Force](#force)
- [DataTransferRate](#datatransferrate)
- [Density](#density)
- [Pressure](#pressure)
- [Power](#power)
- [Energy](#energy)
- [ElectricCharge](#electriccharge)
- [ElectromotiveForce](#electromotiveforce)
- [Capacitance](#capacitance)
- [Inductance](#inductance)

## Unit Types

- **Simple Units:** A basic unit of measure
```fsharp
[<Measure>] type inch
[<Measure>] type inch
```
- **Compound Units:** Derived units of measure consisting of combinations of two or more units of measure
```fsharp
[<Measure>] type in2 = inch * inch
[<Measure>] type in2 = inch * inch
```

## Examples
Expand All @@ -86,7 +50,7 @@ let valueInFeet = Inch.create 1.0 |> Inch.toFeet // float<ft>

#### Implicit Conversion Example

For some compound units, implicit conversion is supported. This allows for a more natural syntax.
For some compound units, implicit conversion is supported. This allows for a more natural syntax in certain instances.

```fsharp
open Fs.Units
Expand Down Expand Up @@ -117,6 +81,7 @@ open Fs.Units.Helpers
let value1 = Foot.create 1.0 // float<ft>
let value2 = Foot.create 2.0 // float<ft>
let maxValue = max value1 value2 // float<ft>
let plainValue = Foot.create 1. |> removeUnits // float
```

### C#
Expand All @@ -126,167 +91,4 @@ let maxValue = max value1 value2 // float<ft>
using Fs.Units.CSharp;

var valueInFeet = 1d.InchToFeet(); // double
```

## Supported Unit Categories

### Simple

#### Length
- Inch
- Foot
- Yard
- Mile
- Millimeter
- Centimeter
- Decimeter
- Meter
- Kilometer
- NauticalMile
- Chain
- Furlong
- League
- Hand
- Rod
#### Time
- Nanosecond
- Microsecond
- Millisecond
- Second
- Minute
- Hour
- Day
- Week
- Fortnight
- Month
- Year
- Decade
- Century
- Millenium
- Eon
#### Mass
- Milligram
- Gram
- Kilogram
- Pound mass
#### Temperature
- Kelvin
- Celsius
- Fahrenheit
- Rankine
#### Angle
- Degree
- Radian
- Gradian
- Revolution
- Arcminute
- Arcsecond
#### DataStorage
- Bit
- Kilobit
- Megabit
- Gigabit
- Terabit
- Petabit
- Byte
- Kilobyte
- Megabyte
- Gigabyte
- Terabyte
- Petabyte
#### Frequency
- Hertz
- Kilohertz
- Megahertz
- Gigahertz
#### Illuminance
- Footcandle
- Lux
- Phot
- Nox
#### Current
- Microampere
- Milliampere
- Ampere
- Biot

### Compound

#### Area
- SquareInch
- SquareFoot
- SquareCentimeter
- SquareMeter
#### Volume
- CubicInch
- CubicFoot
- CubicCentimeter
- CubicMeter
- Liter
- Gallon
#### FuelEconomy
- MilesPerGallon
- KilometersPerLiter
#### Inertia
- QuarticInch
- QuarticCentimeter
#### Speed
- FeetPerSecond
- MetersPerSecond
- MilesPerHour
- KilometersPerHour
#### Force
- Newton
- PoundForce
- Dyne
- Kip
#### DataTransferRate
- Baud
- BitsPerSecond
- KilobitsPerSecond
- MegabitsPerSecond
- GigabitsPerSecond
- TerabitsPerSecond
- PetabitsPerSecond
- BytesPerSecond
- KilobytesPerSecond
- MegabytesPerSecond
- GigabytesPerSecond
- TerabytesPerSecond
- PetabytesPerSecond
#### Density
- KilogramsPerCubicMeter
- GramsPerCubicCentimeter
- PoundMassPerCubicFoot
- PoundMassPerCubicInch
#### Pressure
- Pascal
- PoundsPerSquareInch
#### Power
- Watt
- KiloWatt
- ImperialHorsepower
- TonOfRefrigeration
#### Energy
- Joules
- KiloJoules
- BritishThermalUnits
- calories
- Quads
- Q
#### ElectricCharge
- Coulomb
- AmpereHour
- AmpereSecond
#### ElectromotiveForce
- Microvolts
- Millivolts
- Volts
- Kilovolts
- Megavolts
#### Capacitance
- Farads
#### Inductance
- MicroHenrys
- MilliHenrys
- Henrys
```
Binary file added docs/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 90690c2

Please sign in to comment.