GithubHelp home page GithubHelp logo

aspnet / templating Goto Github PK

View Code? Open in Web Editor NEW
205.0 58.0 79.0 4 MB

[Archived] ASP.NET Core templates for .NET CLI and Visual Studio. Project moved to https://github.com/aspnet/AspNetCore

License: Apache License 2.0

Batchfile 2.54% PowerShell 3.48% C# 62.27% F# 2.28% CSS 1.42% JavaScript 9.29% Shell 3.00% HTML 12.52% TypeScript 3.21%
aspnet-product

templating's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

templating's Issues

NPM dependencies stop working

Moved from dotnet/AspNetCore.Docs#4547. Originally logged by @BlanketGuy.

I've been having a lot of trouble with the dependencies when creating a project with the Angular template on VS 2017.
First I had to install all the npm packages one by one, and some of them stopped working out of the blue.
Every time I fix something and re-open the project, something else stops working. Anyone else had this problem? How did you solve it?

Add server-side rendering option to SPA templates

Server-side rendering requires a significant amount of non-trivial boilerplate code to be added for React and Angular. Making it a part of the template could save days of work for someone who has never done it.

It would add more clutter though if it's not something that the user needs, so it should be optional.

Avoid throwing 'ApplicationException' - it is not recommended by MSDN

From @Eilon on August 8, 2017 19:49

The ApplicationException has been essentially obsolete since .NET 1.0, and MSDN specifically recommends avoiding it:

https://msdn.microsoft.com/en-us/library/system.applicationexception(v=vs.110).aspx

You should derive custom exceptions from the Exception class rather than the ApplicationException class. You should not throw an ApplicationException exception in your code, and you should not catch an ApplicationException exception unless you intend to re-throw the original exception.

We should fix this ASAP in the project templates, as it is not a good practice.

Copied from original issue: dotnet/templating#1191

Mvc Web App template inside docker tries to connect to localdb

Moved from dotnet/efcore#10002 by @smitpatel

Steps:
Create new ASP.NET Core Web Application
Choose Web Application template for 2.0
Add individual accounts auth
Enable Docker support for windows.
Restore packages/build solution etc.
Press F5

Above will fail due to aspnet/Mvc#6923
Once you correct the URL to http://172.21.203.31/
Website loads correctly. But when trying to register User, it fails with following error
image

Essentially it is trying to connect to localdb which does not exist inside docker container (for obvious reason)

Angular SPA template problems adding npm package.

Hi,
I am using the Angular SPA template and have been facing issues with how to correctly configure webpack for several days now. And editing the large webpack.config is rather hard :)

I added ngx-mqtt to my package.json this results in the error:

Module not found : error : Can't resolve 'mqtt'
The package mqtt is imported in ngx-mqtt however it is also listed as a devDependency in ngx-mqtt's package.json so should't it just work?

