petermichaux / maria

The MVC framework for JavaScript applications. The real MVC. The Smalltalk MVC. The Gang of Four MVC.
BSD 2-Clause "Simplified" License
764 stars 51 forks source link

maria command line tool #36

Closed petermichaux closed 8 years ago

petermichaux commented 11 years ago

Developing a full-blown, single-page, web application is a primary target use case for the Maria framework.

Implementing such an application requires creating many models, views, templates, and controllers. The process of creating these files and including a few lines of boilerplate is tedious.

A production-ready, single-page, web application should be built before deploying to the web servers. This involves minifying, concatenating, and gzipping files that have time or checksum stamped file names that are used both for the files and in the references to those files. Yet in a development mode we do not want a build process to slow down our workflow or to deal with error line numbers not matching the source code.

Most of this will seem familiar to folks accustomed to the server-side Ruby on Rails framework with its rails command line tool that generates files and runs a development web server and the Rails asset pipeline. Jammit is a Rails plugin worth looking at also.

I think all of these features should be built into a maria command line tool.

~/src/ $ maria new checkit
    create
    create README
    create src
    create src/index.html
    create src/js
    create src/js/models
    create src/js/views
    create src/js/controllers
    create src/css
    create src/img
    create tst
    create lib
    create lib/maria
    create lib/maria.js
...

I'm not completely sure where templates should go. They need to be written in HTML files that end in the suffix .html and be compiled to the necessary JavaScript template objects that Maria expects (as shown in the examples.)

~/src/checkit/ $ maria generate model Todo
    create src/js/models/TodoModel.js
    create tst/models/TodoModel.js

How will these files be included in the served page? That should be done automatically. Manifest files, require comments, and require AMD are all possibilities.

~/src/checkit/ $ maria generate view Todo
    create src/js/views/TodoView.js
    create src/js/controllers/TodoController.js
    create src/path/to/TodoTemplate.html
~/src/checkit/ $ maria server
application starting in development on http://0.0.0.0:3000
~/src/checkit/ $ maria build

Bower, Yeoman, and Grunt could possibly be used behind the maria command line tool without the developer even knowing.