Skip to content

Commit

Permalink
Penultimate updates for version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SQL-MisterMagoo committed Dec 6, 2019
1 parent 45c80f0 commit c092c2b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Blazor.PWA.MSBuild.Tasks/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>1.0.1</VersionPrefix>
<VersionPrefix>1.0.2</VersionPrefix>
<VersionSuffix>beta$([System.DateTime]::Now.ToString("yyyyMMdd-HHmmss"))</VersionSuffix>
<VersionSuffix Condition="'$(Configuration)' == 'Release'"></VersionSuffix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<!-- Base URL for the app -->
<ManifestBaseUrl Condition="'$(ManifestBaseUrl)' == ''">/</ManifestBaseUrl>
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.StartsWith(/)'">/$(ManifestBaseUrl)</ManifestBaseUrl>
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.EndsWith(/)'">$(ManifestBaseUrl)/</ManifestBaseUrl>
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.StartsWith(/))'">/$(ManifestBaseUrl)</ManifestBaseUrl>
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.EndsWith(/))'">$(ManifestBaseUrl)/</ManifestBaseUrl>

<!-- Please see https://developers.google.com/web/fundamentals/web-app-manifest/#display for options -->
<ManifestDisplay Condition="'$(ManifestDisplay)' == ''">standalone</ManifestDisplay>
Expand Down
4 changes: 2 additions & 2 deletions Blazor.PWA.MSBuild.Tasks/build/BlazorPWA.MSBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

<!-- The "home route" url for the application -->
<ServiceWorkerBaseUrl Condition="'$(ServiceWorkerBaseUrl)' == ''">/</ServiceWorkerBaseUrl>
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.StartsWith(/)'">/$(ServiceWorkerBaseUrl)</ServiceWorkerBaseUrl>
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.EndsWith(/)'">$(ServiceWorkerBaseUrl)/</ServiceWorkerBaseUrl>
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.StartsWith(/))'">/$(ServiceWorkerBaseUrl)</ServiceWorkerBaseUrl>
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.EndsWith(/))'">$(ServiceWorkerBaseUrl)/</ServiceWorkerBaseUrl>

<!-- The CSB home page served up for the base URL -->
<ProjectIndexPage Condition="'$(ProjectIndexPage)' == ''">index.html</ProjectIndexPage>
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#### 06/12/2019

- PR #5 from @chucker merged with these changes
- Bug: **Property** **`ManifestBaseUrl`** - used to specify the base Url in the manifest.json was not being used in the index `<head>` link for **manifest.json**
- Bug: **Property** **`ServiceWorkerBaseUrl`** - used to specify the base Url in the ServiceWorker was not being used in the _required files_ list.
- Bug: **Property** **`ServiceWorkerBaseUrl`** - used to specify the base Url in the ServiceWorker was not being used in the index `<head>` link for **ServiceWorker.js**
- Also @SQL-MisterMagoo
- Added code to automatically add leading and trailing slashes to **Property** **`ManifestBaseUrl`**
- Added code to automatically add leading and trailing slashes to **Property** **`ServiceWorkerBaseUrl`**

#### 11/11/2019

- Added new **Property** **`ServiceWorkerIgnoreHosts`** - used to prevent service worker installation on specific hosts e.g. localhost
Expand Down
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ I don't have a Mac, but I believe Safari does not prompt on desktop either.
Install the nuget BlazorPWA.MsBuild

#### Package Manager:
`Install-Package BlazorPWA.MSBuild -Version 1.0.1`
`Install-Package BlazorPWA.MSBuild -Version 1.0.2`

#### .NET Cli:
`dotnet add package BlazorPWA.MSBuild --version 1.0.1`
`dotnet add package BlazorPWA.MSBuild --version 1.0.2`

#### Package Reference
`<PackageReference Include="BlazorPWA.MSBuild" Version="1.0.1"/>`
`<PackageReference Include="BlazorPWA.MSBuild" Version="1.0.2"/>`

## Configuration

Expand Down Expand Up @@ -171,6 +171,40 @@ The service worker will not register itself when the `hostname` matches anything

*Note: the single quotes around each hostname are required for now*

### Handle different base Urls for different configurations

Sample csproj file for two different base Urls

``` XML
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ManifestForce>true</ManifestForce>
<ServiceWorkerForce>true</ServiceWorkerForce>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<ServiceWorkerBaseUrl>prod</ServiceWorkerBaseUrl>
<ManifestBaseUrl>prod</ManifestBaseUrl>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<ServiceWorkerBaseUrl>dev</ServiceWorkerBaseUrl>
<ManifestBaseUrl>dev</ManifestBaseUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BlazorPWA.MSBuild" Version="1.0.1-beta20191206-002218">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
```
This project file use **`ManifestForce`** and **`ServiceWorkerForce`** to ensure that the **manifest.json** and **ServiceWorker.js** files are rebuilt - otherwise they would not change when you changed configuration.

## Roadmap

- [ ] At the moment, there is only one choice for caching strategy - Cache First/Network Fallback - I will add more (https://developers.google.com/web/ilt/pwa/introduction-to-progressive-web-app-architectures#caching_strategies_supported_by_sw-toolbox)
Expand Down

0 comments on commit c092c2b

Please sign in to comment.