Skip to content

Instantly share code, notes, and snippets.

@isao
Created December 12, 2012 22:12
Show Gist options
  • Save isao/4272114 to your computer and use it in GitHub Desktop.
Save isao/4272114 to your computer and use it in GitHub Desktop.
debugging `mojito build hybdridapp` for 0.5.x the following is a sample hybrid app build after the updating the app/hybrid archetype here: https://github.com/isao/mojito/commit/f1faf282c38ef378ea386c0507607b558539fbe3
% mojito create app hybrid hyb
creating app type named 'hyb'
(using "hybrid" archetype)
✔ app: hyb created!
✔ mojito done.
% ( cd hyb && mojito build hybridapp ../hyb-bld -r -n name -t tag --context build:debug )
warn: (mojito-perf): microtime not found. Recorded times will not have microsecond accuracy
debug: (mojito-dispatcher): Dispatcher created
warn: (mojito-resource-store): Url collision for /favicon.ico. Choosing: /Users/isao/Repos/mojito/apps/hyb/assets/favicon.ico over /Users/isao/Repos/mojito/myfork/lib/app/assets/favicon.ico
debug: Mojito HTTP Server initialized in 3499ms.
debug: (static-handler): serving static path: /yahoo.application.hyb/top_frame/specs/default.json
...
debug: (statichandler): /yahoo.application.hyb/loader-app-base.js was read from disk
debug: (static-handler): serving static path: /yahoo.application.hyb/loader-app.js
debug: (statichandler): /yahoo.application.hyb/loader-app.js was read from disk
debug: (static-handler): serving static path: /yahoo.application.hyb/loader-yui3-resolved.js
debug: (statichandler): /yahoo.application.hyb/loader-yui3-resolved.js was read from disk
✔ mojito done.
# ide/crt does these two things in their own way
% cp -R ~/Repos/mojito/myfork/node_modules/yui hyb-bld/yahoo.libs.yui
% mkdir hyb-bld/yahoo.crt.lib/
% touch hyb-bld/yahoo.crt.lib/yui-cfg.js
# yui and all js should load properly here
% open -a "/Applications/Google Chrome.app/" hyb-bld/yahoo.application.hyb/index.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript">var MOJITO_INIT=new Date().getTime();</script>
<meta name="creator" content="Yahoo! Mojito 0.2">
<title>hyb App</title>
<script type="text/javascript" src="yui/yui-base/yui-base-min.js"></script>
<script type="text/javascript" src="yui/loader-base/loader-base-min.js"></script>
<script type="text/javascript" src="yui/loader-yui3/loader-yui3-min.js"></script>
<script type="text/javascript" src="loader-app.js"></script>
<script type="text/javascript" src="loader-app-base.js"></script>
</head>
<body>
<div id="yui_3_7_3_1_1355349911704_8">
<dl>
<dt>status</dt>
<dd id="dd_status">Mojito is working.</dd>
<dt>data</dt>
<dd id="dd_data">
<b>some:</b> data
</dd>
</dl>
</div>
<script type="text/javascript" src="../yahoo.crt.lib/yui-cfg.js"></script>
<script type="text/javascript">
YUI.applyConfig({"fetchCSS":true,"combine":false,"base":"/yahoo.libs.yui/","comboBase":"http://yui.yahooapis.com/combo?","root":"3.7.3/build/","groups":{"app":{"combine":false,"maxURLLength":1024,"base":"/.","comboBase":"/combo~","comboSep":"~","root":""}},"url":"nullyui/yui-debug.js","loader":"loader/loader-debug.js","logLevelOrder":["debug","mojito","info","warn","error","none"],"lang":"en"});
YUI().use('mojito-client','top_frameBinderIndex', function(Y) {
window.YMojito = { client: new Y.mojito.Client({"context":{"runtime":"client","site":"","device":"","lang":"en","langs":"en,en","region":"","jurisdiction":"","bucket":"","flavor":"","tz":""},"binderMap":{"yui_3_7_3_1_1355349911704_8":{"base":null,"name":"top_frameBinderIndex","action":"index","config":{},"type":"top_frame","viewId":"yui_3_7_3_1_1355349911704_8","instanceId":"yui_3_7_3_1_1355349911308_57"}},"appConfig":{"appPort":"8666","specs":{"frame":{"base":"top_frame"},"tunnelProxy":{"type":"TunnelProxy"}},"staticHandling":{"appName":"yahoo.application.hyb","prefix":"yahoo.application.hyb"},"builds":{"hybridapp":{"forceRelativePaths":true,"urls":["/yahoo.application.hyb/index.html"],"packages":{"yahoo.libs.yui":"*"}}},"yui":{},"actionTimeout":60000,"mojitsDirs":["mojits"],"routesFiles":["routes.json"],"tunnelPrefix":"/tunnel"},"routes":{"root":{"verbs":{"GET":true},"path":"/","call":"frame.index","name":"root","params":{},"regex":{},"query":{},"requires":{},"ext_match":"^/$","int_match":"^$"},"yahoo.application.hyb":{"verbs":{"GET":true},"path":"/yahoo.application.hyb/index.html","call":"frame.index","name":"yahoo.application.hyb","params":{},"regex":{},"query":{},"requires":{},"ext_match":"^/yahoo.application.hyb/index.html$","int_match":"^$"},"any mojit/action":{"verbs":{"GET":true},"path":"/:module/:action","call":"{module}.{action}","name":"any mojit/action","params":{},"regex":{},"query":{"module":"","action":""},"requires":{"module":"[^\\u0026]+","action":"[^\\u0026]+"},"ext_match":"^/([^/]+)/([^/]+)$","int_match":"^action=[^\\u0026]+\\u0026module=[^\\u0026]+$"}}}) };
});
</script>
</body>
</html>
YUI.applyConfig({
"fetchCSS": true,
"combine": false,
"base": "/yahoo.libs.yui/",
"comboBase": "http://yui.yahooapis.com/combo?",
"root": "3.7.3/build/",
"groups": {
"app": {
"combine": false,
"maxURLLength": 1024,
"base": "/.",
"comboBase": "/combo~",
"comboSep": "~",
"root": ""
}
},
"url": "nullyui/yui-debug.js", // *** "nullyui/..."
"loader": "loader/loader-debug.js",
"logLevelOrder": ["debug", "mojito", "info", "warn", "error", "none"],
"lang": "en"
});
YUI().use('mojito-client', 'top_frameBinderIndex', function(Y) {
window.YMojito = {
client: new Y.mojito.Client({
"context": {
"runtime": "client",
"site": "",
"device": "",
"lang": "en",
"langs": "en,en",
"region": "",
"jurisdiction": "",
"bucket": "",
"flavor": "",
"tz": ""
},
"binderMap": {
"yui_3_7_3_1_1355349911704_8": {
"base": null,
"name": "top_frameBinderIndex",
"action": "index",
"config": {},
"type": "top_frame",
"viewId": "yui_3_7_3_1_1355349911704_8",
"instanceId": "yui_3_7_3_1_1355349911308_57"
}
},
"appConfig": {
"appPort": "8666",
"specs": {
"frame": {
"base": "top_frame"
},
"tunnelProxy": {
"type": "TunnelProxy"
}
},
"staticHandling": {
"appName": "yahoo.application.hyb",
"prefix": "yahoo.application.hyb"
},
"builds": {
"hybridapp": {
"forceRelativePaths": true,
"urls": ["/yahoo.application.hyb/index.html"],
"packages": {
"yahoo.libs.yui": "*"
}
}
},
"yui": {},
"actionTimeout": 60000,
"mojitsDirs": ["mojits"],
"routesFiles": ["routes.json"],
"tunnelPrefix": "/tunnel"
},
"routes": {
"root": {
"verbs": {
"GET": true
},
"path": "/",
"call": "frame.index",
"name": "root",
"params": {},
"regex": {},
"query": {},
"requires": {},
"ext_match": "^/$",
"int_match": "^$"
},
"yahoo.application.hyb": {
"verbs": {
"GET": true
},
"path": "/yahoo.application.hyb/index.html",
"call": "frame.index",
"name": "yahoo.application.hyb",
"params": {},
"regex": {},
"query": {},
"requires": {},
"ext_match": "^/yahoo.application.hyb/index.html$",
"int_match": "^$"
},
"any mojit/action": {
"verbs": {
"GET": true
},
"path": "/:module/:action",
"call": "{module}.{action}",
"name": "any mojit/action",
"params": {},
"regex": {},
"query": {
"module": "",
"action": ""
},
"requires": {
"module": "[^\u0026]+",
"action": "[^\u0026]+"
},
"ext_match": "^/([^/]+)/([^/]+)$",
"int_match": "^action=[^\u0026]+\u0026module=[^\u0026]+$"
}
}
})
};
hybrid-bld/
├── favicon.ico
├── snapshot.json
├── yahoo.application.hybrid
│   ├── HTMLFrameMojit
│   │   └── definition.json
│   ├── LazyLoad
│   │   ├── definition.json
│   │   └── views
│   │   └── index.hb.html
│   ├── LazyLoad.js
│   ├── LazyLoadBinderIndex.js
│   ├── TunnelProxy
│   │   ├── definition.json
│   │   └── specs
│   │   └── default.json
│   ├── frame
│   │   └── specs
│   │   └── default.json
│   ├── index.html
│   ├── loader-app-base.js
│   ├── loader-app-resolved.js
│   ├── loader-app.js
│   ├── loader-yui3-base.js
│   ├── loader-yui3-resolved.js
│   ├── mojito-action-context.js
│   ├── mojito-analytics-addon.js
│   ├── mojito-assets-addon.js
│   ├── mojito-client-store.js
│   ├── mojito-client.js
│   ├── mojito-composite-addon.js
│   ├── mojito-config-addon.js
│   ├── mojito-cookie-addon.js
│   ├── mojito-dispatcher.js
│   ├── mojito-hb.js
│   ├── mojito-intl-addon.js
│   ├── mojito-meta-addon.js
│   ├── mojito-models-addon.js
│   ├── mojito-mojit-proxy.js
│   ├── mojito-mu.js
│   ├── mojito-output-handler.js
│   ├── mojito-params-addon.js
│   ├── mojito-partial-addon.js
│   ├── mojito-perf.js
│   ├── mojito-rest-lib.js
│   ├── mojito-route-maker.js
│   ├── mojito-test.js
│   ├── mojito-tunnel-client.js
│   ├── mojito-url-addon.js
│   ├── mojito-util.js
│   ├── mojito-view-renderer.js
│   ├── mojito.js
│   ├── package.json
│   ├── top_frame
│   │   ├── assets
│   │   │   └── index.css
│   │   ├── definition.json
│   │   ├── package.json
│   │   ├── specs
│   │   │   └── default.json
│   │   └── views
│   │   └── index.hb.html
│   ├── top_frameBinderIndex.js
│   └── yui -> ../yahoo.libs.yui
├── yahoo.crt.lib
│   └── yui-cfg.js
└── yahoo.libs.yui
@isao
Copy link
Author

isao commented Dec 12, 2012

  1. git clone --branch hybridapp git://github.com/isao/mojito.git and cd, npm link as needed.. only change is this commit: isao/mojito@f1faf28
  2. follow steps in shell session
  3. need to configure it so the html loads the app's scripts from "yahoo.libs.yui" not "«staticprefix»/yui"
  4. need app js to load statically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment