Skip to content

Commit 177776a

Browse files
committed
ADD mikado-proxy
1 parent b4df679 commit 177776a

File tree

7 files changed

+274
-0
lines changed

7 files changed

+274
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>Mikado-"keyed"</title>
6+
<link rel="preload" href="dist/main.js" as="script">
7+
<link href="/css/currentStyle.css" rel="stylesheet"/>
8+
</head>
9+
<body>
10+
<div id="main"></div>
11+
<script src="dist/main.js"></script>
12+
</body>
13+
</html>
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"private": true,
3+
"name": "js-framework-benchmark-mikado-proxy",
4+
"homepage": "https://github.com/nextapps-de/mikado/",
5+
"author": "Nextapps GmbH",
6+
"license": "Apache-2.0",
7+
"js-framework-benchmark": {
8+
"frameworkVersionFromPackage": "mikado"
9+
},
10+
"preferGlobal": false,
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/krausest/js-framework-benchmark.git"
14+
},
15+
"scripts": {
16+
"compile": "mikado-compile src/template/app.html && mikado-compile src/template/item.html && echo Compile Complete. && exit 0",
17+
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false USE_POLYFILL=false SUPPORT_CACHE=false SUPPORT_EVENTS=true SUPPORT_STORAGE=true SUPPORT_HELPERS=false SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=true SUPPORT_CACHE_HELPERS=false SUPPORT_POOLS=false SUPPORT_CALLBACKS=false SUPPORT_COMPILE=false && exit 0",
18+
"build-prod": "npm run build"
19+
},
20+
"dependencies": {
21+
"mikado": "^0.7.46"
22+
},
23+
"devDependencies": {
24+
"google-closure-compiler": "^20191030.0.0-nightly",
25+
"mikado-compile": "0.6.5"
26+
}
27+
}
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const ADJECTIVES = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"];
2+
const COLOURS = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"];
3+
const NOUNS = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"];
4+
5+
const len_ADJECTIVES = ADJECTIVES.length;
6+
const len_COLOURS = COLOURS.length;
7+
const len_NOUNS = NOUNS.length;
8+
9+
let _nextId = 1;
10+
11+
export function buildData(count){
12+
13+
// if(count === 1){
14+
//
15+
// return {
16+
//
17+
// id: _nextId++,
18+
// label: ADJECTIVES[_random(len_ADJECTIVES)] + " " + COLOURS[_random(len_COLOURS)] + " " + NOUNS[_random(len_NOUNS)]
19+
// }
20+
// }
21+
22+
const data = new Array(count);
23+
24+
for(let i = 0; i < count; i++){
25+
26+
data[i] = {
27+
28+
"id": _nextId++,
29+
"label": ADJECTIVES[_random(len_ADJECTIVES)] + " " + COLOURS[_random(len_COLOURS)] + " " + NOUNS[_random(len_NOUNS)],
30+
"selected": ""
31+
};
32+
}
33+
34+
return data;
35+
}
36+
37+
function _random(max){
38+
39+
return (Math.random() * max) | 0;
40+
}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import Mikado from "../node_modules/mikado/src/mikado.js";
2+
import Array from "../node_modules/mikado/src/array.js";
3+
import app from "./template/app.es6.js";
4+
import item from "./template/item.es6.js";
5+
import { buildData } from "./data.js";
6+
7+
Mikado.once(document.getElementById("main"), app);
8+
9+
let selected = 0;
10+
const store = new Array();
11+
const view = new Mikado(document.getElementById("tbody"), item, {
12+
"reuse": false, "store": store
13+
})
14+
.route("run", () => store.set(buildData(1000)))
15+
.route("runlots", () => store.set(buildData(10000)))
16+
.route("add", () => store.concat(buildData(1000)))
17+
.route("update", () => {
18+
for(let i = 0, len = store.length; i < len; i += 10)
19+
store[i].label += " !!!"
20+
})
21+
.route("clear", () => store.splice())
22+
.route("swaprows", () => {
23+
const tmp = store[998];
24+
store[998] = store[1];
25+
store[1] = tmp;
26+
})
27+
.route("remove", target => store.splice(view.index(target), 1))
28+
.route("select", target => {
29+
store[selected]["selected"] = "";
30+
store[selected = view.index(target)]["selected"] = "danger";
31+
})
32+
.listen("click");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<div class="container">
2+
<div class="jumbotron">
3+
<div class="row">
4+
<div class="col-md-6">
5+
<h1>Mikado-"keyed"</h1>
6+
</div>
7+
<div class="col-md-6">
8+
<div class="row">
9+
<div class="col-sm-6 smallpad">
10+
<button type="button" class="btn btn-primary btn-block" id="run" click="run">Create 1,000 rows</button>
11+
</div>
12+
<div class="col-sm-6 smallpad">
13+
<button type="button" class="btn btn-primary btn-block" id="runlots" click="runlots">Create 10,000 rows</button>
14+
</div>
15+
<div class="col-sm-6 smallpad">
16+
<button type="button" class="btn btn-primary btn-block" id="add" click="add">Append 1,000 rows</button>
17+
</div>
18+
<div class="col-sm-6 smallpad">
19+
<button type="button" class="btn btn-primary btn-block" id="update" click="update">Update every 10th row</button>
20+
</div>
21+
<div class="col-sm-6 smallpad">
22+
<button type="button" class="btn btn-primary btn-block" id="clear" click="clear">Clear</button>
23+
</div>
24+
<div class="col-sm-6 smallpad">
25+
<button type="button" class="btn btn-primary btn-block" id="swaprows" click="swaprows">Swap Rows</button>
26+
</div>
27+
</div>
28+
</div>
29+
</div>
30+
</div>
31+
<table class="table table-hover table-striped test-data">
32+
<tbody id="tbody"></tbody>
33+
</table>
34+
<span class="preloadicon glyphicon glyphicon-remove" aria-hidden="true"></span>
35+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<tr class="{{=data.selected}}" root>
2+
<td class="col-md-1">{{=data.id}}</td>
3+
<td class="col-md-4">
4+
<a class="lbl" click="select:root">{{=data.label}}</a>
5+
</td>
6+
<td class="col-md-1">
7+
<a class="remove" click="remove:root">
8+
<span class="remove glyphicon glyphicon-remove" aria-hidden="true"></span>
9+
</a>
10+
</td>
11+
<td class="col-md-6"></td>
12+
</tr>
+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
const child_process = require('child_process');
2+
const fs = require('fs');
3+
4+
console.log("Start build .....");
5+
console.log();
6+
7+
fs.existsSync("log") || fs.mkdirSync("log");
8+
9+
let flag_str = "";
10+
11+
var options = (function(argv){
12+
13+
const arr = {};
14+
let count = 0;
15+
16+
argv.forEach(function(val, index) {
17+
18+
if(++count > 2){
19+
20+
index = val.split('=');
21+
val = index[1];
22+
index = index[0].toUpperCase();
23+
24+
flag_str += " --define='" + index + "=" + val + "'";
25+
arr[index] = val;
26+
27+
if(count > 3) console.log(index + ': ' + val);
28+
}
29+
});
30+
31+
console.log('RELEASE: ' + (arr['RELEASE'] || 'custom'));
32+
33+
return arr;
34+
35+
})(process.argv);
36+
37+
const parameter = (function(opt){
38+
39+
let parameter = '';
40+
41+
for(let index in opt){
42+
43+
if(opt.hasOwnProperty(index)){
44+
45+
parameter += ' --' + index + '=' + opt[index];
46+
}
47+
}
48+
49+
return parameter;
50+
})({
51+
52+
compilation_level: "ADVANCED_OPTIMIZATIONS", //"WHITESPACE"
53+
use_types_for_optimization: true,
54+
//new_type_inf: true,
55+
jscomp_warning: "newCheckTypes",
56+
//jscomp_error: "strictCheckTypes",
57+
jscomp_error: "newCheckTypesExtraChecks",
58+
generate_exports: true,
59+
export_local_property_definitions: true,
60+
language_in: "ECMASCRIPT6_STRICT",
61+
language_out: "ECMASCRIPT6_STRICT",
62+
process_closure_primitives: true,
63+
summary_detail_level: 3,
64+
warning_level: "VERBOSE",
65+
emit_use_strict: true,
66+
67+
output_manifest: "log/manifest.log",
68+
output_module_dependencies: "log/module_dependencies.log",
69+
property_renaming_report: "log/property_renaming.log",
70+
create_source_map: "log/source_map.log",
71+
variable_renaming_report: "log/variable_renaming.log",
72+
strict_mode_input: true,
73+
assume_function_wrapper: true,
74+
75+
transform_amd_modules: true,
76+
process_common_js_modules: true,
77+
module_resolution: "BROWSER",
78+
//dependency_mode: "SORT_ONLY",
79+
//js_module_root: "./",
80+
entry_point: "./src/main.js",
81+
//manage_closure_dependencies: true,
82+
dependency_mode: "PRUNE_LEGACY",
83+
rewrite_polyfills: false,
84+
85+
isolation_mode: "IIFE"
86+
//output_wrapper: "(function(){%output%}());"
87+
88+
//formatting: "PRETTY_PRINT"
89+
});
90+
91+
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --js='src/*.js' --js='src/template/*.es6.js' --js='node_modules/mikado/src/*.js'" + flag_str + " --js_output_file='dist/main.js' && exit 0", function(){
92+
93+
console.log("Build Complete.");
94+
});
95+
96+
function exec(prompt, callback){
97+
98+
const child = child_process.exec(prompt, function(err, stdout, stderr){
99+
100+
if(err){
101+
102+
console.error(err);
103+
}
104+
else{
105+
106+
if(callback){
107+
108+
callback();
109+
}
110+
}
111+
});
112+
113+
child.stdout.pipe(process.stdout);
114+
child.stderr.pipe(process.stderr);
115+
}

0 commit comments

Comments
 (0)