expressjs / generator

Express' application generator
MIT License
1.82k stars 537 forks source link

Improvements to the Generator #80

Open ritch opened 9 years ago

ritch commented 9 years ago

After a discussion (quite a while ago) with @dougwilson I've been thinking about how we could improve the boilerplate generator for express. The generator itself hasn't really gone through an overhaul since it was converted from a short script that concat'd a bunch of source together and outputted some files into a nice set of templates with improvements to the file structure.

With some large changes to the generator I think we can make express a lot better as a starting point for building your own tailored framework. Right now the choices you have for the generated code are fairly shallow. I think we can expand these choices to include what a lot of people are using express for. The changes are fairly large though.

Here is what I am thinking:

Obviously there are a lot of specifics missing and the example preference file is fairly magic looking. So before I go much further with the idea I wanted to test the waters to see if this idea had any merit. Also there might be other ideas / projects underway that do this?

dougwilson commented 9 years ago

So there is a lot of questions/ideas here, but my main thoughts is yes, this module is pretty bare-bones and really doesn't provide enough value, i.m.o.

ritch commented 9 years ago

@dougwilson What if we started with:

Input

A preference file - using a format that supports comments.

var $ = exports

// Use Resourceful routing?
$.ROUTING_STYLE = 'resource' // resource.index = function
// ROUTING_STYLE = 'plain' // app.get('/foo')

// What templating engine?
$.TEMPLATING = 'jade'
// TEMPLATING = 'dustjs-linkedin'
// TEMPLATING = 'ejs'

// What css engine?
$.CSS_ENGINE = 'plain css'
// CSS_ENGINE = 'less'
// CSS_ENGINE = 'stylus'
// CSS_ENGINE = 'compass'

// Does this app need to interact with a database or orm?
$.ORM = true
$.ORM_LIB = 'juggler'
// ORM_LIB = 'waterline'
// ORM_LIB = 'sequelize'

// Validation
$.VALIDATION_LIB = 'anchor'
// VALIDATION_LIB = 'juggler'
// VALIDATION_LIB = 'joi'
// VALIDATION_LIB = 'validation.js'

Note: we could even default a lot of the above to false / off to avoid bloating the default usage of express(1)

Source code templates - like what we have now but user customizable/overridable.

Output

Almost exactly like we have now, but with more features:

dougwilson commented 9 years ago

I am open to whatever, in the end :) Anything would be an improvement to this module at this point, lol.

ninjasort commented 8 years ago

Just wanted to ping an idea in here about potentially exposing alternative templating engines and possibly using React as a first-class templating flag.

Currently the generator supports jade, hbs, hogan, and ejs. With a library such as consolidate would it be possible to expose more templating engines? Even potentially just removing the flags as a whole and providing a manifest .expressrc file to configure the templating?

In terms of React, considering it renders on the server. Would it be possible to include it with something like react-engine?

slidenerd commented 3 years ago

@cameronroe if you are gonna ask for React, I am gonna advocate for Vue, not only is it much simpler than React but also has a huge community, ever-growing might I add