Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from IvanJosipovic/dev
Browse files Browse the repository at this point in the history
Updated to .Net Core 3.1
  • Loading branch information
IvanJosipovic authored Dec 6, 2019
2 parents 0e22797 + a4f6a90 commit 369d591
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.100
dotnet-version: 3.1.100

- name: Publish
working-directory: src/BlazorFileSaver.Sample
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Deploy to Test
uses: netlify/actions/cli@master
with:
args: deploy --json -d src/BlazorFileSaver.Sample/bin/Release/netstandard2.0/publish/BlazorFileSaver.Sample/dist/
args: deploy --json -d src/BlazorFileSaver.Sample/bin/Release/netstandard2.1/publish/BlazorFileSaver.Sample/dist/
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
Expand All @@ -37,7 +37,7 @@ jobs:
if: github.ref == 'refs/heads/master'
uses: netlify/actions/cli@master
with:
args: deploy --prod --json -d src/BlazorFileSaver.Sample/bin/Release/netstandard2.0/publish/BlazorFileSaver.Sample/dist/
args: deploy --prod --json -d src/BlazorFileSaver.Sample/bin/Release/netstandard2.1/publish/BlazorFileSaver.Sample/dist/
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.100
dotnet-version: 3.1.100

- name: Dotnet Pack
working-directory: src/BlazorFileSaver
run: dotnet pack -c Release -p:Version=${GITHUB_REF##*/v}

- name: Dotnet Nuget Push
- name: Dotnet Nuget Push
working-directory: src/BlazorFileSaver/bin/Release
run: dotnet nuget push BlazorFileSaver.*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
continue-on-error: true
Expand Down
2 changes: 2 additions & 0 deletions BlazorFileSaver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorFileSaver", "src\Blaz
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A7D52708-5E84-4D50-843F-E52B759590FF}"
ProjectSection(SolutionItems) = preProject
.github\workflows\cicd.yml = .github\workflows\cicd.yml
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorFileSaver.Sample", "src\BlazorFileSaver.Sample\BlazorFileSaver.Sample.csproj", "{DE2E2866-4BFE-471F-ADE0-EB206834B63F}"
Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# BlazorFileSaver

Blazor Component wrapper for [FileSaver.js](https://github.com/eligrey/FileSaver.js/)
[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/BlazorFileSaver.svg)](https://www.nuget.org/packages/BlazorFileSaver)

Blazor Component wrapper for [FileSaver.js](https://github.com/eligrey/FileSaver.js/)

# Installation
[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/BlazorFileSaver.svg)](https://www.nuget.org/packages/BlazorFileSaver)
# Demo
[Sample](https://blazorfilesaver.netlify.com)


# Installation

# Demo
[Sample](https://blazorfilesaver.netlify.com)
- Add Nuget BlazorFileSaver
- Add ``<script src="_content/BlazorFileSaver/BlazorFileSaver.min.js"></script>`` to the index.html or _Hosts.cshtml
- Add AddBlazorFileSaver() to the ConfigureServices in Startup.cs as noted below


# Startup.cs
Expand All @@ -35,16 +38,19 @@ namespace BlazorFileSaver.Sample
# Example
```csharp
@page "/sample"

<h1>BlazorFileSaver.Sample</h1>

<input type="text" @bind="@FileName" />
<input type="text" @bind="FileName" />

<buton @onclick="@Save" class="btn btn-primary">Save</buton>
<buton @onclick="Save" class="btn btn-primary">Save</buton>

<textarea class="form-control" type="text" @bind="@Data" rows="20"></textarea>
<textarea class="form-control" type="text" @bind="Data" rows="20"></textarea>

@code {
[Inject] private IBlazorFileSaver BlazorFileSaver { get; set; }
[Inject]
private IBlazorFileSaver BlazorFileSaver { get; set; }

private string FileName { get; set; } = "Sample.txt";

private string Data { get; set; } = "Sample Text";
Expand Down
11 changes: 5 additions & 6 deletions src/BlazorFileSaver.Sample/BlazorFileSaver.Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>latest</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview4.19579.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />

<PackageReference Include="SharpZipLib" Version="1.2.0" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/BlazorFileSaver.Sample/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<app>Loading...</app>

<script src="_framework/blazor.webassembly.js"></script>
<script src="_content/BlazorFileSaver/BlazorFileSaver.min.js"></script>
</body>
</html>
13 changes: 3 additions & 10 deletions src/BlazorFileSaver/BlazorFileSaver.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<IsPackable>true</IsPackable>
<Title>BlazorFileSaver</Title>
Expand All @@ -20,15 +20,8 @@
</ItemGroup>

<ItemGroup>
<!-- .js/.css files will be referenced via <script>/<link> tags; other content files will just be included in the app's 'dist' directory without any tags referencing them -->
<EmbeddedResource Include="wwwroot\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
<EmbeddedResource Include="wwwroot\**\*.css" LogicalName="blazor:css:%(RecursiveDir)%(Filename)%(Extension)" />
<EmbeddedResource Include="wwwroot\**" Exclude="**\*.js;**\*.css" LogicalName="blazor:file:%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.0" />
</ItemGroup>

</Project>

0 comments on commit 369d591

Please sign in to comment.