From e60ea04f86c65bcfbbbab53726a2685d7322be4c Mon Sep 17 00:00:00 2001 From: kmkatsma Date: Fri, 28 Oct 2016 11:16:21 +0100 Subject: [PATCH] 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 0000000..6abcd44 --- /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 0000000..6392600 --- /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 0000000..27cae10 --- /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 0000000..6a70c18 --- /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 0000000..ef4bf8f --- /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 0000000..3217c44 --- /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 0000000..bd06c35 --- /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 0000000..6ec772b --- /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('/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 0000000..9d0474d --- /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 0000000..737d6cc --- /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 0000000..8518eda --- /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 0000000..38b97f9 --- /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 0000000..83a813a --- /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 0000000..9d75da8 --- /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 0000000..1f46d12 --- /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 0000000..c9bf07c --- /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 0000000..b2e5e4b --- /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 0000000..d8ba0b3 --- /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 0000000..412b4db --- /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 0000000..6061b24 --- /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 0000000..473b35d --- /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 0000000..a73bc74 --- /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 0000000..e7b4f83 --- /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 0000000..820a2f6 --- /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 0000000..723c096 --- /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 0000000..8bacd0b --- /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 0000000..4fcf8fc --- /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 0000000..94b22fc --- /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 0000000..b2dcaab --- /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 0000000..b22cc15 --- /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 zcmeHQ>ysQ+6`zz)7G;UygZMR+ScbBS;%h9DEJ2W$f&xLskVH{}fEr#w5CT$wD5937 zY_i#8AG7n=nSErliFt2T2v8*1-Fd&dXErZB`!9HY=kz?XJG+`Lq1pL)1`mSI}x#-yGANofM@weso+&l7ncG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