From 867e60d7fdff9f7c2f080731735e70097c29cf80 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 10:56:19 +0100 Subject: [PATCH 001/610] Take dependency on newer webpack-dev-middleware because it fixes ambiguities in path handling --- .../npm/aspnet-webpack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json index aaf8b37a..797d6152 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json @@ -21,7 +21,7 @@ "es6-promise": "^3.1.2", "memory-fs": "^0.3.0", "require-from-string": "^1.1.0", - "webpack-dev-middleware": "^1.6.1", + "webpack-dev-middleware": "^1.8.4", "webpack-node-externals": "^1.4.3" }, "devDependencies": { From e60ea04f86c65bcfbbbab53726a2685d7322be4c Mon Sep 17 00:00:00 2001 From: kmkatsma Date: Fri, 28 Oct 2016 11:16:21 +0100 Subject: [PATCH 002/610] Add AureliaSpa template (#398) --- templates/AureliaSpa/Aurelia.xproj | 20 +++++ .../ClientApp/app/components/app/app.css | 6 ++ .../ClientApp/app/components/app/app.html | 14 ++++ .../ClientApp/app/components/app/app.ts | 34 ++++++++ .../app/components/counter/counter.html | 9 +++ .../app/components/counter/counter.ts | 7 ++ .../app/components/fetchdata/fetchdata.html | 26 +++++++ .../app/components/fetchdata/fetchdata.ts | 24 ++++++ .../ClientApp/app/components/home/home.html | 16 ++++ .../ClientApp/app/components/home/home.ts | 2 + .../app/components/navmenu/navmenu.css | 59 ++++++++++++++ .../app/components/navmenu/navmenu.html | 26 +++++++ templates/AureliaSpa/ClientApp/boot.ts | 11 +++ .../AureliaSpa/Controllers/HomeController.cs | 21 +++++ .../Controllers/SampleDataController.cs | 44 +++++++++++ templates/AureliaSpa/Dockerfile | 17 ++++ templates/AureliaSpa/Program.cs | 31 ++++++++ templates/AureliaSpa/README.md | 39 ++++++++++ templates/AureliaSpa/Startup.cs | 68 ++++++++++++++++ templates/AureliaSpa/Views/Home/Index.cshtml | 10 +++ .../AureliaSpa/Views/Shared/Error.cshtml | 6 ++ .../AureliaSpa/Views/Shared/_Layout.cshtml | 13 ++++ .../AureliaSpa/Views/_ViewImports.cshtml | 3 + templates/AureliaSpa/Views/_ViewStart.cshtml | 3 + templates/AureliaSpa/appsettings.json | 10 +++ templates/AureliaSpa/package.json | 43 +++++++++++ templates/AureliaSpa/project.json | 73 ++++++++++++++++++ templates/AureliaSpa/tsconfig.json | 14 ++++ templates/AureliaSpa/webpack.config.js | 64 +++++++++++++++ .../AureliaSpa/wwwroot/dist/_placeholder.txt | 9 +++ templates/AureliaSpa/wwwroot/favicon.ico | Bin 0 -> 85432 bytes 31 files changed, 722 insertions(+) create mode 100644 templates/AureliaSpa/Aurelia.xproj create mode 100644 templates/AureliaSpa/ClientApp/app/components/app/app.css create mode 100644 templates/AureliaSpa/ClientApp/app/components/app/app.html create mode 100644 templates/AureliaSpa/ClientApp/app/components/app/app.ts create mode 100644 templates/AureliaSpa/ClientApp/app/components/counter/counter.html create mode 100644 templates/AureliaSpa/ClientApp/app/components/counter/counter.ts create mode 100644 templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.html create mode 100644 templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts create mode 100644 templates/AureliaSpa/ClientApp/app/components/home/home.html create mode 100644 templates/AureliaSpa/ClientApp/app/components/home/home.ts create mode 100644 templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.css create mode 100644 templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html create mode 100644 templates/AureliaSpa/ClientApp/boot.ts create mode 100644 templates/AureliaSpa/Controllers/HomeController.cs create mode 100644 templates/AureliaSpa/Controllers/SampleDataController.cs create mode 100644 templates/AureliaSpa/Dockerfile create mode 100644 templates/AureliaSpa/Program.cs create mode 100644 templates/AureliaSpa/README.md create mode 100644 templates/AureliaSpa/Startup.cs create mode 100644 templates/AureliaSpa/Views/Home/Index.cshtml create mode 100644 templates/AureliaSpa/Views/Shared/Error.cshtml create mode 100644 templates/AureliaSpa/Views/Shared/_Layout.cshtml create mode 100644 templates/AureliaSpa/Views/_ViewImports.cshtml create mode 100644 templates/AureliaSpa/Views/_ViewStart.cshtml create mode 100644 templates/AureliaSpa/appsettings.json create mode 100644 templates/AureliaSpa/package.json create mode 100644 templates/AureliaSpa/project.json create mode 100644 templates/AureliaSpa/tsconfig.json create mode 100644 templates/AureliaSpa/webpack.config.js create mode 100644 templates/AureliaSpa/wwwroot/dist/_placeholder.txt create mode 100644 templates/AureliaSpa/wwwroot/favicon.ico diff --git a/templates/AureliaSpa/Aurelia.xproj b/templates/AureliaSpa/Aurelia.xproj new file mode 100644 index 00000000..6abcd44f --- /dev/null +++ b/templates/AureliaSpa/Aurelia.xproj @@ -0,0 +1,20 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + true + + + + 33d8dad9-74f9-471d-8bad-55f828faa736 + AureliaSpa + .\obj + .\bin\ + v4.5.2 + + + 2.0 + + + diff --git a/templates/AureliaSpa/ClientApp/app/components/app/app.css b/templates/AureliaSpa/ClientApp/app/components/app/app.css new file mode 100644 index 00000000..63926006 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/app/app.css @@ -0,0 +1,6 @@ +@media (max-width: 767px) { + /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */ + .body-content { + padding-top: 50px; + } +} diff --git a/templates/AureliaSpa/ClientApp/app/components/app/app.html b/templates/AureliaSpa/ClientApp/app/components/app/app.html new file mode 100644 index 00000000..27cae10e --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/app/app.html @@ -0,0 +1,14 @@ + diff --git a/templates/AureliaSpa/ClientApp/app/components/app/app.ts b/templates/AureliaSpa/ClientApp/app/components/app/app.ts new file mode 100644 index 00000000..6a70c185 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/app/app.ts @@ -0,0 +1,34 @@ +import { Aurelia } from 'aurelia-framework'; +import { Router, RouterConfiguration } from 'aurelia-router'; + +export class App { + router: Router; + + configureRouter(config: RouterConfiguration, router: Router) { + config.title = 'Aurelia'; + config.map([{ + route: [ '', 'home' ], + name: 'home', + settings: { icon: 'home' }, + moduleId: '../home/home', + nav: true, + title: 'Home' + }, { + route: 'counter', + name: 'counter', + settings: { icon: 'education' }, + moduleId: '../counter/counter', + nav: true, + title: 'Counter' + }, { + route: 'fetch-data', + name: 'fetchdata', + settings: { icon: 'th-list' }, + moduleId: '../fetchdata/fetchdata', + nav: true, + title: 'Fetch data' + }]); + + this.router = router; + } +} diff --git a/templates/AureliaSpa/ClientApp/app/components/counter/counter.html b/templates/AureliaSpa/ClientApp/app/components/counter/counter.html new file mode 100644 index 00000000..ef4bf8f3 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/counter/counter.html @@ -0,0 +1,9 @@ + diff --git a/templates/AureliaSpa/ClientApp/app/components/counter/counter.ts b/templates/AureliaSpa/ClientApp/app/components/counter/counter.ts new file mode 100644 index 00000000..3217c449 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/counter/counter.ts @@ -0,0 +1,7 @@ +export class Counter { + public currentCount = 0; + + public incrementCounter() { + this.currentCount++; + } +} diff --git a/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.html b/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.html new file mode 100644 index 00000000..bd06c35d --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.html @@ -0,0 +1,26 @@ + diff --git a/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts b/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts new file mode 100644 index 00000000..6ec772b2 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts @@ -0,0 +1,24 @@ +/// +/// +import { HttpClient } from 'aurelia-fetch-client'; +import { inject } from 'aurelia-framework'; + +@inject(HttpClient) +export class Fetchdata { + public forecasts: WeatherForecast[]; + + constructor(http: HttpClient) { + http.fetch('https://github.com/api/SampleData/WeatherForecasts') + .then(result => result.json()) + .then(data => { + this.forecasts = data; + }); + } +} + +interface WeatherForecast { + dateFormatted: string; + temperatureC: number; + temperatureF: number; + summary: string; +} diff --git a/templates/AureliaSpa/ClientApp/app/components/home/home.html b/templates/AureliaSpa/ClientApp/app/components/home/home.html new file mode 100644 index 00000000..9d0474db --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/home/home.html @@ -0,0 +1,16 @@ + diff --git a/templates/AureliaSpa/ClientApp/app/components/home/home.ts b/templates/AureliaSpa/ClientApp/app/components/home/home.ts new file mode 100644 index 00000000..737d6cc2 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/home/home.ts @@ -0,0 +1,2 @@ +export class Home { +} diff --git a/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.css b/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.css new file mode 100644 index 00000000..8518eda3 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.css @@ -0,0 +1,59 @@ +li .glyphicon { + margin-right: 10px; +} + +/* Highlighting rules for nav menu items */ +li.au-target.link-active a, +li.au-target.link-active a:hover, +li.au-target.link-active a:focus { + background-color: #4189C7; + color: white; +} + +/* Keep the nav menu independent of scrolling and on top of other items */ +.main-nav { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 1; +} + +@media (min-width: 768px) { + /* On small screens, convert the nav menu to a vertical sidebar */ + .main-nav { + height: 100%; + width: calc(25% - 20px); + } + .navbar { + border-radius: 0px; + border-width: 0px; + height: 100%; + } + .navbar-header { + float: none; + } + .navbar-collapse { + border-top: 1px solid #444; + padding: 0px; + } + .navbar ul { + float: none; + } + .navbar li { + float: none; + font-size: 15px; + margin: 6px; + } + .navbar li a { + padding: 10px 16px; + border-radius: 4px; + } + .navbar a { + /* If a menu item's text is too long, truncate it */ + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } +} diff --git a/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html b/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html new file mode 100644 index 00000000..38b97f9c --- /dev/null +++ b/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html @@ -0,0 +1,26 @@ + diff --git a/templates/AureliaSpa/ClientApp/boot.ts b/templates/AureliaSpa/ClientApp/boot.ts new file mode 100644 index 00000000..83a813a7 --- /dev/null +++ b/templates/AureliaSpa/ClientApp/boot.ts @@ -0,0 +1,11 @@ +import { Aurelia } from 'aurelia-framework'; +import 'bootstrap/dist/css/bootstrap.css'; +import 'bootstrap'; + +export function configure(aurelia: Aurelia) { + aurelia.use.standardConfiguration(); + if (window.location.host.includes('localhost')) { + aurelia.use.developmentLogging(); + } + aurelia.start().then(() => aurelia.setRoot('app/components/app/app')); +} diff --git a/templates/AureliaSpa/Controllers/HomeController.cs b/templates/AureliaSpa/Controllers/HomeController.cs new file mode 100644 index 00000000..9d75da88 --- /dev/null +++ b/templates/AureliaSpa/Controllers/HomeController.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace WebApplicationBasic.Controllers +{ + public class HomeController : Controller + { + public IActionResult Index() + { + return View(); + } + + public IActionResult Error() + { + return View(); + } + } +} diff --git a/templates/AureliaSpa/Controllers/SampleDataController.cs b/templates/AureliaSpa/Controllers/SampleDataController.cs new file mode 100644 index 00000000..1f46d127 --- /dev/null +++ b/templates/AureliaSpa/Controllers/SampleDataController.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace WebApplicationBasic.Controllers +{ + [Route("api/[controller]")] + public class SampleDataController : Controller + { + private static string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + [HttpGet("[action]")] + public IEnumerable WeatherForecasts() + { + var rng = new Random(); + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + DateFormatted = DateTime.Now.AddDays(index).ToString("d"), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }); + } + + public class WeatherForecast + { + public string DateFormatted { get; set; } + public int TemperatureC { get; set; } + public string Summary { get; set; } + + public int TemperatureF + { + get + { + return 32 + (int)(this.TemperatureC / 0.5556); + } + } + } + } +} diff --git a/templates/AureliaSpa/Dockerfile b/templates/AureliaSpa/Dockerfile new file mode 100644 index 00000000..c9bf07c1 --- /dev/null +++ b/templates/AureliaSpa/Dockerfile @@ -0,0 +1,17 @@ +FROM microsoft/dotnet:1.0.0-preview2-onbuild + +RUN apt-get update +RUN wget -qO- https://deb.nodesource.com/setup_4.x | bash - +RUN apt-get install -y build-essential nodejs + +WORKDIR /app + +COPY project.json . +RUN ["dotnet", "restore"] + +COPY . /app +RUN ["dotnet", "build"] + +EXPOSE 5000/tcp + +ENTRYPOINT ["dotnet", "run", "--server.urls", "http://0.0.0.0:5000/"] diff --git a/templates/AureliaSpa/Program.cs b/templates/AureliaSpa/Program.cs new file mode 100644 index 00000000..b2e5e4b8 --- /dev/null +++ b/templates/AureliaSpa/Program.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace WebApplicationBasic +{ + public class Program + { + public static void Main(string[] args) + { + var config = new ConfigurationBuilder() + .AddCommandLine(args) + .AddEnvironmentVariables(prefix: "ASPNETCORE_") + .Build(); + + var host = new WebHostBuilder() + .UseConfiguration(config) + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff --git a/templates/AureliaSpa/README.md b/templates/AureliaSpa/README.md new file mode 100644 index 00000000..d8ba0b38 --- /dev/null +++ b/templates/AureliaSpa/README.md @@ -0,0 +1,39 @@ +# Welcome to ASP.NET Core + +We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. + +You've created a new ASP.NET Core project. [Learn what's new](https://go.microsoft.com/fwlink/?LinkId=518016) + +## This application consists of: + +* Sample pages using ASP.NET Core MVC +* [Gulp](https://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](https://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries +* Theming using [Bootstrap](https://go.microsoft.com/fwlink/?LinkID=398939) + +## How to + +* [Add a Controller and View](https://go.microsoft.com/fwlink/?LinkID=398600) +* [Add an appsetting in config and access it in app.](https://go.microsoft.com/fwlink/?LinkID=699562) +* [Manage User Secrets using Secret Manager.](https://go.microsoft.com/fwlink/?LinkId=699315) +* [Use logging to log a message.](https://go.microsoft.com/fwlink/?LinkId=699316) +* [Add packages using NuGet.](https://go.microsoft.com/fwlink/?LinkId=699317) +* [Add client packages using Bower.](https://go.microsoft.com/fwlink/?LinkId=699318) +* [Target development, staging or production environment.](https://go.microsoft.com/fwlink/?LinkId=699319) + +## Overview + +* [Conceptual overview of what is ASP.NET Core](https://go.microsoft.com/fwlink/?LinkId=518008) +* [Fundamentals of ASP.NET Core such as Startup and middleware.](https://go.microsoft.com/fwlink/?LinkId=699320) +* [Working with Data](https://go.microsoft.com/fwlink/?LinkId=398602) +* [Security](https://go.microsoft.com/fwlink/?LinkId=398603) +* [Client side development](https://go.microsoft.com/fwlink/?LinkID=699321) +* [Develop on different platforms](https://go.microsoft.com/fwlink/?LinkID=699322) +* [Read more on the documentation site](https://go.microsoft.com/fwlink/?LinkID=699323) + +## Run & Deploy + +* [Run your app](https://go.microsoft.com/fwlink/?LinkID=517851) +* [Run tools such as EF migrations and more](https://go.microsoft.com/fwlink/?LinkID=517853) +* [Publish to Microsoft Azure Web Apps](https://go.microsoft.com/fwlink/?LinkID=398609) + +We would love to hear your [feedback](https://go.microsoft.com/fwlink/?LinkId=518015) diff --git a/templates/AureliaSpa/Startup.cs b/templates/AureliaSpa/Startup.cs new file mode 100644 index 00000000..412b4db7 --- /dev/null +++ b/templates/AureliaSpa/Startup.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.SpaServices.Webpack; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace WebApplicationBasic +{ + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(Configuration.GetSection("Logging")); + loggerFactory.AddDebug(); + + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + + app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { + HotModuleReplacement = false // Aurelia Webpack Plugin HMR currently has issues. Leave this set to false. + }); + } + else + { + app.UseExceptionHandler("/Home/Error"); + } + + app.UseStaticFiles(); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller=Home}/{action=Index}/{id?}"); + + routes.MapSpaFallbackRoute( + name: "spa-fallback", + defaults: new { controller = "Home", action = "Index" }); + }); + } + } +} diff --git a/templates/AureliaSpa/Views/Home/Index.cshtml b/templates/AureliaSpa/Views/Home/Index.cshtml new file mode 100644 index 00000000..6061b243 --- /dev/null +++ b/templates/AureliaSpa/Views/Home/Index.cshtml @@ -0,0 +1,10 @@ +@{ + ViewData["Title"] = "Home Page"; +} + +
Loading...
+ +@section scripts { + + +} diff --git a/templates/AureliaSpa/Views/Shared/Error.cshtml b/templates/AureliaSpa/Views/Shared/Error.cshtml new file mode 100644 index 00000000..473b35d6 --- /dev/null +++ b/templates/AureliaSpa/Views/Shared/Error.cshtml @@ -0,0 +1,6 @@ +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

diff --git a/templates/AureliaSpa/Views/Shared/_Layout.cshtml b/templates/AureliaSpa/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..a73bc742 --- /dev/null +++ b/templates/AureliaSpa/Views/Shared/_Layout.cshtml @@ -0,0 +1,13 @@ + + + + + + @ViewData["Title"] - Aurelia + + + @RenderBody() + + @RenderSection("scripts", required: false) + + diff --git a/templates/AureliaSpa/Views/_ViewImports.cshtml b/templates/AureliaSpa/Views/_ViewImports.cshtml new file mode 100644 index 00000000..e7b4f83f --- /dev/null +++ b/templates/AureliaSpa/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using WebApplicationBasic +@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" +@addTagHelper "*, Microsoft.AspNetCore.SpaServices" diff --git a/templates/AureliaSpa/Views/_ViewStart.cshtml b/templates/AureliaSpa/Views/_ViewStart.cshtml new file mode 100644 index 00000000..820a2f6e --- /dev/null +++ b/templates/AureliaSpa/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/templates/AureliaSpa/appsettings.json b/templates/AureliaSpa/appsettings.json new file mode 100644 index 00000000..723c096a --- /dev/null +++ b/templates/AureliaSpa/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/templates/AureliaSpa/package.json b/templates/AureliaSpa/package.json new file mode 100644 index 00000000..8bacd0bb --- /dev/null +++ b/templates/AureliaSpa/package.json @@ -0,0 +1,43 @@ +{ + "name": "AureliaSpa", + "version": "0.0.0", + "dependencies": { + "aurelia-bootstrapper-webpack": "^1.0.0", + "aurelia-event-aggregator": "^1.0.0", + "aurelia-fetch-client": "^1.0.0", + "aurelia-framework": "^1.0.0", + "aurelia-history-browser": "^1.0.0", + "aurelia-loader-webpack": "^1.0.0", + "aurelia-logging-console": "^1.0.0", + "aurelia-pal-browser": "^1.0.0", + "aurelia-polyfills": "^1.0.0", + "aurelia-route-recognizer": "^1.0.0", + "aurelia-router": "^1.0.2", + "aurelia-templating-binding": "^1.0.0", + "aurelia-templating-resources": "^1.0.0", + "aurelia-templating-router": "^1.0.0", + "bootstrap": "^3.3.7", + "isomorphic-fetch": "^2.2.1", + "jquery": "^2.2.1" + }, + "devDependencies": { + "@types/node": "^6.0.45", + "aspnet-webpack": "^1.0.11", + "aurelia-webpack-plugin": "^1.1.0", + "copy-webpack-plugin": "^3.0.1", + "css": "^2.2.1", + "css-loader": "^0.25.0", + "expose-loader": "^0.7.1", + "file-loader": "^0.9.0", + "html-loader": "^0.4.4", + "html-webpack-plugin": "^2.22.0", + "raw-loader": "^0.5.1", + "style-loader": "^0.13.1", + "to-string-loader": "^1.1.5", + "ts-loader": "^0.8.2", + "typescript": "^2.0.0", + "url-loader": "^0.5.7", + "webpack": "2.1.0-beta.22", + "webpack-hot-middleware": "^2.10.0" + } +} diff --git a/templates/AureliaSpa/project.json b/templates/AureliaSpa/project.json new file mode 100644 index 00000000..4fcf8fc0 --- /dev/null +++ b/templates/AureliaSpa/project.json @@ -0,0 +1,73 @@ +{ + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.1", + "type": "platform" + }, + "Microsoft.AspNetCore.SpaServices": "1.0.0-*", + "Microsoft.AspNetCore.Diagnostics": "1.0.0", + "Microsoft.AspNetCore.Mvc": "1.0.1", + "Microsoft.AspNetCore.Razor.Tools": { + "version": "1.0.0-preview2-final", + "type": "build" + }, + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", + "Microsoft.AspNetCore.StaticFiles": "1.0.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", + "Microsoft.Extensions.Configuration.Json": "1.0.0", + "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0" + }, + + "tools": { + "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", + "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", + "Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final" + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dotnet5.6", + "portable-net45+win8" + ] + } + }, + + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true + }, + + "runtimeOptions": { + "configProperties": { + "System.GC.Server": true + } + }, + + "publishOptions": { + "include": [ + "appsettings.json", + "ClientApp/dist", + "Views", + "web.config", + "wwwroot" + ] + }, + + "scripts": { + "prepublish": [ + "npm install", + "node node_modules/webpack/bin/webpack.js --env.prod" + ], + "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" + }, + + "tooling": { + "defaultNamespace": "WebApplicationBasic" + } +} diff --git a/templates/AureliaSpa/tsconfig.json b/templates/AureliaSpa/tsconfig.json new file mode 100644 index 00000000..94b22fce --- /dev/null +++ b/templates/AureliaSpa/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "target": "es5", + "sourceMap": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "skipDefaultLibCheck": true, + "lib": [ "es6", "dom" ], + "types": [ "node" ] + }, + "exclude": [ "bin", "node_modules" ], + "atom": { "rewriteTsconfig": false } +} diff --git a/templates/AureliaSpa/webpack.config.js b/templates/AureliaSpa/webpack.config.js new file mode 100644 index 00000000..b2dcaab7 --- /dev/null +++ b/templates/AureliaSpa/webpack.config.js @@ -0,0 +1,64 @@ +var isDevBuild = process.argv.indexOf('--env.prod') < 0; +var path = require('path'); +var webpack = require('webpack'); +var AureliaWebpackPlugin = require('aurelia-webpack-plugin'); +var srcDir = path.resolve('./ClientApp'); +var rootDir = path.resolve(); +var outDir = path.resolve('./wwwroot/dist'); +var baseUrl = '/'; +var project = require('./package.json'); +var aureliaModules = Object.keys(project.dependencies).filter(dep => dep.startsWith('aurelia-')); + +// Configuration for client-side bundle suitable for running in browsers +var clientBundleConfig = { + resolve: { extensions: [ '.js', '.ts' ] }, + devtool: isDevBuild ? 'inline-source-map' : null, + entry: { + 'app': [], // <-- this array will be filled by the aurelia-webpack-plugin + 'aurelia-modules': aureliaModules + }, + output: { + path: outDir, + publicPath: '/dist', + filename: '[name]-bundle.js' + }, + module: { + loaders: [ + { + test: /\.ts$/, + include: /ClientApp/, + loader: 'ts', + query: {silent: true} + }, { + test: /\.html$/, + exclude: /index\.html$/, + loader: 'html-loader' + }, { + test: /\.css$/, + loaders: ['style-loader', 'css-loader'] + }, { + test: /\.(png|woff|woff2|eot|ttf|svg)$/, + loader: 'url-loader?limit=100000' + } + ] + }, + plugins: [ + new webpack.ProvidePlugin({ + $: 'jquery', // because 'bootstrap' by Twitter depends on this + jQuery: 'jquery' + }), + new AureliaWebpackPlugin({ + root: rootDir, + src: srcDir, + baseUrl: baseUrl + }), + new webpack.optimize.CommonsChunkPlugin({ + name: ['aurelia-modules'] + }), + ].concat(isDevBuild ? [] : [ + // Plugins that apply in production builds only + new webpack.optimize.UglifyJsPlugin() + ]) +}; + +module.exports = [clientBundleConfig]; diff --git a/templates/AureliaSpa/wwwroot/dist/_placeholder.txt b/templates/AureliaSpa/wwwroot/dist/_placeholder.txt new file mode 100644 index 00000000..b22cc154 --- /dev/null +++ b/templates/AureliaSpa/wwwroot/dist/_placeholder.txt @@ -0,0 +1,9 @@ +------------------------------------------------------------------ +Don't delete this file. Do include it in your source control repo. +------------------------------------------------------------------ + +This file exists as a workaround for https://github.com/dotnet/cli/issues/1396 +('dotnet publish' does not publish any directories that didn't exist or were +empty before the publish script started). + +Hopefully, this can be removed after the move to the new MSBuild. diff --git a/templates/AureliaSpa/wwwroot/favicon.ico b/templates/AureliaSpa/wwwroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..6884543f9617d81e56ccd478989bec1ece300e3a GIT binary patch literal 85432 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 HVFdmUW_yrt literal 0 HcmV?d00001 From 3087352ea1a5addec56ede1435dcb57716fa86a7 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 11:40:32 +0100 Subject: [PATCH 003/610] Simplify AureliaSpa's webpack.config.js --- templates/AureliaSpa/webpack.config.js | 61 +++++++++++--------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/templates/AureliaSpa/webpack.config.js b/templates/AureliaSpa/webpack.config.js index b2dcaab7..7e3c6a2d 100644 --- a/templates/AureliaSpa/webpack.config.js +++ b/templates/AureliaSpa/webpack.config.js @@ -2,55 +2,48 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0; var path = require('path'); var webpack = require('webpack'); var AureliaWebpackPlugin = require('aurelia-webpack-plugin'); -var srcDir = path.resolve('./ClientApp'); -var rootDir = path.resolve(); -var outDir = path.resolve('./wwwroot/dist'); -var baseUrl = '/'; -var project = require('./package.json'); -var aureliaModules = Object.keys(project.dependencies).filter(dep => dep.startsWith('aurelia-')); -// Configuration for client-side bundle suitable for running in browsers -var clientBundleConfig = { +module.exports = { resolve: { extensions: [ '.js', '.ts' ] }, devtool: isDevBuild ? 'inline-source-map' : null, entry: { 'app': [], // <-- this array will be filled by the aurelia-webpack-plugin - 'aurelia-modules': aureliaModules + 'aurelia-modules': [ + 'aurelia-bootstrapper-webpack', + 'aurelia-event-aggregator', + 'aurelia-fetch-client', + 'aurelia-framework', + 'aurelia-history-browser', + 'aurelia-loader-webpack', + 'aurelia-logging-console', + 'aurelia-pal-browser', + 'aurelia-polyfills', + 'aurelia-route-recognizer', + 'aurelia-router', + 'aurelia-templating-binding', + 'aurelia-templating-resources', + 'aurelia-templating-router' + ] }, output: { - path: outDir, + path: path.resolve('./wwwroot/dist'), publicPath: '/dist', filename: '[name]-bundle.js' }, module: { loaders: [ - { - test: /\.ts$/, - include: /ClientApp/, - loader: 'ts', - query: {silent: true} - }, { - test: /\.html$/, - exclude: /index\.html$/, - loader: 'html-loader' - }, { - test: /\.css$/, - loaders: ['style-loader', 'css-loader'] - }, { - test: /\.(png|woff|woff2|eot|ttf|svg)$/, - loader: 'url-loader?limit=100000' - } + { test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: {silent: true} }, + { test: /\.html$/, loader: 'html-loader' }, + { test: /\.css$/, loaders: ['style-loader', 'css-loader'] }, + { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' } ] }, plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', // because 'bootstrap' by Twitter depends on this - jQuery: 'jquery' - }), + new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // because Bootstrap expects $ and jQuery to be globals new AureliaWebpackPlugin({ - root: rootDir, - src: srcDir, - baseUrl: baseUrl + root: path.resolve('./'), + src: path.resolve('./ClientApp'), + baseUrl: '/' }), new webpack.optimize.CommonsChunkPlugin({ name: ['aurelia-modules'] @@ -60,5 +53,3 @@ var clientBundleConfig = { new webpack.optimize.UglifyJsPlugin() ]) }; - -module.exports = [clientBundleConfig]; From acfb253a4018669fcf68b359eb3554e3ac7af052 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 14:51:12 +0100 Subject: [PATCH 004/610] Change AureliaSpa to use vendor bundle like the other templates --- templates/AureliaSpa/Views/Home/Index.cshtml | 4 +- .../AureliaSpa/Views/Shared/_Layout.cshtml | 2 + templates/AureliaSpa/package.json | 3 +- templates/AureliaSpa/project.json | 1 + templates/AureliaSpa/webpack.config.js | 42 +++++---------- templates/AureliaSpa/webpack.config.vendor.js | 51 +++++++++++++++++++ 6 files changed, 70 insertions(+), 33 deletions(-) create mode 100644 templates/AureliaSpa/webpack.config.vendor.js diff --git a/templates/AureliaSpa/Views/Home/Index.cshtml b/templates/AureliaSpa/Views/Home/Index.cshtml index 6061b243..f6b17914 100644 --- a/templates/AureliaSpa/Views/Home/Index.cshtml +++ b/templates/AureliaSpa/Views/Home/Index.cshtml @@ -5,6 +5,6 @@
Loading...
@section scripts { - - + + } diff --git a/templates/AureliaSpa/Views/Shared/_Layout.cshtml b/templates/AureliaSpa/Views/Shared/_Layout.cshtml index a73bc742..9daed473 100644 --- a/templates/AureliaSpa/Views/Shared/_Layout.cshtml +++ b/templates/AureliaSpa/Views/Shared/_Layout.cshtml @@ -4,6 +4,8 @@ @ViewData["Title"] - Aurelia + + @RenderBody() diff --git a/templates/AureliaSpa/package.json b/templates/AureliaSpa/package.json index 8bacd0bb..8ea0cb97 100644 --- a/templates/AureliaSpa/package.json +++ b/templates/AureliaSpa/package.json @@ -28,6 +28,7 @@ "css": "^2.2.1", "css-loader": "^0.25.0", "expose-loader": "^0.7.1", + "extract-text-webpack-plugin": "^2.0.0-beta.4", "file-loader": "^0.9.0", "html-loader": "^0.4.4", "html-webpack-plugin": "^2.22.0", @@ -37,7 +38,7 @@ "ts-loader": "^0.8.2", "typescript": "^2.0.0", "url-loader": "^0.5.7", - "webpack": "2.1.0-beta.22", + "webpack": "^2.1.0-beta.25", "webpack-hot-middleware": "^2.10.0" } } diff --git a/templates/AureliaSpa/project.json b/templates/AureliaSpa/project.json index 4fcf8fc0..a4bb93f1 100644 --- a/templates/AureliaSpa/project.json +++ b/templates/AureliaSpa/project.json @@ -62,6 +62,7 @@ "scripts": { "prepublish": [ "npm install", + "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod", "node node_modules/webpack/bin/webpack.js --env.prod" ], "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" diff --git a/templates/AureliaSpa/webpack.config.js b/templates/AureliaSpa/webpack.config.js index 7e3c6a2d..5c0fbe7c 100644 --- a/templates/AureliaSpa/webpack.config.js +++ b/templates/AureliaSpa/webpack.config.js @@ -4,50 +4,32 @@ var webpack = require('webpack'); var AureliaWebpackPlugin = require('aurelia-webpack-plugin'); module.exports = { - resolve: { extensions: [ '.js', '.ts' ] }, - devtool: isDevBuild ? 'inline-source-map' : null, - entry: { - 'app': [], // <-- this array will be filled by the aurelia-webpack-plugin - 'aurelia-modules': [ - 'aurelia-bootstrapper-webpack', - 'aurelia-event-aggregator', - 'aurelia-fetch-client', - 'aurelia-framework', - 'aurelia-history-browser', - 'aurelia-loader-webpack', - 'aurelia-logging-console', - 'aurelia-pal-browser', - 'aurelia-polyfills', - 'aurelia-route-recognizer', - 'aurelia-router', - 'aurelia-templating-binding', - 'aurelia-templating-resources', - 'aurelia-templating-router' - ] - }, + resolve: { extensions: [ '.js', '.ts' ] }, + devtool: isDevBuild ? 'inline-source-map' : null, + entry: { 'app': 'aurelia-bootstrapper-webpack' }, // Note: The aurelia-webpack-plugin will add your app's modules to this bundle automatically output: { path: path.resolve('./wwwroot/dist'), publicPath: '/dist', - filename: '[name]-bundle.js' + filename: '[name].js' }, module: { loaders: [ - { test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: {silent: true} }, - { test: /\.html$/, loader: 'html-loader' }, - { test: /\.css$/, loaders: ['style-loader', 'css-loader'] }, + { test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: { silent: true } }, + { test: /\.html$/, loader: 'html' }, + { test: /\.css$/, loaders: [ 'style', 'css' ] }, { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' } ] }, plugins: [ - new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // because Bootstrap expects $ and jQuery to be globals + new webpack.DllReferencePlugin({ + context: __dirname, + manifest: require('./wwwroot/dist/vendor-manifest.json') + }), new AureliaWebpackPlugin({ root: path.resolve('./'), src: path.resolve('./ClientApp'), baseUrl: '/' - }), - new webpack.optimize.CommonsChunkPlugin({ - name: ['aurelia-modules'] - }), + }) ].concat(isDevBuild ? [] : [ // Plugins that apply in production builds only new webpack.optimize.UglifyJsPlugin() diff --git a/templates/AureliaSpa/webpack.config.vendor.js b/templates/AureliaSpa/webpack.config.vendor.js new file mode 100644 index 00000000..e6051cb1 --- /dev/null +++ b/templates/AureliaSpa/webpack.config.vendor.js @@ -0,0 +1,51 @@ +var isDevBuild = process.argv.indexOf('--env.prod') < 0; +var path = require('path'); +var webpack = require('webpack'); +var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var extractCSS = new ExtractTextPlugin('vendor.css'); + +module.exports = { + resolve: { + extensions: [ '.js' ] + }, + module: { + loaders: [ + { test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, loader: 'url-loader?limit=100000' }, + { test: /\.css(\?|$)/, loader: extractCSS.extract(['css']) } + ] + }, + entry: { + vendor: [ + 'aurelia-event-aggregator', + 'aurelia-fetch-client', + 'aurelia-framework', + 'aurelia-history-browser', + 'aurelia-logging-console', + 'aurelia-pal-browser', + 'aurelia-polyfills', + 'aurelia-route-recognizer', + 'aurelia-router', + 'aurelia-templating-binding', + 'aurelia-templating-resources', + 'aurelia-templating-router', + 'bootstrap', + 'bootstrap/dist/css/bootstrap.css', + 'jquery' + ], + }, + output: { + path: path.join(__dirname, 'wwwroot', 'dist'), + filename: '[name].js', + library: '[name]_[hash]', + }, + plugins: [ + extractCSS, + new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable) + new webpack.DllPlugin({ + path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'), + name: '[name]_[hash]' + }) + ].concat(isDevBuild ? [] : [ + new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) + ]) +}; From 6bceb234d877e521b949adec6953e0decf0c769e Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 15:11:25 +0100 Subject: [PATCH 005/610] In AureliaSpa, use whatwg-fetch to provide type info --- .../ClientApp/app/components/fetchdata/fetchdata.ts | 4 +++- templates/AureliaSpa/package.json | 1 + templates/AureliaSpa/tsconfig.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts b/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts index 6ec772b2..fe9a207e 100644 --- a/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts +++ b/templates/AureliaSpa/ClientApp/app/components/fetchdata/fetchdata.ts @@ -1,5 +1,7 @@ -/// +// The following line is a workaround for aurelia-fetch-client requiring the type UrlSearchParams +// to exist in global scope, but that type not being declared in any public @types/* package. /// + import { HttpClient } from 'aurelia-fetch-client'; import { inject } from 'aurelia-framework'; diff --git a/templates/AureliaSpa/package.json b/templates/AureliaSpa/package.json index 8ea0cb97..d7137e8f 100644 --- a/templates/AureliaSpa/package.json +++ b/templates/AureliaSpa/package.json @@ -22,6 +22,7 @@ }, "devDependencies": { "@types/node": "^6.0.45", + "@types/whatwg-fetch": "0.0.32", "aspnet-webpack": "^1.0.11", "aurelia-webpack-plugin": "^1.1.0", "copy-webpack-plugin": "^3.0.1", diff --git a/templates/AureliaSpa/tsconfig.json b/templates/AureliaSpa/tsconfig.json index 94b22fce..71d738e1 100644 --- a/templates/AureliaSpa/tsconfig.json +++ b/templates/AureliaSpa/tsconfig.json @@ -7,7 +7,7 @@ "emitDecoratorMetadata": true, "skipDefaultLibCheck": true, "lib": [ "es6", "dom" ], - "types": [ "node" ] + "types": [ "node", "whatwg-fetch" ] }, "exclude": [ "bin", "node_modules" ], "atom": { "rewriteTsconfig": false } From 996216c7517e361d47596db2ba376be1934bbaa5 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 15:13:11 +0100 Subject: [PATCH 006/610] Tell aurelia-webpack-plugin to filter the set of dependencies it auto-imports. Note that this will have no effect until the next version of aurelia-webpack-plugin is published to NPM. --- templates/AureliaSpa/package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/AureliaSpa/package.json b/templates/AureliaSpa/package.json index d7137e8f..ffdbfd05 100644 --- a/templates/AureliaSpa/package.json +++ b/templates/AureliaSpa/package.json @@ -41,5 +41,10 @@ "url-loader": "^0.5.7", "webpack": "^2.1.0-beta.25", "webpack-hot-middleware": "^2.10.0" + }, + "aurelia": { + "build": { + "includeDependencies": "aurelia-*" + } } } From bd86026bb95a0fc229124dea1cab362d34b0abfe Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 15:17:58 +0100 Subject: [PATCH 007/610] Change AureliaSpa to use external source maps for compatibility with VS/VSCode debugging --- templates/AureliaSpa/webpack.config.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/AureliaSpa/webpack.config.js b/templates/AureliaSpa/webpack.config.js index 5c0fbe7c..cd3cc07f 100644 --- a/templates/AureliaSpa/webpack.config.js +++ b/templates/AureliaSpa/webpack.config.js @@ -3,12 +3,12 @@ var path = require('path'); var webpack = require('webpack'); var AureliaWebpackPlugin = require('aurelia-webpack-plugin'); +var bundleOutputDir = './wwwroot/dist'; module.exports = { resolve: { extensions: [ '.js', '.ts' ] }, - devtool: isDevBuild ? 'inline-source-map' : null, entry: { 'app': 'aurelia-bootstrapper-webpack' }, // Note: The aurelia-webpack-plugin will add your app's modules to this bundle automatically output: { - path: path.resolve('./wwwroot/dist'), + path: path.resolve(bundleOutputDir), publicPath: '/dist', filename: '[name].js' }, @@ -30,7 +30,13 @@ module.exports = { src: path.resolve('./ClientApp'), baseUrl: '/' }) - ].concat(isDevBuild ? [] : [ + ].concat(isDevBuild ? [ + // Plugins that apply in development builds only + new webpack.SourceMapDevToolPlugin({ + filename: '[file].map', // Remove this line if you prefer inline source maps + moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk + }) + ] : [ // Plugins that apply in production builds only new webpack.optimize.UglifyJsPlugin() ]) From 4b507004b19d77ea468e14c2247700b584b888c9 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 15:27:54 +0100 Subject: [PATCH 008/610] In AureliaSpa, use Webpack build mode to decide whether or not to enable debug logging --- templates/AureliaSpa/ClientApp/boot.ts | 5 ++++- templates/AureliaSpa/webpack.config.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/AureliaSpa/ClientApp/boot.ts b/templates/AureliaSpa/ClientApp/boot.ts index 83a813a7..e03d3f22 100644 --- a/templates/AureliaSpa/ClientApp/boot.ts +++ b/templates/AureliaSpa/ClientApp/boot.ts @@ -1,11 +1,14 @@ import { Aurelia } from 'aurelia-framework'; import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap'; +declare const IS_DEV_BUILD: boolean; // The value is supplied by Webpack during the build export function configure(aurelia: Aurelia) { aurelia.use.standardConfiguration(); - if (window.location.host.includes('localhost')) { + + if (IS_DEV_BUILD) { aurelia.use.developmentLogging(); } + aurelia.start().then(() => aurelia.setRoot('app/components/app/app')); } diff --git a/templates/AureliaSpa/webpack.config.js b/templates/AureliaSpa/webpack.config.js index cd3cc07f..dafa58b2 100644 --- a/templates/AureliaSpa/webpack.config.js +++ b/templates/AureliaSpa/webpack.config.js @@ -21,6 +21,7 @@ module.exports = { ] }, plugins: [ + new webpack.DefinePlugin({ IS_DEV_BUILD: JSON.stringify(isDevBuild) }), new webpack.DllReferencePlugin({ context: __dirname, manifest: require('./wwwroot/dist/vendor-manifest.json') From dfcaae6fda8c6022506bfd12a0aa7cfbfd7b4384 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 15:36:09 +0100 Subject: [PATCH 009/610] Include AureliaSpa in generator-aspnetcore-spa --- templates/AureliaSpa/template_gitignore | 246 ++++++++++++++++++ .../template_nodemodules_placeholder.txt | 11 + templates/package-builder/src/build/build.ts | 1 + .../package-builder/src/yeoman/app/index.ts | 1 + .../package-builder/src/yeoman/package.json | 2 +- 5 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 templates/AureliaSpa/template_gitignore create mode 100644 templates/AureliaSpa/template_nodemodules_placeholder.txt diff --git a/templates/AureliaSpa/template_gitignore b/templates/AureliaSpa/template_gitignore new file mode 100644 index 00000000..f8bf5e92 --- /dev/null +++ b/templates/AureliaSpa/template_gitignore @@ -0,0 +1,246 @@ +/Properties/launchSettings.json + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +bin/ +Bin/ +obj/ +Obj/ + +# Visual Studio 2015 cache/options directory +.vs/ +/wwwroot/dist/** +/ClientApp/dist/** + +# Workaround for https://github.com/aspnet/JavaScriptServices/issues/235 +!/wwwroot/dist/_placeholder.txt +!/ClientApp/dist/_placeholder.txt + + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +orleans.codegen.cs + +# Workaround for https://github.com/aspnet/JavaScriptServices/issues/235 +/node_modules/** +!/node_modules/_placeholder.txt + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ diff --git a/templates/AureliaSpa/template_nodemodules_placeholder.txt b/templates/AureliaSpa/template_nodemodules_placeholder.txt new file mode 100644 index 00000000..97e54d1a --- /dev/null +++ b/templates/AureliaSpa/template_nodemodules_placeholder.txt @@ -0,0 +1,11 @@ +------------------------------------------------------------------ +Don't delete this file. Do include it in your source control repo. +------------------------------------------------------------------ + +This file exists as a workaround for https://github.com/dotnet/cli/issues/1396 +('dotnet publish' does not publish any directories that didn't exist or were +empty before the publish script started, which means it's not enough just to +run 'npm install' during publishing: you need to ensure node_modules already +existed at least). + +Hopefully, this can be removed after the move to the new MSBuild. diff --git a/templates/package-builder/src/build/build.ts b/templates/package-builder/src/build/build.ts index 4d823b5c..e394ddd6 100644 --- a/templates/package-builder/src/build/build.ts +++ b/templates/package-builder/src/build/build.ts @@ -13,6 +13,7 @@ const yeomanGeneratorSource = './src/yeoman'; const templates: { [key: string]: { dir: string, dotNetNewId: string, displayName: string, forceInclusion?: RegExp } } = { 'angular-2': { dir: '../../templates/Angular2Spa/', dotNetNewId: 'Angular', displayName: 'Angular 2', forceInclusion: /^(wwwroot|ClientApp)\/dist\// }, + 'aurelia': { dir: '../../templates/AureliaSpa/', dotNetNewId: 'Aurelia', displayName: 'Aurelia' }, 'knockout': { dir: '../../templates/KnockoutSpa/', dotNetNewId: 'Knockout', displayName: 'Knockout.js' }, 'react-redux': { dir: '../../templates/ReactReduxSpa/', dotNetNewId: 'ReactRedux', displayName: 'React.js and Redux' }, 'react': { dir: '../../templates/ReactSpa/', dotNetNewId: 'React', displayName: 'React.js' } diff --git a/templates/package-builder/src/yeoman/app/index.ts b/templates/package-builder/src/yeoman/app/index.ts index c10038b2..be40beb9 100644 --- a/templates/package-builder/src/yeoman/app/index.ts +++ b/templates/package-builder/src/yeoman/app/index.ts @@ -10,6 +10,7 @@ const optionOrPrompt: YeomanPrompt = require('yeoman-option-or-prompt'); const templates = [ { value: 'angular-2', name: 'Angular 2' }, + { value: 'aurelia', name: 'Aurelia' }, { value: 'knockout', name: 'Knockout' }, { value: 'react', name: 'React' }, { value: 'react-redux', name: 'React with Redux' } diff --git a/templates/package-builder/src/yeoman/package.json b/templates/package-builder/src/yeoman/package.json index e77a4118..f8633144 100644 --- a/templates/package-builder/src/yeoman/package.json +++ b/templates/package-builder/src/yeoman/package.json @@ -1,6 +1,6 @@ { "name": "generator-aspnetcore-spa", - "version": "0.3.10", + "version": "0.4.0", "description": "Single-Page App templates for ASP.NET Core", "author": "Microsoft", "license": "Apache-2.0", From 6259b7b938cfeb41fc0efb3d6ec851f901df9c60 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 16:55:39 +0100 Subject: [PATCH 010/610] In generator-aspnetcore-spa, use 'yarn' (if available) instead of 'npm' to restore dependencies because it's > 10x faster --- .../package-builder/src/yeoman/app/index.ts | 18 ++++++++++++++++++ .../package-builder/src/yeoman/package.json | 3 ++- .../typings/npm-which/npm-which.d.ts | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 templates/package-builder/typings/npm-which/npm-which.d.ts diff --git a/templates/package-builder/src/yeoman/app/index.ts b/templates/package-builder/src/yeoman/app/index.ts index be40beb9..a04af655 100644 --- a/templates/package-builder/src/yeoman/app/index.ts +++ b/templates/package-builder/src/yeoman/app/index.ts @@ -2,6 +2,7 @@ import * as path from 'path'; import * as yeoman from 'yeoman-generator'; import * as uuid from 'node-uuid'; import * as glob from 'glob'; +import npmWhich = require('npm-which'); const yosay = require('yosay'); const toPascalCase = require('to-pascal-case'); @@ -80,6 +81,15 @@ class MyGenerator extends yeoman.Base { } installingDeps() { + // If available, restore dependencies using Yarn instead of NPM + const yarnPath = getPathToExecutable('yarn'); + if (!!yarnPath) { + this.log('Will restore NPM dependencies using \'yarn\' installed at ' + yarnPath); + this.npmInstall = (pkgs, options, cb) => { + return (this as any).runInstall(yarnPath, pkgs, options, cb); + }; + } + this.installDependencies({ npm: true, bower: false, @@ -92,5 +102,13 @@ class MyGenerator extends yeoman.Base { } } +function getPathToExecutable(executableName: string) { + try { + return npmWhich(__dirname).sync(executableName); + } catch(ex) { + return null; + } +} + declare var module: any; (module).exports = MyGenerator; diff --git a/templates/package-builder/src/yeoman/package.json b/templates/package-builder/src/yeoman/package.json index f8633144..10a7b7a0 100644 --- a/templates/package-builder/src/yeoman/package.json +++ b/templates/package-builder/src/yeoman/package.json @@ -1,6 +1,6 @@ { "name": "generator-aspnetcore-spa", - "version": "0.4.0", + "version": "0.4.1", "description": "Single-Page App templates for ASP.NET Core", "author": "Microsoft", "license": "Apache-2.0", @@ -20,6 +20,7 @@ "dependencies": { "glob": "^7.0.3", "node-uuid": "^1.4.7", + "npm-which": "^3.0.1", "to-pascal-case": "^1.0.0", "yeoman-generator": "^0.20.2", "yeoman-option-or-prompt": "^1.0.2", diff --git a/templates/package-builder/typings/npm-which/npm-which.d.ts b/templates/package-builder/typings/npm-which/npm-which.d.ts new file mode 100644 index 00000000..3959c5b4 --- /dev/null +++ b/templates/package-builder/typings/npm-which/npm-which.d.ts @@ -0,0 +1,8 @@ +declare module 'npm-which' { + interface NpmWhichContext { + sync(executableName: string): string; + } + + function defaultFunction(rootDir: string) : NpmWhichContext; + export = defaultFunction; +} From 54f222e88fb21dba2fad696647f604e66930a22b Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Fri, 28 Oct 2016 17:36:55 +0100 Subject: [PATCH 011/610] Update templates for Yarn compatibility --- .gitignore | 1 + templates/Angular2Spa/template_gitignore | 2 ++ templates/AureliaSpa/template_gitignore | 1 + .../KnockoutSpa/ClientApp/components/app-root/app-root.ts | 1 + templates/KnockoutSpa/ClientApp/router.ts | 1 + templates/KnockoutSpa/template_gitignore | 2 ++ templates/ReactReduxSpa/template_gitignore | 1 + templates/ReactReduxSpa/tsconfig.json | 7 ++++++- templates/ReactSpa/template_gitignore | 2 ++ templates/WebApplicationBasic/template_gitignore | 2 ++ templates/package-builder/src/yeoman/package.json | 2 +- 11 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9f1553ef..6453872e 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ npm-debug.log /templates/*/node_modules/ /templates/*/wwwroot/dist/ /templates/*/ClientApp/dist/ +/templates/*/yarn.lock .vscode/ diff --git a/templates/Angular2Spa/template_gitignore b/templates/Angular2Spa/template_gitignore index f8bf5e92..ded4b289 100644 --- a/templates/Angular2Spa/template_gitignore +++ b/templates/Angular2Spa/template_gitignore @@ -196,6 +196,8 @@ orleans.codegen.cs /node_modules/** !/node_modules/_placeholder.txt +/yarn.lock + # RIA/Silverlight projects Generated_Code/ diff --git a/templates/AureliaSpa/template_gitignore b/templates/AureliaSpa/template_gitignore index f8bf5e92..bc5a6f34 100644 --- a/templates/AureliaSpa/template_gitignore +++ b/templates/AureliaSpa/template_gitignore @@ -35,6 +35,7 @@ Obj/ !/wwwroot/dist/_placeholder.txt !/ClientApp/dist/_placeholder.txt +/yarn.lock # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/templates/KnockoutSpa/ClientApp/components/app-root/app-root.ts b/templates/KnockoutSpa/ClientApp/components/app-root/app-root.ts index 108d8ad9..011a2202 100644 --- a/templates/KnockoutSpa/ClientApp/components/app-root/app-root.ts +++ b/templates/KnockoutSpa/ClientApp/components/app-root/app-root.ts @@ -1,4 +1,5 @@ import * as ko from 'knockout'; +import * as History from 'history'; import { Route, Router } from '../../router'; import navMenu from '../nav-menu/nav-menu'; diff --git a/templates/KnockoutSpa/ClientApp/router.ts b/templates/KnockoutSpa/ClientApp/router.ts index 9fa5e9b7..d3ac7497 100644 --- a/templates/KnockoutSpa/ClientApp/router.ts +++ b/templates/KnockoutSpa/ClientApp/router.ts @@ -1,5 +1,6 @@ import * as ko from 'knockout'; import * as $ from 'jquery'; +import * as History from 'history'; import crossroads = require('crossroads'); // This module configures crossroads.js, a routing library. If you prefer, you diff --git a/templates/KnockoutSpa/template_gitignore b/templates/KnockoutSpa/template_gitignore index dacd256f..893db26a 100644 --- a/templates/KnockoutSpa/template_gitignore +++ b/templates/KnockoutSpa/template_gitignore @@ -33,6 +33,8 @@ Obj/ # Workaround for https://github.com/aspnet/JavaScriptServices/issues/235 !/wwwroot/dist/_placeholder.txt +/yarn.lock + # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* diff --git a/templates/ReactReduxSpa/template_gitignore b/templates/ReactReduxSpa/template_gitignore index f8bf5e92..bc5a6f34 100644 --- a/templates/ReactReduxSpa/template_gitignore +++ b/templates/ReactReduxSpa/template_gitignore @@ -35,6 +35,7 @@ Obj/ !/wwwroot/dist/_placeholder.txt !/ClientApp/dist/_placeholder.txt +/yarn.lock # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/templates/ReactReduxSpa/tsconfig.json b/templates/ReactReduxSpa/tsconfig.json index 3d39f6ed..960a981b 100644 --- a/templates/ReactReduxSpa/tsconfig.json +++ b/templates/ReactReduxSpa/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": ".", "moduleResolution": "node", "target": "es6", "jsx": "preserve", @@ -7,7 +8,11 @@ "sourceMap": true, "skipDefaultLibCheck": true, "lib": ["es6", "dom"], - "types": [ "webpack-env", "whatwg-fetch" ] + "types": [ "webpack-env", "whatwg-fetch" ], + "paths": { + // Fixes "Duplicate identifier 'Redux'" error when packages were installed via Yarn (by specifying which .d.ts file is authoritative) + "redux": ["./node_modules/@types/redux/index"] + } }, "exclude": [ "bin", diff --git a/templates/ReactSpa/template_gitignore b/templates/ReactSpa/template_gitignore index dacd256f..893db26a 100644 --- a/templates/ReactSpa/template_gitignore +++ b/templates/ReactSpa/template_gitignore @@ -33,6 +33,8 @@ Obj/ # Workaround for https://github.com/aspnet/JavaScriptServices/issues/235 !/wwwroot/dist/_placeholder.txt +/yarn.lock + # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* diff --git a/templates/WebApplicationBasic/template_gitignore b/templates/WebApplicationBasic/template_gitignore index 2ee8e59c..e12e5da5 100644 --- a/templates/WebApplicationBasic/template_gitignore +++ b/templates/WebApplicationBasic/template_gitignore @@ -30,6 +30,8 @@ Obj/ .vs/ /wwwroot/dist/ +/yarn.lock + # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* diff --git a/templates/package-builder/src/yeoman/package.json b/templates/package-builder/src/yeoman/package.json index 10a7b7a0..fc9ac7d9 100644 --- a/templates/package-builder/src/yeoman/package.json +++ b/templates/package-builder/src/yeoman/package.json @@ -1,6 +1,6 @@ { "name": "generator-aspnetcore-spa", - "version": "0.4.1", + "version": "0.4.2", "description": "Single-Page App templates for ASP.NET Core", "author": "Microsoft", "license": "Apache-2.0", From da51cd588b5df11417ede8e50c830f6aa0be2b41 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 31 Oct 2016 10:49:31 +0000 Subject: [PATCH 012/610] In WebpackDevMiddleware, when copying files, create any needed subdirectories. Fixes #408. --- .../npm/aspnet-webpack/package.json | 2 +- .../npm/aspnet-webpack/src/WebpackDevMiddleware.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json index 797d6152..39e33715 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json @@ -1,6 +1,6 @@ { "name": "aspnet-webpack", - "version": "1.0.21", + "version": "1.0.23", "description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.", "main": "index.js", "scripts": { diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts index 7772a2a2..23db6816 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts @@ -93,7 +93,6 @@ function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configurati // Attach Webpack dev middleware and optional 'hot' middleware const compiler = webpack(webpackConfig); - const originalFileSystem = compiler.outputFileSystem; app.use(require('webpack-dev-middleware')(compiler, { noInfo: true, publicPath: webpackConfig.output.publicPath @@ -108,7 +107,7 @@ function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configurati // file on disk wouldn't match the file served to the browser, and the source map line numbers wouldn't // match up. Breakpoints would either not be hit, or would hit the wrong lines. (compiler as any).plugin('done', stats => { - copyRecursiveSync(compiler.outputFileSystem, originalFileSystem, '/', [/\.hot-update\.(js|json)$/]); + copyRecursiveToRealFsSync(compiler.outputFileSystem, '/', [/\.hot-update\.(js|json)$/]); }); if (enableHotModuleReplacement) { @@ -122,7 +121,7 @@ function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configurati } } -function copyRecursiveSync(from: typeof fs, to: typeof fs, rootDir: string, exclude: RegExp[]) { +function copyRecursiveToRealFsSync(from: typeof fs, rootDir: string, exclude: RegExp[]) { from.readdirSync(rootDir).forEach(filename => { const fullPath = pathJoinSafe(rootDir, filename); const shouldExclude = exclude.filter(re => re.test(fullPath)).length > 0; @@ -130,9 +129,12 @@ function copyRecursiveSync(from: typeof fs, to: typeof fs, rootDir: string, excl const fileStat = from.statSync(fullPath); if (fileStat.isFile()) { const fileBuf = from.readFileSync(fullPath); - to.writeFile(fullPath, fileBuf); + fs.writeFileSync(fullPath, fileBuf); } else if (fileStat.isDirectory()) { - copyRecursiveSync(from, to, fullPath, exclude); + if (!fs.existsSync(fullPath)) { + fs.mkdirSync(fullPath); + } + copyRecursiveToRealFsSync(from, fullPath, exclude); } } }); From f9145a43f67b0a0d677051f5330d699d2156b2b6 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 31 Oct 2016 11:46:00 +0000 Subject: [PATCH 013/610] In Angular2Spa server-side rendering, only render the element, not an entire doc --- templates/Angular2Spa/ClientApp/boot-server.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/Angular2Spa/ClientApp/boot-server.ts b/templates/Angular2Spa/ClientApp/boot-server.ts index a5ee0860..7ae129ab 100644 --- a/templates/Angular2Spa/ClientApp/boot-server.ts +++ b/templates/Angular2Spa/ClientApp/boot-server.ts @@ -16,9 +16,7 @@ export default function (params: any) : Promise<{ html: string, globals?: any }> requestUrl: params.url, originUrl: params.origin, preboot: false, - // TODO: Render just the component instead of wrapping it inside an extra HTML document - // Waiting on https://github.com/angular/universal/issues/347 - document: '' + document: '' }, onHandleError: (parentZone, currentZone, targetZone, error) => { // If any error occurs while rendering the module, reject the whole operation From 7ee3346a7207978782eb0b12aca624171ae7e9fb Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 31 Oct 2016 16:19:36 +0000 Subject: [PATCH 014/610] Fix Angular 2 MusicStore sample so packages can be restored on NPM 2.x (started failing because peerDependencies ceased to be valid following third-party package updates) --- samples/angular/MusicStore/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/angular/MusicStore/package.json b/samples/angular/MusicStore/package.json index 1fa631e3..9946fcbb 100644 --- a/samples/angular/MusicStore/package.json +++ b/samples/angular/MusicStore/package.json @@ -5,6 +5,8 @@ "angular2": "2.0.0-beta.15", "angular2-aspnet": "^0.0.6", "angular2-universal": "0.98.1", + "angular2-express-engine": "0.11.1", + "angular2-hapi-engine": "0.11.1", "aspnet-prerendering": "^1.0.1", "bootstrap": "^3.3.5", "css": "^2.2.1", From 077f91847a882950eeaac7271cd1d473ddea9acc Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 31 Oct 2016 16:35:06 +0000 Subject: [PATCH 015/610] Fix AngularServices NPM package dependency restoration following third-party package changes --- src/Microsoft.AspNetCore.AngularServices/npm/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.AngularServices/npm/package.json b/src/Microsoft.AspNetCore.AngularServices/npm/package.json index cb5ceeb7..67b27641 100644 --- a/src/Microsoft.AspNetCore.AngularServices/npm/package.json +++ b/src/Microsoft.AspNetCore.AngularServices/npm/package.json @@ -18,12 +18,12 @@ "url": "https://github.com/aspnet/JavaScriptServices.git" }, "dependencies": { - "angular2": "^2.0.0-beta.13", + "angular2": "2.0.0-beta.13", + "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2" }, "devDependencies": { "es6-shim": "^0.35.0", - "reflect-metadata": "^0.1.2", "rimraf": "^2.5.4", "systemjs-builder": "^0.14.11", "typescript": "^2.0.0", From 64903fe0c636f988431fa44d8ea4ba6beebfa6cb Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 31 Oct 2016 16:49:37 +0000 Subject: [PATCH 016/610] Fix aspnet-webpack build on machines that don't already have `tsd` in the node_modules dir here --- .../npm/aspnet-webpack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json index 39e33715..9829cd93 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json @@ -4,7 +4,7 @@ "description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.", "main": "index.js", "scripts": { - "prepublish": "rimraf *.d.ts && tsd update && tsc && echo 'Finished building NPM package \"aspnet-webpack\"'", + "prepublish": "rimraf *.d.ts && tsc && echo 'Finished building NPM package \"aspnet-webpack\"'", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Microsoft", From 7ee8a7b15ebff1e817c389b4baebb0163e7b1845 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 31 Oct 2016 17:14:29 +0000 Subject: [PATCH 017/610] Update aspnet-webpack peerDependency to allow Webpack 2.1.0beta+ as well as Webpack 1.x --- .../npm/aspnet-webpack/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json index 9829cd93..66d36834 100644 --- a/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json +++ b/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/package.json @@ -1,6 +1,6 @@ { "name": "aspnet-webpack", - "version": "1.0.23", + "version": "1.0.24", "description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.", "main": "index.js", "scripts": { @@ -33,6 +33,6 @@ "webpack": "^1.13.2" }, "peerDependencies": { - "webpack": "^1.13.2" + "webpack": "^1.13.2 || ^2.1.0-beta" } } From 1b4dd93fa640d50772ba00fff69ff0e9424f0636 Mon Sep 17 00:00:00 2001 From: SteveSandersonMS Date: Mon, 7 Nov 2016 10:16:41 -0800 Subject: [PATCH 018/610] Update React MusicStore sample to use current technologies (TypeScript 2, .NET Core 1.0.1, etc.). Fixes #417 --- samples/react/MusicStore/.gitignore | 1 + .../react/MusicStore/ReactApp/boot-server.tsx | 18 +- samples/react/MusicStore/ReactApp/boot.tsx | 18 +- .../MusicStore/ReactApp/configureStore.ts | 34 +- samples/react/MusicStore/package.json | 79 +- samples/react/MusicStore/project.json | 83 +- samples/react/MusicStore/tsconfig.json | 3 +- samples/react/MusicStore/tsd.json | 45 - .../react-bootstrap/react-bootstrap.d.ts | 976 ------- .../typings/react-redux/react-redux.d.ts | 69 - .../react-router-bootstrap.d.ts | 46 - .../react-router-redux.d.ts | 48 - .../typings/react-router/history.d.ts | 192 -- .../typings/react-router/react-router.d.ts | 474 ---- .../MusicStore/typings/react/react-dom.d.ts | 66 - .../react/MusicStore/typings/react/react.d.ts | 2274 ----------------- .../typings/redux-thunk/redux-thunk.d.ts | 18 - .../react/MusicStore/typings/redux/redux.d.ts | 52 - samples/react/MusicStore/typings/tsd.d.ts | 12 - .../typings/webpack/webpack-env.d.ts | 232 -- .../typings/whatwg-fetch/whatwg-fetch.d.ts | 85 - 21 files changed, 140 insertions(+), 4685 deletions(-) delete mode 100644 samples/react/MusicStore/tsd.json delete mode 100644 samples/react/MusicStore/typings/react-bootstrap/react-bootstrap.d.ts delete mode 100644 samples/react/MusicStore/typings/react-redux/react-redux.d.ts delete mode 100644 samples/react/MusicStore/typings/react-router-bootstrap/react-router-bootstrap.d.ts delete mode 100644 samples/react/MusicStore/typings/react-router-redux/react-router-redux.d.ts delete mode 100644 samples/react/MusicStore/typings/react-router/history.d.ts delete mode 100644 samples/react/MusicStore/typings/react-router/react-router.d.ts delete mode 100644 samples/react/MusicStore/typings/react/react-dom.d.ts delete mode 100644 samples/react/MusicStore/typings/react/react.d.ts delete mode 100644 samples/react/MusicStore/typings/redux-thunk/redux-thunk.d.ts delete mode 100644 samples/react/MusicStore/typings/redux/redux.d.ts delete mode 100644 samples/react/MusicStore/typings/tsd.d.ts delete mode 100644 samples/react/MusicStore/typings/webpack/webpack-env.d.ts delete mode 100644 samples/react/MusicStore/typings/whatwg-fetch/whatwg-fetch.d.ts diff --git a/samples/react/MusicStore/.gitignore b/samples/react/MusicStore/.gitignore index bca785d4..8d1beebe 100644 --- a/samples/react/MusicStore/.gitignore +++ b/samples/react/MusicStore/.gitignore @@ -1,3 +1,4 @@ music-db.sqlite /wwwroot/dist/ /node_modules/ +yarn.lock diff --git a/samples/react/MusicStore/ReactApp/boot-server.tsx b/samples/react/MusicStore/ReactApp/boot-server.tsx index 4bf5d6e3..7aaa1f11 100644 --- a/samples/react/MusicStore/ReactApp/boot-server.tsx +++ b/samples/react/MusicStore/ReactApp/boot-server.tsx @@ -5,19 +5,29 @@ import { match, RouterContext } from 'react-router'; import createMemoryHistory from 'history/lib/createMemoryHistory'; import { routes } from './routes'; import configureStore from './configureStore'; -React; +type BootResult = { html?: string, globals?: { [key: string]: any }, redirectUrl?: string}; export default function (params: any): Promise<{ html: string }> { - return new Promise<{ html: string, globals: { [key: string]: any } }>((resolve, reject) => { + return new Promise((resolve, reject) => { // Match the incoming request against the list of client-side routes match({ routes, location: params.location }, (error, redirectLocation, renderProps: any) => { if (error) { throw error; } + // If there's a redirection, just send this information back to the host application + if (redirectLocation) { + resolve({ redirectUrl: redirectLocation.pathname }); + return; + } + + // If it didn't match any route, renderProps will be undefined + if (!renderProps) { + throw new Error(`The location '${ params.url }' doesn't match any route configured in react-router.`); + } + // Build an instance of the application - const history = createMemoryHistory(params.url); - const store = configureStore(history); + const store = configureStore(); const app = ( diff --git a/samples/react/MusicStore/ReactApp/boot.tsx b/samples/react/MusicStore/ReactApp/boot.tsx index ad8f367e..ea3807db 100644 --- a/samples/react/MusicStore/ReactApp/boot.tsx +++ b/samples/react/MusicStore/ReactApp/boot.tsx @@ -1,21 +1,25 @@ +import './styles/styles.css'; +import 'bootstrap/dist/css/bootstrap.css'; + import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { browserHistory, Router } from 'react-router'; import { Provider } from 'react-redux'; -React; // Need this reference otherwise TypeScript doesn't think we're using it and ignores the import - -import './styles/styles.css'; -import 'bootstrap/dist/css/bootstrap.css'; -import configureStore from './configureStore'; +import { syncHistoryWithStore } from 'react-router-redux'; import { routes } from './routes'; +import configureStore from './configureStore'; import { ApplicationState } from './store'; +// Get the application-wide store instance, prepopulating with state from the server where available. const initialState = (window as any).initialReduxState as ApplicationState; -const store = configureStore(browserHistory, initialState); +const store = configureStore(initialState); +const history = syncHistoryWithStore(browserHistory, store); +// This code starts up the React app when it runs in a browser. It sets up the routing configuration +// and injects the app into a DOM element. ReactDOM.render( - + , document.getElementById('react-app') ); diff --git a/samples/react/MusicStore/ReactApp/configureStore.ts b/samples/react/MusicStore/ReactApp/configureStore.ts index 9274c22b..b7788452 100644 --- a/samples/react/MusicStore/ReactApp/configureStore.ts +++ b/samples/react/MusicStore/ReactApp/configureStore.ts @@ -1,28 +1,22 @@ -import { createStore, applyMiddleware, compose, combineReducers } from 'redux'; -import * as thunkModule from 'redux-thunk'; -import { syncHistory, routeReducer } from 'react-router-redux'; +import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer } from 'redux'; +import thunk from 'redux-thunk'; +import { routerReducer } from 'react-router-redux'; import * as Store from './store'; import { typedToPlain } from 'redux-typed'; -export default function configureStore(history: HistoryModule.History, initialState?: Store.ApplicationState) { - // Build middleware - const thunk = (thunkModule as any).default; // Workaround for TypeScript not importing thunk module as expected - const reduxRouterMiddleware = syncHistory(history); - const middlewares = [thunk, reduxRouterMiddleware, typedToPlain]; - const devToolsExtension = null;//(window as any).devToolsExtension; // If devTools is installed, connect to it - - const finalCreateStore = compose( - applyMiddleware(...middlewares), +export default function configureStore(initialState?: Store.ApplicationState) { + // Build middleware. These are functions that can process the actions before they reach the store. + const windowIfDefined = typeof window === 'undefined' ? null : window as any; + // If devTools is installed, connect to it + const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension as () => GenericStoreEnhancer; + const createStoreWithMiddleware = compose( + applyMiddleware(thunk, typedToPlain), devToolsExtension ? devToolsExtension() : f => f - )(createStore) + )(createStore); - // Combine all reducers + // Combine all reducers and instantiate the app-wide store instance const allReducers = buildRootReducer(Store.reducers); - - const store = finalCreateStore(allReducers, initialState) as Redux.Store; - - // Required for replaying actions from devtools to work - reduxRouterMiddleware.listenForReplays(store); + const store = createStoreWithMiddleware(allReducers, initialState) as Redux.Store; // Enable Webpack hot module replacement for reducers if (module.hot) { @@ -36,5 +30,5 @@ export default function configureStore(history: HistoryModule.History, initialSt } function buildRootReducer(allReducers) { - return combineReducers(Object.assign({}, allReducers, { routing: routeReducer })) as Redux.Reducer; + return combineReducers(Object.assign({}, allReducers, { routing: routerReducer })); } diff --git a/samples/react/MusicStore/package.json b/samples/react/MusicStore/package.json index 084f8ee9..9d0a7cc0 100644 --- a/samples/react/MusicStore/package.json +++ b/samples/react/MusicStore/package.json @@ -1,45 +1,52 @@ { - "name": "MusicStore", + "name": "music-store", "version": "0.0.0", - "devDependencies": { - "babel-loader": "^6.2.1", - "babel-plugin-react-transform": "^2.0.0", - "babel-preset-es2015": "^6.3.13", - "babel-preset-react": "^6.3.13", + "dependencies": { + "@types/react": "^0.14.29", + "@types/react-bootstrap": "^0.0.35", + "@types/react-dom": "^0.14.14", + "@types/react-redux": "^4.4.29", + "@types/react-router": "^2.0.30", + "@types/react-router-bootstrap": "^0.0.27", + "@types/react-router-redux": "^4.0.30", + "@types/redux": "3.5.27", + "@types/redux-thunk": "^2.1.28", + "@types/source-map": "^0.1.28", + "@types/uglify-js": "^2.0.27", + "@types/webpack": "^1.12.35", + "@types/webpack-env": "^1.12.1", + "@types/whatwg-fetch": "0.0.28", + "aspnet-prerendering": "^1.0.7", + "aspnet-webpack": "^1.0.17", + "aspnet-webpack-react": "^1.0.2", + "babel-core": "^6.5.2", + "babel-loader": "^6.2.3", + "babel-preset-es2015": "^6.5.0", + "babel-preset-react": "^6.5.0", + "bootstrap": "^3.3.6", "css-loader": "^0.23.1", - "express": "^4.13.4", + "domain-task": "^2.0.1", + "event-source-polyfill": "^0.0.7", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.8.5", - "react-transform-hmr": "^1.0.2", + "jquery": "^2.2.1", + "react": "^15.3.2", + "react-bootstrap": "^0.30.6", + "react-dom": "^15.3.2", + "react-redux": "^4.4.5", + "react-router": "^2.8.1", + "react-router-bootstrap": "^0.23.1", + "react-router-redux": "^4.0.6", + "redux": "^3.6.0", + "redux-thunk": "^2.1.0", + "redux-typed": "^2.0.0", "style-loader": "^0.13.0", - "ts-loader": "^0.8.0", - "typescript": "^1.7.5", + "ts-loader": "^0.8.1", + "typescript": "2.0.3", "url-loader": "^0.5.7", - "webpack": "^1.12.12", - "webpack-dev-middleware": "^1.5.1", - "webpack-hot-middleware": "^2.6.4" - }, - "dependencies": { - "aspnet-prerendering": "^1.0.0", - "aspnet-webpack": "^1.0.3", - "aspnet-webpack-react": "^1.0.1", - "bootstrap": "^3.3.6", - "domain-context": "^0.5.1", - "domain-task": "^2.0.0", - "history": "^2.0.0", - "isomorphic-fetch": "^2.2.1", - "memory-fs": "^0.3.0", - "react": "^0.14.7", - "react-bootstrap": "^0.28.2", - "react-dom": "^0.14.7", - "react-redux": "^4.2.1", - "react-router": "^2.0.0-rc5", - "react-router-bootstrap": "^0.20.1", - "react-router-redux": "^2.1.0", - "redux": "^3.2.1", - "redux-thunk": "^1.0.3", - "redux-typed": "^1.0.0", - "require-from-string": "^1.1.0", - "webpack-externals-plugin": "^1.0.0" + "webpack": "^1.13.2", + "webpack-hot-middleware": "^2.12.2", + "webpack-merge": "^0.14.1", + "webpack-node-externals": "^1.4.3" } } diff --git a/samples/react/MusicStore/project.json b/samples/react/MusicStore/project.json index 6f5c801b..423d3138 100755 --- a/samples/react/MusicStore/project.json +++ b/samples/react/MusicStore/project.json @@ -1,56 +1,83 @@ { - "version": "1.0.0-*", - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "runtimeOptions": { - "gcServer": true - }, - "tooling": { - "defaultNamespace": "MusicStore" - }, - -"dependencies": { + "dependencies": { "Microsoft.NETCore.App": { - "version": "1.0.0", + "version": "1.0.1", "type": "platform" }, + "Microsoft.AspNetCore.ReactServices": "1.0.0-*", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0", + "Microsoft.AspNetCore.Mvc": "1.0.1", + "Microsoft.AspNetCore.Razor.Tools": { + "version": "1.0.0-preview2-final", + "type": "build" + }, "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.AspNetCore.StaticFiles": "1.0.0", + "Microsoft.EntityFrameworkCore.SQLite": "1.0.0", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", + "Microsoft.Extensions.Configuration.CommandLine": "1.0.0", + "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", - "Microsoft.NETCore.Platforms": "1.0.1", "Microsoft.Extensions.Logging.Debug": "1.0.0", - "Microsoft.EntityFrameworkCore.SQLite": "1.0.0", - "Microsoft.AspNetCore.ReactServices": "1.0.0-*", - "AutoMapper": "5.0.2" + "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", + "AutoMapper": "5.0.2" + }, + + "tools": { + "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", + "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", + "Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final" }, + "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", - "dnxcore50", "portable-net45+win8" ] } }, + + "buildOptions": { + "emitEntryPoint": true, + "preserveCompilationContext": true, + "compile": { + "exclude": ["node_modules"] + } + }, + + "runtimeOptions": { + "configProperties": { + "System.GC.Server": true + } + }, + "publishOptions": { - "exclude": [ + "include": [ + "appsettings.json", + "ClientApp/dist", "node_modules", - "bower_components", - "**.xproj", - "**.user", - "**.vspscc" + "Views", + "web.config", + "wwwroot" + ], + "exclude": [ + "wwwroot/dist/*.map" ] }, + "scripts": { - "prepublish": [ "npm install" ], + "prepublish": [ + "npm install", + "node node_modules/webpack/bin/webpack.js" + ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] + }, + + "tooling": { + "defaultNamespace": "MusicStore" } } diff --git a/samples/react/MusicStore/tsconfig.json b/samples/react/MusicStore/tsconfig.json index 863f6938..f5bad2ca 100644 --- a/samples/react/MusicStore/tsconfig.json +++ b/samples/react/MusicStore/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "jsx": "preserve", "sourceMap": true, - "experimentalDecorators": true + "experimentalDecorators": true, + "types": [ "webpack-env", "whatwg-fetch" ] }, "exclude": [ "node_modules" diff --git a/samples/react/MusicStore/tsd.json b/samples/react/MusicStore/tsd.json deleted file mode 100644 index cebcea0b..00000000 --- a/samples/react/MusicStore/tsd.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "typings", - "bundle": "typings/tsd.d.ts", - "installed": { - "react/react.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "react/react-dom.d.ts": { - "commit": "86dbea8fc37d9473fee465da4f0a21bea4f8cbd9" - }, - "redux/redux.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "webpack/webpack-env.d.ts": { - "commit": "717a5fdb079f8dd7c19f1b22f7f656dd990f0ccf" - }, - "react-redux/react-redux.d.ts": { - "commit": "717a5fdb079f8dd7c19f1b22f7f656dd990f0ccf" - }, - "react-bootstrap/react-bootstrap.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "react-router/react-router.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "react-router/history.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "react-router-bootstrap/react-router-bootstrap.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "react-router-redux/react-router-redux.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "redux-thunk/redux-thunk.d.ts": { - "commit": "e69fe60f2d6377ea4fae539493997b098f52cad1" - }, - "whatwg-fetch/whatwg-fetch.d.ts": { - "commit": "f4b1797c1201b6c575668f5d7ea12d9b1ab21846" - } - } -} diff --git a/samples/react/MusicStore/typings/react-bootstrap/react-bootstrap.d.ts b/samples/react/MusicStore/typings/react-bootstrap/react-bootstrap.d.ts deleted file mode 100644 index c6e30d08..00000000 --- a/samples/react/MusicStore/typings/react-bootstrap/react-bootstrap.d.ts +++ /dev/null @@ -1,976 +0,0 @@ -// Type definitions for react-bootstrap -// Project: https://github.com/react-bootstrap/react-bootstrap -// Definitions by: Walker Burgin -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "react-bootstrap" { - // Import React - import React = require("react"); - - - //