I tried to add mqtt to my package.json (again I thought this isn't how it is done) and then this results in:
node_modules\mqtt\mqtt.js Unexpected character '#'
This probably could be fixed by using shebang-loader or something in my webpack.config, but honestly I have no idea where I would add this without breaking everything.

Missing license header in some files

From @omajid on August 18, 2017 16:5

Some files have only this license header, which doesn't explicitly confirm that the file is licensed under the license documented in the https://github.com/dotnet/templating/blob/rel/2.1.0-preview1/LICENSE file:

/*!
** Unobtrusive validation support library for jQuery and jQuery Validate
** Copyright (C) Microsoft Corporation. All rights reserved.
*/

For example, https://github.com/dotnet/templating/blob/rel/2.1.0-preview1/template_feed/Microsoft.DotNet.Web.ProjectTemplates.1.x/content/StarterWeb-CSharp/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js. Can you please somehow clarify this header? The "All Rights Reserved" and no mention of MIT or jquery license makes me feel uncomfortable.

cc @leecow

Copied from original issue: dotnet/templating#1216

Remove usage of ApplicationException from all templates

This exception type is not recommended by MSDN because it carries no meaning (you might as well throw Exception).

For each current usage we need to either:

  1. Ideally stop throwing an exception (e.g. return an MVC action result, or propagate errors some other way)
  2. If (1) isn't an option, throw a more appropriate (and meaningful) exception type

Fix order of Browser Link middleware

Move the call to app.UseBrowserLink(); up so it runs before the call to app.UseDeveloperExceptionPage(); in the Web Application templates (both Razor Pages and MVC).

This enables Browser Link to run on error pages which is a super important workflow enhancement

Should we remove app.db from the templates

We create the templates with a pre-initialized app.db instance which causes that when we make changes to the migration and instantiate the template (and try to run the migrations) we get the message that everything is up to date when it is not.

Instead of that, we should just run the migrations in the same way we do for local db today.

Any thoughts? @ajcvickers

Update client_info to include policy

From @danroth27 on June 1, 2017 22:33

From @danroth27 on May 5, 2017 6:5

The client_info parameter needs to be updated to look like this:

"client_info": { "uid": "c765bd67-ca10-4337-ad54-fa82babad87a-<policy>", "utid": "1350dd1f-7f35-43b7-8d0f-bf80031d668a" }

Where = whatever policy as used for authentication. For example,

"client_info": { "uid": "c765bd67-ca10-4337-ad54-fa82babad87a-B2C_1_signupsignin", "utid": "1350dd1f-7f35-43b7-8d0f-bf80031d668a" }

Copied from original issue: aspnet/IdentityService#101

Copied from original issue: dotnet/templating#874

Add vertical spacing in the project file?

Seems like it would be a bit nicer to work with the project file (in non-VS; hand-editing) scenarios to include some vertical space among the sections.

Here is a current project file for a Razor Pages app produced from the template (also note the strange extra line between <TargetFramework> and <UserSecretsId>):

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    
    <UserSecretsId>aspnet-sample-C1C143B5-1151-4D1A-855C-A3AC600D099A</UserSecretsId>
  </PropertyGroup>
  <ItemGroup>
    <None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

... I wonder if you support the idea of going with ...

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <UserSecretsId>aspnet-sample-C1C143B5-1151-4D1A-855C-A3AC600D099A</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <None Update="app.db" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

</Project>

Support multiple projects with solution file

I want to create multiple .net core projects with solution files.
Also project other referenced added in them.
My Directory structure is like:

|- data (blank or may contain some files)
|- design
|- help
|- src

|-.sln (VS solution file)
|-Libraries

|-LIB1.csproj
|-LIB2.csproj
|-LIB3.csproj
|-Presentation
|-PRE1.csproj
|-PRE2.csproj
|-Tests
|-TEST1.csproj
|-TEST2.csproj
|-Plugins
|-Plugin1.csproj
|-Plugin2.csproj

Adding BrowserAnimationsModule and NoopAnimationsModule causes webpack HMR to duplicate the app element on update

Using exactly the same code as in the angular-animations-example branch, any changes to the app that invokes the webpack hot module replacement results in the previous app element being left behind underneath the newlay added app element. A browser refresh is necessary to get rid of it and test as normal.

This seems to be provoked merely by importing the two AnimationsModules into the browser and server app modules.

Here's my demo of the problem.

JimLynn/AngularCoreWithAnimation@356be71

Bundling/minifying CSS/JS in 2.0 preview released templates

From @peterblazejewicz on May 13, 2017 21:3

The mvc and razor templates ship with bundleconfig.json but I think the integration is broken. I'm not using VS. The 2.0 uses blank platform meta package dependency Microsoft.AspNetCore.All and cli tool for Secret manager tool Microsoft.Extensions.SecretManager.Tools and that's all. Whenever I made a changes in content client code (JS, CSS that is) I would expect new minified version to be created, but the bundler integration is broken.
How am I supposed to use bundler with 2.0 version? With 1/1.1 everytime the build command is used the bundler produces updated content.
Thanks!

dotnet --info
.NET Command Line Tools (2.0.0-preview1-005977)

Product Information:
 Version:            2.0.0-preview1-005977
 Commit SHA-1 hash:  414cab8a0b

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.0.0-preview1-005977/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview1-002111-00
  Build    : 1ff021936263d492539399688f46fd3827169983

Copied from original issue: dotnet/templating#786

Include the 'additional-methods.js' in the template

A new jquery-unobtrusive adapter was added for handling validation of file extensions. aspnet/jquery-validation-unobtrusive@e7444c9

This adapter uses 'extension' method from the jquery-validation's 'additional-methods.js' file. This file is already being downloaded as part of the jquery-validation package. We just need to include it in the template's .cshtml file: https://github.com/aspnet/templating/blob/dev/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Views/Shared/_ValidationScriptsPartial.cshtml

cc @dougbu @Eilon

Angular namespace converting issue (underscore)

I created angular project with dotnet cli. The project is created nicely, however, the namespace is something a bit different than I expected.

$ dotnet --version
2.0.0
$ dotnet new angular --output src/HelloWorld.AngularApp --name HelloWorld.AngularApp
The template "ASP.NET Core with Angular" was created successfully.
// ...
$ cat src/HelloWorld.AngularApp/Startup.cs
// ...
namespace HelloWorld_AngularApp
{
// ...

What I expected is below:

// ...
namespace HelloWorld.AngularApp
{
// ...

I can replace the namespace manually though, it would be nice to have a --namespace parameter for this case like dotnet new mvc.

Also, name property in project.json needs to check together.

Welcome page/README/Project_ReadMe

From @peterblazejewicz on February 3, 2017 20:23

Not sure if this is a correct repo:
I'm missing a warm welcome page (README) for content:
Remove Project_ReadMe.txt from templates
Replacement for content in README.md
aspnet/Templates#681 (comment)
I've used to write a script to scrap relevant content:
https://github.com/peterblazejewicz/missing-aspnet-readme
but aspnet/Templates#681 removed that option.
The somehow close one startup page from docs is too long I think

I could be missing bit of info, but is there a source or content similar to this one from VS2017 RC?
https://cloud.githubusercontent.com/assets/14539/22482499/916fe2b6-e7f9-11e6-9a31-867f73ca8df2.png

Have you folks discussed that topic?

See below:
https://camo.githubusercontent.com/cb65f07210255d434e2d2b0aab5a1cd572394443/687474703a2f2f6775696465732e727562796f6e7261696c732e6f72672f696d616765732f67657474696e675f737461727465642f7261696c735f77656c636f6d652e706e67

or even this old one:

https://cloud.githubusercontent.com/assets/14539/22607067/8cd81246-ea56-11e6-94c2-8cde68e7c208.png

Thanks!

Copied from original issue: dotnet/templating#247

Updating wwwroot/dist on Rebuild

What does everyone think about regenerating the wwwroot/dist folder on rebuild? Something like this:

<Target Name="DebugRunWebpack" BeforeTargets="Rebuild" Condition=" '$(Configuration)' == 'Debug'">
<RemoveDir Directories="wwwroot/dist" />
<Message Importance="high" Text="Performing re-run Webpack build..." />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" />
<Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target>

reduxreact JQuery-UI example

What's the best way to work with JQuery UI with server-side pre-rendering?

Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: 'Prerendering failed because of error: TypeError: $.each is not a function

I got it to work without server-side pre-rendering, by adding

, 'jquery-ui-bundle', 'jquery-ui-bundle/jquery-ui.css'

to webpack.config.vendor.js and

/// <reference path='../../node_modules/@types/jqueryui/index.d.ts' />
import * as $ from "jquery";
import "jquery-ui-bundle";

to the component.

Template enhancements

Updated: 8/6/2018

Language

This is probably just a localization issue, but the template is in English. Do you want to set a lang="en" here? I do set it on our doc samples.

Add/update crossorigin

Only missing for the Bootstrap stylesheet. Recent updates have squared it (and integrity) away in the 2.1 template.

<h1> MIA

Pages and views should provide the page/view title in <h1> headings. The current templates ignore W3C advice (ref: https://www.w3.org/QA/Tips/Use_h1_for_Title). I suggest raising the <h2> headings to <h1>, and there's nothing wrong with changing the four <h2> elements on the Index page to <h1> elements ... nothing prevents multiple <h1> elements in HTML5. Could set the sizes of headers in the stylesheet (make them smaller than default) to preserve the current style.

Void elements

Some of us in the community feel that W3C hacked their own spec to allow closing void elements. IIRC Razor needs them generally closed; however, the void elements in the template aren't processed by Razor. I think it would be safe to not close most/all of them (i.e., <link>, <meta>, <hr>).

Language in the Error page

I recommend some language updates to the Error page. Something like ...

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications</strong>. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong> and restarting the app or calling <code>UseEnvironment("Development")</code> on the host in <strong>Program.Main</strong> and restarting the app.
</p>

Except for a few style updates, the proposal surfaces .UseEnvironment().

Extra line space

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
    services.Configure<CookiePolicyOptions>(options =>
    {
        // This lambda determines whether user consent for non-essential cookies is needed for a given request.
        options.CheckConsentNeeded = context => true;
        options.MinimumSameSitePolicy = SameSiteMode.None;
    });


    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

At least in the RP template, there seems to be an extra line space before AddMvc.

Bower package manager migration while in maintenance

From @peterblazejewicz on May 21, 2017 17:50

Hi folks,
Just to let you know, the Bower package manager tool has been put into maintenance mode officially:
bower/bower@0bd318d
The related issues was closed on the Bower project discussion list:
bower/bower#2298
The templates ships with Bower configuration and implicit dependency (as precaution the dependencies are bundled with template)
If you start some serious discussion on how to migrate templates to not use Bower and move to NPM/Yarn/Webpack, I'd gladly help.

Copied from original issue: dotnet/templating#840

Re-enable tests to run in parallel

On macOS/Linux, there appears to be some race condition with the tests and the template engine, leading to errors such as:

==> /Users/namc/.dotnet/dotnet new web [/Users/namc/dev/aspnet/templating/test/Templates.Test/bin/Debug/netcoreapp2.0/TestTemplates/37025cf1fb724909ad785b6ef06a34ac]
 [ERROR] Unexpected end when reading JSON. Path 'TemplateInfo[19].Tags.language.Description', line 1365, position 26.
 [ERROR]    at Newtonsoft.Json.JsonTextReader.ParseValue()
 [ERROR]    at Newtonsoft.Json.JsonTextReader.Read()
 [ERROR]    at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)
 [ERROR]    at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)
 [ERROR]    at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
 [ERROR]    at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
 [ERROR]    at Newtonsoft.Json.Linq.JObject.Parse(String json)
 [ERROR]    at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.EnsureTemplatesLoaded()
 [ERROR]    at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.WriteTemplateCache(IList`1 templates, String locale)
 [ERROR]    at Microsoft.TemplateEngine.Edge.Settings.TemplateCache.WriteTemplateCacheForLocale(String locale, String existingCacheVersion)
 [ERROR]    at Microsoft.TemplateEngine.Edge.Settings.TemplateCache.WriteTemplateCaches(String existingCacheVersion)
 [ERROR]    at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save(TemplateCache cacheToSave)

I've disabled test parallelization for now a4ba5a1, but it means a full test run can take 10-15 minutes.

Simplified Chinese characters are garbled in project files

From @HeMinzhang on August 26, 2017 12:23

I use Visual Studio community 2017 15.3.1 create a asp.net core 2.0 angular project.But simplified Chinese characters garbled.
I convert
project\ClientApp\app\components\app\app.component.html project\ClientApp\app\components\home\home.component.html
project\ClientApp\app\components\fetchdata\fetchdata.component.html

Ansi file format to uft8 file.
simplified Chinese characters show normal.Can you fix the bug?

Copied from original issue: aspnet/Mvc#6716

Update Web API templates to use new Web API conventions

We are adding some new Web API specific conventions that we will need the Web API project and time templates to react to.

We are adding [ApiController] attribute as the way to opt-in to new API specific conventions and behaviors that are tuned around best practices for APIs.

This will include:

  • Automatically responding with a 400 when validation errors occur (using https://tools.ietf.org/html/rfc7807)
  • Infer smarter defaults for action parameters ([FromBody] for complex types, [FromRoute] when possible, otherwise [FromQuery])
  • Web API controllers should derive from ControllerBase (see #82)

Unnecessary User.Id provided in password reset link?

Remove Microsoft.VisualStudio.Web.CodeGeneration.Tools from default MVC template

From @josephwoodward on August 3, 2017 21:57

In a similar vein to a previous issue raised, given .NET Core is targeted towards cross-platform development in a range of IDEs and editors, I feel it doesn't make sense to have Visual Studio specific packages (Microsoft.VisualStudio.Web.CodeGeneration.Tools in this case) referenced in the default template created when calling dotnet new mvc in the .NET Core 2 preview (2.0.0-preview2-006497)

screen shot 2017-08-03 at 23 00 34

A better, IDE agnostic alternative could be to add a reference to the package once Visual Studio has created the project?

Copied from original issue: dotnet/templating#1183

MVC template errors on dotnet ef database update

I found a problem with the MVC 2.0 template, related to running 'dotnet ef database update'.

Repro steps:

dotnet new mvc -au Individual -uld -f netcoreapp2.0  
dotnet restore
dotnet build
dotnet ef database update

Relevant part of the error:
System.Data.SqlClient.SqlException (0x80131904): Foreign key 'FK_AspNetUserTokens_AspNetUsers_UserId' references invalid table 'AspNetUsers'.

Fix:
The problem occurs because the AspNetUserTokens table includes a foreign key to the AspNetUsers table, but the AspNetUsers table is not defined when the AspNetUserTokens table create is attempted.

To fix the problem, in the file https://github.com/aspnet/templating/blob/dev/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.cs
move the creation of AspNetUsers table above the creation of AspNetUserTokens

The problem was introduced here:
dotnet/templating@5c7443f#diff-442acc416eaa9c694efaa1c5106bce88

Templates should use app.UseMvcWithDefaultRoute();

From @mlorbetske on August 3, 2017 17:56

From @Rick-Anderson on July 28, 2017 2:6

I recommend the templates use app.UseMvcWithDefaultRoute(); rather than

app.UseMvc(routes =>
{
    routes.MapRoute(
        name: "default",
        template: "{controller}/{action=Index}/{id?}");
});

The more complex code is a barrier to entry for new users who don't need this flexibility. Advanced users will have no problem adding the above code when they need it. The code above doesn't make much sense to Razor Pages developers. Recommend this change for all templates but especially for the Razor Pages template.

cc @DamianEdwards - part of the lower the barrier to entry effort.

Copied from original issue: aspnet/Templates#857

Copied from original issue: dotnet/templating#1180

Using Angular BrowserAnimationsModule throws error

I modified the app.module.browser and app.module.server as shown here:
aspnet/JavaScriptServices@c0c47e3
This was a response to the following issue:
aspnet/JavaScriptServices#1160

However when trying to add to the animations array in a component decorator, I get the error described in this issue:
angular/angular#18562

ERROR TypeError: Cannot read property 'display' of undefined
...

Looks like this may be an Angular problem, not necessarily one with the templates? I'm not sure what, if anything, I'm overlooking.

How to keep authenticated state for logged in user after page refresh?

I'm using the React/Redux template. I'm not sure how to hold the authenticated state for the logged in user after page refresh. I can't use local storage to store the value since I'm using server rendering. One of the option I can think of is to do an API authentication request every time the user refresh the page. Not sure if this is the right approach. If it is can someone share the implementation please. Thank you.

Typescript error in ReactRedux template when upgrading to latest React/Redux libraries

I installed a new project using:

dotnet new reactredux

Since I want to use React 16, I went ahead and updated the package.json to the following versions:

"dependencies": {
    "@types/history": "^4.6.0",
    "@types/react": "^16.0.8",
    "@types/react-dom": "^16.0.0",
    "@types/react-hot-loader": "^3.0.4",
    "@types/react-redux": "^5.0.10",
    "@types/react-router": "^4.0.15",
    "@types/react-router-dom": "^4.0.8",
    "@types/react-router-redux": "^5.0.8",
    "@types/webpack": "^3.0.12",
    "@types/webpack-env": "^1.13.1",
    "aspnet-prerendering": "^3.0.1",
    "aspnet-webpack": "^2.0.1",
    "aspnet-webpack-react": "^3.0.0",
    "awesome-typescript-loader": "^3.2.3",
    "bootstrap": "^3.3.7",
    "css-loader": "^0.28.7",
    "domain-task": "^3.0.3",
    "event-source-polyfill": "0.0.9",
    "extract-text-webpack-plugin": "^3.0.1",
    "file-loader": "^1.1.4",
    "history": "^4.7.2",
    "jquery": "^3.2.1",
    "json-loader": "^0.5.7",
    "node-noop": "^1.0.0",
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-hot-loader": "^3.0.0-beta.7",
    "react-redux": "^5.0.6",
    "react-router-dom": "^4.2.2",
    "react-router-redux": "^5.0.0-alpha.6",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "style-loader": "^0.19.0",
    "typescript": "^2.5.3",
    "url-loader": "^0.5.9",
    "webpack": "^3.6.0",
    "webpack-hot-middleware": "^2.19.1",
    "webpack-merge": "^4.1.0"
}

These are the newest versions of all of these libraries.

Unfortunately the TypeScript fails to compile anymore. This line in Counter.tsx fails:

// Wire up the React component to the Redux store
export default connect(
    (state: ApplicationState) => state.counter, // Selects which state properties are merged into the component's props
    CounterStore.actionCreators                 // Selects which action creators are merged into the component's props
)(Counter) as typeof Counter;

The compiler complains that the resulting datatype lacks the 'count' property and thus cannot be cast to Counter. I tried debugging the types of the various steps in that call, but I was unsuccessful at understanding the complexity of the types involved.

Before giving up, I added an as any cast before as typeof Counter, to fool the compiler into letting it happen. It worked, it compiled, and the example runs.

My question is:

  1. Are the type definitions wrong?
  2. Or is this template using a pattern that the react-redux library does not want us to use?

Remove Bower from ASP.NET Core project templates

Remove Bower completely from the ASP.NET Core project templates and just leave the client-side files in their existing places (e.g. wwwroot/lib/blah).

We'll be moving to the new Library Manager (PackMan) in a release later on, but Bower is done now.

#23

Logging configuration in WebApi and Spa template shouldn't include providers.

From @pakrym on August 14, 2017 23:28

Expected:

 "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
}

https://github.com/dotnet/templating/blob/rel/2.1.0-preview1/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/appsettings.json

Actual:

"Logging": {
    "IncludeScopes": false,
    "Debug": {
      "LogLevel": {
        "Default": "Warning"
      }
    },
    "Console": {
      "LogLevel": {
        "Default": "Warning"
      }
    }
}

https://github.com/dotnet/templating/blob/rel/2.1.0-preview1/template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/WebApi-CSharp/appsettings.json

Copied from original issue: dotnet/templating#1208

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.