Giter VIP home page Giter VIP logo

mojito's Introduction

Black Duck OS 2012 Rookie of the Year

Yahoo! Mojito Build Status

Mojito is the JavaScript library implementing Cocktails, a JavaScript-based on-line/off-line, multi-device, hosted application platform.

Quick Start

This quick start is intended for Mojito application developers. To contribute to the Mojito project, see Contributing Code to Mojito.

  1. Install the Mojito command-line tool:

     $ npm install -g mojito-cli
    
  2. Create an app:

     $ mojito create app hello
     $ cd hello
    
  3. Create a mojit:

     $ mojito create mojit HelloMojit
    
  4. Start the server:

     $ mojito start
    
  5. Go to http://localhost:8666/@HelloMojit/index

  6. Run Unit Tests:

     $ mojito test app .
    
  7. Generate documentation:

     $ mojito docs app hello
    

Mojito Git Branches

The default branch for the Mojito GitHub repository is develop. To clone the version of Mojito that is the same as the latest version of Mojito in the npm registry, explicitly request the master branch: git clone https://github.com/yahoo/mojito.git --branch master Mojito application developers should work with the master branch.

Mojito contributors, however, should clone and make pull requests to the develop branch. Before you start contributing, please read Contributing Code to Mojito.

Documentation

General

API Documentation

Discussion/Forums

http://developer.yahoo.com/forum/Yahoo-Mojito

Licensing and Contributions

Mojito is licensed under a BSD license. To contribute to the Mojito project, please see Contributing.

The Mojito project is a meritocratic, consensus-based community project which allows anyone to contribute and gain additional responsibilities.

mojito's People

Contributors

add0n avatar akshar100 avatar aljimenez avatar bthaeler avatar caridy avatar carystanley avatar davglass avatar diervo avatar dmorilha avatar drewfish avatar ekashida avatar fabianfrank avatar gomezd avatar idearat avatar imalberto avatar isao avatar jarnoux avatar jlecomte avatar kfay avatar lazybean avatar lexander avatar lzhan avatar macmacbr avatar mojit0 avatar mridgway avatar nonopolarity avatar okuryu avatar redonkulus avatar rmadhuram avatar sahat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mojito's Issues

[bz4856275] Mojito logging output can be truncated on failures that crash the server

In the particular case where I hit this, I was trying to launch Mojito when there was already an orphaned instance running somewhere else. I'm guessing Mojito would have produced a very helpful error message, but the logging output was truncated in the midst of a long output line regarding loaded modules.

I'm assuming this is some kind of issue with un-flushed output buffers.

The particular form of this bug is pretty unfortunate since you'll almost always be very interested in the logging output just prior to any server failure, and that's the output most likely to get lost.

[bz4788267] Child errors are not communicated clearly to parents

The default error() function the composite plugin uses to handle child errors looks like this:

        error: function(err) {
            Y.log("Error executing child mojit at '" + this.id + "':", 'error', NAME);
            Y.log(err.message, 'error', NAME);
            Y.log(err.stack, 'error', NAME);
            // Pass back some empty data so we don't fail the composite
            this.done('');
        }

In order to allow the parent mojit to continue running, it passes back an empty string into ac.done(), but we should have a way to communicate child errors

Ability to add route params as an object instead of a query string

Instead of this:

"test static" : {
    "verbs": ["get"],
    "path":"/test/static/",
    "call": "test.static",
    "params": "foo=bar&foo2=bar2"
},

I'd like to do this:

"test static" : {
    "verbs": ["get"],
    "path":"/test/static/",
    "call": "test.static",
    "params": {
        "foo": "bar",
        "foo2": "bar2"
    }
},

[bz5147315] ContextController cache never cleans up

Y instances are cached within the client controller context object by mojit instance guid so that many actions on the same controller can always occur on the same instance.

If all the views of a particular mojit controller are destroyed, that Y instance is never removed.

This is a possible memory leak.

Every time a mojit proxy's private _destroy() function is called, the client needs to do a check to see if there are any more mojit proxies that exist tied to that same instance guid. If not, it should notify the ControllerContext to clear the cache for that guid, and it should dereference the cached Y instance.

