ligershark / generator-aspnet Goto Github PK
View Code? Open in Web Editor NEWyo generator for ASP.NET vNext
yo generator for ASP.NET vNext
We are dropping a nuget.config
file at the "solution root". Currently it is not getting picked up by kpm restore
because we do not have a global.json
file in that directory. The file can be essentially empty, it just needs the following content.
{}
For more info see ligershark/Kulture#29.
The contributions would go into the repo at https://github.com/ligershark/aspnet_vnext_samples.
sudo yo aspnet
Password:
_-----_
| | .--------------------------.
|--(o)--| | Welcome to the marvelous |
---------´ | Aspnet generator! | ( _´U
_ ) '--------------------------'
/_A\
| ~ |
**'.**.'__
´ |° ´ Y
[?] What type of application do you want to create? MVC Application
[?] What's the name of your ASP.NET application? TestApp
info ... Fetching http://github.com/ligershark/aspnet_vnext_samples/archive/master.tar.gz ...
info This might take a few moments
..✔ Done in /Users/dmeijboom/.cache/yeoman/ligershark/aspnet_vnext_samples/master
create NuGet.config
create TestApp/Controllers/HomeController.cs
create TestApp/Models/User.cs
create TestApp/Startup.cs
create TestApp/Views/Home/Index.cshtml
create TestApp/Views/Shared/_Layout.cshtml
create TestApp/project.json
/Users/dmeijboom/.cache/yeoman
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
We are publishing with Sourabh's account, we should instead push using Sayed's account
It would be good if we create a new branch release
that we release from. That would make it easy for us to continue dev in master
and we can push changes to release
when we are ready to go out in yeoman.
Below are the changes that I'm aware of to make this happen.
release
branchmaster
then we can create a dev
branch.@shirhatti did I miss anything?
@shirhatti can you add me as an owner on the generator-aspnet package? My npm username is sayedha
. You should be able to do that with the command npm owner add sayedha generator-aspnet
.
Creating an application installs it and then runs 'kpm restore' which pulls in packages from the feed defined in the Nuget.config dropped by the template. The feed currently points to vnext and user wouldn't have a chance to change the feed. Can we make it optional so that the user can change the feed and then restore the packages?
Try the following.
On the step where you create a nancy project you get the warning below. I believe this is because we copy two different nuget.config files. See https://github.com/ligershark/generator-aspnet/blob/master/app/index.js#L92.
@jchannon could you take a look?
At the moment each option is a list item such as Console App, Web App, MVC App, Nancy App.
I think we should find a way to display the options nested so if you choose Console App you are then given the choice of Nancy Console App and WebApi App
If the k runtime is not present on your machine, the generator will crash will trying to execute kpm restore
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1000:11)
at Process.ChildProcess._handle.onexit (child_process.js:791:34)
We already have a travis build in place. When there are changes it's cumbersome to verify. It would be good if travis could verify the following continue to work.
yo aspnet
creates content for all generatorskpm restore
passes for all generatorskpm build
passes for all generatorsk kestrel
successfully starts kestrel on given port for web projects. _stretch goal_I don't know much about travis myself so this is def an area that we can use some help.
I just install this generator-aspnet, but when I run the below command:
yo aspnet
and select the project(any projects), there is an error:
/usr/local/lib/node_modules/generator-aspnet/node_modules/yeoman-generator/node_modules/download/index.js:70
if (opts.extract && (decompress.canExtract(opts.url, mime) || opts
^
TypeError: Object function Decompress(opts) {
if (!(this instanceof Decompress)) {
return new Decompress(opts);
}
this.opts = opts || {};
this.streams = [];
} has no method 'canExtract'
at Request.<anonymous> (/usr/local/lib/node_modules/generator-aspnet/node_modules/yeoman-generator/node_modules/download/index.js:70:45)
at Request.EventEmitter.emit (events.js:95:17)
at Request.onResponse (/usr/local/lib/node_modules/generator-aspnet/node_modules/yeoman-generator/node_modules/request/request.js:832:10)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1669:21)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:120:23)
at CleartextStream.socketOnData [as ondata] (http.js:1564:20)
at CleartextStream.read [as _read] (tls.js:502:12)
at CleartextStream.Readable.read (_stream_readable.js:320:10)
any ideas?
Thanks!
? What type of application do you want to create? MVC Application
? What's the name of your ASP.NET application? Awesome
info ... Fetching http://github.com/ligershark/aspnet_vnext_samples/archive/master.tar.gz ...
info This might take a few moments
..✔ Done in /Users/ashutoshraina/.cache/yeoman/ligershark/aspnet_vnext_samples/master
create NuGet.config
create global.json
create Awesome/Controllers/HomeController.cs
create Awesome/Models/User.cs
create Awesome/Startup.cs
create Awesome/Views/Home/Index.cshtml
create Awesome/Views/Shared/_Layout.cshtml
create Awesome/project.json
create Awesome/wwwroot/.gitignore
/Users/ashutoshraina/.cache/yeoman
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
Let me know if I can provide some other information that might be useful.
We should update template content to match what we are shipping in VS. We made some changes to project.json and the runtime will not resect old strings in a future version.
{
"dependencies": {
},
"frameworks" : {
"net451" : { },
"k10" : {
"dependencies": {
"System.Console": "4.0.0.0"
}
}
}
}
using System;
namespace ConsoleApp1
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World");
Console.ReadLine();
}
}
}
I saw a thread at yeoman/generator#381 (comment) relating to yeoman generators. If I understand correctly you can use package.json to include the content of the generators in the package instead of using this.remote
.
@shirhatti thoughts?
@shirhatti in the current implementation we are using .remote()
in index.js to retrieve the template content. What I've noticed is that when calling .remote()
if the git repo exists on the client cache then it will not be refreshed. There is a refresh
parameter on remote(). If we specify true
for refresh then the git repo will be cloned each time when the generator is invoked. On my box in order to get rid of yeoman cache I had to remove yo
.
Is using .remote()
the right approach here? I looked at the generator-angular and they include the files directly inside the npm package then use .template() and .copy() to write the files.
The code to always update when using remote is below.
retrieveContent: function () {
var done = this.async();
this.remote('ligershark', 'aspnet_vnext_samples', 'master', function(err, remote) {
done();
},true);
}
cc @jchannon
Currently creating a new application drops Nuget.config and global.json in the root directory. Doing kpm restore, restores the packages from the feed defined in this Nuget.config file and not the Nuget.config defined for the machine. Can we make dropping of this file optional or not drop it at all ?
We should add the scaffolding components to web projects. We need to make the following changes to project.json
for the web projects.
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-*"
in dependencies"gen": "Microsoft.Framework.CodeGeneration"
in the commands sectionWe should update the project.json
file to use frameworks
instead of configurations
.
For reference we can look at how VS creates the file. In our case there are slight differences to include kestrel.
{
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-alpha3",
"Microsoft.AspNet.Mvc": "6.0.0-alpha3",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-alpha3",
"Microsoft.AspNet.Identity.Authentication": "3.0.0-alpha3",
"Microsoft.AspNet.Security.Cookies": "1.0.0-alpha3",
"Microsoft.AspNet.Server.IIS": "1.0.0-alpha3",
"Microsoft.AspNet.Server.WebListener": "1.0.0-alpha3",
"Microsoft.AspNet.StaticFiles": "1.0.0-alpha3",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-alpha3",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0-alpha2"
},
"commands": {
/* Change the port number when you are self hosting this application */
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"net451" : { },
"k10" : { }
}
}
We should create some yo subgenerators for asp.net 5. What I would recommend is looking at the templates in the Add New Item
dialog in VS and create subgenerators for those. That should be our initial release so that we are atleast on par with that.
What I'd love to see after that is to create an additional set of yo subgenerators. Then when a VS release is going to go out we can pickup the files in the subgenerators.
@kenwarner let me know what you think. I'm excited to try it out and see how the experience feels. I've assigned the item to you.
We should add a Unit Test template to the generators. We have a sample test project contained in this sample. We should remove all the Visual Studio artifacts before creating the test project.
We should create a template for an empty vNext project. This is basically a class library template.
This template should just create a new folder with the given application name and create a project.json file. I don't think we need to included the Class1.cs
file in the template. Is there a Sublime snippet to create a C# class? If not we should consider to create one as well. I'll file an issue for us to look into it.
{
"dependencies": {
},
"frameworks" : {
"net451" : {
"dependencies": {
}
},
"k10" : {
"dependencies": {
"System.Runtime": "4.0.20.0"
}
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.