Skip to content

Commit eca1e51

Browse files
authored
Merge pull request #181 from VAlmea/spa-template-react
Spa template react
2 parents ce87d89 + 109ca4b commit eca1e51

27 files changed

+1431
-31
lines changed

generators/spa/index.js

+63-7
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,24 @@ module.exports = class extends DnnGeneratorBase {
181181
template
182182
);
183183

184+
this.fs.copyTpl(
185+
this.templatePath('common/Data/**'),
186+
this.destinationPath(moduleName + '/Data/'),
187+
template
188+
);
189+
190+
this.fs.copyTpl(
191+
this.templatePath('common/ViewModels/**'),
192+
this.destinationPath(moduleName + '/ViewModels/'),
193+
template
194+
);
195+
196+
this.fs.copyTpl(
197+
this.templatePath('common/Providers/**'),
198+
this.destinationPath(moduleName + '/Providers/'),
199+
template
200+
);
201+
184202
// Do all templated copies
185203
this.fs.copyTpl(
186204
this.templatePath('../../common/src/**'),
@@ -205,6 +223,12 @@ module.exports = class extends DnnGeneratorBase {
205223
this.destinationPath(moduleName + '/RouteConfig.cs'),
206224
template
207225
);
226+
227+
this.fs.copyTpl(
228+
this.templatePath('common/Constants.cs'),
229+
this.destinationPath(moduleName + '/Constants.cs'),
230+
template
231+
);
208232

209233
this.fs.copyTpl(
210234
this.templatePath('common/manifest.dnn'),
@@ -213,8 +237,38 @@ module.exports = class extends DnnGeneratorBase {
213237
);
214238

215239
this.fs.copyTpl(
216-
this.templatePath('../../common/csproj/_Project.csproj'),
240+
this.templatePath('common/symbols.dnn'),
241+
this.destinationPath(moduleName + '/' + moduleName + '_Symbols.dnn'),
242+
template
243+
);
244+
245+
this.fs.copyTpl(
246+
this.templatePath('common/License.txt'),
247+
this.destinationPath(moduleName + '/License.txt'),
248+
template
249+
);
250+
251+
this.fs.copyTpl(
252+
this.templatePath('common/ReleaseNotes.txt'),
253+
this.destinationPath(moduleName + '/ReleaseNotes.txt'),
254+
template
255+
);
256+
257+
this.fs.copyTpl(
258+
this.templatePath(spaType + '/common/Module.csproj'),
217259
this.destinationPath(moduleName + '/' + moduleName + '.csproj'),
260+
template
261+
);
262+
263+
this.fs.copyTpl(
264+
this.templatePath(spaType + '/common/Module.build'),
265+
this.destinationPath(moduleName + '/Module.build'),
266+
template
267+
);
268+
269+
this.fs.copyTpl(
270+
this.templatePath('common/Data/ModuleContext.cs'),
271+
this.destinationPath(moduleName + '/Data/' + moduleName + 'Context.cs'),
218272
template
219273
);
220274

@@ -258,7 +312,7 @@ module.exports = class extends DnnGeneratorBase {
258312
'html-webpack-plugin': '^3.2.0',
259313
// eslint-disable-next-line prettier/prettier
260314
'marked': '^0.5.2',
261-
'node-sass': '^4.11.0',
315+
'node-sass': '^8.0.0',
262316
'sass-loader': '^7.1.0',
263317
'style-loader': '^0.23.1',
264318
// eslint-disable-next-line prettier/prettier
@@ -268,10 +322,13 @@ module.exports = class extends DnnGeneratorBase {
268322
'webpack-node-externals': '^1.7.2'
269323
},
270324
dependencies: {
271-
'prop-types': '^15.6.2',
272-
// eslint-disable-next-line prettier/prettier
273-
'react': '^16.6.3',
274-
'react-dom': '^16.6.3'
325+
"@testing-library/jest-dom": "^5.16.5",
326+
"@testing-library/react": "^13.4.0",
327+
"@testing-library/user-event": "^13.5.0",
328+
"react": "^18.2.0",
329+
"react-dom": "^18.2.0",
330+
"react-scripts": "5.0.1",
331+
"web-vitals": "^2.1.4"
275332
}
276333
};
277334

@@ -290,7 +347,6 @@ module.exports = class extends DnnGeneratorBase {
290347
'eslint': '^5.8.0',
291348
'eslint-loader': '^2.1.1',
292349
'eslint-plugin-react': '^7.11.1',
293-
'react-hot-loader': '^4.3.12'
294350
};
295351
} else {
296352
this._writeTsConfig();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<ModulePath><%= moduleName %></ModulePath>
4+
<DNNFileName><%= moduleName %></DNNFileName>
5+
<PackageName><%= fullNamespace %></PackageName>
6+
<Extension>zip</Extension>
7+
<BuildScriptsPath>$(MSBuildProjectDirectory)\..\..\Build</BuildScriptsPath>
8+
<WebsitePath>$(MSBuildProjectDirectory)\..\..\Website</WebsitePath>
9+
<WebsiteInstallPath>$(WebsitePath)\Install\Module</WebsiteInstallPath>
10+
<FullModulePath>$(WebsitePath)\DesktopModules\$(ModulePath)</FullModulePath>
11+
</PropertyGroup>
12+
<Import Project="$(BuildScriptsPath)\ModulePackage.Targets" />
13+
<Target Name="AfterBuild" DependsOnTargets="CopyBin;GetFiles;DebugProject;PackageModule">
14+
</Target>
15+
<Target Name="GetFiles">
16+
<ItemGroup>
17+
<Manifest Include="*.dnn;*.dnn5;*.dnn6" />
18+
<TextFiles Include="*.txt" Exclude="releasenotes.txt;license.txt" />
19+
<ResourceFiles Include="App_LocalResources/*.resx" />
20+
<SourceFiles Include="dist/**" Exclude="providers/**;bin/**" />
21+
<DataProvider Include="dist/Providers/DataProviders/SqlDataProvider/*.SqlDataProvider" />
22+
<Resources Include="@(Manifest);@(TextFiles);@(ResourceFiles);@(DataProvider);@(SourceFiles)" />
23+
</ItemGroup>
24+
</Target>
25+
<ItemGroup>
26+
<SymbolsInclude Include="$(DNNFileName)_Symbols.dnn" />
27+
<SymbolsInclude Include="License.txt" />
28+
<SymbolsInclude Include="ReleaseNotes.txt" />
29+
</ItemGroup>
30+
<Target Name="CopyBin">
31+
<ItemGroup>
32+
<BinSourceInclude Include="$(MSBuildProjectDirectory)\bin\*.dll" Exclude="$(MSBuildProjectDirectory)\bin\DotNetNuke*;$(MSBuildProjectDirectory)\bin\Telerik*;$(MSBuildProjectDirectory)\bin\System.*;$(MSBuildProjectDirectory)\bin\Microsoft.*;$(MSBuildProjectDirectory)\bin\Newtonsoft.Json.*" />
33+
<BinSourceInclude Include="$(MSBuildProjectDirectory)\bin\*.pdb" Exclude="$(MSBuildProjectDirectory)\bin\DotNetNuke*;$(MSBuildProjectDirectory)\bin\Telerik*;$(MSBuildProjectDirectory)\bin\System.*;$(MSBuildProjectDirectory)\bin\Microsoft.*;$(MSBuildProjectDirectory)\bin\Newtonsoft.Json.*" />
34+
</ItemGroup>
35+
<Copy SourceFiles="@(BinSourceInclude)" DestinationFolder="$(WebsitePath)\bin" />
36+
</Target>
37+
<Target Name="DebugProject" Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
38+
<Copy SourceFiles="@(Manifest)" DestinationFolder="$(FullModulePath)" />
39+
<Copy SourceFiles="@(TextFiles)" DestinationFolder="$(FullModulePath)" />
40+
<Copy SourceFiles="@(SourceFiles)" DestinationFolder="$(FullModulePath)\dist\%(RecursiveDir)" />
41+
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(FullModulePath)\App_LocalResources" />
42+
<Copy SourceFiles="@(DataProvider)" DestinationFolder="$(FullModulePath)\Providers\DataProviders\SqlDataProvider" />
43+
</Target>
44+
<Target Name="BuildReactClientApp">
45+
<Message Text="Performing React build." Importance="high"></Message>
46+
<CreateItem Include="$(FullModulePath)\Scripts\client-app\**;">
47+
<Output TaskParameter="Include" ItemName="deleteReactFiles" />
48+
</CreateItem>
49+
<Delete ContinueOnError="true" Files="@(deleteReactFiles)"></Delete>
50+
<Exec Condition="$(Configuration) == 'Debug'" Command="npm run build-client" />
51+
<Exec Condition="$(Configuration) == 'Release'" Command="npm run build-client" />
52+
</Target>
53+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>
7+
</ProductVersion>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<ProjectGuid>{<%= guid %>}</ProjectGuid>
10+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
11+
<OutputType>Library</OutputType>
12+
<AppDesignerFolder>Properties</AppDesignerFolder>
13+
<RootNamespace><%= fullNamespace %></RootNamespace>
14+
<AssemblyName><%= fullNamespace %></AssemblyName>
15+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
16+
<UseIISExpress>false</UseIISExpress>
17+
<IISExpressSSLPort />
18+
<IISExpressAnonymousAuthentication />
19+
<IISExpressWindowsAuthentication />
20+
<IISExpressUseClassicPipelineMode />
21+
<TargetFrameworkProfile />
22+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">.\</SolutionDir>
23+
<RestorePackages>true</RestorePackages>
24+
<FileUpgradeFlags>
25+
</FileUpgradeFlags>
26+
<OldToolsVersion>12.0</OldToolsVersion>
27+
<Use64BitIISExpress />
28+
<UseGlobalApplicationHostFile />
29+
<UpgradeBackupLocation />
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
32+
<DebugSymbols>true</DebugSymbols>
33+
<DebugType>full</DebugType>
34+
<Optimize>false</Optimize>
35+
<OutputPath>bin\</OutputPath>
36+
<DefineConstants>DEBUG;TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
<DocumentationFile>bin\<%= fullNamespace %>.xml</DocumentationFile>
40+
</PropertyGroup>
41+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
42+
<DebugType>pdbonly</DebugType>
43+
<Optimize>true</Optimize>
44+
<OutputPath>bin\</OutputPath>
45+
<DefineConstants>TRACE</DefineConstants>
46+
<ErrorReport>prompt</ErrorReport>
47+
<WarningLevel>4</WarningLevel>
48+
<DocumentationFile>bin\<%= fullNamespace %>.xml</DocumentationFile>
49+
</PropertyGroup>
50+
<Import Project="..\..\Build\SolutionReferences.targets" />
51+
<ItemGroup>
52+
<PackageReference Include="DotNetNuke.Core" Version="9.3.2" />
53+
<PackageReference Include="DotNetNuke.Instrumentation" Version="9.3.2" />
54+
<PackageReference Include="DotNetNuke.Web" Version="9.3.2" />
55+
<PackageReference Include="DotNetNuke.Web.Client" Version="9.3.2" />
56+
<PackageReference Include="DotNetNuke.Web.Deprecated" Version="9.3.2" />
57+
<PackageReference Include="DotNetNuke.WebApi" Version="9.3.2" />
58+
<PackageReference Include="EntityFramework" Version="6.0.0.0" />
59+
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<Reference Include="System.Net.Http" />
63+
<Reference Include="Microsoft.CSharp" />
64+
<Reference Include="System" />
65+
<Reference Include="System.Data" />
66+
<Reference Include="System.ComponentModel.DataAnnotations" />
67+
<Reference Include="System.Data.DataSetExtensions" />
68+
<Reference Include="System.Web" />
69+
<Reference Include="System.Web.Extensions" />
70+
<Reference Include="System.Xml" />
71+
<Reference Include="System.Configuration" />
72+
<Reference Include="System.Web.Services" />
73+
<Reference Include="System.EnterpriseServices" />
74+
<Reference Include="System.Web.DynamicData" />
75+
<Reference Include="System.Web.Entity" />
76+
<Reference Include="System.Web.ApplicationServices" />
77+
</ItemGroup>
78+
<ItemGroup>
79+
<Reference Include="System" />
80+
<Reference Include="System.Core" />
81+
<Reference Include="System.Data" />
82+
<Reference Include="System.Xml" />
83+
</ItemGroup>
84+
<ItemGroup>
85+
<Content Include="App_LocalResources\Settings.resx" />
86+
<Content Include="App_LocalResources\View.resx">
87+
<SubType>Designer</SubType>
88+
</Content>
89+
</ItemGroup>
90+
<ItemGroup>
91+
<Content Include="Providers\DataProviders\SqlDataProvider\00.00.01.SqlDataProvider" />
92+
<Content Include="Providers\DataProviders\SqlDataProvider\Uninstall.SqlDataProvider" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<Content Include="<%= moduleName %>.dnn" />
96+
<Content Include="Module.build">
97+
<SubType>Designer</SubType>
98+
</Content>
99+
<Content Include="<%= moduleName %>_Symbols.dnn">
100+
<SubType>Designer</SubType>
101+
</Content>
102+
</ItemGroup>
103+
<ItemGroup>
104+
<!-- <Compile Include="Components\DataProviderHelper.cs" />
105+
<Compile Include="Components\FeatureController.cs" /> -->
106+
<Content Include="src\app.jsx" />
107+
<Content Include="src\components\Hello.jsx" />
108+
<Content Include="src\Edit.html" />
109+
<Content Include="src\edit.jsx" />
110+
<Content Include="src\Resources\img\extension.png" />
111+
<Content Include="src\Settings.html" />
112+
<Content Include="src\settings.jsx" />
113+
<Content Include="src\View.html" />
114+
<Content Include="src\_templates\Markdown.html" />
115+
<Content Include="src\License.md" />
116+
<Content Include="src\ReleaseNotes.md" />
117+
<Content Include="src\Resources\styles\module.scss" />
118+
<Content Include="src\Resources\scripts\common.js" />
119+
<Content Include="src\Resources\scripts\QuickSettings.js" />
120+
<Content Include="src\Resources\scripts\useFetch.js" />
121+
<!-- <Compile Include="Properties\AssemblyInfo.cs" /> -->
122+
</ItemGroup>
123+
<ItemGroup>
124+
<Compile Include="Components\BaseClasses\ApiControllerBase.cs" />
125+
<Compile Include="Controllers\ItemController.cs" />
126+
<Compile Include="Controllers\SettingsController.cs" />
127+
<Compile Include="RouteConfig.cs" />
128+
<Compile Include="Constants.cs" />
129+
<Compile Include="Controllers\UserController.cs" />
130+
<Compile Include="ViewModels\ItemViewModel.cs" />
131+
<Compile Include="ViewModels\UserViewModel.cs" />
132+
<Compile Include="ViewModels\SettingsViewModel.cs" />
133+
<Compile Include="Data\Item.cs" />
134+
<Compile Include="Data\<%= moduleName %>Context.cs" />
135+
</ItemGroup>
136+
<ItemGroup>
137+
<Content Include="Images\logo.png" />
138+
<Content Include="License.txt" />
139+
<Content Include="module.css" />
140+
<Content Include="ReleaseNotes.txt" />
141+
</ItemGroup>
142+
<PropertyGroup>
143+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
144+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
145+
</PropertyGroup>
146+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
147+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v<%= msBuildVersion %>.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
148+
<ProjectExtensions>
149+
<VisualStudio>
150+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
151+
<WebProjectProperties>
152+
<SaveServerSettingsInUserFile>True</SaveServerSettingsInUserFile>
153+
</WebProjectProperties>
154+
</FlavorProperties>
155+
</VisualStudio>
156+
</ProjectExtensions>
157+
<Import Project="Module.Build" />
158+
<Target Name="BeforeBuild" DependsOnTargets="BuildReactClientApp">
159+
</Target>
160+
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import React from "react";
22
import * as ReactDOM from "react-dom";
3-
import Hello from "./components/Hello";
3+
import Items from "./components/Items";
44

55
ReactDOM.render(
6-
<div className="row">
7-
<div className="col-xs-12">
8-
<Hello name="I am a JSX react module" />
9-
</div>
10-
</div>,
6+
<React.StrictMode>
7+
<Items />
8+
</React.StrictMode>,
119
document.getElementById("<%= namespace.toLowerCase() %><%= moduleName %>")
1210
);

0 commit comments

Comments
 (0)