Skip to content

Commit c092c2b

Browse files
Penultimate updates for version 1.0.2
1 parent 45c80f0 commit c092c2b

File tree

5 files changed

+52
-8
lines changed

5 files changed

+52
-8
lines changed

Blazor.PWA.MSBuild.Tasks/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>1.0.1</VersionPrefix>
3+
<VersionPrefix>1.0.2</VersionPrefix>
44
<VersionSuffix>beta$([System.DateTime]::Now.ToString("yyyyMMdd-HHmmss"))</VersionSuffix>
55
<VersionSuffix Condition="'$(Configuration)' == 'Release'"></VersionSuffix>
66
</PropertyGroup>

Blazor.PWA.MSBuild.Tasks/build/BlazorPWA.MSBuild.Manifest.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
<!-- Base URL for the app -->
1515
<ManifestBaseUrl Condition="'$(ManifestBaseUrl)' == ''">/</ManifestBaseUrl>
16-
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.StartsWith(/)'">/$(ManifestBaseUrl)</ManifestBaseUrl>
17-
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.EndsWith(/)'">$(ManifestBaseUrl)/</ManifestBaseUrl>
16+
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.StartsWith(/))'">/$(ManifestBaseUrl)</ManifestBaseUrl>
17+
<ManifestBaseUrl Condition="!'$(ManifestBaseUrl.EndsWith(/))'">$(ManifestBaseUrl)/</ManifestBaseUrl>
1818

1919
<!-- Please see https://developers.google.com/web/fundamentals/web-app-manifest/#display for options -->
2020
<ManifestDisplay Condition="'$(ManifestDisplay)' == ''">standalone</ManifestDisplay>

Blazor.PWA.MSBuild.Tasks/build/BlazorPWA.MSBuild.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
<!-- The "home route" url for the application -->
3030
<ServiceWorkerBaseUrl Condition="'$(ServiceWorkerBaseUrl)' == ''">/</ServiceWorkerBaseUrl>
31-
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.StartsWith(/)'">/$(ServiceWorkerBaseUrl)</ServiceWorkerBaseUrl>
32-
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.EndsWith(/)'">$(ServiceWorkerBaseUrl)/</ServiceWorkerBaseUrl>
31+
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.StartsWith(/))'">/$(ServiceWorkerBaseUrl)</ServiceWorkerBaseUrl>
32+
<ServiceWorkerBaseUrl Condition="!'$(ServiceWorkerBaseUrl.EndsWith(/))'">$(ServiceWorkerBaseUrl)/</ServiceWorkerBaseUrl>
3333

3434
<!-- The CSB home page served up for the base URL -->
3535
<ProjectIndexPage Condition="'$(ProjectIndexPage)' == ''">index.html</ProjectIndexPage>

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
#### 06/12/2019
2+
3+
- PR #5 from @chucker merged with these changes
4+
- 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**
5+
- Bug: **Property** **`ServiceWorkerBaseUrl`** - used to specify the base Url in the ServiceWorker was not being used in the _required files_ list.
6+
- Bug: **Property** **`ServiceWorkerBaseUrl`** - used to specify the base Url in the ServiceWorker was not being used in the index `<head>` link for **ServiceWorker.js**
7+
- Also @SQL-MisterMagoo
8+
- Added code to automatically add leading and trailing slashes to **Property** **`ManifestBaseUrl`**
9+
- Added code to automatically add leading and trailing slashes to **Property** **`ServiceWorkerBaseUrl`**
10+
111
#### 11/11/2019
212

313
- Added new **Property** **`ServiceWorkerIgnoreHosts`** - used to prevent service worker installation on specific hosts e.g. localhost

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ I don't have a Mac, but I believe Safari does not prompt on desktop either.
2121
Install the nuget BlazorPWA.MsBuild
2222

2323
#### Package Manager:
24-
`Install-Package BlazorPWA.MSBuild -Version 1.0.1`
24+
`Install-Package BlazorPWA.MSBuild -Version 1.0.2`
2525

2626
#### .NET Cli:
27-
`dotnet add package BlazorPWA.MSBuild --version 1.0.1`
27+
`dotnet add package BlazorPWA.MSBuild --version 1.0.2`
2828

2929
#### Package Reference
30-
`<PackageReference Include="BlazorPWA.MSBuild" Version="1.0.1"/>`
30+
`<PackageReference Include="BlazorPWA.MSBuild" Version="1.0.2"/>`
3131

3232
## Configuration
3333

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

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

174+
### Handle different base Urls for different configurations
175+
176+
Sample csproj file for two different base Urls
177+
178+
``` XML
179+
<Project Sdk="Microsoft.NET.Sdk.Web">
180+
181+
<PropertyGroup>
182+
<TargetFramework>netcoreapp3.1</TargetFramework>
183+
<ManifestForce>true</ManifestForce>
184+
<ServiceWorkerForce>true</ServiceWorkerForce>
185+
</PropertyGroup>
186+
187+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
188+
<ServiceWorkerBaseUrl>prod</ServiceWorkerBaseUrl>
189+
<ManifestBaseUrl>prod</ManifestBaseUrl>
190+
</PropertyGroup>
191+
192+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
193+
<ServiceWorkerBaseUrl>dev</ServiceWorkerBaseUrl>
194+
<ManifestBaseUrl>dev</ManifestBaseUrl>
195+
</PropertyGroup>
196+
197+
<ItemGroup>
198+
<PackageReference Include="BlazorPWA.MSBuild" Version="1.0.1-beta20191206-002218">
199+
<PrivateAssets>all</PrivateAssets>
200+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
201+
</PackageReference>
202+
</ItemGroup>
203+
204+
</Project>
205+
```
206+
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.
207+
174208
## Roadmap
175209

176210
- [ ] 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)

0 commit comments

Comments
 (0)