Skip to content

Commit 1da0ddd

Browse files
authored
Merge pull request #657 from stefanloerwald/deploy-static-assets-with-docker
Simplify deploying js/css
2 parents edf8be5 + 137de5a commit 1da0ddd

File tree

8 files changed

+209
-2
lines changed

8 files changed

+209
-2
lines changed

src/MatBlazor.Demo/Demo/DemoMatSelect.razor

+41
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,47 @@
8282
</SourceContent>
8383
</DemoContainer>
8484

85+
86+
<MatAnchorContainer Anchor="MatSelectInt">
87+
<MatH5>MatSelect Guid?</MatH5>
88+
</MatAnchorContainer>
89+
<DemoContainer>
90+
<Content>
91+
<MatSelect Label="Pick a Food Group" @bind-Value="@guidValue">
92+
<MatOption TValue="Guid?" Value="@(null)"></MatOption>
93+
<MatOption TValue="Guid?" Value="@(new Guid("20A82054-F493-4C7B-81A4-4F9A1EDD7C2E"))">Bread, Cereal, Rice, and Pasta</MatOption>
94+
<MatOption TValue="Guid?" Value="@(new Guid("4451642D-24F7-418F-8741-BA5089A1CC65"))">Vegetables</MatOption>
95+
<MatOption TValue="Guid?" Value="@(new Guid("5717DBBE-C205-4E33-9E07-892A51F64021"))">Fruit</MatOption>
96+
</MatSelect>
97+
98+
<span>@guidValue</span>
99+
100+
@code
101+
{
102+
Guid? guidValue = new Guid("20A82054-F493-4C7B-81A4-4F9A1EDD7C2E");
103+
}
104+
105+
</Content>
106+
<SourceContent>
107+
<BlazorFiddle Template="MatBlazor" Code=@(@"
108+
<MatSelect Label=""Pick a Food Group"" @bind-Value=""@guidValue"">
109+
<MatOption TValue=""Guid?"" Value=""@(null)""></MatOption>
110+
<MatOption TValue=""Guid?"" Value=""@(new Guid(""20A82054-F493-4C7B-81A4-4F9A1EDD7C2E""))"">Bread, Cereal, Rice, and Pasta</MatOption>
111+
<MatOption TValue=""Guid?"" Value=""@(new Guid(""4451642D-24F7-418F-8741-BA5089A1CC65""))"">Vegetables</MatOption>
112+
<MatOption TValue=""Guid?"" Value=""@(new Guid(""5717DBBE-C205-4E33-9E07-892A51F64021""))"">Fruit</MatOption>
113+
</MatSelect>
114+
115+
<span>@guidValue</span>
116+
117+
@code
118+
{
119+
Guid? guidValue = new Guid(""20A82054-F493-4C7B-81A4-4F9A1EDD7C2E"");
120+
}
121+
122+
")></BlazorFiddle>
123+
</SourceContent>
124+
</DemoContainer>
125+
85126
<h5 class="mat-h5">Helper Text</h5>
86127
<DemoContainer>
87128
<Content>

src/MatBlazor.Web/README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# es6-webpack2-starter
1+
To deploy static web assets, one needs to use `npm`. If you have NPM installed, see the "Manual deploy with NPM" section. If you prefer running `npm` isolated in a docker container, run `deploy.ps1` (requires powershell).
2+
3+
# Powershell deploy script
4+
5+
In this folder, run `.\deploy.ps1`.
6+
7+
⚠️ This overwrites the static web assets in `MatBlazor/src/MatBlazor/wwwroot/dist` ⚠️
8+
9+
# Manual deploy with NPM
210

311
[![npm](https://img.shields.io/npm/v/es6-webpack2-starter.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/es6-webpack2-starter)
412
[![npm](https://img.shields.io/npm/l/es6-webpack2-starter.svg?maxAge=2592000?style=flat-square)](https://github.com/micooz/es6-webpack2-starter/blob/master/LICENSE)

src/MatBlazor.Web/deploy.df

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node
2+
WORKDIR src
3+
COPY package.json .
4+
COPY .babelrc .
5+
COPY .eslintrc.js .
6+
RUN npm install
7+
COPY . .
8+
RUN npm run build
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
deploy.ps1
2+
deploy.df
3+
deploy.df.dockerignore
4+
README.md
5+
LICENSE
6+
test.html

src/MatBlazor.Web/deploy.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docker build -t matblazor_deploy -f deploy.df .
2+
docker run -it --rm matblazor_deploy cat /MatBlazor/wwwroot/dist/matBlazor.js | Set-Content -Encoding ASCII ..\MatBlazor\wwwroot\dist\matBlazor.js
3+
docker run -it --rm matblazor_deploy cat /MatBlazor/wwwroot/dist/matBlazor.css | Set-Content -Encoding ASCII ..\MatBlazor\wwwroot\dist\matBlazor.css

src/MatBlazor/Core/MatBlazorSwitchT.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public virtual T FromBool(bool v)
6565
.Case<MatBlazorSwitchT<DateTime>>(new MatBlazorSwitchTDateTime())
6666
.Case<MatBlazorSwitchT<DateTime?>>(new MatBlazorSwitchTDateTimeNull())
6767
.Case<MatBlazorSwitchT<bool>>(new MatBlazorSwitchTBool())
68-
.Case<MatBlazorSwitchT<bool?>>(new MatBlazorSwitchTBoolNull());
68+
.Case<MatBlazorSwitchT<bool?>>(new MatBlazorSwitchTBoolNull())
69+
.Case<MatBlazorSwitchT<Guid>>(new MatBlazorSwitchTGuid())
70+
.Case<MatBlazorSwitchT<Guid?>>(new MatBlazorSwitchTGuidNull());
6971

7072
public static MatBlazorSwitchT<T> Get()
7173
{
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System;
2+
3+
namespace MatBlazor
4+
{
5+
public class MatBlazorSwitchTGuid : MatBlazorSwitchT<Guid>
6+
{
7+
public override Guid Increase(Guid v, Guid step, Guid max)
8+
{
9+
throw new NotImplementedException();
10+
}
11+
12+
public override Guid Decrease(Guid v, Guid step, Guid min)
13+
{
14+
throw new NotImplementedException();
15+
}
16+
17+
public override Guid Round(Guid v, int dp)
18+
{
19+
throw new NotImplementedException();
20+
}
21+
22+
public override Guid GetMinimum()
23+
{
24+
throw new NotImplementedException();
25+
}
26+
27+
public override Guid GetMaximum()
28+
{
29+
throw new NotImplementedException();
30+
}
31+
32+
public override Guid GetStep()
33+
{
34+
throw new NotImplementedException();
35+
}
36+
37+
public override string FormatValueAsString(Guid v, string format)
38+
{
39+
return v.ToString(format);
40+
}
41+
42+
public override Guid ParseFromString(string v, string format)
43+
{
44+
return Guid.Parse(v);
45+
}
46+
47+
public override Guid FromDateTimeNull(DateTime? v)
48+
{
49+
throw new NotImplementedException();
50+
}
51+
52+
public override DateTime? ToDateTimeNull(Guid v)
53+
{
54+
throw new NotImplementedException();
55+
}
56+
57+
public override Guid FromBoolNull(bool? v, bool indeterminate)
58+
{
59+
throw new NotImplementedException();
60+
}
61+
62+
public override Guid FromDecimal(decimal v)
63+
{
64+
throw new NotImplementedException();
65+
}
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System;
2+
3+
namespace MatBlazor
4+
{
5+
public class MatBlazorSwitchTGuidNull : MatBlazorSwitchT<Guid?>
6+
{
7+
public override Guid? Increase(Guid? v, Guid? step, Guid? max)
8+
{
9+
throw new NotImplementedException();
10+
}
11+
12+
public override Guid? Decrease(Guid? v, Guid? step, Guid? min)
13+
{
14+
throw new NotImplementedException();
15+
}
16+
17+
public override Guid? Round(Guid? v, int dp)
18+
{
19+
throw new NotImplementedException();
20+
}
21+
22+
public override Guid? GetMinimum()
23+
{
24+
throw new NotImplementedException();
25+
}
26+
27+
public override Guid? GetMaximum()
28+
{
29+
throw new NotImplementedException();
30+
}
31+
32+
public override Guid? GetStep()
33+
{
34+
throw new NotImplementedException();
35+
}
36+
37+
public override string FormatValueAsString(Guid? v, string format)
38+
{
39+
return v?.ToString(format);
40+
}
41+
42+
public override Guid? ParseFromString(string v, string format)
43+
{
44+
if (Guid.TryParse(v, out var result))
45+
{
46+
return result;
47+
}
48+
49+
return null;
50+
}
51+
52+
public override Guid? FromDateTimeNull(DateTime? v)
53+
{
54+
throw new NotImplementedException();
55+
}
56+
57+
public override DateTime? ToDateTimeNull(Guid? v)
58+
{
59+
throw new NotImplementedException();
60+
}
61+
62+
public override Guid? FromBoolNull(bool? v, bool indeterminate)
63+
{
64+
throw new NotImplementedException();
65+
}
66+
67+
public override Guid? FromDecimal(decimal v)
68+
{
69+
throw new NotImplementedException();
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)