Continuing the discussion from MVC core webpack template:
This information is presented as the starting point for discussion. The code is not intended for ‘live’ use.
I have a fork of Aurelia CLI.
As a result of previous thoughts and posts, I have added a new command to the cli called ‘dot-new’. This facilitates the installation of ‘dotnet new’ templates that are hosted externally to the CLI. As I mentioned in my previous posts, I thought that it would be better if templates were external to the CLI and not generated conditionally in code. This could make the addition of extra templates and the maintainability of existing templates much easier (as simple as adding a new entry into a .json file).
If anyone would like to test it, simply clone and install the ‘external-template-cli-projects’ branch.
First ensure that aurelia-cli is not installed. Open a shell to a folder of your choice and clone the repo and install. I use Windows 10 and VS 2017. This is how I do it:
git clone -b external-template-cli-projects https://github.com/constructor/aurelia-cli-fixes.git
cd aurelia-cli-fixes
npm install -g
This version of aurelia-cli should now be installed.
(Note: To remove it use npm uninstall aurelia-cli -g
. Install the official aurelia-cli as usual.)
Now, to test the templates:
Create a project from a template in a similar to usual but using the command au dot-new
as such:
au dot-new -n {project-name}
or…
au dot-new -n {project-name} -o {output-directory}
or…
au dot-new -here
…and follow the cli installer. First of all you will be presented with this set of options:
What template type do you require?
- Web App (Default)
A selection of templates for web based apps - Mobile App
A selection of templates for hybrid mobile and progressive web apps - Plugin
A starting point for Aurelia plugin development.
Select option 1 as there are only 2 different test templates at the moment. Adding more is as simple as editing a .json file.
After selection option 1 you will get:
What web template do you require?
- MVC Webpack (Default)
ASP.net core 2.0 MVC with webpack. - Aurelia Materialize Bridge
ASP.net core 2.0 MVC with Webpack and Aurelia Materialize Bridge. - MVC Webpack again…
ASP.net core 2.0 MVC with webpack. - Aurelia Materialize Bridge and again…
ASP.net core 2.0 MVC with Webpack and Aurelia Materialize Bridge.
Here, option 1 and option 2 have templates that you can test. Options 3 and 4 are simply different links to the same templates in options 1 and 2 for demo purposes. Make a selection between 1 or 2.
After a selection you will get:
Confirm selection and proceed or select a different template?
- Proceed with selection (Default)
- Select a new template
Hopefully this is self explanatory. Select 1 to proceed. The template is generated. You then get the options to install the project dependencies as usual.
I use a Windows 10 and VS 2017 setup. I install the dependencies and open the .csproj in VS and press F5 and the project runs. But it is also just as simple to cd
into the new project folder and au run
and au build
as usual.
These templates are served to the cli via Nuget using . I am looking now at achieving the same but pulling the templates from a git repo and therefore not using Nuget or ‘dotnet new’ command. Is this approach worth while pursuing? Pulling a list of available templates into the cli from a registry of some kind over a network is also something I like the idea of.
Updates: