-
Notifications
You must be signed in to change notification settings - Fork 520
Conversation
Added @typings/node to package.json, removed direct typings reference Small webpack.config.js and tsconfig.json changes for similarity to Angular2 version
Hi @kmkatsma, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! TTYL, DNFBOT; |
@kmkatsma, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
Thanks @kmkatsma! Overall this looks great. You're identified most of the limitations yourself above, and I appreciate that they are beyond your control. Thanks for making it consistent with the other templates where possible. I'll now review and comment on the actual code. Since I don't know Aurelia, I'll wait for @EisenbergEffect to comment on whether Aurelia is being used optimally. Mostly I'll be limited to commenting on the cosmetic aspects of the code - hope you don't mind my rather trivial comments! |
<div class='clearfix'></div> | ||
<div class='navbar-collapse collapse'> | ||
<ul class='nav navbar-nav'> | ||
<li class="${row.isActive ? 'link-active' : ''}" repeat.for = "row of router.navigation" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity, I would put the repeat.for first on the li
, before the class
binding.
I left one minor style comment related to the Aurelia code. Everything else looks fine to me :) |
Forgot to say, great job @kmkatsma ! 💯 👍 |
Agree with @MarkPieszak This is a really awesome contribution. When it this goes live, if you would like to @kmkatsma we can feature you on our official blog for this work. I'm sure a lot of people will be interested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kmkatsma Thanks again for this excellent contribution! I hope you don't mind these comments - most of them are pretty trivial.
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>33d8dad9-74f9-471d-8bad-55f828faa736</ProjectGuid> | ||
<RootNamespace>Angular2</RootNamespace> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this
@@ -0,0 +1,14 @@ | |||
<template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent quote style in this file. In TypeScript let's use single-quotes. In HTML templates, I don't know if Aurelia community has a standard, but can you find out what it is and use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer single quotes in JS/TS and double quotes in HTML.
</div> | ||
</div> | ||
</div> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing linebreak which is present in most files. Could you add one here and to any other TS/JS/HTML/CSS file where it's missing?
@@ -0,0 +1,19 @@ | |||
import {Aurelia} from 'aurelia-framework'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some few formatting issues in this file:
- missing spaces around
{ ImportedModule }
- The
config.map
object looks pretty strange. Not sure if you were trying to line things up with tabs or something, but it's not lined up now. Also some of the key-value pairs have spaces after the colon and others don't. Could you lay this code out more conventionally?
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 18 seems like unnecessary whitespace, then there's a missing trailing linebreak.
entry: { | ||
'app': [], // <-- this array will be filled by the aurelia-webpack-plugin | ||
'aurelia-bootstrap': aureliaBootstrap, | ||
'aurelia-modules': aureliaModules.filter(pkg => aureliaBootstrap.indexOf(pkg) === -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these dependencies going into a separate bundle? Couldn't they just be included in aurelia-bootstrap
? (which they would be by default if this line wasn't here)
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this file is needed. It's not present in any of the other templates.
}, | ||
plugins: [ | ||
new webpack.ProvidePlugin({ | ||
regeneratorRuntime: 'regenerator-runtime', // to support await/async syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that needed? I didn't see any await
/async
anywhere. Can this be simplified?
Promise: 'bluebird', // because Edge browser has slow native Promise object | ||
$: 'jquery', // because 'bootstrap' by Twitter depends on this | ||
jQuery: 'jquery', // just an alias | ||
'window.jQuery': 'jquery' // this doesn't expose jQuery property for window, but exposes it to every module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need all three of these aliases for jQuery?
{ | ||
app.UseDeveloperExceptionPage(); | ||
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { | ||
HotModuleReplacement = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we'll get away with just setting this to false
. The problem is, people will change it to true
, and then you get a really weird and non-descriptive error that people will regard as a bug. It's reasonable for people to think that if some option exists that you should be able to use it.
Obviously the ideal solution would be if HMR could be made to work. I'd hope that's not impossible, since it's quite trivial to enable with Angular/Knockout/React, but I don't know if Aurelia does something that can't handle it.
If it's not possible to make work, can you somehow stop the unrelated-seeming error message, and replace it with something like "Sorry, Hot Module Replacement is not supported with Aurelia"?
@SteveSandersonMS - thanks - a lot of good comments here, responded to couple, but too many to address individually. =) I will look at them all. I was trying to clean things up for consistency, and this helps a ton. @MarkPieszak @EisenbergEffect - thanks, appreciate it! I would definitely be good with a feature on the Aurelia blog! These kinds of projects are really important - anything we can do to help developers get a foothold into technologies like these is worthwhile. And I think Aurelia deserved a place here as well. =) |
I think doing this sort of thing in a constructor is bad, yes. I wouldn't On Mon, Oct 24, 2016 at 6:54 AM, Steve Sanderson notifications@github.com
Rob Eisenberg, |
@EisenbergEffect It's a reasonable point but perhaps we're getting a bit side-tracked. @kmkatsma's Thanks - awaiting your updates :) |
Have pushed in update in updates for all the review items. There's two things to note regarding resolutions (or somewhat lack thereof ).
Let me know thoughts on these things - have learned a ton here going through this! I think the back end integration of these templates is a huge win, and removes a lot of friction we've seen since everything moved to client in a SPA. I can definitely see people wanting to get more things into them. =) |
Added a commit that fixed issues with dotnet publish. First, when publishing to virtual directory that is not at root, the router was having issues due to base url set to "" in the layout.cshtml. Apparently this works for angular2 in publish mode, but causes issues for aurelia routing. I removed this, and now works in dev and publish mode under IIS virtual directory. Second change was to remove node_modules from the items included in publish process. It made the publish really big and run really slow, and is not needed since webpack runs as pre-publish step. There's a funky bug in publish process where the generated web.config keeps appending extra arguments on each run if you don't delete the web.config first. This was causing my publish problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments regarding the Webpack config.
"jquery": "^2.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^6.0.45", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the node
types used for?
resolve: { extensions: [ '.js', '.ts' ] }, | ||
devtool: isDevBuild ? 'inline-source-map' : null, | ||
entry: { | ||
'app': [], // <-- this array will be filled by the aurelia-webpack-plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest Webpack@beta currently errors when an array is empty (it's an ongoing bug). I might be better to instead point it to where the main.js
file is, as that should be in the context anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is changed in the current version too, so I think we're OK.
var outDir = path.resolve('./wwwroot/dist'); | ||
var baseUrl = '/'; | ||
var project = require('./package.json'); | ||
var aureliaModules = Object.keys(project.dependencies).filter(dep => dep.startsWith('aurelia-')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only gets the list of first-level dependencies of Aurelia, which means not all of Aurelia's dependencies might get into the aurelia-modules
bundle specified in the entry
config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. However this approach is no longer used in the current version anyway - dependencies are now listed explicitly.
Thanks again @kmkatsma - this is now merged :) Also I've published I made a few further tweaks - hope you don't mind:
|
@niieani The Also great! Can't wait to take it for a test drive 💯 |
Awesome! @kmkatsma We'd love to have you featured on the official Aurelia blog talking about this new options for our customers :) Please email me and let's make some plans. Thanks for the great work! |
The only thing missing is HMR. Maybe @niieani could help with this. |
HMR support is planned. Once major Aurelia+Webpack fixes land in November, I might tackle basic HMR in December. We'll see how difficult it will be. |
@SteveSandersonMS - your changes wrapped this up nicely, I think! |
@niieani any news about HMR support? |
@ClaudioNunes not yet. But work is on-going. See aurelia/skeleton-navigation#714 for a couple of updates (HMR for CSS works). |
This PR adds a new AureliaSpa folder to the existing templates folder.
Made attempts to be as consistent as possible with existing templates, but this does follow different webpack template build process - it uses a single webpack config utilizing the AureliaWebpackPlugin. However, I tried to keep the WebPack configuration consistent with the configurations that exist in official Aurelia webpack skeletons, except EasyWebpack has been removed for closer match to the existing webpack templates in this repo.
Other things of note with regard to comparison with other templates:
@SteveSandersonMS, @MarkPieszak, @EisenbergEffect