Structured Extensions (Plugins)

Mojito needs a way to group various bits of code that -- when combined -- provide additional features to the platform. These extensions should be installable via npm, but should not be applied to all Mojito applications when installed. Mojito apps should identify which extensions they require within their configuration.

Dependencies:

The npm package for an extension should identify any dependencies on other Mojito extensions. At the application level, a requirement for one extension should automatically install any dependent extensions within that application.

Document the scope for various elements of a Mojito application

Mojito programmers write code that live in various contexts:

Mojito framework
Node.js
mojits
controllers / models
binders
objects - ActionContext, mojitProxy, this.config, etc.
addons / YUI modules
middleware
configuration - application.json, defaults.json, definition.json

Allow passing of app config to model objects

Allow app-level config to be available in models, so that things like API
hostnames, etc.. can be stored in the config.

Example:

Y.mojito.models.foo_model = {

        init: function(cfg, app) {
            if(cfg){
                this.cfg = cfg;
            }
            if(app){
                this.app = app;
            }
        },

[mojito compile rollups] using dot notation in the name of the css files will make compile to discard some of them

When having:
mojit/Foo/assets/css/skin.sam.css
mojit/Foo/assets/css/skin.caridy.css

after running: mojito compile rollups

the rollup.client.js will have only one of those two files, apparently the routine for hashing the filenames is not good.

I can see the files listed in the compile routine output, but somewhere in the middle they got discarded.

The workaround is just to use - instead of .

mojit/Foo/assets/css/skin-sam.css
mojit/Foo/assets/css/skin-caridy.css

and everything works as expected.

[bz4993611] client runtime must keep track of mojit hierarchy when new mojits are dispatched

Initially when the Mojito Client is initialized, the binderMap sent from the server is used to create MojitProxy objects, and each one contains a config object with 'children' if there are any. This state is only the original state of the page, so when any mojits are dispatched that create new binders on the page (and new MojitProxy objects), the state of the parent binder is not updated, and there is no way for mojits to know the current state of its children.

Mojit binders must be able to have info about their current child state in order to destroy their children, otherwise they can only destroy the children defined in the original page state.

This bug must be fixed before I can remove the automatic binder cleanup, because binders must be able to destroy their children programmatically (even those that have appeared after the initial page state).

mustache error crashes node

In a model, I convert an object of objects to an array of objects like this:

var list = [];
list = Y.Object.values(this.feeds).sort(sortFeeds);

In the controller, I assign this array to an object and pass to ac.done() like
this:

var vudata = { //mustache template data
spaceid: this.config.spaceid,
tiles: []
};

//later
vudata.tiles = list;
ac.done(vudata);

Starting mojito and requesting the page crashes node

[bz5403069] Support cookie getSub/setSub

The getSub/setSub methods are very useful to read and write hashed key/value pairs. Please support this so the interface is more similar to the YUI3 Cookie class.

yuidoc: addJs() vs. addCss()

addCss
void addCss ( link , location )
Method for adding a JS file to the page.
^^^^

This should say "a CSS file"

[bz5264893] when using a group setting which is not defined in dimension.json, the error msg is misleading

when using group setting is not defined in dimension.json, for example, in application.json, changed the "environment:testing" to "environment:testing1", the error msg is as following:

✖ The settings group '{"environment":"testing1"}' has already been added.
Error: The settings group '{"environment":"testing1"}' has already been
added.
at Object._processRawBundle
(/usr/local/lib/node_modules/mojito/lib/libs/ycb.js:196:27)
at Object.read (/usr/local/lib/node_modules/mojito/lib/libs/ycb.js:35:26)
at Object._readConfigYCB
(/usr/local/lib/node_modules/mojito/lib/store.server.js:1959:26)
at Object._readAppConfigNC
(/usr/local/lib/node_modules/mojito/lib/store.server.js:1197:30)
at Object.preload
(/usr/local/lib/node_modules/mojito/lib/store.server.js:252:38)
at Object.addMojitoToExpressApp
(/usr/local/lib/node_modules/mojito/lib/index.js:134:15)
at Object.createServer
(/usr/local/lib/node_modules/mojito/lib/index.js:263:14)
at Object.start
(/usr/local/lib/node_modules/mojito/lib/management/utils.js:410:56)
at Object.run
(/usr/local/lib/node_modules/mojito/lib/management/commands/start.js:78:9)
at main (/usr/local/lib/node_modules/mojito/lib/management/cli.js:112:13)

✖ Mojito was not started!

JavaScript error in mojito-client.client.js after refreshView with composites

  • I have a mojit that uses ac.composite.invoke() to create child mojits
  • Each of these child mojits has a binder of its own. When clicking “Search” the XXX binder issues an mp.refreshView() call.
  • The number of child mojit instances will vary from refresh-to-refresh (currently just using Math.random() to achieve this)
  • Eventually if you hit ‘Search’ enough times, you’ll get a Javascript error on the client.

Unify --context flag

"mojito start" has a --context flag that accepts arguments like
"lang:es,environment:dev".

"mojito build" has a --context flag that accepts arguments like
"lang=es&device=iphone".

These contexts both filter into the system in different ways. "start" passes the arguments directly in code, while "build" uses the argument to generate a URL.

These flags should take the same argument, or perhaps use different names since they filter into the system in different ways. "build"'s context is really more of a set of parameters for the URL today.

mojito start loads tests from addons

We made an addon and put it on app/addons/ac/

A test for it located on the sub-directory app/addons/ac/tests/ is successfully loaded and executed with the "mojito test" command.

But when the file is left on the app/addons/ac/tests/ directory, the "mojito start" command throws an error on server load:

YUI-INFO get: Loaded:
/home/julionn/host/mib/todo/addons/ac/tests/featureflipper.common-tests.js
ERROR nodejsYUI3:

ERROR nodejsYUI3: TypeError: undefined is not a function
ERROR nodejsYUI3: at CALL_NON_FUNCTION_AS_CONSTRUCTOR
(native)
ERROR nodejsYUI3: at Object.fn
(/home/julionn/host/mib/todo/addons/ac/tests/featureflipper.common-tests.js:7:17)
ERROR nodejsYUI3: at [object Object]._attach
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5240)
ERROR nodejsYUI3: at [object Object]._use
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:8:2078)
ERROR nodejsYUI3: at [object Object].
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:8:693)
ERROR nodejsYUI3: at Object._finish
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:13:2497)
ERROR nodejsYUI3: at Object._onSuccess
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:13:2997)
ERROR nodejsYUI3: at Object.loadNext
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:14:654)
ERROR nodejsYUI3: at [object Object].
(/home/y/share/node/yui3/node_modules/yui3-core/build/yui/yui-min.js:13:4529)
ERROR nodejsYUI3: at
/home/y/share/node/yui3/lib/node-yui3.js:837:30
ERROR nodejsYUI3:

