From c1e0401a6e20610d8ce4d55ae8925f1c6089989c Mon Sep 17 00:00:00 2001 From: chaskim Date: Sun, 12 Mar 2017 09:48:06 +0100 Subject: [PATCH] fix(project-template): set baseDir to '.wwwroot' for ASP.NET Core projects Add new baseDir property in aurelia.json with default value of '.'. Override baseDir value to './wwwroot' for ASP.NET Core projects. Also allows baseDir to be configurable via aurelia.json instead of having to change the hard-code value in run.js/ts. --- lib/commands/new/project-template.js | 2 ++ lib/resources/tasks/run.js | 2 +- lib/resources/tasks/run.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/commands/new/project-template.js b/lib/commands/new/project-template.js index edcc1ac9a..931abc9a5 100644 --- a/lib/commands/new/project-template.js +++ b/lib/commands/new/project-template.js @@ -259,9 +259,11 @@ exports.ProjectTemplate = class { this.model.cssProcessor.source = path.posix.join(appRoot, '**/*' + this.model.cssProcessor.fileExtension); this.model.platform.output = this.scripts.calculateRelativePath(this.root); this.model.platform.index = path.posix.join(this.projectOutput.calculateRelativePath(this.root), "index.html"); + this.model.platform.baseDir = '.'; if (this.model.platform.id === 'aspnetcore') { this.model.platform.baseUrl = this.scripts.calculateRelativePath(this.projectOutput); + this.model.platform.baseDir = './wwwroot'; } if (this.unitTests.parent) { diff --git a/lib/resources/tasks/run.js b/lib/resources/tasks/run.js index d2ff59379..e9a0eb4ad 100644 --- a/lib/resources/tasks/run.js +++ b/lib/resources/tasks/run.js @@ -27,7 +27,7 @@ let serve = gulp.series( port: 9000, logLevel: 'silent', server: { - baseDir: ['.'], + baseDir: [project.platform.baseDir], middleware: [historyApiFallback(), function(req, res, next) { res.setHeader('Access-Control-Allow-Origin', '*'); next(); diff --git a/lib/resources/tasks/run.ts b/lib/resources/tasks/run.ts index 80c086ea7..1c182a763 100644 --- a/lib/resources/tasks/run.ts +++ b/lib/resources/tasks/run.ts @@ -23,7 +23,7 @@ let serve = gulp.series( port: 9000, logLevel: 'silent', server: { - baseDir: ['.'], + baseDir: [project.platform.baseDir], middleware: [historyApiFallback(), function(req, res, next) { res.setHeader('Access-Control-Allow-Origin', '*'); next();