mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Add AureliaSpa template (#398)
This commit is contained in:
committed by
SteveSandersonMS
parent
867e60d7fd
commit
e60ea04f86
20
templates/AureliaSpa/Aurelia.xproj
Normal file
20
templates/AureliaSpa/Aurelia.xproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>33d8dad9-74f9-471d-8bad-55f828faa736</ProjectGuid>
|
||||
<RootNamespace>AureliaSpa</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
14
templates/AureliaSpa/ClientApp/app/components/app/app.html
Normal file
14
templates/AureliaSpa/ClientApp/app/components/app/app.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<require from="../navmenu/navmenu.html"></require>
|
||||
<require from="./app.css"></require>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<navmenu router.bind="router"></navmenu>
|
||||
</div>
|
||||
<div class="col-sm-9 body-content">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
34
templates/AureliaSpa/ClientApp/app/components/app/app.ts
Normal file
34
templates/AureliaSpa/ClientApp/app/components/app/app.ts
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<h2>Counter</h2>
|
||||
|
||||
<p>This is a simple example of an Aurelia component.</p>
|
||||
|
||||
<p>Current count: <strong>${currentCount}</strong></p>
|
||||
|
||||
<button click.delegate="incrementCounter()">Increment</button>
|
||||
</template>
|
||||
@@ -0,0 +1,7 @@
|
||||
export class Counter {
|
||||
public currentCount = 0;
|
||||
|
||||
public incrementCounter() {
|
||||
this.currentCount++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<h1>Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the server.</p>
|
||||
|
||||
<p if.bind="!forecasts"><em>Loading...</em></p>
|
||||
|
||||
<table if.bind="forecasts" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr repeat.for="forecast of forecasts">
|
||||
<td>${ forecast.dateFormatted }</td>
|
||||
<td>${ forecast.temperatureC }</td>
|
||||
<td>${ forecast.temperatureF }</td>
|
||||
<td>${ forecast.summary }</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
@@ -0,0 +1,24 @@
|
||||
/// <reference path="../../../../node_modules/aurelia-fetch-client/doc/whatwg-fetch.d.ts" />
|
||||
/// <reference path="../../../../node_modules/aurelia-fetch-client/doc/url.d.ts" />
|
||||
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;
|
||||
}
|
||||
16
templates/AureliaSpa/ClientApp/app/components/home/home.html
Normal file
16
templates/AureliaSpa/ClientApp/app/components/home/home.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<h1>Hello, world!</h1>
|
||||
<p>Welcome to your new single-page application, built with:</p>
|
||||
<ul>
|
||||
<li><a href="https://get.asp.net/">ASP.NET Core</a> and <a href="https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx">C#</a> for cross-platform server-side code</li>
|
||||
<li><a href="https://aurelia.io/">Aurelia</a> and <a href="http://www.typescriptlang.org/">TypeScript</a> for client-side code</li>
|
||||
<li><a href="https://webpack.github.io/">Webpack</a> for building and bundling client-side resources</li>
|
||||
<li><a href="http://getbootstrap.com/">Bootstrap</a> for layout and styling</li>
|
||||
</ul>
|
||||
<p>To help you get started, we've also set up:</p>
|
||||
<ul>
|
||||
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
|
||||
<li><strong>Webpack dev middleware</strong>. In development mode, there's no need to run the <code>webpack</code> build tool. Your client-side resources are dynamically built on demand. Updates are available as soon as you modify any file.</li>
|
||||
<li><strong>Efficient production builds</strong>. In production mode, development-time features are disabled, and the <code>webpack</code> build tool produces minified static CSS and JavaScript files.</li>
|
||||
</ul>
|
||||
</template>
|
||||
@@ -0,0 +1,2 @@
|
||||
export class Home {
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<template bindable="router">
|
||||
<require from="./navmenu.css"></require>
|
||||
<div class="main-nav">
|
||||
<div class="navbar navbar-inverse">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#/home">Aurelia</a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li repeat.for = "row of router.navigation" class="${ row.isActive ? 'link-active' : '' }" >
|
||||
<a href.bind = "row.href">
|
||||
<span class="glyphicon glyphicon-${ row.settings.icon }"></span> ${ row.title }
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
11
templates/AureliaSpa/ClientApp/boot.ts
Normal file
11
templates/AureliaSpa/ClientApp/boot.ts
Normal file
@@ -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'));
|
||||
}
|
||||
21
templates/AureliaSpa/Controllers/HomeController.cs
Normal file
21
templates/AureliaSpa/Controllers/HomeController.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
44
templates/AureliaSpa/Controllers/SampleDataController.cs
Normal file
44
templates/AureliaSpa/Controllers/SampleDataController.cs
Normal file
@@ -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<WeatherForecast> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
templates/AureliaSpa/Dockerfile
Normal file
17
templates/AureliaSpa/Dockerfile
Normal file
@@ -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"]
|
||||
31
templates/AureliaSpa/Program.cs
Normal file
31
templates/AureliaSpa/Program.cs
Normal file
@@ -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<Startup>()
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
39
templates/AureliaSpa/README.md
Normal file
39
templates/AureliaSpa/README.md
Normal file
@@ -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)
|
||||
68
templates/AureliaSpa/Startup.cs
Normal file
68
templates/AureliaSpa/Startup.cs
Normal file
@@ -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" });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
10
templates/AureliaSpa/Views/Home/Index.cshtml
Normal file
10
templates/AureliaSpa/Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,10 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div aurelia-app="boot">Loading...</div>
|
||||
|
||||
@section scripts {
|
||||
<script type="text/javascript" src="~/dist/aurelia-modules-bundle.js" asp-append-version="true"></script>
|
||||
<script type="text/javascript" src="~/dist/app-bundle.js" asp-append-version="true"></script>
|
||||
}
|
||||
6
templates/AureliaSpa/Views/Shared/Error.cshtml
Normal file
6
templates/AureliaSpa/Views/Shared/Error.cshtml
Normal file
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
13
templates/AureliaSpa/Views/Shared/_Layout.cshtml
Normal file
13
templates/AureliaSpa/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - Aurelia</title>
|
||||
</head>
|
||||
<body>
|
||||
@RenderBody()
|
||||
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
3
templates/AureliaSpa/Views/_ViewImports.cshtml
Normal file
3
templates/AureliaSpa/Views/_ViewImports.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@using WebApplicationBasic
|
||||
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
||||
@addTagHelper "*, Microsoft.AspNetCore.SpaServices"
|
||||
3
templates/AureliaSpa/Views/_ViewStart.cshtml
Normal file
3
templates/AureliaSpa/Views/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
10
templates/AureliaSpa/appsettings.json
Normal file
10
templates/AureliaSpa/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
43
templates/AureliaSpa/package.json
Normal file
43
templates/AureliaSpa/package.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
73
templates/AureliaSpa/project.json
Normal file
73
templates/AureliaSpa/project.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
14
templates/AureliaSpa/tsconfig.json
Normal file
14
templates/AureliaSpa/tsconfig.json
Normal file
@@ -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 }
|
||||
}
|
||||
64
templates/AureliaSpa/webpack.config.js
Normal file
64
templates/AureliaSpa/webpack.config.js
Normal file
@@ -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];
|
||||
9
templates/AureliaSpa/wwwroot/dist/_placeholder.txt
vendored
Normal file
9
templates/AureliaSpa/wwwroot/dist/_placeholder.txt
vendored
Normal file
@@ -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.
|
||||
BIN
templates/AureliaSpa/wwwroot/favicon.ico
Normal file
BIN
templates/AureliaSpa/wwwroot/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Reference in New Issue
Block a user