From 7ea06554b3070fd62c0cc66c978192a3eed9cc26 Mon Sep 17 00:00:00 2001 From: Roman Sattler Date: Mon, 16 Mar 2020 18:13:39 +0100 Subject: [PATCH 1/3] Move Blazor.Extensions.Storage.JS into Blazor.Extensions.Storage/Interop --- .../Interop}/package-lock.json | 0 .../Interop}/package.json | 0 .../Interop}/src/BrowserStorage.ts | 0 .../Interop}/src/InitializeStorage.ts | 0 .../Interop}/tsconfig.json | 0 .../Interop}/tsfmt.json | 0 .../Interop}/tslint.json | 0 .../Interop}/webpack.config.js | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/package-lock.json (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/package.json (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/src/BrowserStorage.ts (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/src/InitializeStorage.ts (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/tsconfig.json (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/tsfmt.json (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/tslint.json (100%) rename src/{Blazor.Extensions.Storage.JS => Blazor.Extensions.Storage/Interop}/webpack.config.js (100%) diff --git a/src/Blazor.Extensions.Storage.JS/package-lock.json b/src/Blazor.Extensions.Storage/Interop/package-lock.json similarity index 100% rename from src/Blazor.Extensions.Storage.JS/package-lock.json rename to src/Blazor.Extensions.Storage/Interop/package-lock.json diff --git a/src/Blazor.Extensions.Storage.JS/package.json b/src/Blazor.Extensions.Storage/Interop/package.json similarity index 100% rename from src/Blazor.Extensions.Storage.JS/package.json rename to src/Blazor.Extensions.Storage/Interop/package.json diff --git a/src/Blazor.Extensions.Storage.JS/src/BrowserStorage.ts b/src/Blazor.Extensions.Storage/Interop/src/BrowserStorage.ts similarity index 100% rename from src/Blazor.Extensions.Storage.JS/src/BrowserStorage.ts rename to src/Blazor.Extensions.Storage/Interop/src/BrowserStorage.ts diff --git a/src/Blazor.Extensions.Storage.JS/src/InitializeStorage.ts b/src/Blazor.Extensions.Storage/Interop/src/InitializeStorage.ts similarity index 100% rename from src/Blazor.Extensions.Storage.JS/src/InitializeStorage.ts rename to src/Blazor.Extensions.Storage/Interop/src/InitializeStorage.ts diff --git a/src/Blazor.Extensions.Storage.JS/tsconfig.json b/src/Blazor.Extensions.Storage/Interop/tsconfig.json similarity index 100% rename from src/Blazor.Extensions.Storage.JS/tsconfig.json rename to src/Blazor.Extensions.Storage/Interop/tsconfig.json diff --git a/src/Blazor.Extensions.Storage.JS/tsfmt.json b/src/Blazor.Extensions.Storage/Interop/tsfmt.json similarity index 100% rename from src/Blazor.Extensions.Storage.JS/tsfmt.json rename to src/Blazor.Extensions.Storage/Interop/tsfmt.json diff --git a/src/Blazor.Extensions.Storage.JS/tslint.json b/src/Blazor.Extensions.Storage/Interop/tslint.json similarity index 100% rename from src/Blazor.Extensions.Storage.JS/tslint.json rename to src/Blazor.Extensions.Storage/Interop/tslint.json diff --git a/src/Blazor.Extensions.Storage.JS/webpack.config.js b/src/Blazor.Extensions.Storage/Interop/webpack.config.js similarity index 100% rename from src/Blazor.Extensions.Storage.JS/webpack.config.js rename to src/Blazor.Extensions.Storage/Interop/webpack.config.js From 74d9c5d1807514a1c0600a5b3b139a28ca411eba Mon Sep 17 00:00:00 2001 From: Roman Sattler Date: Mon, 16 Mar 2020 18:17:25 +0100 Subject: [PATCH 2/3] Delete Blazor.Extensions.Storage.JS --- Storage.sln | 19 ++--------- .../Blazor.Extensions.Storage.JS.csproj | 34 ------------------- .../Blazor.Extensions.Storage.csproj | 8 ++--- .../Blazor.Extensions.Storage.Test.csproj | 1 - 4 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 src/Blazor.Extensions.Storage.JS/Blazor.Extensions.Storage.JS.csproj diff --git a/Storage.sln b/Storage.sln index 4964bc4..54a94d6 100644 --- a/Storage.sln +++ b/Storage.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29806.167 MinimumVisualStudioVersion = 15.0.26124.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B286BCBD-DAD8-4DE7-9334-3DE18DF233AF}" EndProject @@ -16,8 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Storage.Test", "test\Blazor.Extensions.Storage.Test\Blazor.Extensions.Storage.Test.csproj", "{C4BB6A39-28E6-454D-8679-92562CEAD0A9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Extensions.Storage.JS", "src\Blazor.Extensions.Storage.JS\Blazor.Extensions.Storage.JS.csproj", "{1C49147F-7C73-4962-A71C-6A193970D058}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,18 +50,6 @@ Global {C4BB6A39-28E6-454D-8679-92562CEAD0A9}.Release|x64.Build.0 = Release|Any CPU {C4BB6A39-28E6-454D-8679-92562CEAD0A9}.Release|x86.ActiveCfg = Release|Any CPU {C4BB6A39-28E6-454D-8679-92562CEAD0A9}.Release|x86.Build.0 = Release|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Debug|x64.ActiveCfg = Debug|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Debug|x64.Build.0 = Debug|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Debug|x86.ActiveCfg = Debug|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Debug|x86.Build.0 = Debug|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Release|Any CPU.Build.0 = Release|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Release|x64.ActiveCfg = Release|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Release|x64.Build.0 = Release|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Release|x86.ActiveCfg = Release|Any CPU - {1C49147F-7C73-4962-A71C-6A193970D058}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -71,7 +57,6 @@ Global GlobalSection(NestedProjects) = preSolution {9378C7BF-0899-4835-B8FB-099292C8C63D} = {B286BCBD-DAD8-4DE7-9334-3DE18DF233AF} {C4BB6A39-28E6-454D-8679-92562CEAD0A9} = {20DAA632-F8AD-4C5F-9E5F-FC82B7CB56A7} - {1C49147F-7C73-4962-A71C-6A193970D058} = {B286BCBD-DAD8-4DE7-9334-3DE18DF233AF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A97C0A4B-E309-4485-BB76-898B37BFBFFF} diff --git a/src/Blazor.Extensions.Storage.JS/Blazor.Extensions.Storage.JS.csproj b/src/Blazor.Extensions.Storage.JS/Blazor.Extensions.Storage.JS.csproj deleted file mode 100644 index 8fc515d..0000000 --- a/src/Blazor.Extensions.Storage.JS/Blazor.Extensions.Storage.JS.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - netstandard2.0 - Library - false - false - latest - true - Latest - ${DefaultItemExcludes};dist\**;node_modules\** - CS2008 - - - true - - - - - - - - - - - - - - - - - - - diff --git a/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj b/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj index 67d0f6d..9bb7211 100644 --- a/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj +++ b/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj @@ -17,10 +17,10 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/Blazor.Extensions.Storage.Test/Blazor.Extensions.Storage.Test.csproj b/test/Blazor.Extensions.Storage.Test/Blazor.Extensions.Storage.Test.csproj index ef0b929..e8c9017 100644 --- a/test/Blazor.Extensions.Storage.Test/Blazor.Extensions.Storage.Test.csproj +++ b/test/Blazor.Extensions.Storage.Test/Blazor.Extensions.Storage.Test.csproj @@ -14,7 +14,6 @@ - From 2a4da9dbdec643df4b56920bc2c24b20fb384b29 Mon Sep 17 00:00:00 2001 From: Roman Sattler Date: Mon, 16 Mar 2020 18:44:21 +0100 Subject: [PATCH 3/3] Rewritten MSBuild to include the Interop script at _content/Blazor.Extensions.Storage/Storage.js --- README.md | 6 ++ .../Blazor.Extensions.Storage.csproj | 74 +++++++++++++++++-- .../Interop/webpack.config.js | 2 +- .../wwwroot/index.html | 1 + 4 files changed, 74 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3c49008..28a0eae 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ This package wraps [HTML5 Storage](https://developer.mozilla.org/en-US/docs/Web/ ## Setup +Include the following snippet in the the ```head``` section of the Index page (```wwwroot/index.html```). + +```html + +``` + The following snippet shows how to setup the storage wrapper by registering it for dependency injection in the ```Startup.cs``` of the application. ```c# diff --git a/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj b/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj index 9bb7211..bc4973c 100644 --- a/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj +++ b/src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj @@ -1,4 +1,4 @@ - + Blazor Extensions Storage @@ -12,20 +12,78 @@ 7.3 3.0 true - $(TargetsForTfmSpecificBuildOutput);IncludeP2POutput + $(MSBuildThisFileDirectory)Interop\ + + CompileInterop; + $(ResolveCurrentProjectStaticWebAssetsInputsDependsOn) + + $(DefaultItemExcludes);$(InteropWorkingDir)node_modules\** + 1.1.0-dev - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + + + + + + + + + + + + + + + + + + + + + + + $(IntermediateOutputPath)interop.cache + + + + + + + + - + + + + + + + + + + + <_InteropBuildOutput Include="$(InteropWorkingDir)dist\**" /> + + + + $(PackageId) + $([MSBuild]::NormalizeDirectory('$(InteropWorkingDir)\dist')) + _content/$(PackageId) + $([System.String]::Copy('%(RecursiveDir)%(FileName)%(Extension)').Replace('\','/')) + + + + + + + diff --git a/src/Blazor.Extensions.Storage/Interop/webpack.config.js b/src/Blazor.Extensions.Storage/Interop/webpack.config.js index 6359dbd..fa0bf2d 100644 --- a/src/Blazor.Extensions.Storage/Interop/webpack.config.js +++ b/src/Blazor.Extensions.Storage/Interop/webpack.config.js @@ -16,7 +16,7 @@ module.exports = { ] }, entry: { - "blazor.extensions.storage": "./src/InitializeStorage.ts" + "Storage": "./src/InitializeStorage.ts" }, output: { path: path.join(__dirname, "/dist"), diff --git a/test/Blazor.Extensions.Storage.Test/wwwroot/index.html b/test/Blazor.Extensions.Storage.Test/wwwroot/index.html index 2da78ea..0360a92 100644 --- a/test/Blazor.Extensions.Storage.Test/wwwroot/index.html +++ b/test/Blazor.Extensions.Storage.Test/wwwroot/index.html @@ -10,6 +10,7 @@ Loading... +