Permalink
Browse files

build script for static bundeling; static demo; docs

  • Loading branch information...
1 parent be9f6e2 commit 9ad5c70ebbc720f44d14e994fab9d20efe35b1bd @cadorn committed Mar 22, 2011
Showing with 92 additions and 16 deletions.
  1. +0 −2 .gitignore
  2. +31 −4 README.md
  3. +20 −0 lib/build.js
  4. +6 −3 { → lib}/project.js
  5. +7 −1 package.json
  6. +2 −1 packages/ace-editor/package.json
  7. +9 −1 programs/extjs3-ace/program.json
  8. +12 −2 www/extjs3-ace/index.html
  9. +5 −2 www/index.html
View
@@ -2,5 +2,3 @@
.tmp*~
.pinf-*
*.local.*
-
-/build/
View
@@ -1,7 +1,7 @@
ACE Editor as ExtJS Component
=============================
-Status: dev
+Status: alpha
This project packages the [ACE Editor](http://ace.ajax.org/) as an [ExtJS](http://www.sencha.com/products/extjs/) component.
@@ -30,16 +30,43 @@ TODO
* Toolbar for editor component
* Footer for editor component (line wrapping, caret position, read only, charset, ...)
* Persist editor styling to survive reload
- * Document API
+ * Better API Docs
* ACE Command-line support
* ExtJS 4 support/demo (__cadorn__)
- * Bundeling for production loading (__cadorn__)
+
+
+Production
+==========
+
+When using this component in production a build containing static files only should be used.
+
+Assuming `Development` setup (see above).
+
+ commonjs --script build ./
+
+This will bundle the component and store static files in [./build/](https://github.com/cadorn/ace-extjs/tree/master/build).
+
+To use on a page:
+
+ // TODO: Include ExtJS CSS and JS files
+ <script type="text/javascript">
+ bravojs = {
+ url: window.location.protocol + "//" + window.location.host + "/.../extjs3-ace/Component.js"
+ };
+ document.write('<script type="text/javascript" src="' + bravojs.url + '"><' + '/script>');
+ </script>
+
+**NOTE:** The `bravojs.url` must be set to the same URL as used for the `SCRIPT` tag.
+
+See [./www/extjs3-ace/index.html](https://github.com/cadorn/ace-extjs/blob/master/www/extjs3-ace/index.html) for example.
API
===
-_TODO_
+See implementation: [./packages/extjs3-ace/lib/component.js](https://github.com/cadorn/ace-extjs/blob/master/packages/extjs3-ace/lib/component.js)
+
+Usage example: [./www/extjs3-ace/index.html](https://github.com/cadorn/ace-extjs/blob/master/www/extjs3-ace/index.html)
Support & Feedback
View
@@ -0,0 +1,20 @@
+
+var PATH = require("nodejs/path"),
+ PROMISE = require("jsgi/promise"),
+ PROGRAM_SERVER = require("pinf/program-server");
+
+exports.main = function(env)
+{
+ var server = new PROGRAM_SERVER.JSGI({
+ api: {
+ PROMISE: PROMISE
+ },
+ map: {
+ "/extjs3-ace/Component.js": {
+ programPath: PATH.dirname(PATH.dirname(module.id)) + "/programs/extjs3-ace/program.json"
+ }
+ }
+ });
+
+ server.spider("/extjs3-ace/Component.js", PATH.dirname(PATH.dirname(module.id)) + "/build");
+}
@@ -19,7 +19,10 @@ exports.main = function()
.use('/extjs4', CONNECT.static(require.pkg("extjs4").id(), {
maxAge: 0
}))
- .use('/', CONNECT.static(PATH.dirname(module.id) + "/www", {
+ .use('/', CONNECT.static(PATH.dirname(PATH.dirname(module.id)) + "/www", {
+ maxAge: 0
+ }))
+ .use('/build/', CONNECT.static(PATH.dirname(PATH.dirname(module.id)) + "/build", {
maxAge: 0
}))
.use('/ace', jsgi(new PROGRAM_SERVER.JSGI({
@@ -28,7 +31,7 @@ exports.main = function()
},
map: {
"/ace/AceEditor.js": {
- programPath: PATH.dirname(module.id) + "/programs/ace/program.json"
+ programPath: PATH.dirname(PATH.dirname(module.id)) + "/programs/ace/program.json"
}
},
trackRoutes: true
@@ -39,7 +42,7 @@ exports.main = function()
},
map: {
"/extjs3-ace/Component.js": {
- programPath: PATH.dirname(module.id) + "/programs/extjs3-ace/program.json"
+ programPath: PATH.dirname(PATH.dirname(module.id)) + "/programs/extjs3-ace/program.json"
}
},
trackRoutes: true
View
@@ -3,7 +3,13 @@
"engine": [
"node"
],
- "main": "project.js",
+ "main": "lib/project.js",
+ "scripts": {
+ "build": {
+ "location": "./",
+ "module": "/lib/build.js"
+ }
+ },
"mappings": {
"nodejs": {
"id": "nodejs.org"
@@ -10,7 +10,8 @@
"include": {
"github.com/ajaxorg/pilot/@/lib/pilot/index": {},
"github.com/ajaxorg/ace/@/lib/ace/defaults": {},
- "github.com/ajaxorg/cockpit/@/lib/cockpit/index": {}
+ "github.com/ajaxorg/cockpit/@/lib/cockpit/index": {},
+ "github.com/ajaxorg/ace/": {}
},
"load": {
"github.com/ajaxorg/ace/": {}
@@ -30,12 +30,20 @@
},
"descriptor": {
"uid": "https://github.com/ajaxorg/ace/",
+ "main": "",
"directories": {
"lib": "lib/ace"
},
"contexts": {
"top": {
- "/lib/ace": {
+ "/": {
+ "include": {
+ "/lib/ace/range": {},
+ "/lib/ace/tokenizer": {},
+ "/lib/ace/mode/text": {},
+ "/lib/ace/mode/matching_brace_outdent": {},
+ "/lib/ace/mode/doc_comment_highlight_rules": {}
+ },
"load": {
"/lib/ace/mode/*": {},
"/lib/ace/theme/*": {}
View
@@ -10,8 +10,18 @@
<script type="text/javascript" src="/extjs3/adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="/extjs3/ext-all-debug.js"></script>
- <script src="/extjs3-ace/Component.js" type="text/javascript"></script>
- <script>
+ <script type="text/javascript">
+ var url = "/extjs3-ace/Component.js";
+ if (/^\?\.*?build=true/.test(document.location.search))
+ {
+ url = "/build" + url;
+ bravojs = {
+ url: window.location.protocol + '//' + window.location.host + '/build/extjs3-ace/Component.js'
+ };
+ }
+ document.write('<script type="text/javascript" src="' + url + '"><' + '/script>');
+ </script>
+ <script type="text/javascript">
Ext.onReady(function()
{
View
@@ -14,11 +14,14 @@
<a href="/extjs3/" target="demo">ExtJS 3 Examples</a> |
<a href="/extjs4/" target="demo">ExtJS 4 Examples</a>
&nbsp;&nbsp;&nbsp;
- <a href="/ace/" target="demo">ACE Standalone</a>
- &nbsp;&nbsp;&nbsp;
+ <b>DEV:</b>
+ <a href="/ace/" target="demo">ACE Standalone</a> |
<b><a href="/extjs3-ace/" target="demo">ACE on ExtJS 3</a></b> |
<b><a href="/extjs4-ace/" target="demo">ACE on ExtJS 4</a></b>
&nbsp;&nbsp;&nbsp;
+ <b>BUILD:</b>
+ <b><a href="/extjs3-ace/?build=true" target="demo">ACE on ExtJS 3</a></b>
+ &nbsp;&nbsp;&nbsp;
<b><a href="https://github.com/cadorn/ace-extjs/blob/master/README.md" target="demo">Docs</a></b>
</td>
</tr>

0 comments on commit 9ad5c70

Please sign in to comment.