DEBUG Mojito HTTP Server initialized in 1293ms.

When the file is on the directory app/tests/, it is successfully loaded both on "test" and "start" commands. But its placement is odd: ac addons tests should be on the addons/ac/ directory, and not somewhere else.

Our suggestion is to make "mojito start" ignore either files on tests/ directories or ending with -tests.js, or both.

Missing Mustache template crashes Mojito process

I tried moving the generated index.mu.html to another directory to see what would happen. In the logs I get:

MOJITO mojito-mu: Rendering template "undefined"

/home/y/share/node/mojito/app/addons/view-engines/mu.server.js:33
if (err) { throw err; }
^
Error: EISDIR, Is a directory

And the process crashes.

[bz4910504] API inconsistency between ac.partials and other 'render' methods

index: function(ac) {
var roles = Y._AppUtils.getRoles(ac);
if(roles.indexOf('unknown')==-1) {
ac.partial.render({some:"data"}, "error", function(html) {

the problem is that the callback has 2 parameters, like: function(err, html).
err is null on success.

Here is my working sample:
ac.partial.render(response, 'preview', function(err, html) {
Y.log('renderer: '+html, 'debug', NAME);
});

Maybe the API doc for ac.partials can be improved, so that it also describes
the callback in more detail, i.e. which parameters to receive.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.