Skip to content

Commit

Permalink
Switch to a esproj from csproj
Browse files Browse the repository at this point in the history
remove wepack config.
I am trying to use inbrowser imports and eliminate webpack
  • Loading branch information
StevenTCramer committed Mar 23, 2022
1 parent 00d644f commit 10b4d0e
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 143 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,4 @@ __pycache__/
/StatiqDocs/output
/Source/BlazorState/wwwroot/*.js
/Source/BlazorState/wwwroot/*.js.map
/Source/BlazorState/wwwroot/js/
19 changes: 11 additions & 8 deletions BlazorState.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 17.0.31808.319
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorState", "source\BlazorState\BlazorState.csproj", "{DF355720-EA1E-4505-AE68-1D36BD0D4711}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorState.Js", "source\BlazorState.Js\BlazorState.Js.csproj", "{51173297-32B7-473E-BA34-788B8E022536}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2902FDFD-016E-4BF7-8B41-53D674FA53DD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.Client", "Tests\TestApp\Client\TestApp.Client.csproj", "{C98290C5-6C90-4A36-A561-E96FF367727C}"
Expand Down Expand Up @@ -40,6 +38,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{FA45
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tutorial", "Tutorial", "{243A5B2C-5E9D-432B-A258-7BCE33645683}"
EndProject
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "BlazorState.Js", "Source\BlazorState.Js\BlazorState.Js.esproj", "{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -53,12 +53,6 @@ Global
{DF355720-EA1E-4505-AE68-1D36BD0D4711}.ReduxDevToolsEnabled|Any CPU.Build.0 = ReduxDevToolsEnabled|Any CPU
{DF355720-EA1E-4505-AE68-1D36BD0D4711}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF355720-EA1E-4505-AE68-1D36BD0D4711}.Release|Any CPU.Build.0 = Release|Any CPU
{51173297-32B7-473E-BA34-788B8E022536}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51173297-32B7-473E-BA34-788B8E022536}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51173297-32B7-473E-BA34-788B8E022536}.ReduxDevToolsEnabled|Any CPU.ActiveCfg = ReduxDevToolsEnabled|Any CPU
{51173297-32B7-473E-BA34-788B8E022536}.ReduxDevToolsEnabled|Any CPU.Build.0 = ReduxDevToolsEnabled|Any CPU
{51173297-32B7-473E-BA34-788B8E022536}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51173297-32B7-473E-BA34-788B8E022536}.Release|Any CPU.Build.0 = Release|Any CPU
{C98290C5-6C90-4A36-A561-E96FF367727C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C98290C5-6C90-4A36-A561-E96FF367727C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C98290C5-6C90-4A36-A561-E96FF367727C}.ReduxDevToolsEnabled|Any CPU.ActiveCfg = ReduxDevToolsEnabled|Any CPU
Expand Down Expand Up @@ -95,6 +89,15 @@ Global
{1F8DBDA6-780A-414E-8517-E96A1B9536E1}.ReduxDevToolsEnabled|Any CPU.Build.0 = ReduxDevToolsEnabled|Any CPU
{1F8DBDA6-780A-414E-8517-E96A1B9536E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F8DBDA6-780A-414E-8517-E96A1B9536E1}.Release|Any CPU.Build.0 = Release|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.ReduxDevToolsEnabled|Any CPU.ActiveCfg = Release|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.ReduxDevToolsEnabled|Any CPU.Build.0 = Release|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.ReduxDevToolsEnabled|Any CPU.Deploy.0 = Release|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.Release|Any CPU.Build.0 = Release|Any CPU
{1A63F7FA-E718-4C0E-8548-76A2B7B41EDF}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
44 changes: 0 additions & 44 deletions Source/BlazorState.Js/BlazorState.Js.csproj

This file was deleted.

45 changes: 45 additions & 0 deletions Source/BlazorState.Js/BlazorState.Js.esproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/0.5.16-alpha">
<PropertyGroup Label="Globals">
<ProjectGuid>1A63F7FA-E718-4C0E-8548-76A2B7B41EDF</ProjectGuid>
<NoWarn>NU1503;NU1105</NoWarn>
<BuildCommand>npm run build</BuildCommand>
</PropertyGroup>
<!-- <ItemGroup>
<Script Include="**"/>
<Script Remove="**.d.ts"/>
</ItemGroup> -->
<!-- <PropertyGroup>
<NpmInstallTimeStampFile>node_modules/.install-timestamp</NpmInstallTimeStampFile>
</PropertyGroup> -->

<!-- <Target
Name="EnsureNpmRestored"
Inputs="$(MSBuildThisFileDirectory)package-lock.json"
Outputs="$(NpmInstallTimeStampFile)"
>
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec Command="npm install" />
<Touch Files="$(NpmInstallTimeStampFile)" AlwaysCreate="true"/>
</Target> -->

<!-- <PropertyGroup>
<JavascriptOutputFile>blazorstate.js</JavascriptOutputFile>
</PropertyGroup>
<ItemGroup>
<WebpackInputs Include="**\*.ts" Exclude="node_modules\**" />
<WebpackInputs Remove="src\blazor-state.lib.module.ts" />
<WebpackInputs Remove="src\Constants.ts" />
<WebpackInputs Remove="src\DotNet.ts" />
</ItemGroup>

<Target
Name="RunBuild"
AfterTargets="ResolveReferences"
Inputs="@(WebpackInputs)"
Outputs="..\BlazorState\wwwroot\$(JavascriptOutputFile)"
DependsOnTargets="EnsureNpmRestored"
>
<Delete Files="..\BlazorState\wwwroot\$(JavascriptOutputFile)" />
<Exec Command="npm run build" />
</Target> -->
</Project>
30 changes: 13 additions & 17 deletions Source/BlazorState.Js/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"name": "blazorstate",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@types/emscripten": "1.39.6",
"ts-loader": "9.2.8",
"typescript": "4.6.2",
"webpack": "5.70.0",
"webpack-cli": "4.9.2"
}
}
{
"name": "blazorstate",
"version": "0.0.1",
"description": "",
"scripts": {
"build": "tsc --build --verbose",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@types/emscripten": "1.39.6",
"typescript": "4.6.2"
}
}
4 changes: 2 additions & 2 deletions Source/BlazorState.Js/src/BlazorState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonRequestHandlerMethodName, JsonRequestHandlerName } from './Constants';
import { JsonRequestHandlerMethodName, JsonRequestHandlerName } from './Constants.js';

export class BlazorState {
async DispatchRequest(requestTypeFullName: string, request: any ) {
Expand All @@ -7,4 +7,4 @@ export class BlazorState {
console.log(`Dispatching request of Type ${requestTypeFullName}: ${requestAsJson}`);
await (<any>window[<any>JsonRequestHandlerName]).invokeMethodAsync(JsonRequestHandlerMethodName, requestTypeFullName, requestAsJson);
}
}
}
6 changes: 3 additions & 3 deletions Source/BlazorState.Js/src/ReduxDevTools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BlazorState } from './BlazorState';
import { BlazorStateName, ReduxExtensionName, DevToolsName, ReduxDevToolsName } from './Constants';
import { BlazorState } from './BlazorState.js';
import { BlazorStateName, ReduxExtensionName, DevToolsName, ReduxDevToolsName } from './Constants.js';

export class ReduxDevTools {
IsEnabled: boolean;
Expand Down Expand Up @@ -108,4 +108,4 @@ export class ReduxDevTools {
return window[DevToolsName].send(action, state);
}
}
}
}
38 changes: 38 additions & 0 deletions Source/BlazorState.Js/src/blazor-state.lib.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { BlazorState } from './BlazorState.js';
import { ReduxDevTools } from './ReduxDevTools.js';
import {
BlazorStateName,
InitializeJavaScriptInteropName,
JsonRequestHandlerName,
ReduxDevToolsFactoryName,
ReduxDevToolsName,
} from './Constants.js';

function InitializeJavaScriptInterop(JsonRequestHandler) {
console.log("InitializeJavaScriptInterop");
window[JsonRequestHandlerName] = JsonRequestHandler;
};

function Initialize() {
console.log("Initialize BlazorState");
if (typeof window !== 'undefined' && !window[BlazorStateName]) {
window[BlazorStateName] = new BlazorState();
window[InitializeJavaScriptInteropName] = InitializeJavaScriptInterop;
window[ReduxDevToolsFactoryName] = ReduxDevToolsFactory;
}
}

function ReduxDevToolsFactory(): boolean {
const reduxDevTools = new ReduxDevTools();
window[ReduxDevToolsName] = reduxDevTools;
return reduxDevTools.IsEnabled;
}

export function beforeStart(options, extensions) {
Initialize();
console.log("****beforeStart timewarp-state ****");
}

export function afterStarted(blazor) {
console.log("****afterStarted timewarp-state ****");
}
Loading

0 comments on commit 10b4d0e

Please sign in to comment.